Unresolved type in conditional expression cascades to illegal start of type error

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: 9
    • Component/s: tools
    • None


      There is this JShell bug: https://bugs.openjdk.java.net/browse/JDK-8129337

      Which basically comes down to getting two errors from an undefined symbol in this case:

          /tmp 1150>> cat > T.java
          class T {
            void f() { if (tttt) System.out.println("T"); }
          }
          /tmp 1151>> javac T.java
          T.java:2: error: cannot find symbol
            void f() { if (tttt) System.out.println("T"); }
                           ^
            symbol: variable tttt
            location: class T
          T.java:2: error: illegal start of type
            void f() { if (tttt) System.out.println("T"); }
                          ^
          2 errors

      Is this the desired compiler behavior, or a chained error that should be cut-off?

      Thanks,
      Robert

       I think this is a javac bug - most likely the result of 'cannot resolve symbol' is an erroneous _class_ type, which means then javac complains because it's finding a type where an expression was required; obviously the logic that does the latter check is not skipping erroneous types appropriately.

      Maurizio

            Assignee:
            Jan Lahoda
            Reporter:
            Robert Field (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: