Does "-cv" option to jasm tool override the class file version in jasm file?

Jaikiran Pai jaikiran.pai at oracle.com
Thu Dec 11 05:05:57 UTC 2025


When running some jtreg tests that use ".jasm" files, I see this warning 
being emitted by asmtools:

mexit02a.jasm (24:19) Warning: Class file version not specified in file 
or by -cv parameter. Defaulting to version "45:3"

jtreg uses 8.1 version of asmtools and launches 
org.openjdk.asmtools.jasm.Main to compile these jasm files. Right now it 
doesn't pass any class file version parameter when launching that tool. 
To prevent the above warning, I was considering passing "-cv" option to 
specify a class file version that would be used if the ".jasm" file 
being compiled didn't explicitly have one. However, I then looked at the 
code in org.openjdk.asmtools.jasm.Main and that has this comment for 
this option parsing 
https://github.com/openjdk/asmtools/blob/8.1/src/org/openjdk/asmtools/jasm/Main.java#L216 
:

// overrides cf version even if it's defined in the source file.
case "-fixcv", "-cv" -> {
...

Is that comment accurate? Would passing "-cv" option to the tool 
override the class file version that's present in any .jasm file? I 
would like it to be used as a fallback default version if there isn't 
one set in the jasm files.

-Jaikiran



More information about the asmtools-dev mailing list