asm issueshttps://gitlab.ow2.org/asm/asm/-/issues2017-12-26T09:56:15Zhttps://gitlab.ow2.org/asm/asm/-/issues/317580Data flow analyzer doesn't execute all paths in some methods with subroutines2017-12-26T09:56:15ZdmaplesdenData flow analyzer doesn't execute all paths in some methods with subroutines```
I have found that in some very unusual situations the data flow analysis
implemented in org.objectweb.asm.tree.analysis.Analyzer doesn't evaluate all
paths through the method.
I believe the problem is with how subroutines are being ...```
I have found that in some very unusual situations the data flow analysis
implemented in org.objectweb.asm.tree.analysis.Analyzer doesn't evaluate all
paths through the method.
I believe the problem is with how subroutines are being handled. The code that
deals with the JSR opcode merges the jump frame with the current frame, but the
jump instruction is not queued if the merge produces no changes.
Whilst this makes sense by itself the problem is that this means the RET
instruction (for returning from the subroutine) is not re-evaluated, meaning
that the checks that occur when the RET instruction is handled to see if the
instruction following the JSR (which is where the RET instruction returns the
control flow to) need to be re-evaluated are never performed.
This is a problem because if you have arrived at the JSR instruction with a new
frame state, even if you don't need to re-evaluate the subroutine, you do need
to re-evaluate the rest of the control flow continuing on after the return from
the subroutine.
I have a patch which appears to fix the problem for me, it basically does a
normal merge on the subsequent instruction if the subroutine is not going to be
re-evaluated (code starting at line 210).
if (insnOpcode == JSR) {
merge(jump, current, new Subroutine(j.label,
m.maxLocals, j));
// new code
if (!queued[jump]) {
// if the subroutine isn't going to be re-evaluated
// we still need to continue execution from
here as the frame state might be different
// this mimics what happens when we get the RET
instruction
// pop the value pushed by JSR
current.pop();
// check if the next instruction needs to be
re-evaluated
// we don't need to worry about merging the
results of the subroutine, because it wasn't re-evaluated!
merge(insn + 1, current, subroutine);
newControlFlowEdge(insn, insn + 1);
}
// end new code
} else {
merge(jump, current, subroutine);
}
Please note that this situation is very unusual and I have found only one or
two instances of it amongst tens of thousands of java methods.
One example I have is
org.apache.xpath.axes.FilterExprIteratorSimple.executeFilterExpr() from one
version of xalan. I will upload the exact version of xalan I am using in case
you want to test against exactly this case.
```https://gitlab.ow2.org/asm/asm/-/issues/317780IAE at CheckMethodAdapter.checkInternalName for non-Java-identifier name2017-12-26T09:35:57ZudalovIAE at CheckMethodAdapter.checkInternalName for non-Java-identifier name```
Please use the following short program to reproduce the issue:
import org.objectweb.asm.signature.SignatureVisitor;
import org.objectweb.asm.signature.SignatureWriter;
import org.objectweb.asm.util.CheckSignatureAdapter;...```
Please use the following short program to reproduce the issue:
import org.objectweb.asm.signature.SignatureVisitor;
import org.objectweb.asm.signature.SignatureWriter;
import org.objectweb.asm.util.CheckSignatureAdapter;
public class Test {
public static void main(String[] args) {
SignatureWriter sw = new SignatureWriter();
SignatureVisitor sv = new CheckSignatureAdapter(CheckSignatureAdapter.CLASS_SIGNATURE,
sw).visitSuperclass();
sv.visitClassType("Foo Bar"); // note the whitespace in the name
sv.visitEnd();
System.out.println(sw.toString());
}
}
The program fails with the following exception:
java.lang.IllegalArgumentException: Invalid class name (must be a fully qualified class name in internal form):
Foo Bar
at org.objectweb.asm.util.CheckMethodAdapter.checkInternalName(CheckMethodAdapter.java:1354)
at org.objectweb.asm.util.CheckMethodAdapter.checkInternalName(CheckMethodAdapter.java:1321)
at org.objectweb.asm.util.CheckSignatureAdapter.visitClassType(CheckSignatureAdapter.java:280)
at Test.main(Test.java:25)
The exception is thrown because "Foo Bar" is not a Java identifier (see Character.isJavaIdentifier* calls in
CheckMethodAdapter.checkIdentifier). However, according to JVMS 8, §4.7.9.1
(https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.9.1), this name should be
allowed:
> The grammar includes the terminal symbol Identifier to denote the name of a type, field, method, formal
parameter, local variable, or type variable, as generated by a Java compiler. Such a name must not contain
any of the ASCII characters . ; [ / < > : (that is, the characters forbidden in method names (§4.2.2) and also
colon) but may contain characters that must not appear in an identifier in the Java programming language
(JLS §3.8).
I think CheckMethodAdapter.checkIdentifier should be fixed to support not only names which are Java
identifiers, but also other names allowed by the spec.
Note that this issue causes the Kotlin (kotlinlang.org) compiler to fail on a rather simple example:
https://youtrack.jetbrains.com/issue/KT-10494
```https://gitlab.ow2.org/asm/asm/-/issues/317782OSGI import statement broken2017-12-26T09:34:58ZlostinicelandOSGI import statement broken```
The OSGi artifact uses a broken import-statement in the MANIFEST.MF.
Import-Package: org.objectweb.asm;version="[6.0_ALPHA,6.0_ALPHA]"
6.0_ALPHA is not a numeric value. OSGI uses major.minor.bugfix.qualifier and
all segments expect...```
The OSGi artifact uses a broken import-statement in the MANIFEST.MF.
Import-Package: org.objectweb.asm;version="[6.0_ALPHA,6.0_ALPHA]"
6.0_ALPHA is not a numeric value. OSGI uses major.minor.bugfix.qualifier and
all segments expect the qualifier must be of type String. The correct import
would be "[6.0.0,7.0.0)" assuming you want a upper bound to 7.0.0 (just as an
example)
```https://gitlab.ow2.org/asm/asm/-/issues/317777Infinite loop fix breaks JavaFlow continuation support2017-12-26T09:37:57ZdashorstInfinite loop fix breaks JavaFlow continuation support```
The commit below broke support for the (now rather obsolete) commons-javaflow project, or rather it
breaks the unit tests with class loading issues.
commit 2b155e17098a41a38d3819d79a7c6ec69d7a1e07
Author: ebruneton <ebruneton@271bd...```
The commit below broke support for the (now rather obsolete) commons-javaflow project, or rather it
breaks the unit tests with class loading issues.
commit 2b155e17098a41a38d3819d79a7c6ec69d7a1e07
Author: ebruneton <ebruneton@271bd773-ee82-43a6-9b2b-1890ed8ce7f9>
Date: Sat Sep 1 15:52:49 2012 +0000
Fixed bug in MethodNode (infinite loops when trying to copy a MethodNode into another several
times).
Added unit test for this case (failing without the bug fix).
diff --git a/asm/src/org/objectweb/asm/tree/MethodNode.java
b/asm/src/org/objectweb/asm/tree/MethodNode.java
index f3bbdbd..bf380cf 100644
--- a/asm/src/org/objectweb/asm/tree/MethodNode.java
+++ b/asm/src/org/objectweb/asm/tree/MethodNode.java
@@ -458,7 +458,7 @@ public class MethodNode extends MethodVisitor {
*/
protected LabelNode getLabelNode(final Label l) {
if (!(l.info instanceof LabelNode)) {
- l.info = new LabelNode(l);
+ l.info = new LabelNode();
}
return (LabelNode) l.info;
}
diff --git a/asm/test/conform/org/objectweb/asm/tree/ClassNodeUnitTest.java
b/asm/test/conform/org/objectweb/asm/tree/ClassNodeUnitTest.java
index 5754b81..988038b 100644
--- a/asm/test/conform/org/objectweb/asm/tree/ClassNodeUnitTest.java
+++ b/asm/test/conform/org/objectweb/asm/tree/ClassNodeUnitTest.java
@@ -32,6 +32,7 @@ package org.objectweb.asm.tree;
import junit.framework.TestCase;
import org.objectweb.asm.Handle;
+import org.objectweb.asm.Label;
import org.objectweb.asm.Opcodes;
/**
@@ -138,4 +139,18 @@ public class ClassNodeUnitTest extends TestCase implements Opcodes {
MultiANewArrayInsnNode manan = new MultiANewArrayInsnNode("[[I", 2);
assertEquals(AbstractInsnNode.MULTIANEWARRAY_INSN, manan.getType());
}
+
+ public void testCloneMethod() {
+ MethodNode n = new MethodNode();
+ Label l0 = new Label();
+ Label l1 = new Label();
+ n.visitCode();
+ n.visitLabel(l0);
+ n.visitInsn(Opcodes.NOP);
+ n.visitLabel(l1);
+ n.visitEnd();
+ MethodNode n1 = new MethodNode();
+ n.accept(n1);
+ n.accept(n1);
+ }
}
The class loading issue that arises is the following stack trace:
java.lang.NoClassDefFoundError: org/apache/commons/javaflow/rewrite/Simple
at
org.apache.commons.javaflow.suite.VerificationTestCase.testSimpleSuspend(VerificationTestCase.java:18
8)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at junit.framework.TestCase.runTest(TestCase.java:176)
at junit.framework.TestCase.runBare(TestCase.java:141)
at junit.framework.TestResult$1.protect(TestResult.java:122)
at junit.framework.TestResult.runProtected(TestResult.java:142)
at junit.framework.TestResult.run(TestResult.java:125)
at junit.framework.TestCase.run(TestCase.java:129)
at junit.framework.TestSuite.runTest(TestSuite.java:252)
at junit.framework.TestSuite.run(TestSuite.java:247)
at junit.framework.TestSuite.runTest(TestSuite.java:252)
at junit.framework.TestSuite.run(TestSuite.java:247)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.javaflow.rewrite.Simple Undefined
label used
at
org.apache.commons.javaflow.helper.ClassTransformerClassLoader.loadClass(ClassTransformerClassLoa
der.java:113)
... 22 more
Caused by: java.lang.IllegalStateException: Undefined label used
at org.objectweb.asm.util.CheckMethodAdapter.visitMaxs(CheckMethodAdapter.java:1013)
at
org.apache.commons.javaflow.bytecode.transformation.asm.ContinuationMethodAdapter.visitMaxs(Conti
nuationMethodAdapter.java:313)
at org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:835)
at
org.apache.commons.javaflow.bytecode.transformation.asm.ContinuationMethodAnalyzer.visitEnd(Contin
uationMethodAnalyzer.java:140)
at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1036)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:708)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:521)
at
org.apache.commons.javaflow.bytecode.transformation.asm.AsmClassTransformer.transform(AsmClassTr
ansformer.java:49)
at
org.apache.commons.javaflow.bytecode.transformation.asm.AsmClassTransformer.transform(AsmClassTr
ansformer.java:41)
at
org.apache.commons.javaflow.helper.ClassTransformerClassLoader.transform(ClassTransformerClassLoa
der.java:58)
at
org.apache.commons.javaflow.helper.ClassTransformerClassLoader.loadClass(ClassTransformerClassLoa
der.java:102)
... 22 more
Which is caused by the CheckMethodAdapter.visitMax(...) done in the following code:
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);
}
Reïntroducing the l parameter to the LabelNode constructor fixes these exceptions.
I have no experience in both ASM and javaflow frameworks, but try to ensure that javaflow and a recent
release of ASM work together.
You can find the code for the javaflow project here (if necessary):
https://github.com/topicusonderwijs/commons-javaflow
The method that falls flat with the exception is the following:
https://github.com/topicusonderwijs/commons-
javaflow/blob/master/src/main/java/org/apache/commons/javaflow/bytecode/transformation/asm/Continu
ationMethodAdapter.java#L313
```https://gitlab.ow2.org/asm/asm/-/issues/317781Broken OSGi import statement2017-12-26T09:35:26ZlostinicelandBroken OSGi import statement```
The OSGi artifact uses a broken import-statement in the MANIFEST.MF.
Import-Package: org.objectweb.asm;version="[6.0_ALPHA,6.0_ALPHA]"
6.0_ALPHA is not a numeric value. OSGI uses major.minor.bugfix.qualifier and
all segments expect...```
The OSGi artifact uses a broken import-statement in the MANIFEST.MF.
Import-Package: org.objectweb.asm;version="[6.0_ALPHA,6.0_ALPHA]"
6.0_ALPHA is not a numeric value. OSGI uses major.minor.bugfix.qualifier and
all segments expect the qualifier must be of type String. The correct import
would be "[6.0.0,7.0.0)" assuming you want a upper bound to 7.0.0 (just as an
example)
```https://gitlab.ow2.org/asm/asm/-/issues/317778Java 8 type-use annotation breaks ClassReader in some cases2017-12-26T09:37:33ZyborovikovJava 8 type-use annotation breaks ClassReader in some cases```
The following code breaks maven-shade-plugin relocation:
```
import org.jetbrains.annotations.Nullable;
interface Foo<V> { void foo(V x); }
public abstract class FooImpl implements Foo<Iterable<Object>> {
public void foo(Itera...```
The following code breaks maven-shade-plugin relocation:
```
import org.jetbrains.annotations.Nullable;
interface Foo<V> { void foo(V x); }
public abstract class FooImpl implements Foo<Iterable<Object>> {
public void foo(Iterable<Object> result) {
if ("".equals(null)) {
@Nullable Object o = null;
o = null; // without a statement here errs at offset 65535 instead of 11
}
}
}
```
```
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-
plugin:2.4.3:shade (default) on project asm-bug: Error creating shaded jar: Error in ASM
processing class FooImpl.class: 11 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal
org.apache.maven.plugins:maven-shade-plugin:2.4.3:shade (default) on project asm-bug:
Error creating shaded jar: Error in ASM processing class FooImpl.class
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleB
uilder.java:116)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleB
uilder.java:80)
at
org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(Sin
gleThreadedBuilder.java:51)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43
)
at java.lang.reflect.Method.invoke(Method.java:498)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error creating shaded jar:
Error in ASM processing class FooImpl.class
at org.apache.maven.plugins.shade.mojo.ShadeMojo.execute(ShadeMojo.java:540)
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginMana
ger.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
Caused by: org.apache.maven.plugin.MojoExecutionException: Error in ASM processing
class FooImpl.class
at
org.apache.maven.plugins.shade.DefaultShader.addRemappedClass(DefaultShader.java:45
0)
at
org.apache.maven.plugins.shade.DefaultShader.shadeSingleJar(DefaultShader.java:219)
at org.apache.maven.plugins.shade.DefaultShader.shadeJars(DefaultShader.java:179)
at org.apache.maven.plugins.shade.DefaultShader.shade(DefaultShader.java:104)
at org.apache.maven.plugins.shade.mojo.ShadeMojo.execute(ShadeMojo.java:454)
... 22 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 11
at org.objectweb.asm.ClassReader.readLabel(Unknown Source)
at org.objectweb.asm.ClassReader.a(Unknown Source)
at org.objectweb.asm.ClassReader.a(Unknown Source)
at org.objectweb.asm.ClassReader.b(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at
org.apache.maven.plugins.shade.DefaultShader.addRemappedClass(DefaultShader.java:44
6)
... 26 more
```
```https://gitlab.ow2.org/asm/asm/-/issues/317779The Shrinking in Build Process Turns the Bytecode to Java 1.22017-12-26T09:37:12ZseamlikThe Shrinking in Build Process Turns the Bytecode to Java 1.2```
This bug was found when I was packaging Jack (Java Android Compiler Kit [1])
into Debian and I also submitted the bug to Debian's Bug Tracking System [2].
When compiling Jack, an error occured:
```
<somewhere>/android-toolchain-jac...```
This bug was found when I was packaging Jack (Java Android Compiler Kit [1])
into Debian and I also submitted the bug to Debian's Bug Tracking System [2].
When compiling Jack, an error occured:
```
<somewhere>/android-toolchain-jack/jill/src/com/android/jill/frontend/java/MethodBodyWriter.java:196:
error: type Analyzer does not take parameters
private final Analyzer<BasicValue> analyzer;
^
```
By looking at the source code [3] I found it referenced the generic type
`org.objectweb.asm.tree.analysis.Analyzer` which clearly has a type parameter,
however the compiler still complained. When I checked the file type of the
classes in `asm.jar` it gave me "compiled Java class data, version 46.0 (Java
1.2)". After I turned off the shrinking by adding `-Dproduct.noshrink=true` to
the build command as instructed in [4], Jack was compiled successfully and the
classes became Java 1.5.
I don't see anything mentioning that the shrink process would turn the Bytecode
into Java 1.2, so I am considering this a bug.
[1]: https://source.android.com/source/jack.html
[2]: https://bugs.debian.org/845606
[3]:
https://android.googlesource.com/toolchain/jack/+/ub-jack-douarn-b8/jill/src/com/android/jill/frontend/java/MethodBodyWriter.java#196
[4]: http://asm.ow2.org/doc/developer-guide.html#building
```https://gitlab.ow2.org/asm/asm/-/issues/317775Possible wrong class type parameter type annotation index2017-12-26T09:38:54ZhkueckerPossible wrong class type parameter type annotation index```
My test case class is
public class TestTypeAnnotationOnClassTypeparamWildcard1<
@TypeAnno00 T_EXT_INTERSECTION extends
@TypeAnno01 java.util.List<
@TypeAnno02 String > &
@TypeAnno03 Iterable<
@TypeAnno04 String > &
@Typ...```
My test case class is
public class TestTypeAnnotationOnClassTypeparamWildcard1<
@TypeAnno00 T_EXT_INTERSECTION extends
@TypeAnno01 java.util.List<
@TypeAnno02 String > &
@TypeAnno03 Iterable<
@TypeAnno04 String > &
@TypeAnno05 Serializable
>
{
}
I parse the class file of the java file above with ASM 5.1 AsmDomClassVisitor.
Here a part of my overriding visitTypeAnnotation method:
@Override
public AnnotationVisitor visitTypeAnnotation(
final int typeRef ,
final TypePath typePath ,
final String desc ,
final boolean visibleAtRuntime )
{
System.out.println( ( "typeRef: " + typeRef + " typePath: " + typePath + "
desc: " + desc + " visibleAtRuntime: " + visibleAtRuntime );
System.out.println( DebugUtil.intToBinaryStringWithGroup6( typeRef ) );
System.out.println( Integer.toBinaryString( ( typeRef >>> 24 ) ) );
System.out.println( "typeRef CLASS_TYPE_PARAMETER " + ( ( typeRef >>>
24 ) == TypeReference.CLASS_TYPE_PARAMETER ) );
System.out.println( "typeRef CLASS_EXTENDS " + ( ( typeRef >>>
24 ) == TypeReference.CLASS_EXTENDS ) );
System.out.println( "typeRef CLASS_TYPE_PARAMETER_BOUND " + ( ( typeRef >>>
24 ) == TypeReference.CLASS_TYPE_PARAMETER_BOUND ) );
if ( ( typeRef >>> 24 ) == TypeReference.CLASS_TYPE_PARAMETER )
{
final int typeParameterIndex = new TypeReference( typeRef
).getTypeParameterIndex();
System.out.println( "typeParameterIndex " + typeParameterIndex );
}
if ( ( typeRef >>> 24 ) == TypeReference.CLASS_TYPE_PARAMETER_BOUND )
{
final int typeParameterIndex = new TypeReference( typeRef
).getTypeParameterIndex();
System.out.println( "typeParameterIndex " + typeParameterIndex );
final int typeParameterBoundIndex = new TypeReference( typeRef
).getTypeParameterBoundIndex();
System.out.println( "typeParameterBoundIndex " + typeParameterBoundIndex );
}
Following output occurs:
typeRef: 0 typePath: null desc: LTypeAnno00; visibleAtRuntime: true
00000000 00000000 00000000 00000000
0
typeRef CLASS_TYPE_PARAMETER true
typeRef CLASS_EXTENDS false
typeRef CLASS_TYPE_PARAMETER_BOUND false
typeParameterIndex 0
typeRef: 285212928 typePath: null desc: LTypeAnno01; visibleAtRuntime: true
00010001 00000000 00000001 00000000
10001
typeRef CLASS_TYPE_PARAMETER false
typeRef CLASS_EXTENDS false
typeRef CLASS_TYPE_PARAMETER_BOUND true
typeParameterIndex 0
typeParameterBoundIndex 1
typeRef: 285212928 typePath: 0; desc: LTypeAnno02; visibleAtRuntime: true
00010001 00000000 00000001 00000000
10001
typeRef CLASS_TYPE_PARAMETER false
typeRef CLASS_EXTENDS false
typeRef CLASS_TYPE_PARAMETER_BOUND true
typeParameterIndex 0
typeParameterBoundIndex 1
typeRef: 285213184 typePath: null desc: LTypeAnno03; visibleAtRuntime: true
00010001 00000000 00000010 00000000
10001
typeRef CLASS_TYPE_PARAMETER false
typeRef CLASS_EXTENDS false
typeRef CLASS_TYPE_PARAMETER_BOUND true
typeParameterIndex 0
typeParameterBoundIndex 2
typeRef: 285213184 typePath: null desc: LTypeAnno04; visibleAtRuntime: true
00010001 00000000 00000010 00000000
10001
typeRef CLASS_TYPE_PARAMETER false
typeRef CLASS_EXTENDS false
typeRef CLASS_TYPE_PARAMETER_BOUND true
typeParameterIndex 0
typeParameterBoundIndex 2
typeRef: 285213440 typePath: null desc: LTypeAnno05; visibleAtRuntime: true
00010001 00000000 00000011 00000000
10001
typeRef CLASS_TYPE_PARAMETER false
typeRef CLASS_EXTENDS false
typeRef CLASS_TYPE_PARAMETER_BOUND true
typeParameterIndex 0
typeParameterBoundIndex 3
The typeParameterBoundIndex for TypeAnno01 starts with 1, not with 0.
Is this correct?
Thanks
Heiner
```https://gitlab.ow2.org/asm/asm/-/issues/317773Wrong typepath for array type annotations2017-12-26T09:39:59ZhkueckerWrong typepath for array type annotations```
My test class contains an string array field with type annotations:
File TestTypeAnnotationOnFieldArra.java
@NotNull
String @NotEmpty [] strArr = null;
The type annotations are self written:
File NotNull.java
package de.heiner...```
My test class contains an string array field with type annotations:
File TestTypeAnnotationOnFieldArra.java
@NotNull
String @NotEmpty [] strArr = null;
The type annotations are self written:
File NotNull.java
package de.heinerkuecker.and so on;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention( RetentionPolicy.RUNTIME )
@Target( { ElementType.TYPE_USE } )
@Inherited
@Documented
public @interface NotNull
{
}
File NotEmpty.java
package de.heinerkuecker.and so on;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention( RetentionPolicy.RUNTIME )
@Target( { ElementType.TYPE_USE } )
@Inherited
@Documented
public @interface NotEmpty
{
}
I parse the byte code of TestTypeAnnotationOnFieldArra.class with an
implementation class of
org.objectweb.asm.FieldVisitor
public final class AsmDomFieldVisitor
extends FieldVisitor
{
@Override
public AnnotationVisitor visitTypeAnnotation(
final int typeRef ,
final TypePath typePath ,
final String desc ,
final boolean visibleAtRuntime )
{
System.out.println( ( new Exception() ).getStackTrace()[ 0 ] + " typeRef: " +
typeRef + " typePath: " + typePath + " desc: " + desc + " visibleAtRuntime: " +
visibleAtRuntime );
In my console following output occurs:
de.heinerkuecker.and so
on.AsmDomFieldVisitor.visitTypeAnnotation(AsmDomFieldVisitor.java:87) typeRef:
318767104 typePath: null desc: Lde/heinerkuecker/and so
on/test_data/annotation_def/NotEmpty; visibleAtRuntime: true
de.heinerkuecker.and so
on.AsmDomFieldVisitor.visitTypeAnnotation(AsmDomFieldVisitor.java:87) typeRef:
318767104 typePath: [ desc: Lde/heinerkuecker/and so
on/test_data/annotation_def/NotNull; visibleAtRuntime: true
The typepath of the NotEmpty annotaion is null, which the entire type means and
the typepath of the NotNull is '[', which the array element type means.
This assignment of annotation to typepath is vice versa to my expectation.
Thank you for help and for the amazing asm lib.
Heiner
```https://gitlab.ow2.org/asm/asm/-/issues/317774Test bug: new ClassReader("java.lang.Object") throws IOException("Class not f...2017-12-26T09:39:29ZhamlinTest bug: new ClassReader("java.lang.Object") throws IOException("Class not found") in jdk-9```
bug description:
IOException("Class not found") is thrown in test, the bug is in test code,
it's due to jdk-9 changes, buggy code:
1. org.objectweb.asm.ClassReaderUnitTest.java, line 81:
new ClassReader(Object.class.getName())
2....```
bug description:
IOException("Class not found") is thrown in test, the bug is in test code,
it's due to jdk-9 changes, buggy code:
1. org.objectweb.asm.ClassReaderUnitTest.java, line 81:
new ClassReader(Object.class.getName())
2. org.objectweb.asm.util.CheckClassAdapterUnitTest.java, line 469:
new ClassReader("java.lang.Object")
root cause:
some asm test calls code like 'new ClassReader("java.lang.Object")', which
will finally call code like
'ClassLoader.getSystemResourceAsStream("java/lang/Object.class")', but in
jdk-9 "Resources in a named module are private to that module.", so
getSystemResourceAsStream will return null, finally it will throw
IOException("Class not found").
```https://gitlab.ow2.org/asm/asm/-/issues/317772ClassRemapper is unable to rename classes using ASM?2017-12-26T09:40:19ZvincbreakerClassRemapper is unable to rename classes using ASM?```
Hi there,
I've been trying to obfuscate my obfuscator with itself so I copyied the
builded jar file and tryed to run my obfuscator over it which gave me following
error output:
[INFO] Now processing "net.newtownia.Smoke.Obfuscation...```
Hi there,
I've been trying to obfuscate my obfuscator with itself so I copyied the
builded jar file and tryed to run my obfuscator over it which gave me following
error output:
[INFO] Now processing "net.newtownia.Smoke.Obfuscation.Flow.IfObfuscation".
[INFO] Now processing "net.newtownia.Smoke.Obfuscation.Flow.IfObfuscationAdapter".
[WARN] An error occurred while obfuscating
"net.newtownia.Smoke.Obfuscation.Flow.IfObfuscationAdapter", stacktrace:
[WARN] java.lang.RuntimeException: java.lang.ClassNotFoundException:
net.newtownia.Smoke.Obfuscation.Flow.IfObfuscation
[WARN] at org.objectweb.asm.ClassWriter.getCommonSuperClass(Unknown Source)
[WARN] at org.objectweb.asm.ClassWriter.a(Unknown Source)
[WARN] at org.objectweb.asm.Frame.a(Unknown Source)
[WARN] at org.objectweb.asm.Frame.a(Unknown Source)
[WARN] at org.objectweb.asm.MethodWriter.visitMaxs(Unknown Source)
[WARN] at org.objectweb.asm.MethodVisitor.visitMaxs(Unknown Source)
[WARN] at org.objectweb.asm.ClassReader.a(Unknown Source)
[WARN] at org.objectweb.asm.ClassReader.b(Unknown Source)
[WARN] at org.objectweb.asm.ClassReader.accept(Unknown Source)
[WARN] at org.objectweb.asm.ClassReader.accept(Unknown Source)
[WARN] at u.obfuscate(Smoke.java:179)
[WARN] at u.run(Smoke.java:55)
[WARN] at A.main(Main.java:29)
The obfuscator is only obfuscating class names at the moment.
```https://gitlab.ow2.org/asm/asm/-/issues/317771Java 8 javac -parameters is causing RuntimeException at org.objectweb.asm.Met...2017-12-26T09:40:46ZvorburgerJava 8 javac -parameters is causing RuntimeException at org.objectweb.asm.MethodVisitor.visitParameter```
Java 8 javac's (new) -parameters (Quote e.g.
https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javac.html:
"Stores formal parameter names of constructors and methods in the generated
class file so that the method java.lan...```
Java 8 javac's (new) -parameters (Quote e.g.
https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javac.html:
"Stores formal parameter names of constructors and methods in the generated
class file so that the method java.lang.reflect.Executable.getParameters from
the Reflection API can retrieve them.") appears to cause this problem:
Caused by: java.lang.RuntimeException
at org.objectweb.asm.MethodVisitor.visitParameter(Unknown Source)
at org.objectweb.asm.ClassReader.b(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at
org.apache.aries.proxy.impl.common.AbstractWovenProxyAdapter.readClass(AbstractWovenProxyAdapter.java:683)
at
org.apache.aries.proxy.impl.interfaces.InterfaceCombiningClassAdapter.generateBytes(InterfaceCombiningClassAdapter.java:109)
at
org.apache.aries.proxy.impl.interfaces.ProxyClassLoader.createProxyClass(ProxyClassLoader.java:156)
at
org.apache.aries.proxy.impl.interfaces.InterfaceProxyGenerator.getProxyInstance(InterfaceProxyGenerator.java:95)
at
org.apache.aries.proxy.impl.AsmProxyManager.createNewProxy(AsmProxyManager.java:80)
at
org.apache.aries.proxy.impl.AbstractProxyManager.createDelegatingInterceptingProxy(AbstractProxyManager.java:75)
at
org.apache.aries.proxy.impl.AbstractProxyManager.createDelegatingProxy(AbstractProxyManager.java:40)
at
org.apache.aries.blueprint.container.AbstractServiceReferenceRecipe.createProxy(AbstractServiceReferenceRecipe.java:332)
at
org.apache.aries.blueprint.container.ReferenceRecipe.internalCreate(ReferenceRecipe.java:107)
Originally found in https://bugs.opendaylight.org/show_bug.cgi?id=6523
```https://gitlab.ow2.org/asm/asm/-/issues/317769ClassReader throws ArrayIndexOutOfBoundsException when reading specific modul...2017-12-26T09:41:49ZadannClassReader throws ArrayIndexOutOfBoundsException when reading specific modul-info.class```
I'm using asm-debug-all-6.0_ALPHA.jar for reading modules of the upcoming JDK9.
Therefore, I'm reading module-info classes within my program.
However, on some module-info.class files the ClassReader throws an
ArrayIndexOutOfBoundsEx...```
I'm using asm-debug-all-6.0_ALPHA.jar for reading modules of the upcoming JDK9.
Therefore, I'm reading module-info classes within my program.
However, on some module-info.class files the ClassReader throws an
ArrayIndexOutOfBoundsException in Method readModule when visiting the exports
of a module-info.class file.
In particular, I've experienced this Exception when reading the
module-info.class of the following modules:
- java.compiler
- java.corba
- java.desktop
- java.instrument
- java.management
- java.base
- java.naming
- java.rmi
- java.security.jgss
- java.security.sasl
- java.sql
- java.xml
For the following modules, I get NO exception
- java.logging
- java.activation
- java.annotations.common
- java.compact1
- java.compact2
- java.compact3
- java.httpclient
- java.prefs
- java.scripting
- java.se
- java.se.ee
I've attached a test-case to reproduce the exception when reading
java.base/module-info.class
```https://gitlab.ow2.org/asm/asm/-/issues/317768ClassReader mishandles primitive class as bootstrap method argument2017-12-26T09:42:22ZbjkailClassReader mishandles primitive class as bootstrap method argument```
As reported on StackOverflow
(http://stackoverflow.com/questions/38809101/asm-cannot-pass-type-int-type-
as-constant-bootstrap-method-argument), if a Type representing a primitive
class (e.g., Type.INT_TYPE) is used as a bootstrap ...```
As reported on StackOverflow
(http://stackoverflow.com/questions/38809101/asm-cannot-pass-type-int-type-
as-constant-bootstrap-method-argument), if a Type representing a primitive
class (e.g., Type.INT_TYPE) is used as a bootstrap method argument, then
ClassReader reads it as an object type rather than a primitive type (e.g.,
type.getSort() == Type.OBJECT rather than type.getSort() == Type.INT).
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
cw.visit(Opcodes.V1_8, 0, "c", null, null, null);
MethodVisitor mv = cw.visitMethod(0, "m", "()V", null, null);
mv.visitInvokeDynamicInsn("foo", "(I)I",
new Handle(Opcodes.H_INVOKESTATIC, "o", "n", "()Ljava/lang/Object;"),
Type.INT_TYPE);
mv.visitEnd();
cw.visitEnd();
new ClassReader(cw.toByteArray()).accept(new ClassVisitor(Opcodes.ASM5) {
@Override
public MethodVisitor visitMethod(int access, String name, String desc,
String signature, String[] exceptions) {
return new MethodVisitor(Opcodes.ASM5) {
@Override
public void visitInvokeDynamicInsn(String name, String desc,
Handle bsm, Object... bsmArgs) {
System.err.println(Arrays.toString(bsmArgs));
}
};
}
}, 0);
```https://gitlab.ow2.org/asm/asm/-/issues/317630Frames are re-calculated for Large Methods2018-01-20T15:31:52ZEvgeny MandrikovFrames are re-calculated for Large Methods```
ASM Version: 5.1.0
The problem has been already described by Marc Hoffmann in #317551 which
contains patch, which was not verified and was not applied.
Together with Marc we made a reproducer for this case - see
https://github.c...```
ASM Version: 5.1.0
The problem has been already described by Marc Hoffmann in #317551 which
contains patch, which was not verified and was not applied.
Together with Marc we made a reproducer for this case - see
https://github.com/jacoco/jacoco/pull/177#issuecomment-222227425
And unfortunately patch causes NPE:
Exception in thread "main" java.lang.NullPointerException
at org.objectweb.asm.Frame.push(Frame.java:691)
at org.objectweb.asm.Frame.execute(Frame.java:978)
at org.objectweb.asm.CurrentFrame.execute(CurrentFrame.java:50)
at org.objectweb.asm.MethodWriter.visitInsn(MethodWriter.java:747)
at org.objectweb.asm.ClassReader.readCode(ClassReader.java:1363)
at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1032)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:708)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:521)
at org.objectweb.asm.ClassWriter.toByteArray(ClassWriter.java:1005)
at ResizeInstructions.main(ResizeInstructions.java:62)
Reproducer of this NPE attached.
```https://gitlab.ow2.org/asm/asm/-/issues/317631LocalVariablesSorter.newLocal() return wrong next variable index2017-12-26T09:44:32Zc7yanLocalVariablesSorter.newLocal() return wrong next variable index```
I'm trying to use ASM4.1 (I have to use this version for some reason) to add
code before method exit. I am extending AdviceAdapter and following the
technique described in ”ASM 4.0 Guide” under 3.3.4 ”AdviceAdapter” p64-65. I
use Loc...```
I'm trying to use ASM4.1 (I have to use this version for some reason) to add
code before method exit. I am extending AdviceAdapter and following the
technique described in ”ASM 4.0 Guide” under 3.3.4 ”AdviceAdapter” p64-65. I
use LocalVariablesSorter (a superclass of AdviceAdapter) to add local variables.
I have a method “onAdd” that takes one arg and has two locals of its own. My
understanding is that the variable indexes 0 (this), 1 (arg) and 2 & 3
(existing locals) are already taken, and the LocalVariablesSorter.newLocal()
should give me a index 4 or larger. But instead, it gives 2 as first call in
the inserted code before method exit.
I have made a test case for this (I intentionally made the code with mutiple
variables to show the issue):
1. the method to add code before the exit:
public void onAdd(View v) {
String addedText = inputText.getText().toString();
inputTextDisplay.setText(String.format("%s :%s",
getString(R.string.text_added), addedText));
inputTextDisplay.setVisibility(View.VISIBLE);
/**
* the following code needs to be inserted
String s = getClass().getName();
int i = s.indexOf("$");
if (i != -1) {
s = s.substring(0, i);
}
View view = v.getRootView();
String packageName = v.getContext().getPackageName();
InstrumentationInterface.getInstance().performInstrumentation(
view, s, packageName, ActionType.VIEW_CLICK);
*/
}
2. the MethidExistAdapter extends AdviceAdapter to implement the code insertion
@Override
protected void onMethodExit(int opcode) {
if (opcode != Opcodes.ATHROW) {
/**
* Add the following code before return of the method onAdd:
String s = getClass().getName();
int i = s.indexOf("$");
if (i != -1) {
s = s.substring(0, i);
}
View view = v.getRootView();
String packageName = v.getContext().getPackageName();
InstrumentationInterface.getInstance().performInstrumentation(
view, s, packageName);
*/
mv.visitVarInsn(ALOAD, 0); //0 this, 1 - v
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Object", "getClass",
"()Ljava/lang/Class;");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Class", "getName",
"()Ljava/lang/String;");
int var1 = newLocal(Type.LONG_TYPE); //s variable 2
mv.visitVarInsn(ASTORE, var1); //2
mv.visitVarInsn(ALOAD, var1); //2
mv.visitLdcInsn("$");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "indexOf",
"(Ljava/lang/String;)I");
int var2 = newLocal(Type.INT_TYPE); //variable 3
mv.visitVarInsn(ISTORE, var2); //3
mv.visitVarInsn(ILOAD, var2); //3
mv.visitInsn(ICONST_M1);
Label label = new Label();
mv.visitJumpInsn(IF_ICMPEQ, label);
mv.visitVarInsn(ALOAD, var1); //2
mv.visitInsn(ICONST_0);
mv.visitVarInsn(ILOAD, var2); //3
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "substring",
"(II)Ljava/lang/String;");
mv.visitVarInsn(ASTORE, var1); //2
mv.visitLabel(label);
mv.visitVarInsn(ALOAD, 1); // v
mv.visitMethodInsn(INVOKEVIRTUAL, "android/view/View", "getRootView",
"()Landroid/view/View;");
int var3 = newLocal(Type.LONG_TYPE); //variable index 4
mv.visitVarInsn(ASTORE, var3); // 4
mv.visitVarInsn(ALOAD, 1); // v
mv.visitMethodInsn(INVOKEVIRTUAL, "android/view/View", "getContext",
"()Landroid/content/Context;");
mv.visitMethodInsn(INVOKEVIRTUAL, "android/content/Context",
"getPackageName", "()Ljava/lang/String;");
int var4 = newLocal(Type.LONG_TYPE); //variable index 5
mv.visitVarInsn(ASTORE, var4); //5
mv.visitMethodInsn(INVOKESTATIC,
"com/ibm/haac/mac/util/InstrumentationInterface", "getInstance",
"()Lcom/ibm/haac/mac/util/InstrumentationInterface;");
mv.visitVarInsn(ALOAD, var3); //4
mv.visitVarInsn(ALOAD, var1); //2
mv.visitVarInsn(ALOAD, var4); //5
mv.visitFieldInsn(GETSTATIC,
"com/ibm/haac/mac/constants/InstrumentationUtil$ActionType", "VIEW_CLICK",
"Lcom/ibm/haac/mac/constants/InstrumentationUtil$ActionType;");
mv.visitMethodInsn(INVOKEVIRTUAL,
"com/ibm/haac/mac/util/InstrumentationInterface", "performInstrumentation",
"(Landroid/view/View;Ljava/lang/String;Ljava/lang/String;Lcom/ibm/haac/mac/constants/InstrumentationUtil$ActionType;)V");
System.out.println(var1 +"," +var2 +", " + var3 +","+var4);
}
super.onMethodExit(opcode);
}
3. After the code insertion, the code varies each time, but they all wrong,
and unable to pass the verification. Here is “onAdd” method from one of the
generated classed after decompilation:
public void onAdd(View view) {
view = inputText.getText().toString();
inputTextDisplay.setText(String.format("%s :%s", new Object[] {
getString(0x7f060005), view
}));
inputTextDisplay.setVisibility(0);
String s = getClass().getName();
int i = s.indexOf("$");
if(i != -1)
s = s.substring(0, i);
View view1 = view.getRootView();
String s1 = view.getContext().getPackageName();
InstrumentationInterface.getInstance().performInstrumentation(view1,
s, s1, com.ibm.haac.mac.constants.InstrumentationUtil.ActionType.VIEW_CLICK);
}
The method is totally screwed up. You can see the local variable is
overwritten even in the very first line (the view is rescued for String!!).
I include the following test code in the zip file:
CustomClassVistor: a class visitor class
TestMethodExitAdapter: implementation of insertion logic
CustomTest: test driver, containing the main, you can run the program.
MainActivity.class: a test java class. Please copy over to a local
folder, and modify the file path in the CustomTest to run.
NewMainActivity.class: generated class after the code insertion.
```https://gitlab.ow2.org/asm/asm/-/issues/317770ClassReader/ClassWriter producing less byte codes than original class file2017-12-26T09:41:03Zesheri3ClassReader/ClassWriter producing less byte codes than original class file```
Team,
I am using ClassReader and ClassWriter to generate bytecodes without making any
modifications to the original bytecodes. Given that there is no modification to the bytecodes
during the visiting process, I would expect the nu...```
Team,
I am using ClassReader and ClassWriter to generate bytecodes without making any
modifications to the original bytecodes. Given that there is no modification to the bytecodes
during the visiting process, I would expect the number of weaved byte codes to equal that of
the original byte codes. However, I have a handful of cases where this is not true. Is this a
known issue? Bug? Basic POC code below:
final byte[] originalCodes = Files.readAllBytes(/* some class file */);
final ClassReader reader = new ClassReader(originalCodes);
final ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
reader.accept(writer, 0);
final byte[] weavedCodes = writer.toByteArray();
assert(weavedCodes.length >= originalCodes.length); // fails
An example class that fails is from the Jackson Json library:
com/fasterxml/jackson/annotation/JsonAutoDetect$1.class
The weaved codes for this class is of length 1125 whereas the original byte code length is
1131. What might have been lost? Happy to attach faulty classes for tests if this is indeed a
new issue. Thanks and keep up the great work!
```https://gitlab.ow2.org/asm/asm/-/issues/317624visitSource of ASM itself does not contain file names2017-12-26T09:46:40ZfommilvisitSource of ASM itself does not contain file names```
It looks like the source code file name is missing from your .class files (by
this I mean if ASM is applied to itself!).
This is making it extremely difficult (i.e. we'll need to write a custom
workaround) for us to be able to res...```
It looks like the source code file name is missing from your .class files (by
this I mean if ASM is applied to itself!).
This is making it extremely difficult (i.e. we'll need to write a custom
workaround) for us to be able to resolve the sources for a given FQN.
Also, it looks like the published source jars contain a double posting of the
actual sources? Very weird, I was looking at the source for SimpleRemapper (in
the commons) and the source was definitely appended to the existing source
(unless Emacs has a bug).
For an example of how we read this information see
https://github.com/ensime/ensime-
server/blob/master/core/src/main/scala/org/ensime/indexer/ClassfileIndexer.scala
#L64
```https://gitlab.ow2.org/asm/asm/-/issues/317620Dependency convergence errors2017-12-26T09:47:30Zjebl01Dependency convergence errors```
When running my build with the maven-enforcer-plugin, I get the following convergence error
report:
Dependency convergence error for org.ow2.asm:asm:4.1 paths to dependency are:
+-<obfuscated-projectname>:0.1.5-SNAPSHOT
+-org.spr...```
When running my build with the maven-enforcer-plugin, I get the following convergence error
report:
Dependency convergence error for org.ow2.asm:asm:4.1 paths to dependency are:
+-<obfuscated-projectname>:0.1.5-SNAPSHOT
+-org.springframework.boot:spring-boot-starter-jetty:1.3.2.RELEASE
+-org.eclipse.jetty.websocket:javax-websocket-server-impl:9.2.14.v20151106
+-org.eclipse.jetty:jetty-annotations:9.2.14.v20151106
+-org.ow2.asm:asm:4.1
and
+-<obfuscated-projectname>:0.1.5-SNAPSHOT
+-org.springframework.boot:spring-boot-starter-jetty:1.3.2.RELEASE
+-org.eclipse.jetty.websocket:javax-websocket-server-impl:9.2.14.v20151106
+-org.eclipse.jetty:jetty-annotations:9.2.14.v20151106
+-org.ow2.asm:asm-commons:4.1
+-org.ow2.asm:asm-tree:5.0.1
+-org.ow2.asm:asm:5.0.1
leads me to think that asm-commons:4.1 and asm:4.1 lives two completely separated lives? Is
this correct (and expected)? If so, It's a bit confusing...
A more expected dependency graph would be that asm-commons:4.1 had a transitive
dependency on asm:4.1 (not 5.0.1)
```https://gitlab.ow2.org/asm/asm/-/issues/317618ASM 5.0.4 and 5.1 doesn't support Java 5 bytecode fully (ArrayArrayIndexOutOf...2017-12-26T09:48:14ZSergey PatrikeevASM 5.0.4 and 5.1 doesn't support Java 5 bytecode fully (ArrayArrayIndexOutOfBoundsException: 2304)```
I'm trying to parse the given bytecode (see an attachment) with ASM 5.0.4 or
5.1.
I use the following code:
ClassNode node = new ClassNode();
new ClassReader(getFilePath("RegexUtil.class"))).accept(node, 0);
System.out.println(node....```
I'm trying to parse the given bytecode (see an attachment) with ASM 5.0.4 or
5.1.
I use the following code:
ClassNode node = new ClassNode();
new ClassReader(getFilePath("RegexUtil.class"))).accept(node, 0);
System.out.println(node.name);
The following exception is thrown (see an attachment)
java.lang.ArrayIndexOutOfBoundsException: 2304
I have used "javap" to determine the JDK version. It is 1.5.
I then have tried to use "asm:asm-all:3.3.1" (instead of "org.ow2.asm:asm-
all:5.1") and it helped!
Unfortunately I have to parse the JDK 8 bytecode too, so I can't just use the
old version.
Sorry for duplicate if I have overlooked.
I also might have mixed up the Component/s
```