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

Unresolvable variable/class error could be improved

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 8, 9
    • tools

      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

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

              Created:
              Updated: