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

Quick fix for "Injection point other than injected field must not declare a @Named annotation that does not specify the value member [JSR-299 §3.11]" error marker

XMLWordPrintable

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

      This quick fix should offer to add generated name as value member to @Named annotation

      Test case:
      EXECUTE:
      1. Create CDI Project
      2. Create java classes:

      import javax.inject.Named;
      
      @Named("order")
      public class Order {
      
      }
      
      import javax.inject.Named;
      
      @Named("order2")
      public class Order2 extends Order {
      
      }
      
      import javax.inject.Inject;
      import javax.inject.Named;
      
      public class TestBean {
      
      	@Inject public void init(@Named Order order) {
      		// DO nothing
      	}
      }
      

      3. Build project
      4. Open TestBean class in Java Editor

      ASSERT: annotation @Named should be marked with problem "Injection point other than injected field must not declare a @Named annotation that does not specify the value member [JSR-299 §3.11]"

      EXECUTE: Point mouse to annotation @Named and press Ctrl

      ASSERT: Quick fixes should be shown in Pop Up menu:

      EXECUTE: select one of quick fixes

      ASSERT: annotation @Named should be changed to @Named("oreder") or @Named("order2") accordingly

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

                Created:
                Updated:
                Resolved: