Multiple this$1 fields when mixing subclassing and inner classes

Stefan Reich stefan.reich.maker.of.eye at
Mon Sep 9 23:09:45 UTC 2019

> But you're not talking about bytecode here you're talking about inside
> the VM. If there is an invokespecial on this$1 of type A then the
> constant pool lookup of its type will be A and we will resolve the call
> based on A's methods. If it were of type B then the resolution process
> would be different. There's nowhere to "insert a cast" here.

Can invokespecials on this$0/this$1 happen? I'm struggling to imagine a
case for this.

invokespecial invokes private instance methods, superclass methods or
constructors. Superclass methods don't apply, neither do constructors. And
calls to private methods happen through bridges (just verified this for
myself again :):

      13: aload_0
      14: getfield      #1                  // Field this$0:Lbla;
      17: invokestatic  #4                  // Method

So what remains?

> BTW what introspection tool did you use to show this?

My own tools ("JavaX")... here's the example program:

Many greetings :)

More information about the hotspot-dev mailing list