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

Request to update error messages from javac for negative varargs test cases

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • None
    • tools
    • b03
    • Verified

      javac needs to show more information in error message for the following negative varargs test cases:
      1. Misplaced ellipsis: void foo( String s, Object o... ) { }
      2. Varargs is not the last argument: void foo(String... s, int i){}

      As per Jon's review: In both cases, the dominant (first) error message is "')' expected". In both cases, the reality is the language allows any of ',', ')', or '[' there, and javac is wrong for not mentioning all of these possibilities.

      Please refer to the attached test cases and the current corresponding .out files.

        1. MisplacedEllipsis.java
          0.3 kB
        2. MisplacedEllipsis.out
          0.3 kB
        3. VarargsNotLastArg.java
          0.3 kB
        4. VarargsNotLastArg.out
          0.1 kB

            jlahoda Jan Lahoda
            sogoel Sonali Goel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: