Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6558551

Type variables incorrectly inherits private members

XMLWordPrintable

    • generic
    • generic

      This is a javac bug. A type variable should not "inherit" any private members. This follows from 4.4 and 4.9.

      -Neal

      On 1/11/07, ... wrote:
      Section 4.4 describes the members of type variables and the access to
              them, including an example on page 50. Based on that description, I
              would expect an access error on the reference to E.i, but this is
              accepted by javac.
              
              Did I overlook something in the JLS? If not, is this a JLS error or
              a javac bug?
              
              class X<E extends X<E>> {
                       private static int i;
                       int f() {
                               return E.i;
                       }
              }

            Unassigned Unassigned
            ahe Peter Ahe
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: