Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2046

Specialized bean gets @Default qualifier even if the parent class already has a different qualifier

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 2.3.1.Final, 3.0.0.Alpha14, 2.2.x
    • 2.3.0.Final
    • None
    • None

    Description

      I have the following code. Please note that @Microservice annotation is my own extension to weld-se. It is recognized as a CDI bean.

         public interface SpecializationMicro {
            String hello();
         }
      
         @Sharp
         @Microservice
         public static class SpecializationMicroBean implements SpecializationMicro {
      
            @Override
            public String hello() {
               return "normal";
            }
         }
      
         @Specializes
         public static class MockSpecializationMicroBean extends SpecializationMicroBean {
      
            @Override
            public String hello() {
               return "special";
            }
         }
      
         @Qualifier
         @Target({ ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER })
         @Retention(RetentionPolicy.RUNTIME)
         public @interface Sharp {
         }
      
      @Retention(RetentionPolicy.RUNTIME)
      @Documented
      @Inherited
      @Named
      @MicroserviceScoped
      @Stereotype
      @Target(ElementType.TYPE)
      public @interface Microservice {
         String value() default "";
      }
      

      When I delete MockSpecializationMicroBean, the original bean SpecializationMicroBean is registered with qualifiers @Sharp and @Any.
      However, the MockSpecializationMicroBean is registered with qualifiers @Sharp @Default and @Any. I believe the @Default qualifier whould not be there.

      Attachments

        Activity

          People

            mkouba@redhat.com Martin Kouba
            mvecera Martin Vecera
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: