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

NullPointerException in compiler on bad constant

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.0beta
    • CPU:
      sparc
    • OS:
      generic
    • Verification:
      Not verified

      Description

      When I compile the following code:

      import oak.io.*;

      class foo {
          static final int CAT = 1;
          static final int DOG = 2;

          boolean broken(int i) {
              switch (i) {
                 case CAT: return true;
                 case DAWG: return true;
                 default: return false;
              }
          }
      }
      I get the following error:

      pan:/tmp[1031] oakc foo.oak
      oak.lang.NullPointerException
      at oak.tools.tree.IdentifierExpression.inlineValue(IdentifierExpression.oak)
      at oak.tools.tree.CaseStatement.check(CaseStatement.oak)
      at oak.tools.tree.SwitchStatement.check(SwitchStatement.oak)
      at oak.tools.tree.CompoundStatement.check(CompoundStatement.oak)
      at oak.tools.tree.Statement.checkMethod(Statement.oak)
      at oak.tools.oakc.SourceField.check(SourceField.oak)
      at oak.tools.oakc.SourceClass.check(SourceClass.oak)
      at oak.tools.oakc.SourceClass.compile(SourceClass.oak)
      at oak.tools.oakc.Main.main(Main.oak)
      oakc: an exception has occurred, please contact x47242.
      foo.oak:10: Undefined variable: DAWG
      foo.oak:10: case DAWG: return true;
                  ^

        Attachments

          Activity

            People

            Assignee:
            ahoffsunw Arthur Hoff (Inactive)
            Reporter:
            fyellinsunw Frank Yellin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: