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

javac crashing when processing broken annotations

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 7u11, 8
    • Fix Version/s: 9
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b02
    • Verification:
      Verified

      Description

      For this source code:
      -----
      public class Test {
          public static final int INT_VALUE = 1;
          @interface Main {
              Nested v1();
              int v2();
          }
          @interface Nested { }
          @Main(@Unknown, 1)
          private void test() { }
      }
      -----

      javac crashes:
      -----
      $ javac -XDdev CheckAnnotations.java
      CheckAnnotations.java:7: error: annotation values must be of the form 'name=value'
          @Main(@Unknown, 1)
                ^
      CheckAnnotations.java:7: error: annotation values must be of the form 'name=value'
          @Main(@Unknown, 1)
                          ^
      An exception has occurred in the compiler (1.8.0-internal). 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.NullPointerException
              at com.sun.tools.javac.comp.Check$1AnnotationValidator.visitAnnotation(Check.java:2647)
              at com.sun.tools.javac.tree.JCTree$JCAnnotation.accept(JCTree.java:2311)
              at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
              at com.sun.tools.javac.tree.TreeScanner.visitAnnotation(TreeScanner.java:320)
              at com.sun.tools.javac.comp.Check$1AnnotationValidator.visitAnnotation(Check.java:2648)
              at com.sun.tools.javac.tree.JCTree$JCAnnotation.accept(JCTree.java:2311)
              at com.sun.tools.javac.comp.Check.validateAnnotationTree(Check.java:2653)
              at com.sun.tools.javac.comp.Check.validateAnnotation(Check.java:2720)
              at com.sun.tools.javac.comp.Check.validateAnnotations(Check.java:2707)
              at com.sun.tools.javac.comp.MemberEnter$6.run(MemberEnter.java:893)
              at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:155)
              at com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:129)
              at com.sun.tools.javac.comp.Enter.complete(Enter.java:516)
              at com.sun.tools.javac.comp.Enter.main(Enter.java:475)
              at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:985)
              at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:860)
              at com.sun.tools.javac.main.Main.compile(Main.java:523)
              at com.sun.tools.javac.main.Main.compile(Main.java:381)
              at com.sun.tools.javac.main.Main.compile(Main.java:370)
              at com.sun.tools.javac.main.Main.compile(Main.java:361)
              at com.sun.tools.javac.Main.compile(Main.java:56)
              at com.sun.tools.javac.Main.main(Main.java:42)
      -----

      This is for javac built from jdk8/tl:
      -----
      langtools$ hg tip
      changeset: 2197:4fa835472e3c
      tag: tip
      user: rfield
      date: Fri Nov 22 17:07:35 2013 -0800
      summary: 8028739: javac generates incorrect descriptor for MethodHandle::invoke
      -----

      Also reproducible with:
      $ javac -fullversion
      javac full version "1.7.0_11-b21"

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: