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

Regression: NPE in com.sun.tools.javac.code.Symbol$VarSymbol.getConstValue

XMLWordPrintable

    • x86
    • linux

      FULL PRODUCT VERSION :
      java version "1.7.0"
      Java(TM) SE Runtime Environment (build 1.7.0-b147)
      Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)

      javac 1.7.0

      ADDITIONAL OS VERSION INFORMATION :
      Linux 2.6.38-10-generic #46-Ubuntu SMP Tue Jun 28 15:07:17 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      Javac fails with NPE on compiling annotated class where an annotation parameter is a reference to an annotated constant (code example is provided in a Steps to Reproduce section).

      REGRESSION. Last worked in version 6u26

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create a file Sample.java with a following content:
      @SuppressWarnings(Holder.S)
      public class Sample {
      }

      class Holder {
        @SuppressWarnings("")
        static final String S = "";
      }

      2. Invoke "javac Sample.java"

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Compilation passed.
      ACTUAL -
      Exception occurred.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      An exception has occurred in the compiler (1.7.0). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
      java.lang.AssertionError: java.lang.NullPointerException
      at com.sun.tools.javac.code.Symbol$VarSymbol.getConstValue(Symbol.java:1005)
      at com.sun.tools.javac.comp.Attr.checkInit(Attr.java:2627)
      at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:2285)
      at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1677)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
      at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
      at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:449)
      at com.sun.tools.javac.comp.Annotate.enterAttributeValue(Annotate.java:203)
      at com.sun.tools.javac.comp.Annotate.enterAttributeValue(Annotate.java:243)
      at com.sun.tools.javac.comp.Annotate.enterAnnotation(Annotate.java:181)
      at com.sun.tools.javac.comp.MemberEnter.enterAnnotations(MemberEnter.java:778)
      at com.sun.tools.javac.comp.MemberEnter.access$300(MemberEnter.java:56)
      at com.sun.tools.javac.comp.MemberEnter$5.enterAnnotation(MemberEnter.java:746)
      at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:109)
      at com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:101)
      at com.sun.tools.javac.comp.Enter.complete(Enter.java:510)
      at com.sun.tools.javac.comp.Enter.main(Enter.java:469)
      at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:929)
      at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:824)
      at com.sun.tools.javac.main.Main.compile(Main.java:417)
      at com.sun.tools.javac.main.Main.compile(Main.java:331)
      at com.sun.tools.javac.main.Main.compile(Main.java:322)
      at com.sun.tools.javac.Main.compile(Main.java:76)
      at com.sun.tools.javac.Main.main(Main.java:61)
      Caused by: java.lang.NullPointerException
      at com.sun.tools.javac.code.Lint$AugmentVisitor.augment(Lint.java:290)
      at com.sun.tools.javac.code.Lint.augment(Lint.java:82)
      at com.sun.tools.javac.comp.Attr.attribLazyConstantValue(Attr.java:597)
      at com.sun.tools.javac.code.Symbol$VarSymbol$1.call(Symbol.java:971)
      at com.sun.tools.javac.code.Symbol$VarSymbol.getConstValue(Symbol.java:1003)
      ... 23 more

      REPRODUCIBILITY :
      This bug can be reproduced always.

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: