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

javac doesn't allow access to protected members in intersection types

XMLWordPrintable

    • b40
    • generic
    • generic
    • Not verified

      javac doesn't seem to handle intersection types membership in a consistent way (it allows access to protected members but forbids access to package private members)
      there are several tck tests regarding this issue:
      allows access to protected members:
      JCK-compiler-7/tests/lang/TYPE/type154/type15406/type15406.html
      forbits access to package private members:
      JCK-compiler-7/tests/lang/CONV/conv148/conv148.html
      There's also another related problem:

      class X<E extends X<E>> {
                   private static int i;
                   int f() {
                           return E.i;
                   }
          }

      'i' shouldn't be accessible from E since is private (and type variable should not inherit private members).

            mcimadamore Maurizio Cimadamore
            vrudomet Victor Rudometov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: