Replaced getUnsafeInstance.defineClass by MethodHandles.privateLookupIn#19
Replaced getUnsafeInstance.defineClass by MethodHandles.privateLookupIn#19judovana wants to merge 1 commit intomstrobel:developfrom
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.
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.
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.
@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