Nonrelevant error message when passing int to anonymous class constructor

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P5
    • tbd
    • Affects Version/s: 9
    • Component/s: tools

      Let's consider following example:

      class Test19_2 <T> {
          private static class MyClass {}
          public static MyClass v1 = new MyClass();
          Test19_2(T t, MyClass ... mc) {}
      }

      public class Test19 {
          public static void main(String[] args) {
              new Test19_2<>(1, Test19_2.v1){};
          }
      }

      On JDK9b73 compilation fails with following errors:

      Error:(9, 21) java: incompatible types: cannot infer type arguments for Test19_2<>
          reason: formal varargs element type Test19_2.MyClass is not accessible from class Test19
      Error:(9, 39) java: Test19_2.MyClass has private access in Test19_2
      Error:(9, 24) java: incompatible types: int cannot be converted to T

      The last error message is nonrelevant.

            Assignee:
            Vicente Arturo Romero Zaldivar
            Reporter:
            Georgiy Rakov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: