<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="en-CZ" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:36.0pt">
<b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">classfile-api-dev <classfile-api-dev-retn@openjdk.org> on behalf of ebruneton@free.fr <ebruneton@free.fr><br>
<b>Date: </b>Tuesday, 19 July 2022 19:27<br>
<b>To: </b>Ben Evans <benjamin.john.evans@gmail.com><br>
<b>Cc: </b>Remi Forax <forax@univ-mlv.fr>, Paul Sandoz <paul.sandoz@oracle.com>, Rafael Winterhalter <rafael.wth@gmail.com>, Brian Goetz <brian.goetz@oracle.com>, classfile-api-dev <classfile-api-dev@openjdk.org>, classfile-api-dev <classfile-api-dev-retn@openjdk.org><br>
<b>Subject: </b>Re: POC: JDK ClassModel -> ASM ClassReader<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><br>
Forward compatibility is a difficult topic I think, even for the <br>
ClassFile API. I don't think users will be able to just upgrade to the <br>
latest JDK to have their ClassFile API code automatically work with the <br>
latest class version. In the majority of cases, maybe. But there will be <br>
cases where their code might silently fail, when the new class version <br>
introduces new features.<br>
<br>
For example, consider the ClassRemapper here <br>
<a href="https://github.com/openjdk/jdk-sandbox/blob/classfile-api-branch/src/java.base/share/classes/jdk/classfile/transforms/ClassRemapper.java">https://github.com/openjdk/jdk-sandbox/blob/classfile-api-branch/src/java.base/share/classes/jdk/classfile/transforms/ClassRemapper.java</a>.
<br>
It seems that it currently does not remap record components, annotations <br>
or type annotations, modules, LDC opcode, etc? You could imagine that it <br>
was written for an old class version, pre annotations. If you upgrade to <br>
a new JDK version with records and type annotations, this code will <br>
silently produce incorrect results, where not everything is remapped. It <br>
might be possible to rewrite it in a more secure way, but this would <br>
probably require all "switch" to list all known options at the time of <br>
writing (and the default case to throw an exception)?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US">Hi Eric,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Thanks for pointing ClassRemapper out. It was written as an example of transformations modularity for jdk.jfr class instrumentation use case.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">The implementation is incomplete yet, however I see no blockers to finish it and keep it up to date with every new JDK feature coming.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Adam</span><o:p></o:p></p>
</div>
</div>
</body>
</html>