Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-6644 Offer quick fixes for CDI validations
  3. JBIDE-7686

Quick fix for "Interceptor/Decorator is annotated @Specializes [JSR-299 ยง4.3.1]" error markers

XMLWordPrintable

    • Interactive Demo/Tutorial
    • Not Required

      This quick fix should offer to Delete @Specializes annotation

      Test case:

      EXECUTE: Create CDI project
      EXECUTE: Create TestBean class

      package org.test;
      import javax.enterprise.inject.Specializes;
      import javax.interceptor.Interceptor;
      
      
      @Interceptor
      @AnyBinding
      @Specializes
      public class TestBean extends AnyBean{
      
      	public String produce(){
      		return "a";
      	}
      }
      

      EXECUTE: Create AAnnotation interface

      package org.test;
      
      public @interface AAnnotation {
      
      }
      

      EXECUTE: Create AnyBean class

      package org.test;
      
      public class AnyBean {
      }
      

      EXECUTE: Create AnyBinding interface

      package org.test;
      
      import java.lang.annotation.ElementType;
      import java.lang.annotation.Inherited;
      import java.lang.annotation.Retention;
      import java.lang.annotation.RetentionPolicy;
      import java.lang.annotation.Target;
      
      import javax.interceptor.InterceptorBinding;
      
      @Inherited 
      @InterceptorBinding 
      @Target(ElementType.TYPE) 
      @Retention(RetentionPolicy.RUNTIME)
      public @interface AnyBinding {
      
      }
      

      ASSERT: @Specializes annotation should be marked by problem marker
      EXECUTE: Point mouse to @Specializes annotation
      ASSERT: Text hover with quick fixe appears

      EXECUTE: Create TestBean2 class

      package org.test;
      
      import javax.decorator.Decorator;
      import javax.decorator.Delegate;
      import javax.enterprise.inject.Specializes;
      import javax.inject.Inject;
      
      @Decorator
      @Specializes
      public class TestBean2 extends AnyBean{
      	@Inject @Delegate @AAnnotation String str;
      
      	public String produce(){
      		return str;
      	}
      }
      

      ASSERT: @Specializes annotation should be marked by problem marker
      EXECUTE: Point mouse to @Specializes annotation
      ASSERT: Text hover with quick fixe appears

        1. SpecializesInDecorator.png
          26 kB
          Daniel Azarov
        2. SpecializesInInterceptor.png
          27 kB
          Daniel Azarov

              dazarov_jira Daniel Azarov (Inactive)
              dazarov_jira Daniel Azarov (Inactive)
              Isaac Rooskov Isaac Rooskov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: