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

[1.8] NPE when compiling throws clause with TYPE_USE annotated qualified type

XMLWordPrintable

    • Verified

      FULL PRODUCT VERSION :
      java version " 1.8.0-ea "
      Java(TM) SE Runtime Environment (build 1.8.0-ea-b82)
      Java HotSpot(TM) 64-Bit Server VM (build 25.0-b23, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      Try to compile the given example that contains method declaration

      void foo() throws @Critical AnnotatedQualifiedThrows.@Critical InnerException {}

      ACTUAL -
      javac full version " 1.8.0-ea-b82 "
      An exception has occurred in the compiler (1.8.0-ea). 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.util.ListBuffer.append(ListBuffer.java:131)
      at com.sun.tools.javac.comp.Attr.fromAnnotations(Attr.java:3899)
      at com.sun.tools.javac.comp.Attr.access$500(Attr.java:76)
      at com.sun.tools.javac.comp.Attr$9.enterAnnotation(Attr.java:3887)
      at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:134)
      at com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:123)
      at com.sun.tools.javac.comp.Enter.complete(Enter.java:514)
      at com.sun.tools.javac.comp.Enter.main(Enter.java:473)
      at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:990)
      at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:865)
      at com.sun.tools.javac.main.Main.compile(Main.java:517)
      at com.sun.tools.javac.main.Main.compile(Main.java:376)
      at com.sun.tools.javac.main.Main.compile(Main.java:365)
      at com.sun.tools.javac.main.Main.compile(Main.java:356)
      at com.sun.tools.javac.Main.compile(Main.java:77)
      at com.sun.tools.javac.Main.main(Main.java:62)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package jsr308.bug;

      import java.lang.annotation.Documented;
      import java.lang.annotation.ElementType;
      import java.lang.annotation.Retention;
      import java.lang.annotation.RetentionPolicy;
      import java.lang.annotation.Target;

      public class AnnotatedQualifiedThrows {
      @Target(ElementType.TYPE_USE)
      @Retention(RetentionPolicy.RUNTIME)
      @Documented
      static @interface Critical { }

      class InnerException extends Exception {
      private static final long serialVersionUID = 1L;
      }

      void foo() throws @Critical AnnotatedQualifiedThrows.@Critical InnerException {

      }
      }

      ---------- END SOURCE ----------

            ssides Steve Sides
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: