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

spurious error message for compact constructors with throws clause

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 15
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b11

      Description

      javac generates spurious error messages for this test case:

      record R(){
              public R throws Exception {}
      }

      R.java:2: error: <identifier> expected
              public R throws Exception {}
                      ^
      R.java:2: error: field declaration must be static
              public R throws Exception {}
                       ^
        (consider replacing field with record component)
      R.java:2: error: invalid method declaration; return type required
              public R throws Exception {}
                              ^
      Note: R.java uses preview language features.
      Note: Recompile with -Xlint:preview for details.
      3 errors

      a better error message should be generated

        Attachments

          Activity

            People

            Assignee:
            vromero Vicente Arturo Romero Zaldivar
            Reporter:
            vromero Vicente Arturo Romero Zaldivar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: