Krakatau
Krakatau copied to clipboard
Incorrect handling of ldc MethodType
Strangely enough, I can ldc
a MethodType
, and the JVM will let me print it:
.version 52 0
.class public super Test
super java/lang/Object
.method public static main : ([Ljava/lang/String;)V
.code stack 10 locals 10
L0: getstatic Field java/lang/System out Ljava/io/PrintStream;
L3: ldc MethodType "(Ljava/lang/Object;)V"
L5: invokevirtual Method java/io/PrintStream println (Ljava/lang/Object;)V
L8: return
L9:
.end code
.end method
.end class
Output: (Object)void
Decompiled output:
public class proof {
public static void main(String[] a)
{
System.out.println();
}
}
The decompiler doesn't really attempt to handle method handle/type/invoke dynamic stuff, since I'm not sure if there is a good way to represent it in Java.
In this case, it seems to just print the simple version of the MethodType. MethodHandles can't be loaded onto the stack. I wonder if this is an oversight in the JVM..?
It seems that at 3am in the morning I don't function too well. Looking back at that comment I'm not really sure what I was thinking but it obviously isn't correct.
For MethodTypes maybe an artificial MethodType.fromMethodDescriptorString
could be inserted? It seems better than not displaying any indication of the value at all