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

Quick fix for "Producer method has a parameter annotated @Disposes/@Observes [JSR-299 ยง3.3.2]" error markers

    XMLWordPrintable

Details

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

    Description

      This quick fix should offer next:
      1. Delete @Disposes/@Observes annotation
      2. Delete @Produces annotation

      Test case:

      EXECUTE: Create CDI project
      EXECUTE: Create TestBean class

      package org.test;
      
      import javax.enterprise.event.Observes;
      import javax.enterprise.inject.Produces;
      
      public class TestBean {
      	@Produces
      	public String produceString(@Observes String aa){
      		return "test";
      	}
      }
      

      ASSERT: @Produces and @Observes annotations should be marked by problem markers
      EXECUTE: Point mouse to @Produces or @Observes annotation
      ASSERT: Text hover with quick fixes appears

      EXECUTE: Create TestBean2 class

      package org.test;
      
      import javax.enterprise.inject.Disposes;
      import javax.enterprise.inject.Produces;
      
      public class TestBean2 {
      	@Produces
      	public String produceString(@Disposes String aaa){
      		return "test";
      	}
      }
      

      ASSERT: @Produces and @Disposes annotations should be marked by problem markers
      EXECUTE: Point mouse to @Produces or @Disposes annotation
      ASSERT: Text hover with quick fixes appears

      Attachments

        1. DisposerInProducer1.png
          DisposerInProducer1.png
          31 kB
        2. DisposerInProducer2.png
          DisposerInProducer2.png
          37 kB
        3. ObserverInProducer1.png
          ObserverInProducer1.png
          32 kB
        4. ObserverInProducer2.png
          ObserverInProducer2.png
          38 kB

        Activity

          People

            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

            Dates

              Created:
              Updated:
              Resolved: