asm merge requestshttps://gitlab.ow2.org/asm/asm/-/merge_requests2018-03-11T21:50:38Zhttps://gitlab.ow2.org/asm/asm/-/merge_requests/56Remove the workaround introduced for synthetic parameters.2018-03-11T21:50:38ZEric BrunetonRemove the workaround introduced for synthetic parameters.A workaround was added in 4accca37 for issue #307392. The root cause of the bug was that, via a ClassReader->ClassWriter transform, the length of the parameter_annotations array in the Runtime[In]VisibleParameterAnnotations attribute was...A workaround was added in 4accca37 for issue #307392. The root cause of the bug was that, via a ClassReader->ClassWriter transform, the length of the parameter_annotations array in the Runtime[In]VisibleParameterAnnotations attribute was not preserved (the number read in ClassReader was ignored, and it was recomputed from the descriptor in MethodWriter).
The workaround added at this time was fixing that, and it was also attempting to report parameter indices corresponding to the source parameters, assuming that the implicit parameters were at added at the begining. However, synthetic parameters can also be added at the end (see issue #317788), so the second part of the above workaround does not work.
This change removes this workaround, and replaces it with a new visitAnnotableParameterCount method to preserve the size of the above array in a ClassReader->ClassWriter chain. In other words, this change still fixes the root cause of #307392 (closed), but no longer attempts to map bytecode parameter indices to source level parameter indices. We believe there is no universal method for doing that, but users can implement their own method, if desired, on top of the ASM API. Indeed, the JVMS spec states that (https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.18):
> The i'th entry in the parameter_annotations table may, but is not required to, correspond to the i'th parameter descriptor in the method descriptor (§4.3.3).
>
> For example, a compiler may choose to create entries in the table corresponding only to those parameter descriptors which represent explicitly declared parameters in source code. In the Java programming language, a constructor of an inner class is specified to have an implicitly declared parameter before its explicitly declared parameters (JLS §8.8.1), so the corresponding <init> method in a class file has a parameter descriptor representing the implicitly declared parameter before any parameter descriptors representing explicitly declared parameters. If the first explicitly declared parameter is annotated in source code, then a compiler may create parameter_annotations[0] to store annotations corresponding to the second parameter descriptor.
Note that the new visit method need not be called. By default (for instance for classes generated from scratch, without a ClassReader), the number of annotable parameters is the number of parameters in the method descriptor. This was also the case with the current code (i.e. when no ASM specific Ljava/lang/Synthetic; annotation was used to mark synthetic parameters). In theory, we should define a new API version, e.g. ASM_6_1, and implement the full backward compatibility mechanism for this new visit method, but I'm not sure it is worth doing so. What do you think?
Closes #317788Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/44Remove the workaround introduced for synthetic parameters.2017-11-07T19:34:31ZEric BrunetonRemove the workaround introduced for synthetic parameters.A workaround was added in https://gitlab.ow2.org/asm/asm/commit/4accca37fbf28623afeb46148cdaeec2ad97a6be for issue #307392. The root cause of the bug was that, via a ClassReader->ClassWriter transform, the number of parameter annotations...A workaround was added in https://gitlab.ow2.org/asm/asm/commit/4accca37fbf28623afeb46148cdaeec2ad97a6be for issue #307392. The root cause of the bug was that, via a ClassReader->ClassWriter transform, the number of parameter annotations was not preserved (the number read in ClassReader was ignored, and it was recomputed from the descriptor in MethodWriter).
The workaround added at this time was fixing that, and it was also attempting to report parameter indices corresponding to the source parameters, assuming that the implicit parameters were at added at the begining. However, synthetic parameters can also be added at the end (see issue #317788), so the second part of the above workaround does not work.
This change removes this workaround, and replaces it with a method to preserve the num_parameters value read in ClassReader (via a sentinel annotation). In other words, this change still fixes the root cause of #307392, but no longer attempts to map bytecode parameter indices to source level parameter indices. We believe there is no universal method for doing that, but users can implement their own method, if desired, on top of the ASM API. Indeed, the JVMS spec states that (https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.18):
> The i'th entry in the parameter_annotations table may, but is not required to, correspond to the i'th parameter descriptor in the method descriptor (§4.3.3).
>
> For example, a compiler may choose to create entries in the table corresponding only to those parameter descriptors which represent explicitly declared parameters in source code. In the Java programming language, a constructor of an inner class is specified to have an implicitly declared parameter before its explicitly declared parameters (JLS §8.8.1), so the corresponding <init> method in a class file has a parameter descriptor representing the implicitly declared parameter before any parameter descriptors representing explicitly declared parameters. If the first explicitly declared parameter is annotated in source code, then a compiler may create parameter_annotations[0] to store annotations corresponding to the second parameter descriptor.
Closes #317788Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/335Remove the restrictions for the checkDataFlow option in CheckClassAdapter.2022-03-19T20:14:01ZEric BrunetonRemove the restrictions for the checkDataFlow option in CheckClassAdapter.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/3Remove the optimizer and the asm-all and asm-debug-all jars.2017-09-07T19:28:34ZEric BrunetonRemove the optimizer and the asm-all and asm-debug-all jars.The jar size is no longer an issue for the vast majority of the ASM users, unlike the lack of debug info in the default jars. This changes keeps the debug info in the default jars by removing the optimizer. The asm-debug-all jars is then...The jar size is no longer an issue for the vast majority of the ASM users, unlike the lack of debug info in the default jars. This changes keeps the debug info in the default jars by removing the optimizer. The asm-debug-all jars is then no longer necessary, and is thus removed.
Similarly, maintaining compatibility with the JDK 1.3 is no longer necessary (it is unsupported since a long time). Instead, this change uses the JDK 1.5 as the new baseline. This is now striclty enforced (the build will fail if a more recent API is used internally), for all jars (previously different jars were using different baseline APIs).
This change also updates the sigtest tool, which uses a slightly different format to store API descriptions.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/51Remove the duplicated signature files.2017-10-22T13:10:39ZEric BrunetonRemove the duplicated signature files.Some files differ from the content for the previous version only by the version number line, everything else being identical. They can be removed since they only give redundant tests and increase the build time for nothing.Some files differ from the content for the previous version only by the version number line, everything else being identical. They can be removed since they only give redundant tests and increase the build time for nothing.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/231Remove the 1.7 source and target compatibility.2019-01-24T19:45:56ZEric BrunetonRemove the 1.7 source and target compatibility.The Java compiler can not really enforce full 1.7 compatibility unless we specify a bootstrap classpath, but the JDK 7 is no longer supported. Since our retrofitter enforces a stricter 1.5 compatibility, we don't need this less strict ch...The Java compiler can not really enforce full 1.7 compatibility unless we specify a bootstrap classpath, but the JDK 7 is no longer supported. Since our retrofitter enforces a stricter 1.5 compatibility, we don't need this less strict check.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/315Remove redundant '& 0xFF' from int-to-byte cast2021-03-13T10:39:02ZСергей ЦыпановRemove redundant '& 0xFF' from int-to-byte castWhen we do
```java
byte b1 = (byte) (value & 0xFF);
```
we keep from int only 1 lower byte and exactly the same can be achieved with plain cast. See the test below:
```java
public class Main {
public static void main(String[] args) thr...When we do
```java
byte b1 = (byte) (value & 0xFF);
```
we keep from int only 1 lower byte and exactly the same can be achieved with plain cast. See the test below:
```java
public class Main {
public static void main(String[] args) throws Exception {
IntStream.range(Integer.MIN_VALUE, Integer.MAX_VALUE).forEach(value -> {
byte b1 = (byte) (value & 0xFF);
byte b2 = (byte) value;
if (b1 != b2) {
throw new RuntimeException("" + value);
}
});
}
```Eric BrunetonEric Brunetonhttps://gitlab.ow2.org/asm/asm/-/merge_requests/31Remove jbet and BCEL modified verifier tests2017-10-05T19:19:47ZEric BrunetonRemove jbet and BCEL modified verifier testsjbet is no longer available online and the BCEL modified verifier tests give many out of memory errors and are thus not meaningful.jbet is no longer available online and the BCEL modified verifier tests give many out of memory errors and are thus not meaningful.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/365Remove duplicate articles in Javadoc2022-11-01T14:12:57ZJohnny LimRemove duplicate articles in JavadocThis PR removes duplicate articles in Javadoc.This PR removes duplicate articles in Javadoc.https://gitlab.ow2.org/asm/asm/-/merge_requests/42Remove dependencies between test packages.2017-10-07T14:01:52ZEric BrunetonRemove dependencies between test packages.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/356Remove biz aqute bnd gradle plugin2023-01-14T10:23:22ZEric BrunetonRemove biz aqute bnd gradle pluginThe generated Manifest are not exactly the same. For instance, from what I understand the "uses" in `Export-Package` was including only the packages appearing in the public API. It now also lists the packages used in the implementation. ...The generated Manifest are not exactly the same. For instance, from what I understand the "uses" in `Export-Package` was including only the packages appearing in the public API. It now also lists the packages used in the implementation. But I think the Manifest are still valid for OSGi. Example before/after for asm-util:
```
Export-Package: org.objectweb.asm.util;version="9.3";
uses:="org.objectweb.asm,org.objectweb.asm.signature"
Export-Package: org.objectweb.asm.util;version="9.4-SNAPSHOT";
uses:="org.objectweb.asm,org.objectweb.asm.signature,org.objectweb.asm.tree,org.objectweb.asm.tree.analysis"
```
```
Import-Package: org.objectweb.asm;version="[9.3,10)",
org.objectweb.asm.signature;version="[9.3,10)",
org.objectweb.asm.tree;version="[9.3,10)",
org.objectweb.asm.tree.analysis;version="[9.3,10)"
Import-Package: org.objectweb.asm;version="9.4-SNAPSHOT",
org.objectweb.asm.signature;version="9.4-SNAPSHOT",
org.objectweb.asm.tree;version="9.4-SNAPSHOT",
org.objectweb.asm.tree.analysis;version="9.4-SNAPSHOT"
```
Also the `Module-Requires` now lists all transitive dependencies, as the module-info classes.Eric BrunetonEric Brunetonhttps://gitlab.ow2.org/asm/asm/-/merge_requests/381Remove an extra space at the end of a line.2023-10-18T06:14:38ZEric Spishak-ThomasRemove an extra space at the end of a line.https://gitlab.ow2.org/asm/asm/-/merge_requests/203Remapper do not remap constant dynamic and handle correctly2018-09-06T20:20:41ZRemi ForaxRemapper do not remap constant dynamic and handle correctlyAdd the support of ConstantDynamic to Remapper.mapValue and fix the code for Handle.
While working on that fix i've discovered that the code that handles Handle in Remapper.mapValue suppose that the Handle descriptor is always a method ...Add the support of ConstantDynamic to Remapper.mapValue and fix the code for Handle.
While working on that fix i've discovered that the code that handles Handle in Remapper.mapValue suppose that the Handle descriptor is always a method descriptor but it's not true constant method handles that reference a field are decribed using a field descriptor.
close #317852Eric BrunetonEric Brunetonhttps://gitlab.ow2.org/asm/asm/-/merge_requests/327Remap invokedynamic field handles properly2021-09-19T09:21:45ZJamie MansfieldRemap invokedynamic field handles properlyThis was discovered attempting to remap record classes from Java 16 - where we were getting calls to #mapMethodName with field descriptors.
This should resolve #317954.This was discovered attempting to remap record classes from Java 16 - where we were getting calls to #mapMethodName with field descriptors.
This should resolve #317954.https://gitlab.ow2.org/asm/asm/-/merge_requests/175reformat the comments in Opcodes that i've butechered with the previous commit2018-05-14T14:35:20ZRemi Foraxreformat the comments in Opcodes that i've butechered with the previous commitcommitcommitRemi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/37Refactor the unit tests to use JUnit 4 annotations.2017-10-07T11:56:43ZEric BrunetonRefactor the unit tests to use JUnit 4 annotations.Also remove the dependency from AnalyzerUnitTest to ClassWriterComputeMaxUnitTest (by duplicating some code; this will be needed to use a multi-project layout).Also remove the dependency from AnalyzerUnitTest to ClassWriterComputeMaxUnitTest (by duplicating some code; this will be needed to use a multi-project layout).Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/21Refactor the tree analysis tests to use AsmTest.2017-10-02T18:51:29ZEric BrunetonRefactor the tree analysis tests to use AsmTest.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/23Refactor the TraceClassAdapterTest to use AsmTest.2017-10-02T18:32:40ZEric BrunetonRefactor the TraceClassAdapterTest to use AsmTest.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/16Refactor the ClassWriter tests to use AsmTest.2017-10-01T12:25:54ZEric BrunetonRefactor the ClassWriter tests to use AsmTest.Remi ForaxRemi Foraxhttps://gitlab.ow2.org/asm/asm/-/merge_requests/17Refactor the ASMifier tests to use AsmTest.2018-03-11T21:50:38ZEric BrunetonRefactor the ASMifier tests to use AsmTest.The new tests fail with jdk3.* classes because of the handling of synthetic attribute vs flag. With a ClassReader->ClassWriter chain, ClassReader sets the ACC_SYNTHETIC_ATTRIBUTE pseudo access flag to know whether a Synthetic attribute w...The new tests fail with jdk3.* classes because of the handling of synthetic attribute vs flag. With a ClassReader->ClassWriter chain, ClassReader sets the ACC_SYNTHETIC_ATTRIBUTE pseudo access flag to know whether a Synthetic attribute was originally present. But this does not work with ASMifier (no ClassReader involved). To fix this I removed the ACC_SYNTHETIC_ATTRIBUTE pseudo access flag, and instead generate either the attribute or the access flag in ClassWriter, depending on the class version. This means a ClassReader->ClassWriter chain can change the attribute to an access flag, or vice versa, only with "strange" classes where the flag is used before 1.5, or the attribute is used after 1.5. I believe this does not introduce a regression for issue #314934, which was fixed with https://gitlab.ow2.org/asm/asm/commit/46b53a9ddae932d4813b1b3e95ed6ef3e1d6a238.Remi ForaxRemi Forax