-
Bug
-
Resolution: Fixed
-
P4
-
1.1.6, 1.2.0
-
beta
-
sparc
-
solaris_2.5
Name: mgC56079 Date: 04/09/98
According to javadoc comments:
* The <code>Compiler</code> class is provided to support
* Java-to-native-code compilers and related services. By design, the
* <code>Compiler</code> class does nothing; it serves as a
* placeholder for a JIT compiler implementation.
* If no compiler is available, these methods do nothing.
This doesn't seem to ve the case for methods
public static native boolean compileClass(Class clazz);
public static native boolean compileClasses(String string);
public static native Object command(Object any);
e.g. compileClass method should return false if java.compiler property is not defined.
/**
* Compiles the specified class.
*
* @param clazz a class.
* @return <code>true</code> if the compilation succeeded;
* <code>false</code> if the compilation failed or no compiler
* is available.
*/
public static native boolean compileClass(Class clazz);
However these methods throw NullPointerException instead of returning false
if called with null parameter.
Here is a test:
======= CompilerTest.java =======
public class CompilerTest {
public static void main(String[] args) {
System.out.println(System.getProperty("java.compiler"));
Compiler.compileClass(null);
}
}
======= Output from the test =======
% java CompilerTest
null
java.lang.NullPointerException
at CompilerTest.main(CompilerTest.java:5)
======================================================================