<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=Windows-1252">
<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:10.0pt;
        font-family:"Calibri",sans-serif;}
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="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;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="margin-bottom:12.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 liangchenblue@gmail.com <liangchenblue@gmail.com><br>
<b>Date: </b>Wednesday, 1 March 2023 22:03<br>
<b>To: </b>classfile-api-dev@openjdk.org <classfile-api-dev@openjdk.org><br>
<b>Subject: </b>Signature model issues<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt">Hi,<br>
While reviewing the Signature move proposal, I found a few issue with<br>
this model:<br>
<br>
1. Signature.TypeArg specifically represents wildcards, which is one<br>
of the type arguments (the other being reference types represented by<br>
Signature.RefTypeSig). Thus, the current model allows passing in a<br>
wildcard as a bound of another wildcard, which is illegal in both the<br>
Java language and JVM.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">I see, the wildcards model has been probably simplified and squashed too much.<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt">I recommend renaming Signature.TypeArg to Signature.WildcardSig and<br>
make it directly extend Signature instead (or add another common<br>
superinterface for wildcard and ref type signatures).<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Thanks for the proposal, I’ll double-check with all the use cases.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">My first impression when looking at
</span><span style="font-size:11.0pt">Signature.TypeArg</span><span style="font-size:11.0pt">
<span lang="EN-US">now </span></span><span lang="EN-US" style="font-size:11.0pt">is that it
</span><span lang="EN-US" style="font-size:11.0pt">probably should not extend </span>
<span style="font-size:11.0pt">Signature.RefTypeSig</span><span lang="EN-US" style="font-size:11.0pt"> nor Signature. It does not represent a signature according to the spec.</span><span lang="EN-US" style="font-size:11.0pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-size:11.0pt"><br>
<br>
2. Another issue with the model is ClassTypeSig does not validate its<br>
input, so it's currently possible to pass a base type or void<br>
signature as a type argument, which is illegal as well, and it won't<br>
cause an error. If we have the common superinterface recommended<br>
above, we can control such malformed inputs.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt">Right, validation is not there yet. Thanks for pointing it out.<o:p></o:p></span></p>
</div>
</div>
</body>
</html>