Am 04.03.2015 23:50, schrieb Charles Oliver Nutter:
On Thu, Feb 26, 2015 at 4:27 AM, Jochen Theodorou <> wrote:
my biggest request: allow the call of a super constructor (like
super(foo,bar)) using MethodHandles an have it understood by the JVM like a
normal super constructor call... same for this(...)

Just so I understand...the problem is that unless you can get a Lookup
that can do the super call from Java (i.e. from within a subclass),
you can't get a handle that can do the super call, right? And you
can't do that because the method bodies might not be emitted into a
natural subclass of the super class?

Not fully right. Sorry for the possibly false flag with the permissions from the runtime. I am in a natural subclass. Take this pseudoexample:

public class Foo {
  public Foo(String s, Integer i){}
  public Foo(Integer s, Object o){}

public class Bar extends Foo {
  public Bar(def a, def b) {
     super(a,b) // call with runtime types here

I cannot express super(a,b) using method handles, even if I did know the types at compiletime (in which case I would not need invokedynamic anyway). Sure, there is,%20java.lang.String,%20java.lang.invoke.MethodType,%20java.lang.Class%29 but this is for calling methods in a invokespecial like manner, <init> is excluded here as stated in the comment. The comment refers to findConsructor for calls to constructors, and indeed we have invokeSpecial calls there as well, but those are for what in Java is "new", and are different from calls to a super constructor. See also from almost 3 years ago here on the list. Remi gives here a good reason why it probably cannot be done easily... in that or an even older thread someone (I think John) was talking about security.

bye Jochen

Jochen "blackdrag" Theodorou - Groovy Project Tech Lead
german groovy discussion newsgroup: de.comp.lang.misc
For Groovy programming sources visit

mlvm-dev mailing list

Reply via email to