-
Bug
-
Resolution: Fixed
-
P3
-
1.2.0
-
1.2fcs
-
sparc
-
solaris_2.5.1
-
Not verified
Name: szC45993 Date: 05/07/98
The JCK
vm/instr/invokeinterface/invokeinterface025/invokeinterface02501/invokeinterface02501.html
test detects some non-coincidence of the jdk1.2b4C jvm to the new vm spec for
invokeinterface instruction.
The chapter 6 Java Virtual Machine Instruction Set says the following about
invokeinterface instruction:
"Let C be the class of objectref . The actual method to be invoked is selected by the following lookup procedure:
- If C contains a declaration for an instance method with the same name and descriptor as the resolved method, then this is the method to be invoked, and the lookup procedure terminates.
- Otherwise, if C has a superclass, this same lookup procedure is performed recursively using the direct superclass of C; the method to be invoked is the result of the recursive invocation of this lookup procedure.
- Otherwise, an AbstractMethodError is raised."
and then
"Otherwise, if the selected method is not public, invokeinterface throws an IllegalAccessError."
It means if selected method are "public static" then AbstractMethodError must
be raised according to the new vm spec. However, the test bellow leads to:
novo7% /export/home/JAVA/dest_java/jdk1.2/solaris/bin/java -version
java version "1.2beta4"
novo7% /export/home/JAVA/dest_java/jdk1.2/solaris/bin/java -verify javasoft.sqe.tests.vm.invokeinterface.invokeinterface025.invokeinterface02501.invokeinterface02501
Exception in thread "main" java.lang.IllegalAccessError: illegal interface method javasoft/sqe/tests/vm/invokeinterface/invokeinterface025/invokeinterface02501/clss.f1
at javasoft.sqe.tests.vm.invokeinterface.invokeinterface025.invokeinterface02501.invokeinterface02501.main(invokeinterface02501.jasm)
test result: Failed. unexpected exit code
SOURCE:
--------------------- invokeinterface02501.jasm
package javasoft/sqe/tests/vm/invokeinterface/invokeinterface025/invokeinterface02501;
public interface i {
public abstract Method f1:"(IF)I";
} // end Class i
public class clss implements i {
public static Method f1:"(IF)I"
stack 1 locals 3
{
iconst_0;
ireturn;
}
public Method <init>:"()V"
stack 1 locals 1
{
aload_0;
invokenonvirtual Method java/lang/Object.<init>:"()V";
return;
}
} // end class clss
public class invokeinterface02501 {
public static Method run:"([Ljava/lang/String;Ljava/io/PrintStream;)I"
stack 6 locals 4
{
try t1;
new class clss;
dup;
invokenonvirtual Method clss.<init>:"()V";
iconst_1;
fconst_1;
invokeinterface InterfaceMethod i.f1:"(IF)I", 3;
iconst_2; // no exception - test failed
ireturn;
endtry t1;
catch t1 java/lang/AbstractMethodError;
iconst_0; // passed
ireturn;
}
public static Method main:"([Ljava/lang/String;)V"
stack 2 locals 1
{
aload_0;
getstatic Field java/lang/System.out:"Ljava/io/PrintStream;";
invokestatic Method run:"([Ljava/lang/String;Ljava/io/PrintStream;)I";
//iconst_0;
bipush 95/*STATUS_TEMP*/;
iadd;
invokestatic Method java/lang/System.exit:"(I)V";
return;
}
} // end Class invokeinterface02501
======================================================================
Hook 5(hook5): test
======================================================================