-
Notifications
You must be signed in to change notification settings - Fork 120
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
Replaced getUnsafeInstance.defineClass by MethodHandles.privateLookupIn #19
base: develop
Are you sure you want to change the base?
Conversation
getUnsafeInstance().defineClass was removed in jdk11 in favour of MethodHandles.privateLookupIn MethodHandles.privateLookupIn are nto available in jdk8
This patch + #20 is making procyon jdk11 friendly. |
This patch is making it not buildable on jdk8. |
_protectionDomain | ||
); | ||
MethodHandles.Lookup lookup = MethodHandles.lookup(); | ||
MethodHandles.Lookup privateLookup = MethodHandles.privateLookupIn(Class.forName(fullName), lookup); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you test this? I don't see how Class.forName(fullName)
could work, since the class doesn't exist until the next line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi!
it is definitely tested in usual workloads. Is there some cornercase you think is sure to hit those lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mstrobel : You have unit tests that cover that part of the code
@judovana: I'm confused how you can test this without changing JDK version from 1.7 to 11 in the build.gradle? I've run the build and I have 31 test failures (that can be reduced to 15 with the PR #35), failures such as variable renames that appear trivial at first but can cause collisions and loss of meaningful naming (x instead of b for boolean, etc...) and compiler methods such as makeConcatWithConstants not interpreted anymore (@mstrobel: was that supported?)
ping please? |
I am sure, you haven't tested your code. It can't work -> Class.forName(fullName) will always throw "java.lang.ClassNotFoundException" on non-existing classes. You haven't even changed JDK Java version in your build and MethodHandles.privateLookupIn is also awailable only since java 9, it also can't work with java versions prior to 9. |
@delafer Hello, please thread whole issue, and timestamps on comments: "it is definitely tested in usual workloads" : I'm using procyon with this patch on daily base, and had not hit the issue: https://src.fedoraproject.org/rpms/procyon/blob/rawhide/f/lookupPatch.patch . However I must admit, my usecase is not exactly straightforward, and am using procyon only on fields where other decompilers fails. As Procyon is one of the worse in ordinary code load, but can handle corner cases best of all. I never claimed the patch flawless. but got only minimal feedback until @nbauma109 just day ago. |
getUnsafeInstance().defineClass was removed in jdk11 in favour of MethodHandles.privateLookupIn
MethodHandles.privateLookupIn are nto available in jdk8