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

Access error when unboxing a primitive whose target is a type-variable in a different package

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 9
    • tools
    • b66
    • 9
    • b76
    • Verified

        Let's consider the code below.

        Foo.java:
        package Test10pkg;

        public class Foo {
            public static <T extends Integer> void foo(T a1){}

        }

        Test10.java:
        import Test10pkg.Foo;

        public class Test10 {
            public static void test() {
                Foo.foo(10);
            }
        }

        Compilation results in following error:

        Error:(5, 17) java: valueOf(int) in java.lang.Integer is defined in an inaccessible class or interface

        This is reproduced on JDK9b69.

              mcimadamore Maurizio Cimadamore
              grakov Georgiy Rakov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: