asm issueshttps://gitlab.ow2.org/asm/asm/-/issues2018-10-28T12:47:23Zhttps://gitlab.ow2.org/asm/asm/-/issues/317862changing between instrumentation candidates2018-10-28T12:47:23ZRoy Kimchanging between instrumentation candidatesHello, team. Thank you for such a wonderful framework.
I'm trying to solve a certain situation and couldn't find anywhere to ask.
Here is the problem.
A Method in *AA* Class is being instrumented within a certain logic
B Method in *BB...Hello, team. Thank you for such a wonderful framework.
I'm trying to solve a certain situation and couldn't find anywhere to ask.
Here is the problem.
A Method in *AA* Class is being instrumented within a certain logic
B Method in *BB* Class is also being instrumented and calls A Method inside it.
So when I execute B Method. instrumentation in B Method is called and then also instrumentation in A Method is called.
The thing is. I'd like to leave the instrumentation in A Method. since this can be called from several other places.
But! If it's called from B Method. I DO NOT want to execute the original instrumentation in A Method but want to execute another instrumentation.
I just can't even find where to begin to take care of this problem.
I've gone through FAQ, and Developer guide and User guide(wasn't quite easy to understand).
I can't say I've perfectly reviewed and understood the user guide. But so far I couldn't find a hint to take care of this case.
Maybe even a little advice of where to start looking for will be a tremendous help.
Thank you in advance for any advice. Have a nice day.https://gitlab.ow2.org/asm/asm/-/issues/317861Frame is not checked before merge2018-10-14T09:40:50ZHao ZhongFrame is not checked before mergeI notice that the `public boolean merge(final Frame<? extends V> frame, final boolean[] localsUsed)` method of `org.objectweb.asm.tree.analysis.Frame` does not check frame:
`public boolean merge(final Frame<? extends V> frame, final bo...I notice that the `public boolean merge(final Frame<? extends V> frame, final boolean[] localsUsed)` method of `org.objectweb.asm.tree.analysis.Frame` does not check frame:
`public boolean merge(final Frame<? extends V> frame, final boolean[] localsUsed) {
boolean changed = false;
for (int i = 0; i < numLocals; ++i) {
if (!localsUsed[i] && !values[i].equals(frame.values[i])) {
values[i] = frame.values[i];
changed = true;
}
}
return changed;
}`
In the same class, the `public boolean merge(final Frame<? extends V> frame, final Interpreter<V> interpreter)` checks the parameter:
` public boolean merge(final Frame<? extends V> frame, final Interpreter<V> interpreter)
throws AnalyzerException {
if (numStack != frame.numStack) {
throw new AnalyzerException(null, "Incompatible stack heights");
}
boolean changed = false;
for (int i = 0; i < numLocals + numStack; ++i) {
V v = interpreter.merge(values[i], frame.values[i]);
if (!v.equals(values[i])) {
values[i] = v;
changed = true;
}
}
return changed;
}`
Please add the check to the first method as well to avoid possible bugs.https://gitlab.ow2.org/asm/asm/-/issues/317860Java 11 Compatibility check: ASM2018-09-21T17:33:54ZKrzysztof DraganJava 11 Compatibility check: ASMHi,
We are reaching out to you to check Java 11 compatibility of the library ASM.
Could you help us by answering the following questions:
Library Name:
Latest version: <latest 1.1.1="" eg:="" version.="">
Latest version Is the library ...Hi,
We are reaching out to you to check Java 11 compatibility of the library ASM.
Could you help us by answering the following questions:
Library Name:
Latest version: <latest 1.1.1="" eg:="" version.="">
Latest version Is the library compatible with Java 11 Compatible? (Y/N)
Is the library supported with Java 11? (Y/N)
(If āNā in compatibility or support) What is the versions that would be compatible and Supported?
Date of support availability?
Appreciate your response by 24.09.2018.
Thanks,
Krzysztof Dragan,
PTC Inc. Contractorhttps://gitlab.ow2.org/asm/asm/-/issues/317859Exception processing a module-info.class found in the wild2018-09-27T07:01:09ZChris WestException processing a module-info.class found in the wildThe package `libjson-smart-java` in Debian pre-release currently contains an embedded `module-info.class` which ASM barfs on.
* Package page: https://packages.debian.org/search?keywords=libjson-smart-java
* Upstream: https://netplex.g...The package `libjson-smart-java` in Debian pre-release currently contains an embedded `module-info.class` which ASM barfs on.
* Package page: https://packages.debian.org/search?keywords=libjson-smart-java
* Upstream: https://netplex.github.io/json-smart/
* Build script: https://sources.debian.org/src/json-smart/2.2-2/json-smart/pom.xml/#L60
* Build-script weirdness: Maven Bundle Plugin `<Embed-Dependency>accessors-smart;groupId=net.minidev;inline=true</Embed-Dependency>`.
* The file: [module-info.class](/uploads/b3e34c3c5527b9f528beff6b858d9f37/module-info.class)
Error message in HEAD (0cae8ffadb63f2760a8186819f94a509b7cff6fc):
```
% java -cp asm-util/build/libs/asm-util-7.0-beta-SNAPSHOT.jar:asm/build/libs/asm-7.0-beta-SNAPSHOT.jar org.objectweb.asm.util.ASMifier module-info.class
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 29
at org.objectweb.asm.ClassReader.readUtf(ClassReader.java:3424)
at org.objectweb.asm.ClassReader.readUTF8(ClassReader.java:3411)
at org.objectweb.asm.ClassReader.readStringish(ClassReader.java:3480)
at org.objectweb.asm.ClassReader.readModule(ClassReader.java:3508)
at org.objectweb.asm.ClassReader.readModuleAttributes(ClassReader.java:710)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:534)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:389)
at org.objectweb.asm.util.Printer.main(Printer.java:1247)
at org.objectweb.asm.util.ASMifier.main(ASMifier.java:137)
```
Almost identical failure from our repackaged 6.2.1(?):
```
Caused by: java.lang.ArrayIndexOutOfBoundsException: 29
at ...asm.ClassReader.readUTF(ClassReader.java:3388)
at ...asm.ClassReader.readUTF8(ClassReader.java:3375)
at ...asm.ClassReader.readStringish(ClassReader.java:3445)
at ...asm.ClassReader.readModule(ClassReader.java:3473)
at ...asm.ClassReader.readModule(ClassReader.java:711)
at ...asm.ClassReader.accept(ClassReader.java:536)
at ...asm.ClassReader.accept(ClassReader.java:391)
...
```
Note that javap also has some issues with the file:
```
% javap -c /var/tmp/faux180917.profuse/module-info.class
class org.objectweb.asm.module-info {
}
% javap -c -verbose /var/tmp/faux180917.profuse/module-info.class
Classfile /var/tmp/faux180917.profuse/module-info.class
Last modified 16 Oct 2017; size 186 bytes
MD5 checksum 14376005a9a1306d35901dc9522bece7
class org.objectweb.asm.module-info
minor version: 0
major version: 53
flags: (0x8000) ACC_MODULE
this_class: #2 // "org/objectweb/asm/module-info"
super_class: #0
interfaces: 0, fields: 0, methods: 0, attributes: 2
Constant pool:
#1 = Utf8 org/objectweb/asm/module-info
#2 = Class #1 // "org/objectweb/asm/module-info"
#3 = Utf8 java.base
#4 = Utf8 org/objectweb/asm
#5 = Utf8 org/objectweb/asm/signature
#6 = Utf8 Module
#7 = Utf8 Version
#8 = Utf8 6.0_ALPHA
{
}
Error: java.lang.reflect.InvocationTargetException
Module: length = 0x14
00 01 00 03 80 20 00 02 00 04 00 00 00 05 00 00
00 00 00 00
Error: unknown attribute
Version: length = 0x2
00 08
```
(Note the errors towards the end, and the irony of it being an older embedded ASM.)
This is almost certainly an invalid file, but it was probably produced by an OpenJDK build at some point, so it's not impossible others will see them.
Maybe you think the exception is okay, and that I shouldn't be processing `module-info` files. I don't care, but I didn't know that when I started!https://gitlab.ow2.org/asm/asm/-/issues/317858InsnList nodes are removed after "accept"2018-10-27T15:43:12ZTodd WestInsnList nodes are removed after "accept"I noticed this issue recently when trying out ASM 7.0 (snapshot) and I believe I have been able to track it down to the following recent change:
https://gitlab.ow2.org/asm/asm/merge_requests/177
Here is a simple test I've set up that r...I noticed this issue recently when trying out ASM 7.0 (snapshot) and I believe I have been able to track it down to the following recent change:
https://gitlab.ow2.org/asm/asm/merge_requests/177
Here is a simple test I've set up that reproduces the issue that I'm seeing:
```
@Test
public void testAcceptWithLabelInfo() {
MethodNode method = new MethodNode();
method.instructions = new InsnList();
LabelNode labelNode = new LabelNode(new Label());
labelNode.getLabel().info = labelNode;
method.instructions.add(labelNode);
method.instructions.add(new InsnNode(11));
method.instructions.add(new InsnNode(22));
method.instructions.add(new InsnNode(33));
MethodNode otherMethod = new MethodNode();
final InsnList insnList = new InsnList();
method.accept(new MethodVisitor(Opcodes.ASM7, otherMethod) {
@Override
public void visitInsn(int opcode) {
insnList.add(new InsnNode(opcode));
super.visitInsn(opcode);
}
});
assertEquals(3, insnList.size()); // This will fail
assertEquals(11, insnList.get(0).opcode);
assertEquals(22, insnList.get(1).opcode);
assertEquals(33, insnList.get(2).opcode);
}
```
It appears that the change to null out the `nextInsn` field:
https://gitlab.ow2.org/asm/asm/commit/dc8acb48450bbb4aa461fb103916378cd226a6f6#5e3df072b61d74b2fd71d97a1d99188ccc46c1da_235_233
can cause the iteration of this loop to stop before it gets through all of the instruction nodes:
https://gitlab.ow2.org/asm/asm/blob/dc8acb48450bbb4aa461fb103916378cd226a6f6/asm-tree/src/main/java/org/objectweb/asm/tree/InsnList.java#L143-146
It's entirely possible that I may be doing something wrong here so please let me know if that's the case.
In my usage, I tried not using the `info` field on the `Label` and that allowed the instructions to be iterated through but caused a failure when attempting to compute frames later on:
```
java.lang.NullPointerException
at org.objectweb.asm.MethodWriter.computeAllFrames(MethodWriter.java:1581)
at org.objectweb.asm.MethodWriter.visitMaxs(MethodWriter.java:1555)
at org.objectweb.asm.tree.MethodNode.accept(MethodNode.java:806)
```
Any help would be greatly appreciated. Thank you!https://gitlab.ow2.org/asm/asm/-/issues/317857Gradle has trouble copying /home/forax/git/asm2/asm-test/src/main/resources/j...2018-09-08T14:02:31ZRemi ForaxGradle has trouble copying /home/forax/git/asm2/asm-test/src/main/resources/jdk8/AllStructures$š».classI can not build ASM anymore :(
This seems to be related to https://github.com/gradle/gradle/issues/789
But i can not explain why it was working yesterday but doesn't work anymore ??
---
bash-4.4$ ./gradle/gradlew clean build --stacktr...I can not build ASM anymore :(
This seems to be related to https://github.com/gradle/gradle/issues/789
But i can not explain why it was working yesterday but doesn't work anymore ??
---
bash-4.4$ ./gradle/gradlew clean build --stacktrace
> Task :tools:retrofitter:compileJava
warning: [options] bootstrap class path not set in conjunction with -source 1.7
1 warning
> Task :asm:compileJava
warning: [options] bootstrap class path not set in conjunction with -source 1.7
1 warning
> Task :tools:bnd-module-plugin:compileJava
warning: [options] bootstrap class path not set in conjunction with -source 1.7
1 warning
> Task :asm-test:processResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':asm-test:processResources'.
> Could not copy file '/home/forax/git/asm2/asm-test/src/main/resources/jdk8/AllStructures$š».class' to '/home/forax/git/asm2/asm-test/build/resources/main/jdk8/AllStructures$š».class'.
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':asm-test:processResources'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:77)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:51)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46)
at org.gradle.execution.taskgraph.LocalTaskInfoExecutor.execute(LocalTaskInfoExecutor.java:42)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:273)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:258)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:135)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:130)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.execute(DefaultTaskPlanExecutor.java:200)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.executeWithWork(DefaultTaskPlanExecutor.java:191)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.run(DefaultTaskPlanExecutor.java:130)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.api.GradleException: Could not copy file '/home/forax/git/asm2/asm-test/src/main/resources/jdk8/AllStructures$š».class' to '/home/forax/git/asm2/asm-test/build/resources/main/jdk8/AllStructures$š».class'.
at org.gradle.api.internal.file.AbstractFileTreeElement.copyTo(AbstractFileTreeElement.java:79)
at org.gradle.api.internal.file.copy.DefaultFileCopyDetails.copyTo(DefaultFileCopyDetails.java:111)
at org.gradle.api.internal.file.copy.FileCopyAction$FileCopyDetailsInternalAction.processFile(FileCopyAction.java:44)
at org.gradle.api.internal.file.copy.NormalizingCopyActionDecorator$1$1.processFile(NormalizingCopyActionDecorator.java:66)
at org.gradle.api.internal.file.copy.DuplicateHandlingCopyActionDecorator$1$1.processFile(DuplicateHandlingCopyActionDecorator.java:60)
at org.gradle.api.internal.file.copy.CopyFileVisitorImpl.processFile(CopyFileVisitorImpl.java:62)
at org.gradle.api.internal.file.copy.CopyFileVisitorImpl.visitFile(CopyFileVisitorImpl.java:46)
at org.gradle.api.internal.file.collections.jdk7.Jdk7DirectoryWalker$1.visitFile(Jdk7DirectoryWalker.java:86)
at org.gradle.api.internal.file.collections.jdk7.Jdk7DirectoryWalker$1.visitFile(Jdk7DirectoryWalker.java:59)
at org.gradle.api.internal.file.collections.jdk7.Jdk7DirectoryWalker.walkDir(Jdk7DirectoryWalker.java:59)
at org.gradle.api.internal.file.collections.DirectoryFileTree.walkDir(DirectoryFileTree.java:154)
at org.gradle.api.internal.file.collections.DirectoryFileTree.visitFrom(DirectoryFileTree.java:132)
at org.gradle.api.internal.file.collections.DirectoryFileTree.visit(DirectoryFileTree.java:117)
at org.gradle.api.internal.file.collections.FileTreeAdapter.visit(FileTreeAdapter.java:117)
at org.gradle.api.internal.file.CompositeFileTree.visit(CompositeFileTree.java:93)
at org.gradle.api.internal.file.copy.CopySpecActionImpl.execute(CopySpecActionImpl.java:39)
at org.gradle.api.internal.file.copy.CopySpecActionImpl.execute(CopySpecActionImpl.java:24)
at org.gradle.api.internal.file.copy.DefaultCopySpec$DefaultCopySpecResolver.walk(DefaultCopySpec.java:707)
at org.gradle.api.internal.file.copy.DefaultCopySpec$DefaultCopySpecResolver.walk(DefaultCopySpec.java:709)
at org.gradle.api.internal.file.copy.DefaultCopySpec.walk(DefaultCopySpec.java:513)
at org.gradle.api.internal.file.copy.DelegatingCopySpecInternal.walk(DelegatingCopySpecInternal.java:282)
at org.gradle.api.internal.file.copy.CopySpecBackedCopyActionProcessingStream.process(CopySpecBackedCopyActionProcessingStream.java:38)
at org.gradle.api.internal.file.copy.DuplicateHandlingCopyActionDecorator$1.process(DuplicateHandlingCopyActionDecorator.java:44)
at org.gradle.api.internal.file.copy.NormalizingCopyActionDecorator$1.process(NormalizingCopyActionDecorator.java:57)
at org.gradle.api.internal.file.copy.FileCopyAction.execute(FileCopyAction.java:35)
at org.gradle.api.internal.file.copy.NormalizingCopyActionDecorator.execute(NormalizingCopyActionDecorator.java:53)
at org.gradle.api.internal.file.copy.DuplicateHandlingCopyActionDecorator.execute(DuplicateHandlingCopyActionDecorator.java:42)
at org.gradle.api.internal.file.copy.CopyActionExecuter.execute(CopyActionExecuter.java:40)
at org.gradle.api.tasks.AbstractCopyTask.copy(AbstractCopyTask.java:179)
at org.gradle.language.jvm.tasks.ProcessResources.copy(ProcessResources.java:35)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:46)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:786)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:753)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:131)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:120)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:99)
... 31 more
Caused by: org.gradle.internal.nativeintegration.filesystem.FileException: Could not get file mode for '/home/forax/git/asm2/asm-test/src/main/resources/jdk8/AllStructures$š».class'.
at org.gradle.internal.nativeintegration.filesystem.services.GenericFileSystem.getUnixMode(GenericFileSystem.java:76)
at org.gradle.api.internal.file.DefaultFileTreeElement.getMode(DefaultFileTreeElement.java:73)
at org.gradle.api.internal.file.AbstractFileTreeElement.copyTo(AbstractFileTreeElement.java:76)
... 74 more
Caused by: net.rubygrapefruit.platform.NativeException: Could not get file details of /home/forax/git/asm2/asm-test/src/main/resources/jdk8/AllStructures$š».class: could not convert string to current locale
at net.rubygrapefruit.platform.internal.DefaultPosixFiles.stat(DefaultPosixFiles.java:38)
at net.rubygrapefruit.platform.internal.DefaultPosixFiles.stat(DefaultPosixFiles.java:27)
at net.rubygrapefruit.platform.internal.DefaultPosixFiles.getMode(DefaultPosixFiles.java:66)
at org.gradle.internal.nativeintegration.filesystem.services.NativePlatformBackedStat.getUnixMode(NativePlatformBackedStat.java:34)
at org.gradle.internal.nativeintegration.filesystem.services.GenericFileSystem.getUnixMode(GenericFileSystem.java:74)
... 76 more
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.9/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 4s
23 actionable tasks: 16 executed, 7 up-to-date
bash-4.4$ ./gradle/gradlew version
FAILURE: Build failed with an exception.
* What went wrong:
Task 'version' not found in root project 'root'.
* Try:
Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 0s
bash-4.4$ ./gradle/gradlew --version
------------------------------------------------------------
Gradle 4.9
------------------------------------------------------------
Build time: 2018-07-16 08:14:03 UTC
Revision: efcf8c1cf533b03c70f394f270f46a174c738efc
Kotlin DSL: 0.18.4
Kotlin: 1.2.41
Groovy: 2.4.12
Ant: Apache Ant(TM) version 1.9.11 compiled on March 23 2018
JVM: 1.8.0_181 (Oracle Corporation 25.181-b13)
OS: Linux 4.17.12-100.fc27.x86_64 amd64Eric BrunetonEric Brunetonhttps://gitlab.ow2.org/asm/asm/-/issues/317856Bug in AdviceAdapter.java with superclass constructors2020-05-20T08:19:28ZArshan DabirsiaghiBug in AdviceAdapter.java with superclass constructorsFirst, we are huge fans and loyal users!
Unfortunately, I believe there is a bug in AdviceAdapter#visitLabel() in all 6.x versions. I am happy to be convinced otherwise.
Here's the code from 5.2:
```@Override
public void visitLabe...First, we are huge fans and loyal users!
Unfortunately, I believe there is a bug in AdviceAdapter#visitLabel() in all 6.x versions. I am happy to be convinced otherwise.
Here's the code from 5.2:
```@Override
public void visitLabel(final Label label) {
mv.visitLabel(label);
if (constructor && branches != null) {
List<Object> frame = branches.get(label);
if (frame != null) {
stackFrame = frame;
branches.remove(label);
}
}
}
```
If this code visits a label in a constructor that was found before the INVOKESPECIAL instruction, it removes it from the `branches` set. I believe this is a fine idea because I think you want to avoid code that could jump to before the superclass constructor after it executed. I have no problems with this.
However, that same `if` check became more aggressive in 6.x:
```@Override
public void visitLabel(final Label label) {
super.visitLabel(label);
if (isConstructor && forwardJumpStackFrames != null) {
List<Object> labelStackFrame = forwardJumpStackFrames.get(label);
if (labelStackFrame != null) {
stackFrame = labelStackFrame;
superClassConstructorCalled = false; // the problem is here in this new line
forwardJumpStackFrames.remove(label);
}
}
}
```
Starting with version 6.x, it incorrectly infers that the super class constructor has not been called yet. This is a stronger step, and I think it may be overkill. I think it's wrong because I am not creating any labels until `onMethodEnter()` occurs, which necessarily takes place after INVOKESPECIAL is seen. I do see the `visitLabel()` is called within `readCode()` when reading the `exception_table`, so maybe this is the source of the troublesome labels.
Anyway, this causes a problem when you call methods on AdviceAdapter like `visitJumpInsn()` that try to update the model of the stack because it now believes it's in the area before the superclass constructor is called:
```@Override
public void visitJumpInsn(final int opcode, final Label label) {
super.visitJumpInsn(opcode, label);
if (isConstructor && !superClassConstructorCalled) {
switch (opcode) {
case IFEQ:
case IFNE:
case IFLT:
case IFGE:
case IFGT:
case IFLE:
case IFNULL:
case IFNONNULL:
popValue();
```
The `popValue()` is called with an empty stack, and then you get an exception like:
```java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.elementData(ArrayList.java:422)
at java.util.ArrayList.remove(ArrayList.java:499)
at org.objectweb.asm.commons.AdviceAdapter.popValue(AdviceAdapter.java:589)
at org.objectweb.asm.commons.AdviceAdapter.visitJumpInsn(AdviceAdapter.java:520)
```
Please see the attached minimal test case.
I am not sure of all the conditions that could cause this issue to occur, but it seems like `InputStreamReader.<init>(InputStream)` is one candidate. Maybe I am missing something, because it seems like these conditions don't seem hard to satisfy. Maybe the compiler is producing a funny exception_table for InputStreamReader, but I'm not sure I'm qualified to speculate any further.
My workaround, which is working just fine and instrumenting a number of diverse JREs and systems, is to create my own version of AdviceAdapter with the `superClassConstructorCalled = false` line taken out.
There weren't a lot of comments and no change logs around this change in behavior so I wanted to know:
1) Do you agree that setting `superClassConstructorCalled = false` is jarring and probably incorrect?
2) Is there any piece of the story am I missing? Was there a change in Java 9/10/11 that precipitated this more aggressive behavior?
3) Is whoever's compiling the Oracle InputStreamReader class creating a funny bytecode?
I have other examples of classes that cause similar issues, but this was the simplest test case to give to you.
[ASMForwardJumpTest.java](/uploads/c26f3c36f19bf06017fa606e907a60c7/ASMForwardJumpTest.java)
[InputStreamReader.class](/uploads/9779a4437cb1e2205e9a9e1b8779520c/InputStreamReader.class)https://gitlab.ow2.org/asm/asm/-/issues/317855Bytecode instruction `ldc2_w` transformed to `ldc`2018-09-05T01:44:02ZBen KushigianBytecode instruction `ldc2_w` transformed to `ldc`I'm not sure if this is properly a bug or an intentional design decision, so apologies
if this is the latter (or if there is an easy solution...)
Problem
=======
Given a bytecode instruction `ldc2_w` in a classfile the resultant `Method...I'm not sure if this is properly a bug or an intentional design decision, so apologies
if this is the latter (or if there is an easy solution...)
Problem
=======
Given a bytecode instruction `ldc2_w` in a classfile the resultant `MethodNode` has
replaced the `ldc2_w` instance with an `ldc` instruction (i.e., opcode 20 => 18).
Example
=======
Given the following method
```java
void example() {
int i = 65536; // Too big for two bytes
long l = 65537;
}
```
calling `javac ...; javap -c ...;` yields
```
void example();
Code:
0: ldc #26 // int 65536
2: istore_1
3: ldc2_w #27 // long 65537l
6: lstore_2
7: return
```
which has width data about the values being loaded (double precision, etc).
Once I've loaded this with asm and inspect the instruction list in the debugger
I get the following (note instructions 2 and 6 which are identical modulo their
respective values):
![LDC-collision](/uploads/670dcba4f08f45da2cca1b3a19f48c1f/LDC-collision.png)
Here we see that both `ldcxxx` ops have opcode 18 and no other differentiating data.
Why This Matters
================
In my specific use case I'm simulating the JVM and am depending on the specific
asm bytecode values to give me width data. This could be resolved with an extra
pass or some sort of lookahead to glean width data but it would be nice to have
the expected opcode
Possible Workaround
===================
A potential workaround is to do a prepass to glean type/width data. This is possible
but not desirable since isn't obvious to me that there won't be subtleties to a correct
implementation that I miss, subtly breaking my software. Further, this seems like a fair
amount of implementation work to correct for something that could be known by getting
the actual opcode.
##https://gitlab.ow2.org/asm/asm/-/issues/317854Inconsistent behaviour of ClassReader and ClassVisitor under Java 11 in versi...2018-09-03T08:12:41ZDimitry PolivaevInconsistent behaviour of ClassReader and ClassVisitor under Java 11 in version 6.2.1in asm 6.2.1 ClassVisitor method visitNestMemberExperimental checks that api version is not less than Opcodes.ASM7_EXPERIMENTAL = 17235968
/** @deprecated */
@Deprecated
public void visitNestMemberExperimental(String nestMemb...in asm 6.2.1 ClassVisitor method visitNestMemberExperimental checks that api version is not less than Opcodes.ASM7_EXPERIMENTAL = 17235968
/** @deprecated */
@Deprecated
public void visitNestMemberExperimental(String nestMember) {
if (this.api < 17235968) {
throw new UnsupportedOperationException();
} else {
if (this.cv != null) {
this.cv.visitNestMemberExperimental(nestMember);
}
}
}
but the calling method ClassReader.accept(groovyjarjarasm.asm.ClassVisitor, groovyjarjarasm.asm.Attribute[], int) does not make any checks on it.
if (nestMembersOffset != 0) {
fieldsCount = this.readUnsignedShort(nestMembersOffset);
for(methodsCount = nestMembersOffset + 2; fieldsCount-- > 0; methodsCount += 2) {
classVisitor.visitNestMemberExperimental(this.readClass(methodsCount, charBuffer));
}
}
It leads to issues like https://issues.apache.org/jira/browse/GROOVY-8727.
Example stacktrace:
~~~~
java.lang.UnsupportedOperationException
at groovyjarjarasm.asm.ClassVisitor.visitNestMemberExperimental(ClassVisitor.java:248)
at groovyjarjarasm.asm.ClassReader.accept(ClassReader.java:651)
at groovyjarjarasm.asm.ClassReader.accept(ClassReader.java:391)
at org.codehaus.groovy.ast.decompiled.AsmDecompiler.parseClass(AsmDecompiler.java:83)
at org.codehaus.groovy.control.ClassNodeResolver.findDecompiled(ClassNodeResolver.java:254)
at org.codehaus.groovy.control.ClassNodeResolver.tryAsLoaderClassOrScript(ClassNodeResolver.java:192)
at org.codehaus.groovy.control.ClassNodeResolver.findClassNode(ClassNodeResolver.java:172)
at org.codehaus.groovy.control.ClassNodeResolver.resolveName(ClassNodeResolver.java:128)
at org.codehaus.groovy.control.ResolveVisitor.resolveToOuter(ResolveVisitor.java:744)
at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:394)
at org.codehaus.groovy.control.ResolveVisitor.resolveFromDefaultImports(ResolveVisitor.java:522)
at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:392)
at org.codehaus.groovy.control.ResolveVisitor.resolve(ResolveVisitor.java:355)
at org.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:339)
at org.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:351)
at org.codehaus.groovy.control.ResolveVisitor.transformConstructorCallExpression(ResolveVisitor.java:1141)
at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:774)
at org.codehaus.groovy.control.ResolveVisitor.transformMethodCallExpression(ResolveVisitor.java:1156)
at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:770)
at org.codehaus.groovy.control.ResolveVisitor.transformMethodCallExpression(ResolveVisitor.java:1156)
at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:770)
at org.codehaus.groovy.control.ResolveVisitor.transformBinaryExpression(ResolveVisitor.java:1048)
at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:768)
at org.codehaus.groovy.control.ResolveVisitor.transformBinaryExpression(ResolveVisitor.java:1109)
at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:768)
at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitExpressionStatement(ClassCodeExpressionTransformer.java:144)
at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:88)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:106)
at org.codehaus.groovy.control.ResolveVisitor.visitBlockStatement(ResolveVisitor.java:1430)
at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:110)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:121)
at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitConstructorOrMethod(ClassCodeExpressionTransformer.java:55)
at org.codehaus.groovy.control.ResolveVisitor.visitConstructorOrMethod(ResolveVisitor.java:249)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:132)
at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1103)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:54)
at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1375)
at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:222)
at org.codehaus.groovy.control.CompilationUnit$13.call(CompilationUnit.java:691)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:968)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:633)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:582)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:354)
at groovy.lang.GroovyClassLoader.access$300(GroovyClassLoader.java:87)
at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:323)
at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:320)
at org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:147)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:318)
~~~~https://gitlab.ow2.org/asm/asm/-/issues/317853SimpleVerifier merges types incorrectly when one type is an interface2018-09-03T18:19:08ZEric BrunetonSimpleVerifier merges types incorrectly when one type is an interfaceSee detailed description in https://mail.ow2.org/wws/arc/asm/2018-08/msg00002.html.See detailed description in https://mail.ow2.org/wws/arc/asm/2018-08/msg00002.html.Eric BrunetonEric Brunetonhttps://gitlab.ow2.org/asm/asm/-/issues/317852Remapper doesn't handle ConstantDynamic2018-09-06T20:20:41ZlauritRemapper doesn't handle ConstantDynamicTest renaming condy type from Foo to Bar
```java
import java.lang.invoke.MethodHandles;
import java.util.concurrent.atomic.AtomicReference;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectw...Test renaming condy type from Foo to Bar
```java
import java.lang.invoke.MethodHandles;
import java.util.concurrent.atomic.AtomicReference;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.ConstantDynamic;
import org.objectweb.asm.Handle;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.commons.ClassRemapper;
import org.objectweb.asm.commons.Remapper;
public class Test3 implements Opcodes {
public static void main(String... args) throws Exception {
byte[] bytes = dumpBytes();
AtomicReference<Class<?>> ref = new AtomicReference<>();
new ClassLoader() {{
ref.set((Class<?>) defineClass("Target", bytes, 0, bytes.length));
}};
Class<?> c = ref.get();
Object o = c.getDeclaredConstructor().newInstance();
System.out.println(c.getDeclaredMethod("test").invoke(o));
}
// public static Foo create(MethodHandles.Lookup lookup, String name, Class<?> owner) {
// return new Foo();
// }
public static Bar create(MethodHandles.Lookup lookup, String name, Class<?> owner) {
return new Bar();
}
public static byte[] dumpBytes() {
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
ClassVisitor cv = cw;
cv = new ClassRemapper(ASM7_EXPERIMENTAL, cv, new Remapper() {
@Override
public String map(String s) {
// rename Foo to Bar
if ("Foo".equals(s))
return "Bar";
return s;
}
/*
@Override
public Object mapValue(final Object value) {
if (value instanceof ConstantDynamic) {
ConstantDynamic cd = (ConstantDynamic) value;
Object[] bootstrapMethodArguments = cd.getBootstrapMethodArguments();
Object[] remappedBootstrapMethodArguments = new Object[bootstrapMethodArguments.length];
for (int i = 0; i < bootstrapMethodArguments.length; ++i) {
remappedBootstrapMethodArguments[i] = mapValue(bootstrapMethodArguments[i]);
}
return new ConstantDynamic(cd.getName(),
mapDesc(cd.getDescriptor()),
(Handle) mapValue(cd.getBootstrapMethod()),
remappedBootstrapMethodArguments);
}
return super.mapValue(value);
}
*/
}) {}; // must subclass ClassRemapper and set api to ASM7_EXPERIMENTAL as ClassRemapper defaults to ASM6
cv.visit(V11, ACC_PUBLIC | ACC_SUPER, "Target", null, "java/lang/Object", null);
MethodVisitor mv;
mv = cv.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
mv.visitCode();
mv.visitVarInsn(ALOAD, 0);
mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
mv.visitInsn(RETURN);
mv.visitMaxs(1, 1);
mv.visitEnd();
mv = cv.visitMethod(ACC_PUBLIC, "test", "()LFoo;", null, null);
mv.visitCode();
mv.visitLdcInsn(new ConstantDynamic("test", "LFoo;", new Handle(H_INVOKESTATIC, "Test3", "create", "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;)LFoo;", false)));
mv.visitInsn(ARETURN);
mv.visitMaxs(0, 0);
mv.visitEnd();
cv.visitEnd();
return cw.toByteArray();
}
}
public class Bar {
}
public class Foo {
}
```Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/issues/317851Analyzer gets StackOverflowError when method has lots of jumps2018-09-02T13:20:32ZlauritAnalyzer gets StackOverflowError when method has lots of jumps```java
import org.objectweb.asm.Label;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.MethodNode;
import org.objectweb.asm.tree.analysis.Analyzer;
import org.objectweb.asm.tree.analysis.BasicInterpreter;
import org.obj...```java
import org.objectweb.asm.Label;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.MethodNode;
import org.objectweb.asm.tree.analysis.Analyzer;
import org.objectweb.asm.tree.analysis.BasicInterpreter;
import org.objectweb.asm.tree.analysis.BasicValue;
public class Test2 implements Opcodes {
public static void main(String... args) throws Exception {
MethodNode mv = new MethodNode(ACC_PUBLIC, "test", "()V", null, null);
mv.visitCode();
for (int i = 0; i < 5000; i++) {
Label label = new Label();
mv.visitJumpInsn(GOTO, label);
mv.visitLabel(label);
}
mv.visitInsn(RETURN);
mv.visitMaxs(0, 1);
mv.visitEnd();
Analyzer<BasicValue> a = new Analyzer<>(new BasicInterpreter());
a.analyze("test", mv);
}
}
```
For me it would be enough if i could somehow communicate to analyzer that method does not have any JSRs and it could skip finding subroutines.Eric BrunetonEric Brunetonhttps://gitlab.ow2.org/asm/asm/-/issues/317850Condy that returns long or double generates bad bytecode2018-09-05T18:40:19ZlauritCondy that returns long or double generates bad bytecodeMethodWriter.visitLdcInsn should emit LDC2_W instead of LDC for condy of long/double.
```java
import java.lang.invoke.MethodHandles;
import java.util.concurrent.atomic.AtomicReference;
import org.objectweb.asm.ClassWriter;
import org.o...MethodWriter.visitLdcInsn should emit LDC2_W instead of LDC for condy of long/double.
```java
import java.lang.invoke.MethodHandles;
import java.util.concurrent.atomic.AtomicReference;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.ConstantDynamic;
import org.objectweb.asm.Handle;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
public class Test implements Opcodes {
public static void main(String... args) throws Exception {
byte[] bytes = dumpBytes();
AtomicReference<Class<?>> ref = new AtomicReference<>();
new ClassLoader() {{
ref.set((Class<?>) defineClass("Target", bytes, 0, bytes.length));
}};
Class<?> c = ref.get();
Object o = c.getDeclaredConstructor().newInstance();
System.out.println(c.getDeclaredMethod("test").invoke(o));
}
public static long create(MethodHandles.Lookup lookup, String name, Class<?> owner) {
return 1;
}
public static byte[] dumpBytes() {
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
cw.visit(V11, ACC_PUBLIC | ACC_SUPER, "Target", null, "java/lang/Object", null);
MethodVisitor mv;
mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
mv.visitCode();
mv.visitVarInsn(ALOAD, 0);
mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
mv.visitInsn(RETURN);
mv.visitMaxs(1, 1);
mv.visitEnd();
mv = cw.visitMethod(ACC_PUBLIC, "test", "()J", null, null);
mv.visitCode();
mv.visitLdcInsn(new ConstantDynamic("test", "J", new Handle(H_INVOKESTATIC, "Test", "create", "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/Class;)J", false)));
mv.visitInsn(LRETURN);
mv.visitMaxs(0, 0);
mv.visitEnd();
cw.visitEnd();
return cw.toByteArray();
}
}
```Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/issues/317849Provide method to get latest supported API2019-10-07T17:30:29ZRobert ScholteProvide method to get latest supported APIWith the new Java Release Train it is quite hard for the Apache Maven team to keep up and do releases when there's a new API for the class. Depending on the stage of the plugin specifying a newer version of ASM as dependency can be good ...With the new Java Release Train it is quite hard for the Apache Maven team to keep up and do releases when there's a new API for the class. Depending on the stage of the plugin specifying a newer version of ASM as dependency can be good enough, but sometimes a newer version of the api need to be passed to the ClassVisitor as well.
I could create a parameter for it so users can specify it themselves, but if they're hitting an issue, it is because they are not using the latest supported API.
It would be great for us if we could somehow use the latest api, either by a new constructor without the need to specify the API, and/or a method to get the latest supported version (with or without experimental...)https://gitlab.ow2.org/asm/asm/-/issues/317848Type names no longer included in declaration comments produced by Textifier2018-08-27T18:00:56ZJ TorkkolaType names no longer included in declaration comments produced by Textifierc0f7167d changed [`Textifier`](https://gitlab.ow2.org/asm/asm/commit/c0f7167da41435bd01b3e9891590693bbe3438fb#88bcb89b593f2c9040b50d27f43779bc62b9730d_230_177) to no longer include the type name first as part of `// declaration:` comment...c0f7167d changed [`Textifier`](https://gitlab.ow2.org/asm/asm/commit/c0f7167da41435bd01b3e9891590693bbe3438fb#88bcb89b593f2c9040b50d27f43779bc62b9730d_230_177) to no longer include the type name first as part of `// declaration:` comments. Was this intentional, @ebruneton?
Example:
```
// class version 52.0 (52)
// access flags 0x4421
// signature Ljava/lang/Enum<Lcom/example/buck/A;>;Ljava/lang/Runnable;
// declaration: com/example/buck/A extends java.lang.Enum<com.example.buck.A> implements java.lang.Runnable
public abstract enum com/example/buck/A extends java/lang/Enum implements java/lang/Runnable {
```
->
```
// class version 52.0 (52)
// access flags 0x4421
// signature Ljava/lang/Enum<Lcom/example/buck/A;>;Ljava/lang/Runnable;
// declaration: extends java.lang.Enum<com.example.buck.A> implements java.lang.Runnable
public abstract enum com/example/buck/A extends java/lang/Enum implements java/lang/Runnable {
```https://gitlab.ow2.org/asm/asm/-/issues/317847Gradle build missing Implementation-Version property2018-08-21T20:12:47ZUrban MalcGradle build missing Implementation-Version propertyAs mentioned, Gradle build is missing the `Implementation-Version` property. This prevents asm library version lookup with the `getImplementationVersion()` method. E.g:
```java
System.out.println(Opcodes.class.getPackage().getImplementa...As mentioned, Gradle build is missing the `Implementation-Version` property. This prevents asm library version lookup with the `getImplementationVersion()` method. E.g:
```java
System.out.println(Opcodes.class.getPackage().getImplementationVersion());
```
The problem is that some libraries were using this approach to determine asm library version (see [this](https://github.com/eclipse/jetty.project/issues/2834) Jetty issue).
Affected are all version above `6.0` (`6.1`, `6.1.1`, `6.2`, `6.2.1`). It seems like the property went missing when the project switched from Ant build to Gradle with transition from `6.0` to `6.1`.
Comparing the `MANIFEST.MF` file from Maven Central versions of asm library:
This is the content of `MANIFEST.MF` for asm __6.0__:
```
Manifest-Version: 1.0
Bnd-LastModified: 1506148153920
Bundle-DocURL: http://asm.objectweb.org
Bundle-ManifestVersion: 2
Bundle-Name: ASM
Bundle-RequiredExecutionEnvironment: J2SE-1.3
Bundle-SymbolicName: org.objectweb.asm
Bundle-Vendor: France Telecom R&D
Bundle-Version: 6.0
Created-By: 1.8.0_131 (Oracle Corporation)
Export-Package: org.objectweb.asm;version="6.0",org.objectweb.asm.sign
ature;version="6.0"
Implementation-Title: ASM
Implementation-Vendor: France Telecom R&D
Implementation-Version: 6.0
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.5))"
Tool: Bnd-3.2.0.201605172007
```
This is the content of `MANIFEST.MF` for asm __6.2.1__:
```
Manifest-Version: 1.0
Bundle-DocURL: http://asm.ow2.org
Bundle-ManifestVersion: 2
Bundle-Name: org.objectweb.asm
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-SymbolicName: org.objectweb.asm
Bundle-Version: 6.2.1
Export-Package: org.objectweb.asm;version="6.2.1",org.objectweb.asm.si
gnature;version="6.2.1"
Implementation-Title: ASM, a very small and fast Java bytecode manipul
ation framework
```https://gitlab.ow2.org/asm/asm/-/issues/317846Documentation of ModuleVisitor is incorrect2018-08-28T21:29:51ZraphwDocumentation of ModuleVisitor is incorrectThe javadoc for ModuleVisitor indicates that the visitMainClass method is obligatory and needs to be invoked first. From the code, I would not understand why the method would need to be invoked first. That multiple invocations do not mak...The javadoc for ModuleVisitor indicates that the visitMainClass method is obligatory and needs to be invoked first. From the code, I would not understand why the method would need to be invoked first. That multiple invocations do not make sense is however obvious.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/issues/317845In some cases, ClassReader.readLabel fails when local variables are annotated...2019-09-19T21:26:10ZLyubomyr ShaydarivIn some cases, ClassReader.readLabel fails when local variables are annotated with non-RetentionPolicy.SOURCE retention policy annotationsHello,
I'm not sure if it's a right place to ask, but let me try.
I'm using RetroLambda in order to backport some of my code to Java 6.
During backporting of a particular class I'm getting the following exception:
```
java.lang.Runtime...Hello,
I'm not sure if it's a right place to ask, but let me try.
I'm using RetroLambda in order to backport some of my code to Java 6.
During backporting of a particular class I'm getting the following exception:
```
java.lang.RuntimeException: Failed to backport class: lsh/gtfs/data/feed/CsvDeserializer
at net.orfjackal.retrolambda.Transformers.transform(Transformers.java:129)
at net.orfjackal.retrolambda.Transformers.transform(Transformers.java:107)
at net.orfjackal.retrolambda.Transformers.backportClass(Transformers.java:47)
at net.orfjackal.retrolambda.Retrolambda.run(Retrolambda.java:92)
at net.orfjackal.retrolambda.Main.main(Main.java:28)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 28
at net.orfjackal.retrolambda.asm.ClassReader.readLabel(ClassReader.java:2251)
at net.orfjackal.retrolambda.asm.ClassReader.readTypeAnnotations(ClassReader.java:1678)
at net.orfjackal.retrolambda.asm.ClassReader.readCode(ClassReader.java:1210)
at net.orfjackal.retrolambda.asm.ClassReader.readMethod(ClassReader.java:1032)
at net.orfjackal.retrolambda.asm.ClassReader.accept(ClassReader.java:708)
at net.orfjackal.retrolambda.asm.ClassReader.accept(ClassReader.java:521)
at net.orfjackal.retrolambda.Transformers.lambda$transform$4(Transformers.java:107)
at net.orfjackal.retrolambda.Transformers.transform(Transformers.java:125)
```
Please note that the array index `28` may be different depending on a length of the method that fails to be backported (if I'm not mistaken while trying to narrow down).
Here is the class that fails (it shrank a lot and now looks weird):
```
final class CsvDeserializer
implements IDeserializer<Map<String, String>> {
private static final IDeserializer<Map<String, String>> instance = new CsvDeserializer();
private CsvDeserializer() {
}
static IDeserializer<Map<String, String>> get() {
return instance;
}
@Nonnull
@Override
public CalendarDate toCalendarDate(@Nonnull final Map<String, String> row) {
@Nonnull
@Id LocalDate date = As.id(null); // a factory method to check legal values assignment (ids can be only assigned to ids) using Checker Framework
assert date != null; // keep javac from discarding the `date` reference
return null; // no need to instantiate for testing purposes
}
}
```
Once I remove the `@Id` annotation from the `date` reference, it succeeds.
However, if I, for example, move the same code to another method (cannot see the reasons clear, and not sure how do I do it) or change the `@Id` retention policy to `SOURCE` (actually Checker Framework requires `CLASS` to work across modules), it succeeds too.
The `@Id` annotation is declared as follows:
```
@SubtypeOf(Any.class)
@Target({ ElementType.TYPE_USE, ElementType.TYPE_PARAMETER })
public @interface Id {
}
```
How I run it:
```
java \
-Dretrolambda.bytecodeVersion=50 \
-Dretrolambda.classpath=input \
-Dretrolambda.defaultMethods=true \
-Dretrolambda.inputDir=input \
-Dretrolambda.outputDir=output \
-jar retrolambda-2.5.4.jar[javacbug.zip](/uploads/0a023a9ee93c395aca5d280977aec740/javacbug.zip)
```
My toolchain:
* Retrolambda 2.5.4 with transitive `asm-debug-all:5.2`
* Oracle JDK 1.8.0_151 (Windows/Linux; x64)
I tried to rebuild Retrolambda 2.5.5-SNAPSHOT with `asm-debug-all:6.0_BETA` -- the effect is the same.
(Not sure, Retrolambda seems to be unable to be easily upgraded to a newer asm 6+ -- it can use 5.2 only.)
Could you please confirm the issue?
Thanks.
[CsvDeserializer.class](/uploads/af091cd028b683637ad49aab6a6cb12a/CsvDeserializer.class)https://gitlab.ow2.org/asm/asm/-/issues/317844branch name prevents jgit operations on Windows2018-08-05T06:56:44ZAndrey Loskutovbranch name prevents jgit operations on WindowsUnfortunately jgit on Windows is limited and does not allow refs to contain "<" character.
There is a merged branch "check-method-adapter-doesn't-allow-<init>-when-ldc-a-method-handle
" which prevents jgit to pull from this repository.
...Unfortunately jgit on Windows is limited and does not allow refs to contain "<" character.
There is a merged branch "check-method-adapter-doesn't-allow-<init>-when-ldc-a-method-handle
" which prevents jgit to pull from this repository.
@forax: Can we please delete this branch?
Thanks.
```
java.nio.file.InvalidPathException: Illegal char <<> at index 71: C:\git\asm\.git\refs\remotes\origin\check-method-adapter-doesn't-allow-<init>-when-ldc-a-method-handle
at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94)
at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255)
at java.io.File.toPath(File.java:2234)
at org.eclipse.jgit.util.FileUtils.exists(FileUtils.java:675)
at org.eclipse.jgit.util.FS.exists(FS.java:794)
at org.eclipse.jgit.internal.storage.file.RefDirectory.pack(RefDirectory.java:781)
at org.eclipse.jgit.internal.storage.file.RefDirectory.pack(RefDirectory.java:716)
at org.eclipse.jgit.internal.storage.file.PackedBatchRefUpdate.execute(PackedBatchRefUpdate.java:180)
at org.eclipse.jgit.lib.BatchRefUpdate.execute(BatchRefUpdate.java:635)
at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:225)
at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:123)
at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1271)
at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:243)
at org.eclipse.jgit.api.PullCommand.call(PullCommand.java:290)
```https://gitlab.ow2.org/asm/asm/-/issues/317843Bug in CheckMethodAdapter2018-08-04T13:49:54ZStephane EpardaudBug in CheckMethodAdapterI got the following exception:
```
Caused by: java.lang.IllegalArgumentException: Invalid handle name (must be a valid unqualified name): <init>
at com.github.fromage.quasi.asm.util.CheckMethodAdapter.checkMethodIdentifier (CheckMet...I got the following exception:
```
Caused by: java.lang.IllegalArgumentException: Invalid handle name (must be a valid unqualified name): <init>
at com.github.fromage.quasi.asm.util.CheckMethodAdapter.checkMethodIdentifier (CheckMethodAdapter.java:1282)
at com.github.fromage.quasi.asm.util.CheckMethodAdapter.checkLdcConstant (CheckMethodAdapter.java:1201)
at com.github.fromage.quasi.asm.util.CheckMethodAdapter.visitInvokeDynamicInsn (CheckMethodAdapter.java:780)
at com.github.fromage.quasi.asm.tree.InvokeDynamicInsnNode.accept (InvokeDynamicInsnNode.java:85)
at com.github.fromage.quasi.asm.tree.InsnList.accept (InsnList.java:145)
```
Due to a perfectly valid bootstrap method:
```
0: #117 invokestatic java/lang/invoke/LambdaMetafactory.metafactory:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;
Method arguments:
#118 (Ljava/lang/Object;)Ljava/lang/Object;
#122 newinvokespecial net/redpipe/example/wiki/keycloakJooq/jooq/tables/pojos/Pages."<init>":(Lio/vertx/core/json/JsonObject;)V
#124 (Lio/vertx/core/json/JsonObject;)Lnet/redpipe/example/wiki/keycloakJooq/jooq/tables/pojos/Pages;
```
I guess this one is due to passing a `Pages::new` lambda to a method.