asm issueshttps://gitlab.ow2.org/asm/asm/-/issues2023-06-01T17:36:41Zhttps://gitlab.ow2.org/asm/asm/-/issues/317990recognize Java 21 version (65)2023-06-01T17:36:41Zcushonrecognize Java 21 version (65)ASM should be updated to recognize Java 21 version (65).
The latest upstream JDK versions now were updated to use that class file version in https://github.com/openjdk/jdk/commit/175e3d3ff332be25cca9822c58c46f1e012953c2
The previous AS...ASM should be updated to recognize Java 21 version (65).
The latest upstream JDK versions now were updated to use that class file version in https://github.com/openjdk/jdk/commit/175e3d3ff332be25cca9822c58c46f1e012953c2
The previous ASM commit that added support for version 20 was https://gitlab.ow2.org/asm/asm/-/commit/8b7090dc7fc280aeff270473658766179cb2024b.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/issues/317989Silent removal of zero-valued entries from the line-number table2022-12-21T08:10:52ZIan ZernySilent removal of zero-valued entries from the line-number tableWhen using ASM to inspect or transform line tables it will silently ignore/strip zero-valued lines.
### Expected Behavior
Zero-valued line entries should be treated as any other line value and a call to MethodVisitor.visitLineNumber sho...When using ASM to inspect or transform line tables it will silently ignore/strip zero-valued lines.
### Expected Behavior
Zero-valued line entries should be treated as any other line value and a call to MethodVisitor.visitLineNumber should be made.
(The JVM spec does not appear to have any other requirement than that the line entries are unsigned 2-byte values IFAICT. That is also consistent with JVM execution as illustrated by the attached code).
### Current Behavior
MethodVisitor never receives a callback.
### Steps to Reproduce
Attached is a .class file with a method that has respectively a non-zero line followed by a zero-valued line. Any use of MethodVisitor on these lines will fail to act on the zero-valued entry. The result is that the throw will inherent the previous line value.
Second line number table is that of the main method:
```
$ javap -v -cp /tmp/test.zip com.android.tools.r8.debuginfo.AsmZeroLineEntryRegressionTest\$TestClass |grep line -B 1
LineNumberTable:
line 126: 0
--
LineNumberTable:
line 1: 0
line 0: 8
```
Executing the program will throw on "line 0":
```
$ java -cp /tmp/test.zip com.android.tools.r8.debuginfo.AsmZeroLineEntryRegressionTest\$TestClass
Hello, world!
Exception in thread "main" java.lang.RuntimeException: BOO!
at com.android.tools.r8.debuginfo.AsmZeroLineEntryRegressionTest$TestClass.main(AsmZeroLineEntryRegressionTest.java:0)
```
Doing an "identity" transformation on this will strip the zero-valued line and the result will be a stack trace at line `:1`
More details can be found in the [R8 regression test](https://r8-review.git.corp.google.com/c/r8/+/74032) or via the [R8 tracking bug](https://issuetracker.google.com/260389461).
Archive with the single class file [test.zip](/uploads/4d40776f00a15074cabbab2c14c89891/test.zip)https://gitlab.ow2.org/asm/asm/-/issues/317988Interface not being added to class2022-11-27T09:17:18ZAlex HoweInterface not being added to classI'm trying to make the Minecraft class implement my MinecraftBridge interface using
```kt
node.interfaces.add(Type.getInternalName(MinecraftBridge::class.java))
```
When I add it to my own MinecraftBridgeImpl class it adds fine using the...I'm trying to make the Minecraft class implement my MinecraftBridge interface using
```kt
node.interfaces.add(Type.getInternalName(MinecraftBridge::class.java))
```
When I add it to my own MinecraftBridgeImpl class it adds fine using the same code but when I try to add it to the Minecraft class it doesnt add it. No errors are thrown it just writes it without the added interface.
### Expected Behavior
The MinecraftBridge interface is added to the Minecraft class.
### Current Behavior
The MinecraftBridge interface is not added to the Minecraft class.
### Steps to Reproduce
This is the MinecraftBridge interface I'm trying to implement along with the LocalPlayerBridge
```java
public interface LocalPlayerBridge {
void addChatMessage(String msg);
}
public interface MinecraftBridge {
LocalPlayerBridge getLocalPlayer();
}
```
```kt
val reader = ClassReader(/* The Minecraft class bytes */)
val node = ClassNode()
reader.accept(node, 0)
node.interfaces.add(Type.getInternalName(MinecraftBridge::class.java))
val cw = ClassWriter(reader, ClassWriter.COMPUTE_FRAMES)
node.accept(cw)
val bytes = cw.toByteArray()
```
## Example Class Files
The .class is the original class I'm trying to add the interface to. The .modif.class is what ow2.asm
[MinecraftPatch.class](/uploads/c94326e95463a70cd4484194cb31e7fa/MinecraftPatch.class)
[MinecraftPatch.modif.class](/uploads/5a8bf5abcae41b50095c2d78574d040c/MinecraftPatch.modif.class)
[MinecraftBridgeImplPatch.class](/uploads/532a199c44b0463256f905721dc9de1a/MinecraftBridgeImplPatch.class)
[MinecraftBridgeImplPatch.modif.class](/uploads/dcac94cee0b0a2a6d26be642b6ab282c/MinecraftBridgeImplPatch.modif.class)https://gitlab.ow2.org/asm/asm/-/issues/317987Incorrect serialVersionUID on Scala class2022-11-27T08:15:52ZMaxime ThebaultIncorrect serialVersionUID on Scala classWhile testing an application relying on Java serialization between several nodes in a cluster to operate, I stumbled on an exception:
```
Caused by: java.io.InvalidClassException: java.class.XXX; local class incompatible: stream classdes...While testing an application relying on Java serialization between several nodes in a cluster to operate, I stumbled on an exception:
```
Caused by: java.io.InvalidClassException: java.class.XXX; local class incompatible: stream classdesc serialVersionUID = 5893177478437626661, local class serialVersionUID = -2099619866804728723
at java.base/java.io.ObjectStreamClass.initNonProxy(Unknown Source)
at java.base/java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
```
Of course, I eliminated all the most obvious reasons for the exception: all libraries were on the same versions on my test application as on all the other nodes of the cluster, same Java version, same env, and so on.
After hours of debugging, the exception went away after removing JaCoCo gradle integration, which is a tool relying on ASM. I could see ASM has a "SerialVersionUIDAdder" class that can add serialVersionUID to classes that don't have one, which is my case.
I believe ASM is generating a different serialVersionUid as the one generated by the JVM.
The offending class (or rather, trait, as this is originally Scala code) is the `StructDef` trait that can be found here: https://github.com/datastax/spark-cassandra-connector/blob/v3.2.0/driver/src/main/scala/com/datastax/spark/connector/cql/Schema.scala#L34
Tested with latest ASM version 9.4. Tested with different implementations of Java 11 SDK (corretto, graalvm).
I'm going to disable code coverage utilities as they don't make sense in my case, but I post this issue anyway for people who might face it.https://gitlab.ow2.org/asm/asm/-/issues/317986Using ClassWriter with COMPUTE_MAXS may generate non-valid frames2022-11-27T08:16:14ZThomas BitontiUsing ClassWriter with COMPUTE_MAXS may generate non-valid frames### Expected Behavior
When performing code injection using COMPUTE_MAXS correct frames should be generated.
### Current Behavior
Non-valid frames may be generated.
### Steps to Reproduce
See the attached projects and test class "com.ib...### Expected Behavior
When performing code injection using COMPUTE_MAXS correct frames should be generated.
### Current Behavior
Non-valid frames may be generated.
### Steps to Reproduce
See the attached projects and test class "com.ibm.l3.util.VerifyClass".
####
**Short Description:** Using ClassWriter with COMPUTE_MAXS may generate non-valid frames.
**Long Description:**
When performing dynamic trace injection using ClassWriter and using flag COMPUTE_MAXS, non-valid frames may be generated. Attempting to load a class with non-valid frames fails with a VerifyError.
The problem is visible comparing byte codes generated using COMPUTE_MAXS with byte codes generated using COMPUTE_FRAMES.
The problem occurs using both v9.3 and v9.4 of ASM (using current published versions on Maven Central).
This non-valid frame was analyzed in detail by the IBM Java L3 support, with the following being the main comment:
> So this means that the VerifyError is correct. The problem is the mismatch between the boolean type found in locals[1] at offset 42, vs the 'top' type specified in the stackmap table, i.e.:
>
> locals = [ class com/ibm/zosconnect/engine/impl/ZosAssetFactoryManager, 'top' ] (locals[0] = 0xc0, locals[1] = 0x1)
>
> The JVM expected the stackmap entry to look something like this:
>
> locals = [ class com/ibm/zosconnect/engine/impl/ZosAssetFactoryManager, '[Z' ] (locals[0] = 0xc0, locals[1] = 0x1002)
####
See the attached archive for a test program which demonstrates the problem. The archive contains three Eclipse projects, "ASM 9.3", "ASM 9.4", and "TraceInjection".
Test class "com.ibm.l3.util.VerifyClass" in project "TraceInjection" reproduces the problem.
The test may be varied in two independent ways:
* By changing between COMPUTE_MAX and COMPUTE_FRAMES.
* By changing between ASM 9.3 and ASM 9.4.
The COMPUTE flag is updated at line 269 of "LibertyRuntimeTransformer.transform":
```
ClassWriter writer = new ClassWriter(reader, ClassWriter.COMPUTE_MAXS);
// ClassWriter writer = new ClassWriter(reader, ClassWriter.COMPUTE_FRAMES);
```
The test class performs the following functions:
* Loads the initial byte codes for the class "ZosAssetFactoryManager". These are loaded from "initial/ZosAssetFactoryManager.class".
* Loads the byte codes for the (non-valid) COMPUTE_MAXS generated byte codes. These are loaded from "final/ZosAssetFactoryManager.class".
* Transforms the initial bytes using the Liberty dynamic trace injection, using API com.ibm.ws.ras.instrument.internal.main.LibertyRuntimeTransformer.transform.
* Runs all three versions of the byte codes through the ASM class verifier, which includes the display of the byte codes.
* Does a test load of the byte codes. (Note: In the Eclipse Environment, the Verify error does not occur.)
* Does a comparison of the "final" byte codes with the freshly instrumented byte codes. When COMPUTE_MAXS is set, the freshly instrumented byte codes match the "final" byte codes. When COMPUTE_FRAMES is set, the byte codes do not match.
The project includes Liberty source obtained from the Open Liberty GIT repository: https://github.com/OpenLiberty/open-liberty. The source is current as of 09-Nov-2022.
The project includes source for ASM 9.3 and ASM 9.4, obtained from Maven Central: https://search.maven.org/search?q=org.ow2.asm.
####
The non-valid frames cause class loading to throw a VerifyError:
> ERROR ] TRAS3000E: Runtime injection of detailed method trace failed for class com.ibm.zosconnect.engine.impl.ZosAssetFactoryManager with exception java.lang.reflect.UndeclaredThrowableException
> at com.sun.proxy.$Proxy0.retransformClasses(Unknown Source)
> at com.ibm.ws.ras.instrument.internal.main.LibertyRuntimeTransformer.retransformClass(LibertyRuntimeTransformer.java:250)
> at [internal classes]
> at com.ibm.zosconnect.engine.impl.ZosAssetFactoryManager.(ZosAssetFactoryManager.java:28)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:83)
> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:57)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:437)
> at org.apache.felix.scr.impl.inject.internal.ComponentConstructorImpl.newInstance(ComponentConstructorImpl.java:312)
> at [internal classes]
> Caused by: java.lang.reflect.InvocationTargetException
> ... 16 more
> Caused by: java.lang.VerifyError
> ... 18 more
####
Byte code listings. The error is present at line 00017 of the byte codes which were generated using COMPUTE_MAXS.
**Initial:**
```
<init>()V
00000 ZosAssetFactoryManager . : : INVOKESTATIC com/ibm/zosconnect/engine/impl/ZosAssetFactoryManager.$jacocoInit ()[Z
00001 ZosAssetFactoryManager . : [Z : ASTORE 1
00002 ZosAssetFactoryManager [Z : : ALOAD 0
00003 ZosAssetFactoryManager [Z : ZosAssetFactoryManager : INVOKESPECIAL java/lang/Object.<init> ()V
// TRACE INJECTION POINT
00004 ZosAssetFactoryManager [Z : : ALOAD 1
00005 ZosAssetFactoryManager [Z : [Z : ICONST_0
00006 ZosAssetFactoryManager [Z : [Z I : ICONST_1
00007 ZosAssetFactoryManager [Z : [Z I I : BASTORE
00008 ZosAssetFactoryManager [Z : : ALOAD 0
00009 ZosAssetFactoryManager [Z : ZosAssetFactoryManager : NEW java/util/HashMap
00010 ZosAssetFactoryManager [Z : ZosAssetFactoryManager HashMap : DUP
00011 ZosAssetFactoryManager [Z : ZosAssetFactoryManager HashMap HashMap : INVOKESPECIAL java/util/HashMap.<init> ()V
00012 ZosAssetFactoryManager [Z : ZosAssetFactoryManager HashMap : PUTFIELD com/ibm/zosconnect/engine/impl/ZosAssetFactoryManager.assetFactories : Ljava/util/Map;
00013 ZosAssetFactoryManager [Z : : ALOAD 1
00014 ZosAssetFactoryManager [Z : [Z : ICONST_1
00015 ZosAssetFactoryManager [Z : [Z I : ICONST_1
00016 ZosAssetFactoryManager [Z : [Z I I : BASTORE
// TRACE INJECTION POINT
00017 ZosAssetFactoryManager [Z : : RETURN
```
**Using COMPUTE_MAXS:**
```
<init>()V
00000 ZosAssetFactoryManager . : : INVOKESTATIC com/ibm/zosconnect/engine/impl/ZosAssetFactoryManager.$jacocoInit ()[Z
00001 ZosAssetFactoryManager . : [Z : ASTORE 1
00002 ZosAssetFactoryManager [Z : : ALOAD 0
00003 ZosAssetFactoryManager [Z : ZosAssetFactoryManager : INVOKESPECIAL java/lang/Object.<init> ()V
// BEGIN INJECTED TRACE
00004 ZosAssetFactoryManager [Z : : INVOKESTATIC com/ibm/websphere/ras/TraceComponent.isAnyTracingEnabled ()Z
00005 ZosAssetFactoryManager [Z : I : IFEQ L0
00006 ZosAssetFactoryManager [Z : : GETSTATIC com/ibm/zosconnect/engine/impl/ZosAssetFactoryManager.tc : Lcom/ibm/websphere/ras/TraceComponent;
00007 ZosAssetFactoryManager [Z : TraceComponent : IFNULL L0
00008 ZosAssetFactoryManager [Z : : GETSTATIC com/ibm/zosconnect/engine/impl/ZosAssetFactoryManager.tc : Lcom/ibm/websphere/ras/TraceComponent;
00009 ZosAssetFactoryManager [Z : TraceComponent : INVOKEVIRTUAL com/ibm/websphere/ras/TraceComponent.isEntryEnabled ()Z
00010 ZosAssetFactoryManager [Z : I : IFEQ L0
00011 ZosAssetFactoryManager [Z : : GETSTATIC com/ibm/zosconnect/engine/impl/ZosAssetFactoryManager.tc : Lcom/ibm/websphere/ras/TraceComponent;
00012 ZosAssetFactoryManager [Z : TraceComponent : LDC "<init>"
00013 ZosAssetFactoryManager [Z : TraceComponent String : LDC 0
00014 ZosAssetFactoryManager [Z : TraceComponent String I : ANEWARRAY java/lang/Object
00015 ZosAssetFactoryManager [Z : TraceComponent String [Object : INVOKESTATIC com/ibm/websphere/ras/Tr.entry (Lcom/ibm/websphere/ras/TraceComponent;Ljava/lang/String;[Ljava/lang/Object;)V
00016 ZosAssetFactoryManager [Z : : L0
00017 ZosAssetFactoryManager [Z : : FRAME FULL [com/ibm/zosconnect/engine/impl/ZosAssetFactoryManager] [] // ***** NON-VALID *****
00018 ZosAssetFactoryManager [Z : : NOP
// END INJECTED TRACE
00019 ZosAssetFactoryManager [Z : : ALOAD 1
00020 ZosAssetFactoryManager [Z : [Z : ICONST_0
00021 ZosAssetFactoryManager [Z : [Z I : ICONST_1
00022 ZosAssetFactoryManager [Z : [Z I I : BASTORE
00023 ZosAssetFactoryManager [Z : : ALOAD 0
00024 ZosAssetFactoryManager [Z : ZosAssetFactoryManager : NEW java/util/HashMap
00025 ZosAssetFactoryManager [Z : ZosAssetFactoryManager HashMap : DUP
00026 ZosAssetFactoryManager [Z : ZosAssetFactoryManager HashMap HashMap : INVOKESPECIAL java/util/HashMap.<init> ()V
00027 ZosAssetFactoryManager [Z : ZosAssetFactoryManager HashMap : PUTFIELD com/ibm/zosconnect/engine/impl/ZosAssetFactoryManager.assetFactories : Ljava/util/Map;
00028 ZosAssetFactoryManager [Z : : ALOAD 1
00029 ZosAssetFactoryManager [Z : [Z : ICONST_1
00030 ZosAssetFactoryManager [Z : [Z I : ICONST_1
00031 ZosAssetFactoryManager [Z : [Z I I : BASTORE
// BEGIN INJECTED TRACE
00032 ZosAssetFactoryManager [Z : : INVOKESTATIC com/ibm/websphere/ras/TraceComponent.isAnyTracingEnabled ()Z
00033 ZosAssetFactoryManager [Z : I : IFEQ L1
00034 ZosAssetFactoryManager [Z : : GETSTATIC com/ibm/zosconnect/engine/impl/ZosAssetFactoryManager.tc : Lcom/ibm/websphere/ras/TraceComponent;
00035 ZosAssetFactoryManager [Z : TraceComponent : IFNULL L1
00036 ZosAssetFactoryManager [Z : : GETSTATIC com/ibm/zosconnect/engine/impl/ZosAssetFactoryManager.tc : Lcom/ibm/websphere/ras/TraceComponent;
00037 ZosAssetFactoryManager [Z : TraceComponent : INVOKEVIRTUAL com/ibm/websphere/ras/TraceComponent.isEntryEnabled ()Z
00038 ZosAssetFactoryManager [Z : I : IFEQ L1
00039 ZosAssetFactoryManager [Z : : ALOAD 0
00040 ZosAssetFactoryManager [Z : ZosAssetFactoryManager : ALOAD 0
00041 ZosAssetFactoryManager [Z : ZosAssetFactoryManager ZosAssetFactoryManager : SWAP
00042 ZosAssetFactoryManager [Z : ZosAssetFactoryManager ZosAssetFactoryManager : GETSTATIC com/ibm/zosconnect/engine/impl/ZosAssetFactoryManager.tc : Lcom/ibm/websphere/ras/TraceComponent;
00043 ZosAssetFactoryManager [Z : ZosAssetFactoryManager ZosAssetFactoryManager TraceComponent : SWAP
00044 ZosAssetFactoryManager [Z : ZosAssetFactoryManager TraceComponent ZosAssetFactoryManager : LDC "<init>"
00045 ZosAssetFactoryManager [Z : ZosAssetFactoryManager TraceComponent ZosAssetFactoryManager String : SWAP
00046 ZosAssetFactoryManager [Z : ZosAssetFactoryManager TraceComponent String ZosAssetFactoryManager : INVOKESTATIC com/ibm/websphere/ras/Tr.exit (Ljava/lang/Object;Lcom/ibm/websphere/ras/TraceComponent;Ljava/lang/String;Ljava/lang/Object;)V
00047 ZosAssetFactoryManager [Z : : L1
00048 ZosAssetFactoryManager [Z : : FRAME SAME
// END INJECTED TRACE
00049 ZosAssetFactoryManager [Z : : RETURN
```
**Using COMPUTE_FRAMES:**
```
<init>()V
00000 ZosAssetFactoryManager . : : INVOKESTATIC com/ibm/zosconnect/engine/impl/ZosAssetFactoryManager.$jacocoInit ()[Z
00001 ZosAssetFactoryManager . : [Z : ASTORE 1
00002 ZosAssetFactoryManager [Z : : ALOAD 0
00003 ZosAssetFactoryManager [Z : ZosAssetFactoryManager : INVOKESPECIAL java/lang/Object.<init> ()V
// BEGIN INJECTED TRACE
00004 ZosAssetFactoryManager [Z : : INVOKESTATIC com/ibm/websphere/ras/TraceComponent.isAnyTracingEnabled ()Z
00005 ZosAssetFactoryManager [Z : I : IFEQ L0
00006 ZosAssetFactoryManager [Z : : GETSTATIC com/ibm/zosconnect/engine/impl/ZosAssetFactoryManager.tc : Lcom/ibm/websphere/ras/TraceComponent;
00007 ZosAssetFactoryManager [Z : TraceComponent : IFNULL L0
00008 ZosAssetFactoryManager [Z : : GETSTATIC com/ibm/zosconnect/engine/impl/ZosAssetFactoryManager.tc : Lcom/ibm/websphere/ras/TraceComponent;
00009 ZosAssetFactoryManager [Z : TraceComponent : INVOKEVIRTUAL com/ibm/websphere/ras/TraceComponent.isEntryEnabled ()Z
00010 ZosAssetFactoryManager [Z : I : IFEQ L0
00011 ZosAssetFactoryManager [Z : : GETSTATIC com/ibm/zosconnect/engine/impl/ZosAssetFactoryManager.tc : Lcom/ibm/websphere/ras/TraceComponent;
00012 ZosAssetFactoryManager [Z : TraceComponent : LDC "<init>"
00013 ZosAssetFactoryManager [Z : TraceComponent String : LDC 0
00014 ZosAssetFactoryManager [Z : TraceComponent String I : ANEWARRAY java/lang/Object
00015 ZosAssetFactoryManager [Z : TraceComponent String [Object : INVOKESTATIC com/ibm/websphere/ras/Tr.entry (Lcom/ibm/websphere/ras/TraceComponent;Ljava/lang/String;[Ljava/lang/Object;)V
00016 ZosAssetFactoryManager [Z : : L0
00017 ZosAssetFactoryManager [Z : : FRAME FULL [com/ibm/zosconnect/engine/impl/ZosAssetFactoryManager [Z] [] // ***** VALID *****
00018 ZosAssetFactoryManager [Z : : NOP
// END INJECTED TRACE
00019 ZosAssetFactoryManager [Z : : ALOAD 1
00020 ZosAssetFactoryManager [Z : [Z : ICONST_0
00021 ZosAssetFactoryManager [Z : [Z I : ICONST_1
00022 ZosAssetFactoryManager [Z : [Z I I : BASTORE
00023 ZosAssetFactoryManager [Z : : ALOAD 0
00024 ZosAssetFactoryManager [Z : ZosAssetFactoryManager : NEW java/util/HashMap
00025 ZosAssetFactoryManager [Z : ZosAssetFactoryManager HashMap : DUP
00026 ZosAssetFactoryManager [Z : ZosAssetFactoryManager HashMap HashMap : INVOKESPECIAL java/util/HashMap.<init> ()V
00027 ZosAssetFactoryManager [Z : ZosAssetFactoryManager HashMap : PUTFIELD com/ibm/zosconnect/engine/impl/ZosAssetFactoryManager.assetFactories : Ljava/util/Map;
00028 ZosAssetFactoryManager [Z : : ALOAD 1
00029 ZosAssetFactoryManager [Z : [Z : ICONST_1
00030 ZosAssetFactoryManager [Z : [Z I : ICONST_1
00031 ZosAssetFactoryManager [Z : [Z I I : BASTORE
// BEGIN INJECTED TRACE
00032 ZosAssetFactoryManager [Z : : INVOKESTATIC com/ibm/websphere/ras/TraceComponent.isAnyTracingEnabled ()Z
00033 ZosAssetFactoryManager [Z : I : IFEQ L1
00034 ZosAssetFactoryManager [Z : : GETSTATIC com/ibm/zosconnect/engine/impl/ZosAssetFactoryManager.tc : Lcom/ibm/websphere/ras/TraceComponent;
00035 ZosAssetFactoryManager [Z : TraceComponent : IFNULL L1
00036 ZosAssetFactoryManager [Z : : GETSTATIC com/ibm/zosconnect/engine/impl/ZosAssetFactoryManager.tc : Lcom/ibm/websphere/ras/TraceComponent;
00037 ZosAssetFactoryManager [Z : TraceComponent : INVOKEVIRTUAL com/ibm/websphere/ras/TraceComponent.isEntryEnabled ()Z
00038 ZosAssetFactoryManager [Z : I : IFEQ L1
00039 ZosAssetFactoryManager [Z : : ALOAD 0
00040 ZosAssetFactoryManager [Z : ZosAssetFactoryManager : ALOAD 0
00041 ZosAssetFactoryManager [Z : ZosAssetFactoryManager ZosAssetFactoryManager : SWAP
00042 ZosAssetFactoryManager [Z : ZosAssetFactoryManager ZosAssetFactoryManager : GETSTATIC com/ibm/zosconnect/engine/impl/ZosAssetFactoryManager.tc : Lcom/ibm/websphere/ras/TraceComponent;
00043 ZosAssetFactoryManager [Z : ZosAssetFactoryManager ZosAssetFactoryManager TraceComponent : SWAP
00044 ZosAssetFactoryManager [Z : ZosAssetFactoryManager TraceComponent ZosAssetFactoryManager : LDC "<init>"
00045 ZosAssetFactoryManager [Z : ZosAssetFactoryManager TraceComponent ZosAssetFactoryManager String : SWAP
00046 ZosAssetFactoryManager [Z : ZosAssetFactoryManager TraceComponent String ZosAssetFactoryManager : INVOKESTATIC com/ibm/websphere/ras/Tr.exit (Ljava/lang/Object;Lcom/ibm/websphere/ras/TraceComponent;Ljava/lang/String;Ljava/lang/Object;)V
00047 ZosAssetFactoryManager [Z : : L1
00048 ZosAssetFactoryManager [Z : : FRAME SAME
// END INJECTED TRACE
00049 ZosAssetFactoryManager [Z : : RETURN
```https://gitlab.ow2.org/asm/asm/-/issues/317985Erroneous stack map frame exception after move from 9.3 to 9.42022-11-10T16:16:03ZDavid GoodenoughErroneous stack map frame exception after move from 9.3 to 9.4I have come code that takes existing classes and adds extra methods (one normal method and one constructor) to those classes.
The existing classes are produced by Scala 3.2.0 (I have not tried earlier versions).
When processing the vis...I have come code that takes existing classes and adds extra methods (one normal method and one constructor) to those classes.
The existing classes are produced by Scala 3.2.0 (I have not tried earlier versions).
When processing the visitEnd I get:-
Exception in thread "main" java.lang.IllegalArgumentException: Error at instruction 14: Stack map frame incompatible with frame at instruction 32 (incompatible types at local 3: . and R) $anonfun$6(Luk/co/dga/pdf2odoo/ScanData;Luk/co/dga/pdf2odoo/ItemLine;)Luk/co/dga/pdf2odoo/ScanData;
00000 R R R . . . : : L0
00001 R R . . . . : : LINENUMBER 383 L0
00002 R R . . . . : : ALOAD 1
00003 R R . . . . : R : INVOKEVIRTUAL uk/co/dga/pdf2odoo/ItemLine.newLine ()Z
00004 R R . . . . : I : IFEQ L1
00005 R R . . . . : : L2
00006 R R . . . . : : LINENUMBER 384 L2
00007 R R . . . . : : ALOAD 0
00008 R R . . . . : R : INVOKEVIRTUAL uk/co/dga/pdf2odoo/ScanData.pending ()Lscala/Option;
00009 R R . . . . : R : ASTORE 2
00010 R R R . . . : : L3
00011 R R R . . . : : LINENUMBER 385 L3
00012 R R R . . . : : ALOAD 2
00013 R R R . . . : R : INSTANCEOF scala/Some
00014 R R R . . . : I : IFEQ L4
00015 ? : ALOAD 2
00016 ? : CHECKCAST scala/Some
00017 ? : INVOKEVIRTUAL scala/Some.value ()Ljava/lang/Object;
00018 ? : CHECKCAST uk/co/dga/pdf2odoo/ItemLine
00019 ? : ASTORE 3
00020 ? : L5
00021 ? : GETSTATIC uk/co/dga/pdf2odoo/ScanData$.MODULE$ : Luk/co/dga/pdf2odoo/ScanData$;
00022 ? : ALOAD 0
00023 ? : INVOKEVIRTUAL uk/co/dga/pdf2odoo/ScanData.list ()Lscala/collection/immutable/List;
00024 ? : ALOAD 3
00025 ? : INVOKEVIRTUAL scala/collection/immutable/List.$colon$plus (Ljava/lang/Object;)Ljava/lang/Object;
00026 ? : CHECKCAST scala/collection/immutable/List
00027 ? : GETSTATIC scala/Some$.MODULE$ : Lscala/Some$;
00028 ? : ALOAD 1
00029 ? : INVOKEVIRTUAL scala/Some$.apply (Ljava/lang/Object;)Lscala/Some;
00030 ? : INVOKEVIRTUAL uk/co/dga/pdf2odoo/ScanData$.apply (Lscala/collection/immutable/List;Lscala/Option;)Luk/co/dga/pdf2odoo/ScanData;
00031 ? : ARETURN
00032 R R . R . . : : L4
00033 R R . R . . : : LINENUMBER 386 L4
00034 R R . R . . : : FRAME APPEND [scala/Option]
00035 ? : GETSTATIC scala/None$.MODULE$ : Lscala/None$;
00036 ? : ALOAD 2
when I run with 9.4, but with 9.3 I get no such exception. When I run the code with openjdk-17 or openjdk-11 it runs correctly having been processed with 9.3.https://gitlab.ow2.org/asm/asm/-/issues/317984Add link to Type.getInternalName() after each occurence of "internal name" in...2022-10-01T15:33:08ZEric BrunetonAdd link to Type.getInternalName() after each occurence of "internal name" in Javadoc comments.https://gitlab.ow2.org/asm/asm/-/issues/317983Retrofitter generates wrong module name of module-info.class2022-09-04T06:10:08ZMarián KončekRetrofitter generates wrong module name of module-info.classYour latest change to Retrofitter changed its behaviour. Module names now use slash separator instead of dot as previously.
This is previously released jar:
```
$ jar -f asm-commons-9.3.jar --describe-module ...Your latest change to Retrofitter changed its behaviour. Module names now use slash separator instead of dot as previously.
This is previously released jar:
```
$ jar -f asm-commons-9.3.jar --describe-module
org.objectweb.asm.commons@9.3.0 jar:file:///.../asm-commons-9.3.jar/!module-info.class open
exports org.objectweb.asm.commons
requires java.base mandated
requires org.objectweb.asm transitive
requires org.objectweb.asm.tree transitive
requires org.objectweb.asm.tree.analysis transitive
```
This is a new one:
```
$ jar -f asm-commons-9.4-SNAPSHOT.jar --describe-module
org/objectweb/asm/commons@9.4-SNAPSHOT jar:file:///.../asm-commons-9.4-SNAPSHOT.jar/!module-info.class open
exports org.objectweb.asm.commons
requires java.base mandated
requires org.objectweb.asm transitive
requires org.objectweb.asm.tree transitive
```
The issue seems to be related to this change https://gitlab.ow2.org/asm/asm/-/commit/5921eb2a141f0dcc83c6a5d7dcd5035a30c5edfc#7faae5d009762b67aa417810e799870bc25f219c_86_0 but you need to verify it.https://gitlab.ow2.org/asm/asm/-/issues/317982Get offsets of instructions in MethodVisitor2022-12-13T07:25:22ZAo LiGet offsets of instructions in MethodVisitorI need to get offsets of instructions in MethodVisitor and I followed the implementation of `CodeSizeEvaluator`, which works for most instructions except for `LDC` and `LDC_W`. `LDC` requires 2 bytes and `LDC_W` requires 3 bytes but they...I need to get offsets of instructions in MethodVisitor and I followed the implementation of `CodeSizeEvaluator`, which works for most instructions except for `LDC` and `LDC_W`. `LDC` requires 2 bytes and `LDC_W` requires 3 bytes but they are both passed to `visitLdcInsn`.
One solution is to pass opcode to `visitLdcInsn` which may break many dependencies.
Another solution is to make `readCode` method in `ClassReader` public or protected so that I can override the method to maintain the code offset manually.
Please let me know if there is another way to solve this issue.https://gitlab.ow2.org/asm/asm/-/issues/317981Add public getDelegate method to all visitor classes.2022-10-01T15:53:55ZraphwAdd public getDelegate method to all visitor classes.Currently, only the RecordComponentVisitor offers a public method for reading the underlying visitor. Sometimes, it is however desirable to communicate with a visitor that lies beneath another visitor also for the other visitor implement...Currently, only the RecordComponentVisitor offers a public method for reading the underlying visitor. Sometimes, it is however desirable to communicate with a visitor that lies beneath another visitor also for the other visitor implementations. Could an equivalent getter be added for the other visitors, too?
Also, would you consider to make the delegate field for the record component visitor protected as with the other visitors? This can be handy when a subclass of a visitor wants to change its delegate after visiting some properties, for example after all attributes were passed. Ideally, ASM would be consistent here.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/issues/317980Not able to build ASM source code locally on windows2022-08-27T06:11:23ZVirag PurnamNot able to build ASM source code locally on windowsI am trying to build ASM 9.3 using Gradle 7.5.1 on windows. I get the below error.
`> Task :asm:checkstyleMain FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':asm:checkstyleMain'.
> A fa...I am trying to build ASM 9.3 using Gradle 7.5.1 on windows. I get the below error.
`> Task :asm:checkstyleMain FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':asm:checkstyleMain'.
> A failure occurred while executing org.gradle.api.plugins.quality.internal.CheckstyleAction
> Unable to create Root Module: config {C:\ViragPurnam\temp\ASM\asm\tools\checkstyle.xml}, classpath {null}.`
Any help would be highly appreciated.https://gitlab.ow2.org/asm/asm/-/issues/317979Request: Manually add module-info.java into source tree2022-08-01T07:41:14ZMarián KončekRequest: Manually add module-info.java into source treeI am packaging this project in Fedora where we don't have access to Gradle, so we use poms from Maven Central.
We can use maven-bundle-plugin along with your bnd-module-plugin tool to generate module-info.class files.
But I don't like th...I am packaging this project in Fedora where we don't have access to Gradle, so we use poms from Maven Central.
We can use maven-bundle-plugin along with your bnd-module-plugin tool to generate module-info.class files.
But I don't like this approach as it brings in more dependencies.
I inspected your decompiled module-info.class files and I have seen that they are effectively just ~5 lines long.
Would you please consider adding module-info.java files into the source tree so that bnd-module-plugin is not necessary for module-info.class generation?Eric BrunetonEric Brunetonhttps://gitlab.ow2.org/asm/asm/-/issues/317978OpenJDK ClassFile API and ASM2022-08-27T06:14:16ZraphwOpenJDK ClassFile API and ASMI am wondering what you are planning for ASM in the light of the soon-to-be-released (?) ClassFile API in OpenJDK. Are you planning to maintain ASM along OpenJDK or do you think that you will stop developing the library at some point?
P...I am wondering what you are planning for ASM in the light of the soon-to-be-released (?) ClassFile API in OpenJDK. Are you planning to maintain ASM along OpenJDK or do you think that you will stop developing the library at some point?
Personally, I do of course hope that ASM continues even in the light of a native API. In Byte Buddy, ASM is exposed as API for "in-method-instrumentation" and even if it was not, rewriting Byte Buddy to this degree would be impossible considering the time that would take.
However, I would like to embrace the JDK API in Byte Buddy and am planning to write a bridge:
1. ClassModel -> ClassVisitor
2. ClassVisitor -> ClassBuilder
After that, I would want to make ClassReader/ClassWriter pluggable where the JDK API could be used instead, either by opt-in or by default for unknown versions.
Have you thought about something like this? If so, would you want this to become a part of ASM? There is so much use of ASM that I would think several people would benefit of this.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/issues/317977CheckClassAdapter is no longer transparent for MAXLOCALS2022-06-12T15:03:35ZJohn VasileffCheckClassAdapter is no longer transparent for MAXLOCALS### Expected Behavior
`CheckClassAdapter` should not alter the input data. That is, for valid classes, the following should produce identical results:
```java
cr.accept(new CheckClassAdapter(tcv), 0);
```
and
```java
cr.accept(tcv, 0...### Expected Behavior
`CheckClassAdapter` should not alter the input data. That is, for valid classes, the following should produce identical results:
```java
cr.accept(new CheckClassAdapter(tcv), 0);
```
and
```java
cr.accept(tcv, 0);
```
### Current Behavior
As of v9.3 commit 9b880c26c, `MAXLOCALS` is incremented by `1` for `static` methods. For example, using v9.2, the following is produced with or without `CheckClassAdapter`
```
// access flags 0x19
public final static main([Ljava/lang/String;)V
INVOKESTATIC run.$apply ()V
RETURN
MAXSTACK = 0
MAXLOCALS = 1
```
but with v9.3 & when using `CheckClassAdapter`, the following is produced:
```
// access flags 0x19
public final static main([Ljava/lang/String;)V
INVOKESTATIC run.$apply ()V
RETURN
MAXSTACK = 0
MAXLOCALS = 2
```
### Steps to Reproduce
Process a valid class with a static method using the following code. Uncomment one of the *VERSION X* lines.
```java
byte[] classBytes = // ...valid-class-with-static-method...;
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
ClassReader cr = new ClassReader(classBytes);
TraceClassVisitor tcv = new TraceClassVisitor(null, new Textifier(), pw);
// cr.accept(new CheckClassAdapter(tcv), 0); // VERSION 1
// cr.accept(tcv, 0); // VERSION 2
System.out.println(sw.toString());
```https://gitlab.ow2.org/asm/asm/-/issues/317976ASM processing error2022-06-12T09:18:53Ztang yanASM processing error![image](/uploads/6b0565ab8bd768716f953a6659b9be5f/image.png)
![image](/uploads/5bc504df5b7e320b4315e9c25c5474d8/image.png)
mv.visitInsn(AALOAD); to case Opcodes.FCONST_2:
![image](/uploads/a86524d3a288b39bb44d0590ba4ec2e7/image.png)![image](/uploads/6b0565ab8bd768716f953a6659b9be5f/image.png)
![image](/uploads/5bc504df5b7e320b4315e9c25c5474d8/image.png)
mv.visitInsn(AALOAD); to case Opcodes.FCONST_2:
![image](/uploads/a86524d3a288b39bb44d0590ba4ec2e7/image.png)https://gitlab.ow2.org/asm/asm/-/issues/317975Incomplete OSGi manifest?2022-06-12T09:20:29ZChristoph LäubrichIncomplete OSGi manifest?I'm looking at the 9.3 version deployed at maven central:
https://search.maven.org/artifact/org.ow2.asm/asm/9.3/jar
The manifest declares:
```
Export-Package: org.objectweb.asm;version="9.3",
org.objectweb.asm.signature;version="9.3"...I'm looking at the 9.3 version deployed at maven central:
https://search.maven.org/artifact/org.ow2.asm/asm/9.3/jar
The manifest declares:
```
Export-Package: org.objectweb.asm;version="9.3",
org.objectweb.asm.signature;version="9.3"
```
but from the the code https://gitlab.ow2.org/asm/asm/-/blob/master/asm/src/main/java/org/objectweb/asm/signature/SignatureVisitor.java uses org.objectweb.asm.Opcodes so there should be a use constraint on the signature export to the package org.objectweb.asm.
If I'm correct BND is used here to generate the manifest:
https://gitlab.ow2.org/asm/asm/-/blob/master/build.gradle#L286
but from the source it seems to be three years old now, so probably needs an update or the config is not correct here? Sadly I don't know enough about gradle to help here.https://gitlab.ow2.org/asm/asm/-/issues/317974Questions: org.ow2.asm:asm-debug-all:2022-05-28T11:43:27ZGodRuiQuestions: org.ow2.asm:asm-debug-all:Excuse me, I can't find where to ask questions. I would like to ask about the relationship between org.ow2.asm:asm-debug-all: the code base and the asm main repository?Excuse me, I can't find where to ask questions. I would like to ask about the relationship between org.ow2.asm:asm-debug-all: the code base and the asm main repository?https://gitlab.ow2.org/asm/asm/-/issues/317973How do I import asm into a modularized application2022-06-12T09:20:02ZDavid BerkmanHow do I import asm into a modularized applicationI can't seem to come up with a magical set of require statements in a module-info.java file that will capture the use of asm core, tree and util and will not result in being told...
Module 'my.module' reads package 'org.objectweb.asm' f...I can't seem to come up with a magical set of require statements in a module-info.java file that will capture the use of asm core, tree and util and will not result in being told...
Module 'my.module' reads package 'org.objectweb.asm' from both 'org.objectweb.asm' and 'org.objectweb.asm'
Any suggestions? Any possibility of adding module-info to asm to provide a clean import?https://gitlab.ow2.org/asm/asm/-/issues/317972ClassVisitor inner class and outer class documentation confusing2022-11-27T08:15:23ZtoadstreetClassVisitor inner class and outer class documentation confusing### Expected Behavior
The documentation on `ClassVisitor.visitInnerClass` should mention it is a few inner class relations observed by this class. For instance, classes that use `invokedynamic` instructions compiled by `javac` usually ha...### Expected Behavior
The documentation on `ClassVisitor.visitInnerClass` should mention it is a few inner class relations observed by this class. For instance, classes that use `invokedynamic` instructions compiled by `javac` usually have the `MethodHandles.Lookup` described as a nested class (static inner class) of `MethodHandles` upon inspection by `javap`.
It should also mention that the member classes and the enclosing class of this class, if any, **must** be described in this attribute per [JVMS 18 - 4.7.6](https://docs.oracle.com/javase/specs/jvms/se18/html/jvms-4.html#jvms-4.7.6).
The documentation for `ClassVisitor.visitOuterClass` should state it is only called for anonymous or local classes, which are defined in method bodies or initializers. In addition, if the class is defined in an initializer, then the `name` and `descriptor` will be `null`. It is not called for instance inner or nested classes, i.e. classes that are direct members of other classes. Refer to [JVMS 18 - 4.7.7](https://docs.oracle.com/javase/specs/jvms/se18/html/jvms-4.html#jvms-4.7.7).
### Current Behavior
The documentation for `ClassVisitor.visitInnerClass` fails to ask users to supply all the member classes and the enclosing class relations of this class.
The documentation for `ClassVisitor.visitOuterClass` fails to mention that it should only be called for anonymous or local classes (i.e. classes defined in method bodies or initializers in source code), and `null` method name and descriptors mean the class is defined in an initializer as opposed to a regular method.
### Notes
In addition, the documentations for the tree API, such as `ClassNode`, should be updated simultaneously.https://gitlab.ow2.org/asm/asm/-/issues/317971java 19 support?2022-06-12T09:19:20ZAndres Luukjava 19 support?ASM Latest release was a year ago and now JDK19 Early-Access Builds is relevant.
As expected currently it get's IllegalArgumentException: Unsupported class file major version 63 when trying to parse a file from there.ASM Latest release was a year ago and now JDK19 Early-Access Builds is relevant.
As expected currently it get's IllegalArgumentException: Unsupported class file major version 63 when trying to parse a file from there.