<div dir="ltr">This program compiles without error:<div><br></div><div style="margin-left:40px"><span style="font-family:monospace">import java.util.concurrent.atomic.*;</span></div><div style="margin-left:40px"><span style="font-family:monospace">public class TypeParamStaticContext<T> extends AtomicReference<T> {<br>    public TypeParamStaticContext(Object obj) {<br>        super((T)obj);<br>    }<br>}</span></div><div><br></div><div>Yet according to my reading of the JLS, the appearance of <span style="font-family:monospace">T</span> inside the <span style="font-family:monospace">super()</span> call should be disallowed:<br></div><div><br></div><div>§<a href="http://8.8.7.1">8.8.7.1</a>:</div><div><br></div><div style="margin-left:40px"><span style="background-color:rgb(255,255,0)"><span style="background-color:rgb(255,255,255)">An explicit constructor invocation statement introduces a </span>static
                     context</span> (<a class="gmail-xref" href="https://docs.oracle.com/javase/specs/jls/se19/html/jls-8.html#jls-8.1.3" title="8.1.3. Inner Classes and Enclosing Instances">§8.1.3</a>), which limits the use of
                     constructs that refer to the current object. Notably, the keywords
                     <code class="gmail-literal">this</code> and <code class="gmail-literal">super</code> are prohibited in a static context (<a class="gmail-xref" href="https://docs.oracle.com/javase/specs/jls/se19/html/jls-15.html#jls-15.8.3" title="15.8.3. this">§15.8.3</a>, <a class="gmail-xref" href="https://docs.oracle.com/javase/specs/jls/se19/html/jls-15.html#jls-15.11.2" title="15.11.2. Accessing Superclass Members using super">§15.11.2</a>), as are
                     unqualified references to instance variables, instance methods, and
<span style="background-color:rgb(255,255,0)">                     type parameters of lexically enclosing declarations</span> (<a class="gmail-xref" href="https://docs.oracle.com/javase/specs/jls/se19/html/jls-6.html#jls-6.5.5.1" title="6.5.5.1. Simple Type Names">§6.5.5.1</a>, <a class="gmail-xref" href="https://docs.oracle.com/javase/specs/jls/se19/html/jls-6.html#jls-6.5.6.1" title="6.5.6.1. Simple Expression Names">§6.5.6.1</a>, <a class="gmail-xref" href="https://docs.oracle.com/javase/specs/jls/se19/html/jls-15.html#jls-15.12.3" title="15.12.3. Compile-Time Step 3: Is the Chosen Method Appropriate?">§15.12.3</a>). <br></div><div><br></div><div>§<a href="http://6.5.5.1">6.5.5.1</a>:</div><div style="margin-left:40px"><p class="gmail-norm-error">If a type name consists of a single <span class="emphasis"><em>Identifier</em></span>, then the identifier
                     must occur in the scope of exactly one  declaration of a
                     class, interface, or type parameter with this name (<a class="gmail-xref" href="https://docs.oracle.com/javase/specs/jls/se19/html/jls-6.html#jls-6.3" title="6.3. Scope of a Declaration">§6.3</a>), or a compile-time error occurs.
                  </p>
                  <p class="gmail-norm-error"><a name="jls-6.5.5.1-110"></a>
                     If the declaration denotes a <span style="background-color:rgb(255,255,0)">type parameter of a generic class</span> or interface
                     <span class="gmail-type">C</span> (<a class="gmail-xref" href="https://docs.oracle.com/javase/specs/jls/se19/html/jls-8.html#jls-8.1.2" title="8.1.2. Generic Classes and Type Parameters">§8.1.2</a>, <a class="gmail-xref" href="https://docs.oracle.com/javase/specs/jls/se19/html/jls-9.html#jls-9.1.2" title="9.1.2. Generic Interfaces and Type Parameters">§9.1.2</a>),
                     then <span style="background-color:rgb(255,255,0)">both of the following must be true, or a compile-time error occurs</span>:
                  </p>
                  <div class="gmail-norm">
                     <ul class="gmail-norm" style="list-style-type:disc"><li class="gmail-listitem">
                           <p class="gmail-norm-error"><a name="jls-6.5.5.1-110-A"></a>
                                    <span style="background-color:rgb(255,255,0)">The type name does not occur in a static context</span>
                                    (<a class="gmail-xref" href="https://docs.oracle.com/javase/specs/jls/se19/html/jls-8.html#jls-8.1.3" title="8.1.3. Inner Classes and Enclosing Instances">§8.1.3</a>)</p></li><li class="gmail-listitem"><p class="gmail-norm-error">If the type name appears in a nested class or interface declaration
                                    of <span class="gmail-type">C</span>, then the immediately enclosing class or interface declaration
                                    of the type name is an inner class of <span class="gmail-type">C</span>.
                           
                        </p></li></ul>
                  </div></div><div><br></div><div>What am I missing?</div><div><br></div><div>Thanks,</div><div>-Archie<br></div><div><br>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Archie L. Cobbs<br></div></div></div>