<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 26/08/2024 14:44, Maurizio
      Cimadamore wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:4856dfb1-e0a1-424d-b90d-203c39b596a8@oracle.com">That
      is, an “extends” or “permits” clause is not really type-checked as
      if inside the body of class C. This results in the accessibility
      problem you point out (which might or might not be a compiler
      glitch, I don’t think the JLS is crystal clear on how Tmp.A should
      be checked).</blockquote>
    <p>I stand corrected - see JLS 6.6:</p>
    <p>
      <blockquote type="cite">A member (class, interface, field, or
        method) of a class, interface, type parameter, or reference
        type, or a constructor of a class, is accessible only if (i) the
        class, interface, type parameter, or reference type is
        accessible, and (ii) the member or constructor is declared to
        permit access: <br>
        [...]<br>
        <div class="norm">
          <ul class="norm" style="list-style-type: circle; ">
            <li class="listitem">
              <p class="norm-static"> Otherwise, the member or
                constructor is declared <code class="literal">private</code>.
                Access is permitted only when one of the following is
                true: </p>
              <div class="norm">
                <ul class="norm" style="list-style-type: square; ">
                  <li class="listitem">
                    <p class="norm-static">Access occurs from within the
                      body of the top level class or interface that
                      encloses the declaration of the member or
                      constructor. </p>
                  </li>
                  <li class="listitem"> Access occurs in the <code class="literal">permits</code> clause of the top
                    level class or interface that encloses the
                    declaration of the member. </li>
                  <li class="listitem">
                    <p class="norm-static">Access occurs in the record
                      component list of the top level record class that
                      encloses the declaration of the member. </p>
                  </li>
                </ul>
              </div>
            </li>
          </ul>
        </div>
      </blockquote>
      So, there's special accessibility pleads for "permits" clauses. So
      yes, this is a javac bug.</p>
    <p>I've added some comments to JDK-8338981.</p>
    <p>Maurizio<br>
    </p>
  </body>
</html>