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

Quick fix for "Interceptor/Decorator cannot have a method with a parameter annotated @Observes [JSR-299 ยง10.4.2]" error markers

XMLWordPrintable

    • Documentation (Ref Guide, User Guide, etc.)
    • Not Required

      This quick fix should offer to Delete @Observes annotation

      Test case:

      EXECUTE: Create CDI project
      EXECUTE: Create ObserverInDecorator class

      package org.test;
      
      import javax.decorator.Decorator;
      import javax.decorator.Delegate;
      import javax.enterprise.event.Observes;
      import javax.inject.Inject;
      
      @Decorator
      public class ObserverInDecorator {
      	@Inject @Delegate @AAnnotation String str;
      	
      	public void method(@Observes String param){
      		
      	}
      }
      

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

      EXECUTE: Create ObserverInInterceptor class

      package org.test;
      
      import javax.enterprise.event.Observes;
      import javax.interceptor.Interceptor;
      
      @Interceptor
      @FooBinding
      public class ObserverInInterceptor {
      	
      	public void method(@Observes String param){
      		
      	}
      }
      

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

        1. ObserverInDecorator.png
          37 kB
          Daniel Azarov
        2. ObserverInInterceptor.png
          34 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: