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

[lworld] javac allows inline type array as varargs arg

    Details

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

      Description

      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();
        }
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sadayapalam Srikanth Adayapalam
                Reporter:
                dsimms David Simms
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: