Uploaded image for project: 'OpenWebBeans'
  1. OpenWebBeans
  2. OWB-992

Decorator generic delegate attribute must be same with decorated type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2.6
    • 1.2.7, 1.5.0
    • None
    • None
    • Windows 7 32bit
      Oracle JDK1.7.0_51

    Description

      public interface IService<O extends Object> {
      boolean test(final O value);
      }
      public interface IExtendService<S extends Serializable> extends IService<S> {
      boolean another(final S value);
      }
      public class ServiceImpl implements IExtendService<Serializable> {
      public boolean test(final Serializable value)

      { return false; }
      public boolean another(final Serializable value) { return false; }

      }
      @Decorator
      public abstract class ServiceDecorator<S extends Serializable> implements
      IExtendService<S> {
      @Inject
      @Delegate
      @Any
      private IExtendService<S> delegate;
      public static boolean called = false;
      public boolean test(final S value)

      { called = true; return this.delegate.test(value); }

      }
      @RunWith(BlockJUnit4ClassRunner.class)
      public class ServiceTest extends
      org.apache.myfaces.extensions.cdi.test.junit4.AbstractCdiAwareTest {
      @Inject
      IExtendService<Serializable> service;
      @Test
      public void test() {
      Assert.assertNotNull("Inject service is null", this.service);
      Assert.assertFalse("Value should be false before calling service",ServiceDecorator.called);
      this.service.test(new Serializable() {
      });
      Assert.assertTrue("Value should be true before calling service",
      ServiceDecorator.called);
      }
      }

      When running the JUnit test, i've got next exception :
      java.lang.RuntimeException: org.apache.webbeans.exception.inject.DeploymentException: org.apache.webbeans.exception.WebBeansConfigurationException: Decorator : org.apache.webbeans.component.creation.DecoratorBeanBuilder@1329346 generic delegate attribute must be same with decorated type : IService<S>

      I've attached a maven projet to reproduce the error.

      Attachments

        1. owbdecorator.zip
          20 kB
          Bruno

        Activity

          People

            rsandtner Reinhard Sandtner
            qjafcunuas Bruno
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: