<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 02/02/2023 14:33, Archie Cobbs
      wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:CANSoFxs=cszkRC5MmEzhWr7W67cd6YxQPaxAK5M1KG5ctf06dw@mail.gmail.com">
      <div>Referring to the example (btw, I forgot to include the return
        type of the method which obviously is <span style="font-family:monospace">float</span>):</div>
      <div><br>
      </div>
      <div>- Any call to <span style="font-family:monospace">toFloat()</span>
        is correct, because <span style="font-family:monospace">T</span>
        has <span style="font-family:monospace">Number</span> as upper
        bound. Same as if the method were not static and you invoked it
        on a <span style="font-family:monospace">Foo<?></span>.</div>
      <div>- If a static method returns T, then the compiler treats this
        as if it returned <span style="font-family:monospace">? extends
          Number</span>.</div>
      <div>- The synthetic cast for <span style="font-family:monospace">T</span>
        would always be to <span style="font-family:monospace">Number</span></div>
      <div><br>
      </div>
      <div>I'm NOT saying that allowing static methods would be an
        intuitive and obviously beneficial addition to the language. I'm
        just saying that it could be done in a reasonably coherent way.
        The point of that is just to provide more evidence that it's NOT
        automatically true that type parameters should be forbidden from
        static contexts.<br>
      </div>
      <div>
        <div>
          <div><br>
          </div>
        </div>
      </div>
    </blockquote>
    <p>There are indeed more ways to get there - but I believe that this
      particular way doesn't seem very economical - because different
      occurrences of T in different methods (static vs. instance) end up
      having different semantics. Which seems indesirable and put (as
      Remi observed) this on collision course with any attempt to add
      "species statics" later on (e.g. specialization-specific type
      parameters).</p>
    <p>So, in abstract terms I agree with you; for the specific case of
      the Java language we have, I tend to disagree - regular type
      parameters and static contexts don't seem a good fit.<br>
    </p>
    <p>Maurizio<br>
    </p>
  </body>
</html>