[lworld] javac allows inline type array as varargs arg

XMLWordPrintable

    • Type: Bug
    • Resolution: Not an Issue
    • Priority: P3
    • repo-valhalla
    • Affects Version/s: repo-valhalla
    • Component/s: tools

      Found when fixing JDK-8224110:

      public class VarArgsArray {

        inline class MyInt {
          int value;
          public MyInt() { this(0); }
          public MyInt(int v) { this.value = v; }
        }

        public VarArgsArray() throws Throwable {
          MyInt[] a = new MyInt[0];
          this.getClass().getDeclaredMethod("test", MyInt[].class).invoke(this, a); // <--- Warns, but in the case of known inline type, should be error
        }

        public void test(MyInt[] a) {
          System.out.println(a);
        }

        public static void main(String[] args) throws Throwable {
          new VarArgsArray();
        }
      }

            Assignee:
            Srikanth Adayapalam (Inactive)
            Reporter:
            David Simms
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: