MethodHandleInfo.getDeclaringClass()
Peter Levart
peter.levart at gmail.com
Sat Dec 14 06:17:25 PST 2013
Hi,
The following code:
public class Test {
static class X {
public void x() { }
}
static class Y extends X {
}
public static void main(String[] args) throws Exception {
MethodHandles.Lookup lookup = MethodHandles.lookup();
MethodHandle mh = lookup.findVirtual(Y.class, "x",
MethodType.methodType(void.class, new Class[0]));
MethodHandleInfo mhi = lookup.revealDirect(mh);
System.out.println(mhi.getDeclaringClass().getSimpleName());
}
}
...prints "Y". Is this correct? The javadoc for the method says:
/Returns the class in which the cracked method handle's underlying
member was defined.//
//
//Returns://
// the declaring class of the underlying member/
The "declaring" class of the underlying member (the method x()) is
clearly not class Y, but class X, isn't it?
Regards, Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20131214/565840eb/attachment.html
More information about the mlvm-dev
mailing list