You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Gregory Shimansky (JIRA)" <ji...@apache.org> on 2007/08/09 08:41:43 UTC
[jira] Resolved: (HARMONY-4355) [drlvm][classloader] compatibility:
VM throws NoClassDefFoundError when the implementation of some abstract
method is absent while RI throws AbstractMethodError
[ https://issues.apache.org/jira/browse/HARMONY-4355?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gregory Shimansky resolved HARMONY-4355.
----------------------------------------
Resolution: Fixed
Patch is applied at 564111. Please check that the bug is fixed for you.
> [drlvm][classloader] compatibility: VM throws NoClassDefFoundError when the implementation of some abstract method is absent while RI throws AbstractMethodError
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: HARMONY-4355
> URL: https://issues.apache.org/jira/browse/HARMONY-4355
> Project: Harmony
> Issue Type: Bug
> Components: DRLVM
> Reporter: Vera Petrashkova
> Assignee: Gregory Shimansky
> Priority: Minor
> Attachments: H4355.patch, invoke.zip
>
>
> According to J2SE 1.5 specifications of
> invokestatic and invokevirtual
> instructions
> During resolution of the symbolic reference to the method, any of the exceptions listed "Method resolution" can be thrown.
> Otherwise, if the resolved method is an instance method, the invokestatic/invokevirtual instruction throws
> IncompatibleClassChangeError.
> The specification also says about resolving a method reference in class C:
> 1) Method resolution checks whether C is a class or an interface.
> - If C is an interface VM throws IncompatibleClassChangeError.
> 2 ) Method resolution attempts to look up the referenced method in C and its superclasses:
> - If C declares a method with the name and descriptor specified by the method reference,
> method lookup succeeds.
> - Otherwise, if C has a superclass, step 2 of method lookup is recursively
> invoked on the direct superclass of C.
> 3) Otherwise, method lookup attempts to locate the referenced method in any of the superinterfaces
> of the specified class C.
> - If any superinterface of C declares a method with the name and descriptor specified by the method
> reference, method lookup succeeds.
> - Otherwise, method lookup fails.
> If method lookup fails, method resolution throws a NoSuchMethodError. If method lookup succeeds and the method is abstract, but C is not abstract, method resolution throws an AbstractMethodError.
> The following test which uses synthetic classes demonstrates that DRLVM and RI behavior are differ
> when some method is declared in the interface but the its implementation is absent.
> RI throws AbstractMethodError but DRLVM returns NoClassDefFoundError.
> This occurs because RI resolves method reference using steps 2 and 3 but DRLVM uses only step 2.
> --------------test.java------------
> public class test {
> public static void main(String[] args) {
> System.out.println("------invokestatic instruction");
> try {
> System.out.println(new invokeS().test(args));
> } catch (Throwable e) {
> e.printStackTrace();
> }
> System.out.println("------invokevirtual instruction");
> try {
> System.out.println(new invokeV().test(args));
> } catch (Throwable e){
> e.printStackTrace();
> }
> }
> }
> ---------------------invokeS.jj---------------
> .class public invokeS
> .super java/lang/Object
> ; standard initializer
> .method public <init>()V
> aload_0
> invokenonvirtual java/lang/Object/<init>()V
> return
> .end method
> .method public test([Ljava/lang/String;)I
> .limit stack 2
> .limit locals 2
> invokestatic invokeSn/testNeg()I
> sipush 104
> ireturn
> .end method
> .method public test1([Ljava/lang/String;)I
> .limit stack 2
> .limit locals 2
> invokestatic invokeSn1/testNeg()I
> sipush 104
> ireturn
> .end method
> ----------------invokeSn.jj-------------
> .class public invokeSn
> .super invokeSc1
>
> ; standard initializer
> .method public <init>()V
> aload_0
> invokenonvirtual invokeSc1/<init>()V
> return
> .end method
> .method public static testNeg()I
> .limit stack 2
> .limit locals 1
> invokestatic invokeSn/testAbstr()I
> ireturn
> .end method
> ----------------invokeV.jj-----------------
> .class public invokeV
> .super java/lang/Object
> ; standard initializer
> .method public <init>()V
> aload_0
> invokenonvirtual java/lang/Object/<init>()V
> return
> .end method
> .method public test([Ljava/lang/String;)I
> .limit stack 2
> .limit locals 2
> invokestatic invokeVn/testNeg()I
> sipush 104
> ireturn
> .end method
> ----------invokeVn.jj----------
> .class public invokeVn
> .super invokeSc1
>
> ; standard initializer
> .method public <init>()V
> aload_0
> invokenonvirtual invokeSc1/<init>()V
> return
> .end method
> .method public static testNeg()I
> .limit stack 3
> .limit locals 2
> new invokeVn
> dup
> invokespecial invokeVn/<init>()V
> invokevirtual invokeVn/testAbstr()I
> ireturn
> .end method
> ----------invokeSc1.jj-----------
> .class public invokeSc1
> .super java/lang/Object
> .implements invokeSc2
> ; standard initializer
> .method public <init>()V
> aload_0
> invokenonvirtual java/lang/Object/<init>()V
> return
> .end method
> -----------invokeSc2.jj------------------------
> .interface abstract public invokeSc2
> .super java/lang/Object
> .implements invokeSc3
> ----------- invokeSc3.jj------------------------
> .interface abstract public invokeSc3
> .super java/lang/Object
> .implements invokeSc4
> ----------- invokeSc4.jj------------------------
> .interface abstract public invokeSc4
> .super java/lang/Object
> .implements invokeSc5
> ----------- invokeSc5.jj------------------------
> .interface abstract public invokeSc5
> .super java/lang/Object
> ; method
> .method abstract public testAbstr()I
> .end method
> ---------------------------
> Output:
> =======
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> ------invokestatic instruction
> java.lang.AbstractMethodError: invokeSn.testAbstr()I
> at invokeSn.testNeg(invokeSn.jj)
> at invokeS.test(invokeS.jj)
> at test.main(test.java:5)
> ------invokevirtual instruction
> java.lang.AbstractMethodError: invokeVn.testAbstr()I
> at invokeVn.testNeg(invokeVn.jj)
> at invokeV.test(invokeV.jj)
> at test.main(test.java:11)
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r551077, (Jun 27 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> ------invokestatic instruction
> java.lang.NoSuchMethodError: invokeSn.testAbstr()I while resolving constant pool entry at
> index 16 in class invokeSn
> at invokeS.test(invokeS.jj)
> at test.main(test.java:5)
> ------invokevirtual instruction
> java.lang.NoSuchMethodError: invokeVn.testAbstr()I while resolving constant pool entry at
> index 3 in class invokeVn
> at invokeV.test(invokeV.jj)
> at test.main(test.java:11)
> This bug causes the failure of VTS test
> vm/jvms/instructions/invokeReturn/invokestatic/invokestatic11/invokestatic1102/invokestatic1102.xml
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.