[ https://issues.apache.org/jira/browse/BCEL-187?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14354512#comment-14354512 ]
Jérôme Leroux commented on BCEL-187: ------------------------------------ Here is some element of the _Java Virtual Machine specification_ about this issue http://docs.oracle.com/javase/specs/jvms/se6/html/ConstantPool.doc.html#86899 {quote} 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. 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. {quote} Since the old revision of the _Java Virtual Machine specification_, some precisions have been added to this chapter. You can find the last revision here: https://docs.oracle.com/javase/specs/jvms/se8/jvms8.pdf > Verification error when an invoke references a method defined in superclass > --------------------------------------------------------------------------- > > Key: BCEL-187 > URL: https://issues.apache.org/jira/browse/BCEL-187 > Project: Commons BCEL > Issue Type: Bug > Components: Verifier > Affects Versions: 5.2 > Reporter: Jérôme Leroux > Fix For: 6.0 > > Attachments: BCEL-187-tests-src.zip, BCEL-187.patch, BCEL-187.zip > > > Assuming a class A with a method foo() and a class B subclass of A. If an > invoke opcode references the method B.foo() then the bytecode verifier raises > an error with the following error message: > {quote} > Referenced method 'foo' with expected signature '()void' not found in class > 'B'. The native verifier does allow the method to be declared in some > superinterface, which the Java Virtual Machine Specification, Second Edition > does not. > {quote} > I can't find where in the _Java Virtual Machine Specification, Second > Edition_ this restriction is defined. > The verification of the bytecode generated by the following code fails: > {code:java} > public class TestLegalInvokeInterface01{ > public static void test1(Interface01 t){ > t.run(); > } > } > interface Interface01 extends Runnable { > > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)