RFR: 8356548: Avoid using ASM to parse latest class files in tests

Chen Liang liach at openjdk.org
Thu May 8 18:35:55 UTC 2025


On Thu, 8 May 2025 18:23:58 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> For early eval; test by changing the ClassReader max accepted version of test ASM to 24 instead of 25
>
> test/hotspot/jtreg/compiler/calls/common/InvokeDynamicPatcher.java line 76:
> 
>> 74:             throw new Error("TESTBUG: Can't get code source" + ex, ex);
>> 75:         }
>> 76:         try (FileInputStream fis = new FileInputStream(filePath.toFile())) {
> 
> Don't you have to delete lines 149-155 also?

This path is used to dump the destination bytes. I tried to use `test.classes` to dump the output bytes but to no avail - seems libraries have some custom mechanisms, that I can neither find the location of their classes, nor can I easily pass javac flags for libraries via jtreg.

> test/hotspot/jtreg/runtime/MirrorFrame/Test8003720.java line 30:
> 
>> 28:  * @library /testlibrary/asm
>> 29:  * @modules java.base/jdk.internal.misc
>> 30:  * @compile -XDignore.symbol.file -source 21 -target 21 Victim.java
> 
> Why is this necessary?

The Asmator uses objectweb ASM to transform Victim, which means ASM needs to parse the javac output Victim.class. If this class wishes to be backported in the future, this flag ensures the output class file is of a constant version that ASM on older versions can consistently parse.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/25124#discussion_r2080260173
PR Review Comment: https://git.openjdk.org/jdk/pull/25124#discussion_r2080256577


More information about the serviceability-dev mailing list