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

Make javac error on a generic enum friendlier

    XMLWordPrintable

    Details

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

      Description

      Should an attempt to generify enum lead to a friendlier error?

      ```
      $ cat E.java
      public enum E<T> {}

      $ javac E.java
      E.java:1: error: '{' expected
      public enum E<T> {}
                   ^
      E.java:1: error: <identifier> expected
      public enum E<T> {}
                      ^
      E.java:1: error: reached end of file while parsing
      public enum E<T> {}
                         ^
      3 errors
      ```

      In comparison, here's how javac reports on an attempt to generify annotation:

      ```
      $ cat A.java
      public @interface A<T> {}

      $ javac A.java
      A.java:1: error: annotation interface A cannot be generic
      public @interface A<T> {}
                          ^
      1 error
      ```

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              abimpoudis Angelos Bimpoudis
              Reporter:
              prappo Pavel Rappo
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: