-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.1
-
sparc
-
solaris_2.4
Name: akC45999 Date: 11/18/96
The section "6.4 The Virtual machine instruction set" of The Java Virtual Machine,
subsection invokeinterface/Linking Exceptions defines which exception is to be
thrown in each case. For example, if accessed method is happens to not be public,
IllegalAccessError should be thrown.
However, in all such cases linker throws java.lang.UnknownError.
See the sample test. It takes into account that the jdk11 now performs
this check during linking.
-------------------------------------------------------- invokeinterface02002.jasm
public interface i {
public abstract Method f1:"(IF)I";
} // end class i
public class clss implements i {
protected /*private*/ Method f1:"(IF)I" // method should be public
stack 1 locals 1
{
iconst_0;
ireturn;
}
public static Method run:"()V"
stack 4 locals 1
{
new class clss;
dup;
invokenonvirtual Method clss.<init>:"()V";
iconst_1;
fconst_1;
invokeinterface InterfaceMethod i.f1:"(IF)I", 3;
return;
}
public Method <init>:"()V"
stack 1 locals 1
{
aload_0;
invokenonvirtual Method java/lang/Object.<init>:"()V";
return;
}
} // end class clss
public class invokeinterface02002 {
public static Method run:"([Ljava/lang/String;Ljava/io/PrintStream;)I"
stack 6 locals 2
{
try t1;
new class clss;
dup;
invokenonvirtual Method clss.<init>:"()V";
iconst_1;
fconst_1;
invokeinterface InterfaceMethod i.f1:"(IF)I", 3;
iconst_1; // no exception - test failed
ireturn;
endtry t1;
catch t1 java/lang/IllegalAccessError;
iconst_0; // passed
ireturn;
catch t1 java/lang/UnknownError;
iconst_2; // failed
ireturn;
catch t1 #0; // all other exceptions
iconst_3; // failed
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";
bipush 95/*STATUS_TEMP*/;
iadd;
invokestatic Method java/lang/System.exit:"(I)V";
return;
}
} // end Class invokeinterface02002
-----------------------------------------------------------------
======================================================================
- duplicates
-
JDK-4010282 JVM does not throw or does not catch VerifyError when subclass of a final class.
- Closed