<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p dir="ltr" style="text-align: left; text-indent: 0px;"><span style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">In typical usage, a
<code>.jasm</code> file explicitly specifies the class-file version in its header, for example:</span></p>
<pre><div dir="ltr" class="overflow-y-auto p-4" style="text-align: left; text-indent: 0px; font-size: 12pt; color: rgb(0, 0, 0);"><code>test.jasm
public super class test version 55:0 {}
</code></div></pre>
<p style="text-align: left; text-indent: 0px;"><span style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">If the version isn't specified in the file,
<code>jasm</code> defaults to 45.3.</span></p>
<p style="text-align: left; text-indent: 0px;"><span style="font-size: 16px;">When a version is present in the
</span><span style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><code style="font-family: Aptos, Arial, Helvetica, sans-serif;">.jasm</code></span><span style="font-size: 16px;"> file, the
</span><span style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><code style="font-family: Aptos, Arial, Helvetica, sans-serif;">-cv</code></span><span style="font-size: 16px;"> option
</span>doesn’t override<span style="font-size: 16px;"> it. For example, given a header such as:</span></p>
<pre><div dir="ltr" class="overflow-y-auto p-4" style="text-align: left; text-indent: 0px; font-size: 12pt; color: rgb(0, 0, 0);"><code>public super class test version 55:0 {}
</code></div></pre>
<p style="text-align: left; text-indent: 0px;"><span style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">and the command:</span></p>
<pre><div dir="ltr" class="overflow-y-auto p-4" style="text-align: left; text-indent: 0px; font-size: 12pt; color: rgb(0, 0, 0);"><code>jasm -cv 66.0 -w . test.jasm
</code></div></pre>
<p style="text-align: left; text-indent: 0px;"><span style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">the generated class file will still use version 55.0, because the version defined in the source takes precedence.</span></p>
<p style="text-align: left; text-indent: 0px;"><span style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">If your intention is to force the class-file version - regardless of whether the
<code>.jasm</code> file declares one, then you must use:</span></p>
<pre><div dir="ltr" class="overflow-y-auto p-4" style="text-align: left; text-indent: 0px; font-size: 12pt; color: rgb(0, 0, 0);"><code>jasm -fixcv 66.0 -w . test.jasm
</code></div></pre>
<p style="text-align: left; text-indent: 0px;"><span style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">The
<code>-fixcv</code> option overrides the version unconditionally, while <code>-cv</code> supplies only a fallback value that is used only if the source file does not specify a version.</span></p>
<div dir="ltr" style="color: rgb(0, 0, 0);"><span style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt;">The options (</span><span style="font-family: monospace; font-size: 16px; background-color: rgb(255, 255, 255);">-fixcv, -cv</span><span style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt;">)
were added to support batch updates of large sets of .jasm files. In general, it is preferable to specify the correct class-file version directly in the .jasm source.</span></div>
<div dir="ltr" style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div dir="ltr" style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Leonid</div>
<div dir="ltr" style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
BTW: The latest asmtools release is 9.1, which is preferable to version 8.1 for new or updated workflows.</div>
<div dir="ltr" style="font-family: Aptos, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="mail-editor-reference-message-container">
<div class="ms-outlook-mobile-reference-message skipProofing">
<meta name="Generator" content="Microsoft Exchange Server">
</div>
<div class="ms-outlook-mobile-reference-message skipProofing" style="text-align: left; padding: 3pt 0in 0in; border-width: 1pt medium medium; border-style: solid none none; border-color: rgb(181, 196, 223) currentcolor currentcolor; font-family: Aptos; font-size: 12pt; color: black;">
<b><br>
<p style="font-family:Calibri;font-size:10pt;color:#000000;margin:5pt;font-style:normal;font-weight:normal;text-decoration:none;" align="Left">
Confidential- Oracle Internal<br>
</p>
From: </b>asmtools-dev <asmtools-dev-retn@openjdk.org> on behalf of Jaikiran Pai <jaikiran.pai@oracle.com><br>
<b>Date: </b>Wednesday, December 10, 2025 at 9:06 PM<br>
<b>To: </b>asmtools-dev@openjdk.org <asmtools-dev@openjdk.org><br>
<b>Subject: </b>Does "-cv" option to jasm tool override the class file version in jasm file?<br>
<br>
</div>
<div class="PlainText" style="font-size: 11pt;">When running some jtreg tests that use ".jasm" files, I see this warning<br>
being emitted by asmtools:<br>
<br>
mexit02a.jasm (24:19) Warning: Class file version not specified in file<br>
or by -cv parameter. Defaulting to version "45:3"<br>
<br>
jtreg uses 8.1 version of asmtools and launches<br>
org.openjdk.asmtools.jasm.Main to compile these jasm files. Right now it<br>
doesn't pass any class file version parameter when launching that tool.<br>
To prevent the above warning, I was considering passing "-cv" option to<br>
specify a class file version that would be used if the ".jasm" file<br>
being compiled didn't explicitly have one. However, I then looked at the<br>
code in org.openjdk.asmtools.jasm.Main and that has this comment for<br>
this option parsing<br>
<a href="https://github.com/openjdk/asmtools/blob/8.1/src/org/openjdk/asmtools/jasm/Main.java#L216" data-outlook-id="153fc13c-c7ad-4167-a4fb-621503439978">https://github.com/openjdk/asmtools/blob/8.1/src/org/openjdk/asmtools/jasm/Main.java#L216</a><br>
:<br>
<br>
// overrides cf version even if it's defined in the source file.<br>
case "-fixcv", "-cv" -> {<br>
...<br>
<br>
Is that comment accurate? Would passing "-cv" option to the tool<br>
override the class file version that's present in any .jasm file? I<br>
would like it to be used as a fallback default version if there isn't<br>
one set in the jasm files.<br>
<br>
-Jaikiran<br>
<br>
</div>
</div>
</body>
</html>