-
Bug
-
Resolution: Duplicate
-
P1
-
None
-
1.3.0
-
x86
-
windows_95
Name: dkC59003 Date: 06/29/99
JVMS, second edition (CHAPTER 5 Loading, Linking, and Initializing,
section 5.4.3.4 Interface Method Resolution) reads
"When resolving an interface method reference:
........
Otherwise, if the referenced method does not have the same name
and descriptor as a method in C or in one of the superinterfaces of C,
or in class Object, interface method resolution throws a NoSuchMethodError. "
The following test shows JDK-1.3G(H) with HotSpot does not resolve an
interface method reference. In the test "interface2" has no method f1, but it's
superinterfaces "interface1" has one. Therefore, the interface method references
must be resolve to interface1.f1.
****************************** source1 **************************
//================== test.jasm ======================//
interface interface1
{
public abstract Method f1:"()I";
}
//===================================================//
interface interface2 implements interface1 {}
//===================================================//
super class test implements interface2
{
Method "<init>":"()V"
stack 1 locals 1
{
aload_0;
invokespecial Method java/lang/Object."<init>":"()V";
return;
}
public Method f1:"()I"
stack 1 locals 1
{
iconst_0;
ireturn;
}
public static Method main:"([Ljava/lang/String;)V"
stack 2 locals 1
{
new class test;
dup;
invokespecial Method "<init>":"()V";
invokeinterface InterfaceMethod interface2.f1:"()I", 1;
pop;
return;
}
} // end Class test
//===================================================//
****************************** source2 **************************
rem do.bat
@echo off
H:\ld25\java\dest\jdk1.3H\win32\bin\java %1 -version
H:\ld25\java\dest\jdk1.3H\win32\bin\java %1 -verify test
if not errorlevel=1 goto L1
echo ----Bad----
goto end
:L1
if errorlevel=0 echo ----OK----
:end
****************************** logs ******************************
>do.bat -classic
java version "1.3"
Classic VM (build JDK-1.3-H, native threads, symcjit)
----OK----
>
>
>do.bat
java version "1.3"
HotSpot Client VM (1.3beta, mixed mode, build h)
Exception in thread "main" java.lang.NullPointerException
at test.main(test.jasm)
----Bad----
>
*******************************************************************
see also JCK test
vm/instr/invokeinterface/invokeinterface018/invokeinterface01801/invokeinterface01801.html
BTW, the NullPointerException is very strange exception for this case.
======================================================================
- duplicates
-
JDK-4245437 1.3c1: vm/instr/invokeinterface/invokei...face018/invoke....ace01801 fails with
-
- Closed
-