I encountered following bug in ProGuard 6.1.1 when processing a Java 11 compiled jar. This is related to the nest based access control feature introduced in Java 11 and is triggered in cases where Java 10 would have generated acess bridge methods.When changing access to public in the inner class the issue does not appear. I have put together a trivial java source file and jar to demonstrate the issue.
The byte code verifier displays this message in the obfuscated class. The original (not obfuscated) jar works as intended.
Error: Unable to initialize main class test.Host
Caused by: java.lang.VerifyError: Bad invokespecial instruction: current class isn't assignable to reference class.
Exception Details:
Location:
test/Host.main([Ljava/lang/String;)V @14: invokespecial
Reason:
Error exists in the bytecode
Bytecode:
0000000: bb00 0359 b700 0759 4b59 4bb4 0005 b700
0000010: 09b1
Jars created with OpenJDK 11.0.4 on Windows 10.
TestIn.jar: executable jar file with original class file
TestOut.jar: executable jar file created with ProGuard 6.1.1
The minimal code change to workaround the issue is to chage the outer class method to package local access.
I just got similar problem in my java application.
After I change the outer class method from "private" to "protected" or "public" (or just remove "private"), it is ok. (However, if I change your example's getString() to "protected", the problem still exists.)
I am also using Java 11 and proguard 6.1.1.
Last edit: Clive Wong 2019-07-30
I'm seeing the same error message, but it seems to happen with nested try/catch blocks in a static initializer.
I have just tried ProGuard 6.2.0 and the issue still isn't solved (for me).
What can we do to help?
Do we need a better test case?
I have a similar issue with open jdk 13 and latest version 6.2.0
Same here:
Reason:
Error exists in the bytecode
Bytecode:
0000000: 2ab4 000c 9900 082a b400 0db0 2ab4 000a
0000010: b400 0959 4cc2 2ab4 000d c700 222a 59b4
0000020: 000a 2ab4 000b b600 11b5 000d 2ab4 000a
0000030: 2ab4 000d b700 0e2a 04b5 000c 2bc3 a700
0000040: 084d 2bc3 2cbf 2ab4 000d b0
Exception Handler Table:
bci [22, 62] => handler: 65
bci [65, 68] => handler: 65
Stackmap Table:
same_frame(@12)
append_frame(@60,Object[#6])
full_frame(@65,{Top,Object[#6]},{Object[#8]})
full_frame(@70,{Object[#2]},{})
Related
Bugs:
#2Bugs:
#6Bugs:
#8This was also reported in this bug report: https://github.com/Guardsquare/proguard/issues/10
We have fixed this in the meantime and the fix will be included in 6.2.1 available the next days.
Fixed and will be included in v6.2.1.
This is not fixed. As of 6.2.2 and 6.3.0beta1 I still get the same error. (Using JDK 13.0.2)
Last edit: Scott W Palmer 2020-02-20
The test case I provided in the github report is passing now, but I get the exact same error in my actual application. Some case is still causing this problem.