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

Insufficient alternatives listed in some errors produced by the parser

    XMLWordPrintable

Details

    • b07

    Description

      In some cases, the errors produced by the parser do not list all viable "expected" tokens. For example:
      {code}
      enum E {
          E(String s) { }
          A("");
      }
      {code}

      Will produce:
      {code}
      $ javac E.java
      E.java:2: error: ')' expected
          E(String s) { }
                  ^
      <snip>
      {code}

      But at least ',' is also allowed in this context.

      Another case:
      {code}
      public class TP {
          Foo<? extends A|B> foo1 = null;
      }
      {code}

      errors:
      {code}
      $ javac TP.java
      TP.java:2: error: > expected
          Foo<? extends A|B> foo1 = null;
                         ^
      <snip>
      {code}

      In addition to '>', at least ',' and '&' is allowed at this point.

      Another example that should be investigated:
      {code}
      @SuppressWarnings({,0})
      public class AV {
      }
      {code}

      Errors:
      {code}
      $ javac AV.java
      AV.java:1: error: '}' expected
      @SuppressWarnings({,0})
                          ^
      <snip>
      {code}

      This is all with:
      $ javac -fullversion
      javac full version "1.8.0-b129"

      Attachments

        Issue Links

          Activity

            People

              abimpoudis Angelos Bimpoudis
              jlahoda Jan Lahoda
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: