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

javac crashes on bad annotation value

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 10
    • Fix Version/s: 10
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Introduced In Version:
      10
    • Resolved In Build:
      b14
    • Verification:
      Verified

      Description

      The following program crashes javac:

      class TestLVTI {

      static final Class<?> c = Object.class;

      @Anno1(c)
      void testAnno() {

      }
      }

      @interface Anno1 {
      Class<?> value();
      }

      Stacktrace is this:

      An exception has occurred in the compiler (10-internal). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
      java.lang.ClassCastException: jdk.compiler/com.sun.tools.javac.tree.JCTree$JCIdent cannot be cast to jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess
      at jdk.compiler/com.sun.tools.javac.comp.Annotate.getAnnotationClassValue(Annotate.java:633)
      at jdk.compiler/com.sun.tools.javac.comp.Annotate.attributeAnnotationValue(Annotate.java:590)
      at jdk.compiler/com.sun.tools.javac.comp.Annotate.attributeAnnotationNameValuePair(Annotate.java:511)
      at jdk.compiler/com.sun.tools.javac.comp.Annotate.attributeAnnotationValues(Annotate.java:476)
      at jdk.compiler/com.sun.tools.javac.comp.Annotate.attributeAnnotation(Annotate.java:411)
      at jdk.compiler/com.sun.tools.javac.comp.Annotate.annotateNow(Annotate.java:337)
      at jdk.compiler/com.sun.tools.javac.comp.Annotate.lambda$annotateLater$0(Annotate.java:263)
      at jdk.compiler/com.sun.tools.javac.comp.Annotate.flush(Annotate.java:187)
      at jdk.compiler/com.sun.tools.javac.comp.Annotate.unblockAnnotations(Annotate.java:140)
      at jdk.compiler/com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:153)
      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterDone(JavaCompiler.java:1726)
      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1056)
      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:925)
      at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:305)
      at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:165)
      at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:55)
      at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:41)


      Regression probably introduced in JDK-8181464.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              vromero Vicente Arturo Romero Zaldivar
              Reporter:
              mcimadamore Maurizio Cimadamore
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: