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

Private member of type variable wrongly accesible

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      This program compiles:

      class T<X extends T<X>> {
          private int t = 123;
          {
              X x = null;
              x.t = 456; // X inherits private member t? Not according to JLS
          }
      }

      According to the JLS 4.4 (Type Variables) the members of
      a type variable are the same as the intersection type 4.9
      (Intersection Types), meaning that this is equivalent:

      class T {
          private int t = 123;
          {
              class X extends T {}
              X x = null;
              x.t = 456;
          }
      }

      This program doesn't compile.

      ###@###.### 2005-03-28 19:33:39 GMT

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mcimadamore Maurizio Cimadamore
                Reporter:
                ahe Peter Ahe
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: