Bad invokespecial instruction: current class isn't assignable to reference class.
Java class file shrinker, optimizer, obfuscator, and preverifier
Brought to you by:
guardsquare
Last working version is 4.9 for me. For all other versions thereafter the following VerifyError will be thrown.
2015-01-27T22:12:37: SCHWERWIEGEND: it.schulte.beans.UncaughtExceptionHandler: Bad invokespecial instruction: current class isn't assignable to reference class.
Exception Details:
Location:
it/schulte/beans/sdi/actions/CreateFileAction.g()V @122: invokespecial
Reason:
Error exists in the bytecode
Bytecode:
0000000: 2ab6 004e c600 aa2a b400 402a b600 4fb6
0000010: 0076 9a00 9c2a b700 51b6 0056 03bd 002e
0000020: b800 6799 0017 2a59 4cb4 003b 2ab6 004d
0000030: 2ab7 0051 b600 4399 0077 2ab6 004e c000
0000040: 212a b700 514d 4c2c b600 56b8 0066 572b
0000050: b400 3c59 4ec2 2bb4 003d 3a04 2b01 b500
0000060: 3d2b 01b5 003e 2b12 1b19 0401 b600 472d
0000070: c3a7 0008 4d2d c32c bf2b b700 48bb 0022
0000080: 592b 2c01 b700 49b9 007a 0200 57a7 0016
0000090: 4ebb 001d 592b b400 3f59 4db4 003a 2db7
00000a0: 0042 bf2a b400 402a b700 51b6 0075 b1
Exception Handler Table:
bci [86, 113] => handler: 116
bci [116, 119] => handler: 116
bci [71, 141] => handler: 144
Stackmap Table:
same_frame(@58)
full_frame(@116,{Top,Object[#33],Top,Object[#41]},{Object[#44]})
full_frame(@121,{Object[#35],Object[#33],Object[#36]},{})
full_frame(@144,{Top,Object[#33]},{Object[#37]})
full_frame(@163,{Object[#35]},{})
chop_frame(@174,1)
java.lang.VerifyError: Bad invokespecial instruction: current class isn't assignable to reference class.
Exception Details:
Location:
it/schulte/beans/sdi/actions/CreateFileAction.g()V @122: invokespecial
Reason:
Error exists in the bytecode
Bytecode:
0000000: 2ab6 004e c600 aa2a b400 402a b600 4fb6
0000010: 0076 9a00 9c2a b700 51b6 0056 03bd 002e
0000020: b800 6799 0017 2a59 4cb4 003b 2ab6 004d
0000030: 2ab7 0051 b600 4399 0077 2ab6 004e c000
0000040: 212a b700 514d 4c2c b600 56b8 0066 572b
0000050: b400 3c59 4ec2 2bb4 003d 3a04 2b01 b500
0000060: 3d2b 01b5 003e 2b12 1b19 0401 b600 472d
0000070: c3a7 0008 4d2d c32c bf2b b700 48bb 0022
0000080: 592b 2c01 b700 49b9 007a 0200 57a7 0016
0000090: 4ebb 001d 592b b400 3f59 4db4 003a 2db7
00000a0: 0042 bf2a b400 402a b700 51b6 0075 b1
Exception Handler Table:
bci [86, 113] => handler: 116
bci [116, 119] => handler: 116
bci [71, 141] => handler: 144
Stackmap Table:
same_frame(@58)
full_frame(@116,{Top,Object[#33],Top,Object[#41]},{Object[#44]})
full_frame(@121,{Object[#35],Object[#33],Object[#36]},{})
full_frame(@144,{Top,Object[#33]},{Object[#37]})
full_frame(@163,{Object[#35]},{})
chop_frame(@174,1)
at it.schulte.beans.sdi.SingleDocumentApplicationFrame.<init>(Unknown Source)
at it.schulte.passwords.PasswortverwaltungFrame.<init>(Unknown Source)
at bU.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:312)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:694)
at java.awt.EventQueue$3.run(EventQueue.java:692)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:703)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Configuration is:
-verbose
-forceprocessing
-injars ${project.build.directory}${file.separator}${project.build.finalName}.${project.packaging}
-outjars ${project.build.directory}${file.separator}${project.build.finalName}-proguard.${project.packaging}
-libraryjars ${java.home}${file.separator}lib${file.separator}rt.jar${path.separator}${java.home}${file.separator}lib${file.separator}jce.jar${path.separator}${proguard.libraryjars}
-printmapping ${project.build.directory}${file.separator}proguard.map
-allowaccessmodification
-optimizations !code/removal/advanced,!field/removal/writeonly,!method/marking/static,!method/removal/parameter,!code/removal/simple,!code/simplification/branch,!code/removal/exception
-optimizationpasses 1000
-repackageclasses
-keepattributes Exceptions,Signature,*Annotation*
-keep class it.schulte.beans.model.package-info
-keep class it.schulte.passwords.model.package-info
-keep public class * {
}
-keep public enum * {
}
-keep public interface * {
}
-keepclassmembers public class * {
*** getObject();
*** valueOf(***);
*** getJavaValue(java.lang.ClassLoader);
public static void main(java.lang.String[]);
}
-keepclassmembers,allowoptimization enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keepclassmembers enum it.schulte.beans.model.** {
public protected *;
}
-keepclassmembers class it.schulte.beans.model.** {
public protected *;
}
-keepclassmembers enum it.schulte.passwords.model.** {
public protected *;
}
-keepclassmembers class it.schulte.passwords.model.** {
public protected *;
}
-assumenosideeffects class java.lang.System {
public static long currentTimeMillis();
}
-assumenosideeffects interface org.jomc.ObjectManager {
*;
}
-assumenosideeffects class org.jomc.ObjectManagerFactory {
*;
}
-assumenosideeffects class org.jomc.ObjectManagementException {
*;
}
Searching that error message yields
https://bugs.openjdk.java.net/browse/JDK-8009697
which maybe explains what is wrong about that class file.
Thanks for your report. The problem is still a bit hard to track down based on the error log. Would it be possible to reduce it to a test case that allows me to reproduce the problem?
Side-note: don't use -assumenosideeffects with a wildcard '*'. It matches all methods, including methods like Object.wait(), for all objects. Removing those invocations can lead to serious problems.
I'm now getting this error with 6.1beta2 where I wasn't with 6.0.x
Last edit: Scott W Palmer 2019-01-22
Another case:
Related
Bugs:
#2Bugs:
#6Bugs:
#8I'm also seeing this bug, both with 6.1beta2 and 6.1.1. Question for https://sourceforge.net/u/cfxmarvin/ -- did you find a workaround?
@katznm I have not found a workaround. Currently building with anything later than Java 8 has multiple issues (e.g. transitive dependencies that aren't happy), so I haven't investigated further.
I suspect this is the same bug as https://sourceforge.net/p/proguard/bugs/757/