java.lang.IllegalArgumentException: JSR/RET are not supported with computeFrames option when instrumenting bouncycastle library
Firebase Performance received a customer issue which is publicly tracked at https://issuetracker.google.com/issues/141497570.
Note: When developer integrates Firebase Performance to their app, before application code is converted to DEX files, the Performance Monitoring plugin uses the Transform API and the ASM bytecode instrumentation framework to visit the app's compiled class files and to instrument the code (to measure performance). More details here.
The issue is that when Firebase Performance Monitoring plugin tries to instrument below 2 classes:
org/bouncycastle/jce/provider/X509LDAPCertStoreSpi.class
org/bouncycastle/x509/util/LDAPStoreHelper.class
It fails with below exception:
java.lang.IllegalArgumentException: JSR/RET are not supported with computeFrames option
at org.objectweb.asm.Frame.execute(Frame.java:1009)
at org.objectweb.asm.MethodWriter.visitJumpInsn(MethodWriter.java:1156)
at org.objectweb.asm.commons.AdviceAdapter.visitJumpInsn(AdviceAdapter.java:503)
at org.objectweb.asm.ClassReader.readCode(ClassReader.java:2040)
at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1275)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:679)
at com.google.firebase.perf.plugin.instrumentation.Instrument.instrument(Instrument.java:170)
at com.google.firebase.perf.plugin.instrumentation.Instrument.instrumentClassesInJar(Instrument.java:117)
at com.google.firebase.perf.plugin.FirebasePerfTransform.performTransformationFor(FirebasePerfTransform.java:563)
at com.google.firebase.perf.plugin.FirebasePerfTransform.transformJarInputs(FirebasePerfTransform.java:445)
at com.google.firebase.perf.plugin.FirebasePerfTransform.transform(FirebasePerfTransform.java:416)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:239)
at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:235)
Searching on the web I found below similar issues:
-
https://bugs.eclipse.org/bugs/show_bug.cgi?id=481150
Mitigation Strategy: Looks like they are skipping classes that are known to contain a JSR Instruction.
-
https://github.com/pbadenski/halik/issues/2
Mitigation Strategy: They deduced that this will happen when you depend on the code that had been compiled with Java 1.5 or lower.
-
https://www-01.ibm.com/support/docview.wss?uid=swg1PM96609
Mitigation Strategy: They deduced that it's also because of handling of really old Java classes that were compiled with JDK 1.1.
-
https://community.oracle.com/thread/3966549
Mitigation Strategy: They deduced that from ASM 4.0 and above, ASM provided JSRInlinerAdapter Class to transform JSR before processing to bypass this issue, but unfortunately even after switching to a high version of ASM lib (4.0 and 4.1) the issue is still happening.
Wondering if this is something similar to what you fixed in #317823 (closed), in which case switching to ASM 6.2+
should resolve this?
If not, do you recommend skipping the files (avoid instrumenting X509LDAPCertStoreSpi.class
and LDAPStoreHelper.class
) which are known to contain a JSR Instruction to avoid the issue?
Or, is this happening because the bouncycastle lib might have been compiled with some older incompatible version of java? In which case we need to check with bouncycastle
team.