<div dir="ltr">Currently, TypeArg is only used by 2 consumers: javap and Class-File API's own Class remapper. This impact should be relatively miniscule.<div><br></div><div>The creation factories will be updated to return the more specific types; too. Currently, no producer in the JDK uses those factories except Class-File API's own parsing.</div><div><br></div><div>Thus, I believe the impact is on the lesser end. Before we perform the refactor, should we handle default, extends, super in one class + 3-value enum or 3 classes (like RuntimeInvisible/Visible annotations)?</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Nov 4, 2023 at 10:06 PM Brian Goetz <<a href="mailto:brian.goetz@oracle.com" target="_blank">brian.goetz@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

  
  <div>
    <font size="4"><font face="monospace">Makes sense.  Would be good to
        rough this out to see the impact on the codebase?<br>
        <br>
        <br>
      </font></font><br>
    <div>On 11/3/2023 9:23 PM, - wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">Hello,<br>
        <div>I am currently looking into reimplementing core
          reflection's signature parsing to be based off the new
          Class-file API.</div>
        <div><br>
        </div>
        <div>One thing I noticed when using Signature.TypeArg is that it
          is a perfect candidate for algebraic data type, like:</div>
        <div>TypeArg</div>
        <div>  - Unbounded: a singleton ENUM</div>
        <div>  - Bounded: has 2 fields: 3-way wildcard indicator (+-and
          none), a RefTypeSig</div>
        <div><br>
        </div>
        <div>Alternatively, Bounded can be split into 3 classes that
          each hold a RefTypeSig instead of using the 3-way indicator,
          for the ref type sig is not really interchangeable. </div>
        <div><br>
        </div>
        <div>This model's main advantage is that users can be assured
          that they can just obtain RefTypeSig if the TypeArg is
          bounded, without having to write dubious
          Optional.get()/orElseThrow() in user code.</div>
        <div><br>
        </div>
        <div>Best,</div>
        <div>Chen Liang</div>
      </div>
    </blockquote>
    <br>
  </div>

</blockquote></div>