Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-13252

NullPointerException in AnnotationDeclaration.validateNamedValue

    Details

    • Steps to Reproduce:
      Hide

      Create an annotation type

      @Target({ElementType.TYPE})
      public @interface MyAnnotation {
          String[] value();
      }
      

      and add it to a type with null element

      @MyAnnotation({null})
      public class C {
      }
      

      In this case, method validateNamedValue gets parameter value=null and fails at line

      String stringValue = value.toString();

      Show
      Create an annotation type @Target({ElementType.TYPE}) public @ interface MyAnnotation { String [] value(); } and add it to a type with null element @MyAnnotation({ null }) public class C { } In this case, method validateNamedValue gets parameter value=null and fails at line String stringValue = value.toString();
    • Workaround Description:
      Hide

      If the issue is caused by an error in annotation, fix it.

      Show
      If the issue is caused by an error in annotation, fix it.

      Description

      https://community.jboss.org/message/780126

      Comment to method IMemberValuePair.getValue() says that it may return null.
      There is no check for null in AnnotationDeclaration.validateNamedValue.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  maxandersen Max Andersen
                  Reporter:
                  scabanovich Viacheslav Kabanovich
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: