You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-dev@jakarta.apache.org by Andreas Schlapbach <sc...@iam.unibe.ch> on 2002/03/06 21:14:04 UTC
[Fwd: Re: invokevirtual #3 ]
This is the explaination for <method null> I got asking some time ago on
a newsgroup.
Andreas
> ---------------------------------------------------------------------
> JLS 13
> requires that compilers emit method references relative to the class
> that qualifies the method invocation, even if that class only inherits
> the method. It is then up to the VM to correctly track inheritance
> issues when resolving method calls. Sun's javac 1.3 also had this bug,
> JDK 1.4 compiles the way jikes 1.15a does (ie. Encoder8859_1.loadTable).
>
> It makes a difference in this example:
>
> in A.java:
> class A
> {
> static void m() { System.out.print("a"); }
> }
>
> in B.java:
> class B extends A {}
>
> in C.java:
> class C
> {
> public static void main(String[] args)
> {
> B.m();
> }
> }
>
> Now, recompile B.java:
> class B extends A
> {
> static void m() { System.out.print("b"); }
> }
>
> The result of executing the (unchanged) C.class should now be "b", not
> "a".
>
> This is also the reason that Sun's javap program will often list null as
> the method or field name for classes compiled with javac 1.4, because
> they have not yet fixed javap to take inheritance into account.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>