Name: akC45999 Date: 07/15/98
The Java VM spec chapter "4.6 Methods" reads:
...
If the method is either native or abstract, its method_info structure must not have a Code attribute.
But the attached test shows that VM doesn't reject a class which contain a native method with Code attribute.
--------------------------------- test.java
import java.io.PrintStream;
public class test {
public static void main(String argv[]) {
try {
Class.forName("BadClass");
System.out.println("Very bad");
} catch (Throwable e) {
System.out.println("Exception " + e);
}
}
}
--------------------------------- BadClass.jasm
abstract class BadClass
{
native Method testMethod:"()V"
{
return;
}
}
------------------------------------- dotest
#!/bin/sh
TESTCLASSES=/opt/home/testclasses
CLASSPATH=$TESTCLASSES
export CLASSPATH
jasm -d $TESTCLASSES *.jasm
javac -d $TESTCLASSES *.java
java -verify test;
----------------------------------------
Running the test:
novo49% dotest
Very bad
novo49%
======================================================================
======================================================================