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

Type annotations with a missing type throw NullPointerException

XMLWordPrintable

    • b127
    • x86
    • linux_ubuntu
    • Verified

      FULL PRODUCT VERSION :


      A DESCRIPTION OF THE PROBLEM :
      When an annotation is put on a member but the annotation type is missing on the class path, the specification requires the runtime to ignore this annotation, i.e. to act as if the annotation is not present.

      This works for all annotations but for type annotations where a NullPointerException is thrown from within the code that resolves the type annotation (sun.reflect.annotation.TypeAnnotationParser).

      THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Yes

      THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      The annotation should simply be suppressed but a NullPointerException is thrown.
      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Caused by: java.lang.NullPointerException
          at sun.reflect.annotation.TypeAnnotationParser.mapTypeAnnotations(TypeAnnotationParser.java:356)
          at sun.reflect.annotation.AnnotatedTypeFactory$AnnotatedTypeBaseImpl.(AnnotatedTypeFactory.java:139)
          at sun.reflect.annotation.AnnotatedTypeFactory.buildAnnotatedType(AnnotatedTypeFactory.java:65)
          at sun.reflect.annotation.TypeAnnotationParser.buildAnnotatedType(TypeAnnotationParser.java:79)
          at java.lang.reflect.Executable.getAnnotatedReturnType0(Executable.java:633)
          at java.lang.reflect.Method.getAnnotatedReturnType(Method.java:648)

      REPRODUCIBILITY :
      This bug can be reproduced always.

            darcy Joe Darcy
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: