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

Quick fix for HTTPMethod annotation without @Target and @Retention doesn't add all imports

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 4.2.0.Beta3
    • 4.2.0.Beta2
    • webservices
    • None
    • Hide

      STEP: Create Dynamic Web Project with JAX-RS support.
      STEP: Create annotation annotated with the @HttpMethod annotation without @Target and @Retention annotation.

      import javax.ws.rs.HttpMethod;
      
      @HttpMethod(value="GET")
      public @interface MyAnnotation {
       
      }
      

      ASSERT: There are 2 errors:

      • The HTTP Method should have a @Retention(RetentionPolicy.RUNTIME) annotation on its type.
      • The HTTP Method should have a @Target(ElementType.METHOD) annotation on its type.

      STEP: Use quick fix "Add @Target annotation on type 'MyAnnotation'"
      STEP: Use quick fix "Add @Retention annotation on type 'MyAnnotation'"
      ASSERT: There is no error
      FAIL: There are 2 errors:

      • RetentionPolicy cannot be resolved to a variable
      • The @Target annotation value is not correct. It should be ElementType.METHOD
      Show
      STEP: Create Dynamic Web Project with JAX-RS support. STEP: Create annotation annotated with the @HttpMethod annotation without @Target and @Retention annotation. import javax.ws.rs.HttpMethod; @HttpMethod(value= "GET" ) public @ interface MyAnnotation { } ASSERT: There are 2 errors: The HTTP Method should have a @Retention(RetentionPolicy.RUNTIME) annotation on its type. The HTTP Method should have a @Target(ElementType.METHOD) annotation on its type. STEP: Use quick fix "Add @Target annotation on type 'MyAnnotation'" STEP: Use quick fix "Add @Retention annotation on type 'MyAnnotation'" ASSERT: There is no error FAIL: There are 2 errors: RetentionPolicy cannot be resolved to a variable The @Target annotation value is not correct. It should be ElementType.METHOD

    Description

      Quick fix, which fixes missing @Retention or @Target annotation on @HttpMethod annotation, doesn't add all required imports (missing import of java.lang.annotation.RetentionPolicy or java.lang.annotation.ElementType)

      Attachments

        Activity

          People

            xcoulon@redhat.com Xavier Coulon
            rrabara Radoslav RĂ¡bara (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: