FileDocCategorySizeDatePackage
Javac13.javaAPI DocApache Ant 1.702603Wed Dec 13 06:16:24 GMT 2006org.apache.tools.ant.taskdefs.compilers

Javac13

public class Javac13 extends DefaultCompilerAdapter
The implementation of the javac compiler for JDK 1.3 This is primarily a cut-and-paste from the original javac task before it was refactored.
since
Ant 1.3

Fields Summary
private static final int
MODERN_COMPILER_SUCCESS
Integer returned by the "Modern" jdk1.3 compiler to indicate success.
Constructors Summary
Methods Summary
public booleanexecute()
Run the compilation.

return
true if the compiler ran with a zero exit result (ok)
exception
BuildException if the compilation has problems.


                               
         
        attributes.log("Using modern compiler", Project.MSG_VERBOSE);
        Commandline cmd = setupModernJavacCommand();

        // Use reflection to be able to build on all JDKs >= 1.1:
        try {
            Class c = Class.forName ("com.sun.tools.javac.Main");
            Object compiler = c.newInstance ();
            Method compile = c.getMethod ("compile",
                new Class [] {(new String [] {}).getClass ()});
            int result = ((Integer) compile.invoke
                          (compiler, new Object[] {cmd.getArguments()}))
                .intValue ();
            return (result == MODERN_COMPILER_SUCCESS);
        } catch (Exception ex) {
            if (ex instanceof BuildException) {
                throw (BuildException) ex;
            } else {
                throw new BuildException("Error starting modern compiler",
                                         ex, location);
            }
        }