ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional Javah.java
Date Sun, 30 Dec 2001 06:13:33 GMT
donaldp     01/12/29 22:13:33

  Modified:    proposal/myrmidon/src/java/org/apache/myrmidon/api
                        AbstractTask.java JavaVersion.java TaskContext.java
               proposal/myrmidon/src/java/org/apache/myrmidon/components/embeddor
                        DefaultEmbeddor.java
               proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace
                        DefaultTaskContext.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs
                        Javac.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers
                        DefaultCompilerAdapter.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional
                        Javah.java
  Log:
  Move JavaVersion stuff outside the TaskContext.
  
  JavaVersion is now a completely self-contained class.
  
  Revision  Changes    Path
  1.11      +0 -5      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/api/AbstractTask.java
  
  Index: AbstractTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/api/AbstractTask.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- AbstractTask.java	23 Dec 2001 06:25:34 -0000	1.10
  +++ AbstractTask.java	30 Dec 2001 06:13:33 -0000	1.11
  @@ -78,11 +78,6 @@
           return m_context;
       }
   
  -    protected final JavaVersion getJavaVersion()
  -    {
  -        return getContext().getJavaVersion();
  -    }
  -
       protected final Object get( final Object key )
           throws ContextException
       {
  
  
  
  1.5       +37 -0     jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/api/JavaVersion.java
  
  Index: JavaVersion.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/api/JavaVersion.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JavaVersion.java	23 Dec 2001 06:25:34 -0000	1.4
  +++ JavaVersion.java	30 Dec 2001 06:13:33 -0000	1.5
  @@ -23,6 +23,18 @@
       public final static JavaVersion JAVA1_2 = new JavaVersion( "Java 1.2", 120 );
       public final static JavaVersion JAVA1_3 = new JavaVersion( "Java 1.3", 130 );
   
  +    private final static JavaVersion CURRENT = determineCurrentJavaVersion();
  +
  +    /**
  +     * Method to retrieve the current JVM version.
  +     *
  +     * @return the current JVM version
  +     */
  +    public static final JavaVersion getCurrentJavaVersion()
  +    {
  +        return CURRENT;
  +    }
  +
       /**
        * Private constructor so no instance except here can be defined.
        *
  @@ -32,5 +44,30 @@
       private JavaVersion( final String name, final int value )
       {
           super( name, value );
  +    }
  +
  +    /**
  +     * Helper method to retrieve current JVM version.
  +     *
  +     * @return the current JVM version
  +     */
  +    private static final JavaVersion determineCurrentJavaVersion()
  +    {
  +        JavaVersion version = JavaVersion.JAVA1_0;
  +
  +        try
  +        {
  +            Class.forName( "java.lang.Void" );
  +            version = JavaVersion.JAVA1_1;
  +            Class.forName( "java.lang.ThreadLocal" );
  +            version = JavaVersion.JAVA1_2;
  +            Class.forName( "java.lang.StrictMath" );
  +            version = JavaVersion.JAVA1_3;
  +        }
  +        catch( final ClassNotFoundException cnfe )
  +        {
  +        }
  +
  +        return version;
       }
   }
  
  
  
  1.12      +0 -8      jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/api/TaskContext.java
  
  Index: TaskContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/api/TaskContext.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TaskContext.java	23 Dec 2001 06:28:04 -0000	1.11
  +++ TaskContext.java	30 Dec 2001 06:13:33 -0000	1.12
  @@ -30,16 +30,8 @@
       ScopeEnum TOP_LEVEL = new ScopeEnum( "TopLevel" );
   
       //these are the names of properties that every TaskContext must contain
  -    String JAVA_VERSION = "myrmidon.java.version";
       String BASE_DIRECTORY = "myrmidon.base.directory";
       String NAME = "myrmidon.task.name";
  -
  -    /**
  -     * Retrieve JavaVersion running under.
  -     *
  -     * @return the version of JVM
  -     */
  -    JavaVersion getJavaVersion();
   
       /**
        * Retrieve Name of tasklet.
  
  
  
  1.17      +0 -26     jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/embeddor/DefaultEmbeddor.java
  
  Index: DefaultEmbeddor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/embeddor/DefaultEmbeddor.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- DefaultEmbeddor.java	23 Dec 2001 06:25:35 -0000	1.16
  +++ DefaultEmbeddor.java	30 Dec 2001 06:13:33 -0000	1.17
  @@ -20,7 +20,6 @@
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.parameters.Parameterizable;
   import org.apache.avalon.framework.parameters.Parameters;
  -import org.apache.myrmidon.api.JavaVersion;
   import org.apache.myrmidon.interfaces.aspect.AspectManager;
   import org.apache.myrmidon.interfaces.builder.ProjectBuilder;
   import org.apache.myrmidon.interfaces.configurer.Configurer;
  @@ -435,31 +434,6 @@
               final String message = REZ.getString( "file-not-dir.error", name, file );
               throw new Exception( message );
           }
  -    }
  -
  -    /**
  -     * Helper method to retrieve current JVM version.
  -     *
  -     * @return the current JVM version
  -     */
  -    private JavaVersion getJavaVersion()
  -    {
  -        JavaVersion version = JavaVersion.JAVA1_0;
  -
  -        try
  -        {
  -            Class.forName( "java.lang.Void" );
  -            version = JavaVersion.JAVA1_1;
  -            Class.forName( "java.lang.ThreadLocal" );
  -            version = JavaVersion.JAVA1_2;
  -            Class.forName( "java.lang.StrictMath" );
  -            version = JavaVersion.JAVA1_3;
  -        }
  -        catch( final ClassNotFoundException cnfe )
  -        {
  -        }
  -
  -        return version;
       }
   
       /**
  
  
  
  1.6       +0 -26     jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/DefaultTaskContext.java
  
  Index: DefaultTaskContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/components/workspace/DefaultTaskContext.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DefaultTaskContext.java	23 Dec 2001 06:25:35 -0000	1.5
  +++ DefaultTaskContext.java	30 Dec 2001 06:13:33 -0000	1.6
  @@ -14,7 +14,6 @@
   import org.apache.avalon.excalibur.io.FileUtil;
   import org.apache.avalon.framework.context.ContextException;
   import org.apache.avalon.framework.context.DefaultContext;
  -import org.apache.myrmidon.api.JavaVersion;
   import org.apache.myrmidon.api.TaskContext;
   import org.apache.myrmidon.api.TaskException;
   
  @@ -55,24 +54,6 @@
       }
   
       /**
  -     * Retrieve JavaVersion running under.
  -     *
  -     * @return the version of JVM
  -     */
  -    public JavaVersion getJavaVersion()
  -    {
  -        try
  -        {
  -            return (JavaVersion)get( JAVA_VERSION );
  -        }
  -        catch( final ContextException ce )
  -        {
  -            final String message = REZ.getString( "no-version.error" );
  -            throw new IllegalStateException( message );
  -        }
  -    }
  -
  -    /**
        * Retrieve Name of tasklet.
        *
        * @return the name
  @@ -210,7 +191,6 @@
   
           context.setProperty( TaskContext.NAME, getName() + "." + name );
           context.setProperty( TaskContext.BASE_DIRECTORY, getBaseDirectory() );
  -        context.setProperty( TaskContext.JAVA_VERSION, getJavaVersion() );
   
           return context;
       }
  @@ -235,12 +215,6 @@
           {
               final String message =
                   REZ.getString( "bad-property.error", NAME, String.class.getName() );
  -            throw new TaskException( message );
  -        }
  -        else if( JAVA_VERSION.equals( name ) && !( value instanceof JavaVersion
) )
  -        {
  -            final String message =
  -                REZ.getString( "bad-property.error", JAVA_VERSION, JavaVersion.class.getName()
);
               throw new TaskException( message );
           }
       }
  
  
  
  1.16      +2 -3      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javac.java
  
  Index: Javac.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/Javac.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- Javac.java	30 Dec 2001 01:14:58 -0000	1.15
  +++ Javac.java	30 Dec 2001 06:13:33 -0000	1.16
  @@ -10,11 +10,10 @@
   import java.io.File;
   import java.util.ArrayList;
   import java.util.Iterator;
  -import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.api.JavaVersion;
  +import org.apache.myrmidon.api.TaskException;
   import org.apache.myrmidon.framework.Os;
   import org.apache.tools.ant.DirectoryScanner;
  -import org.apache.tools.ant.Project;
   import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter;
   import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory;
   import org.apache.tools.ant.types.Argument;
  @@ -895,7 +894,7 @@
   
           if( compiler == null )
           {
  -            if( JavaVersion.JAVA1_2  != getJavaVersion() )
  +            if( JavaVersion.JAVA1_2 != JavaVersion.getCurrentJavaVersion() )
               {
                   compiler = "modern";
               }
  
  
  
  1.18      +0 -1      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
  
  Index: DefaultCompilerAdapter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- DefaultCompilerAdapter.java	30 Dec 2001 03:33:58 -0000	1.17
  +++ DefaultCompilerAdapter.java	30 Dec 2001 06:13:33 -0000	1.18
  @@ -13,7 +13,6 @@
   import java.io.PrintWriter;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.myrmidon.api.TaskException;
  -import org.apache.myrmidon.api.JavaVersion;
   import org.apache.tools.ant.Project;
   import org.apache.tools.ant.taskdefs.Javac;
   import org.apache.tools.ant.taskdefs.exec.Execute;
  
  
  
  1.12      +1 -1      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java
  
  Index: Javah.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/Javah.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Javah.java	30 Dec 2001 01:14:59 -0000	1.11
  +++ Javah.java	30 Dec 2001 06:13:33 -0000	1.12
  @@ -268,7 +268,7 @@
           String compiler = getProject().getProperty( "build.compiler" );
           if( compiler == null )
           {
  -            if( JavaVersion.JAVA1_2  != getJavaVersion() )
  +            if( JavaVersion.JAVA1_2  != JavaVersion.getCurrentJavaVersion() )
               {
                   compiler = "modern";
               }
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message