Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect handling of ldc MethodType #109

Open
samczsun opened this issue Dec 29, 2016 · 3 comments
Open

Incorrect handling of ldc MethodType #109

samczsun opened this issue Dec 29, 2016 · 3 comments

Comments

@samczsun
Copy link

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();
    }
}
@Storyyeller
Copy link
Owner

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.

@samczsun
Copy link
Author

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..?

@samczsun
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants