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

Unresolvable variable/class error could be improved

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8, 9
    • Fix Version/s: tbd_major
    • Component/s: tools
    • Labels:

      Description

      Consider this code:
      ---
      public class Test {
           private void test() {
               Undefined x = Undefined.create();
           }
      }
      ---

      When compiled, this code produces the following errors:
      ---
      Test.java:3: error: cannot find symbol
               Undefined x = Undefined.create();
               ^
        symbol: class Undefined
        location: class Test
      Test.java:3: error: cannot find symbol
               Undefined x = Undefined.create();
                             ^
        symbol: variable Undefined
        location: class Test
      2 errors
      ---

      The latter error may be confusing, as the unresolvable "Undefined" identifier may also (more likely in this case) refer to an unknown class.

      Original report:
      http://mail.openjdk.java.net/pipermail/compiler-dev/2015-April/009399.html

        Attachments

          Activity

            People

            • Assignee:
              jlahoda Jan Lahoda
              Reporter:
              jlahoda Jan Lahoda
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: