[
https://issues.apache.org/jira/browse/SANDBOX-476?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14133339#comment-14133339
]
offbynull commented on SANDBOX-476:
-----------------------------------
Good morning,
This fix introduces a new issue: In certain situations transformations fail
because ASM 5.0 cannot determine the correct class type.
Here's a stacktrace:
{{monospaced}}
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException:
com.offbynull.peernetic.playground.chorddht.shared.Pointer
at
org.objectweb.asm.ClassWriter.getCommonSuperClass(ClassWriter.java:1684)
at org.objectweb.asm.ClassWriter.getMergedType(ClassWriter.java:1654)
at org.objectweb.asm.Frame.merge(Frame.java:1426)
at org.objectweb.asm.Frame.merge(Frame.java:1325)
at org.objectweb.asm.MethodWriter.visitMaxs(MethodWriter.java:1475)
at org.objectweb.asm.MethodVisitor.visitMaxs(MethodVisitor.java:866)
at
org.objectweb.asm.util.CheckMethodAdapter.visitMaxs(CheckMethodAdapter.java:1021)
at
org.apache.commons.javaflow.bytecode.transformation.asm.ContinuationMethodAdapter.visitMaxs(ContinuationMethodAdapter.java:313)
at org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:834)
at
org.apache.commons.javaflow.bytecode.transformation.asm.ContinuationMethodAnalyzer.visitEnd(ContinuationMethodAnalyzer.java:143)
at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1021)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:693)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:506)
at
org.apache.commons.javaflow.bytecode.transformation.asm.AsmClassTransformer.transform(AsmClassTransformer.java:49)
at
org.apache.commons.javaflow.bytecode.transformation.asm.AsmClassTransformer.transform(AsmClassTransformer.java:41)
at
org.apache.commons.javaflow.utils.RewritingUtils.rewriteClassFile(RewritingUtils.java:60)
at
meme.singularsyntax.mojo.JavaflowEnhanceMojo.enhanceClassFiles(JavaflowEnhanceMojo.java:213)
at
meme.singularsyntax.mojo.JavaflowEnhanceMojo.execute(JavaflowEnhanceMojo.java:154)
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
... 20 more
{{monospaced}}
It looks like the folks at coberture also encountered this issue and worked
around it by allowing the user to supply an auxiliary classpath via a
customized version of ASM's ClassWriter class
(https://github.com/cobertura/cobertura/blob/dddd1d30d19006c0a0ae0119ac8039557d0e206b/cobertura/src/main/java/net/sourceforge/cobertura/instrument/CoberturaClassWriter.java).
The original issued is described on stackoverflow
(http://stackoverflow.com/questions/17522385/java-lang-runtimeexception-java-lang-classnotfoundexception-org-objectweb-asm).
I have taken Coberture's custom ClassWriter implementation and plugged it in
to Javaflow. This exception went away when I gave Javaflow the classpath for my
project.
> [asm] IllegalStateException: "Undefined label used" with ASM > 4.1
> ------------------------------------------------------------------
>
> Key: SANDBOX-476
> URL: https://issues.apache.org/jira/browse/SANDBOX-476
> Project: Commons Sandbox
> Issue Type: Bug
> Components: Javaflow
> Affects Versions: Nightly Builds
> Reporter: Alexandre Chatiron
> Labels: asm, label
> Attachments: BytecodeClassLoader.java, ContinuationClassAdapter.java,
> ContinuationMethodAdapter.java, ContinuationMethodAnalyzer.java,
> javaflow-asm5.02.patch, pom.xml
>
>
> I want to upgrade Commons Javaflow from ASM 4 to 5 (same problem with 4.1 )
> and I get this exception:
> {code}
> java.lang.IllegalStateException: Undefined label used
> at org.objectweb.asm.util.CheckMethodAdapter.visitMaxs(Unknown Source)
> at
> org.apache.commons.javaflow.bytecode.transformation.asm.ContinuationMethodAdapter.visitMaxs(ContinuationMethodAdapter.java:313)
> at org.objectweb.asm.tree.MethodNode.accept(Unknown Source)
> at
> org.apache.commons.javaflow.bytecode.transformation.asm.ContinuationMethodAnalyzer.visitEnd(ContinuationMethodAnalyzer.java:140)
> {code}
> the code triggering this error is:
> {code:java}
> public void visitMaxs(int maxStack, int maxLocals) {
> Label endLabel = new Label();
> mv.visitLabel(endLabel);
> mv.visitLocalVariable("__stackRecorder", "L" + STACK_RECORDER + ";",
> null, startLabel, endLabel, stackRecorderVar);
> mv.visitMaxs(0, 0);
> }
> {code}
> Any idea how to fix that?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)