You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "Reinhard Sandtner (JIRA)" <ji...@apache.org> on 2014/10/07 14:42:34 UTC

[jira] [Reopened] (OWB-992) Decorator generic delegate attribute must be same with decorated type

     [ https://issues.apache.org/jira/browse/OWB-992?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Reinhard Sandtner reopened OWB-992:
-----------------------------------

applying fix to branch own-1.2.x

> Decorator generic delegate attribute must be same with decorated type
> ---------------------------------------------------------------------
>
>                 Key: OWB-992
>                 URL: https://issues.apache.org/jira/browse/OWB-992
>             Project: OpenWebBeans
>          Issue Type: Bug
>    Affects Versions: 1.2.6
>         Environment: Windows 7 32bit
> Oracle JDK1.7.0_51
>            Reporter: Bruno
>            Assignee: Reinhard Sandtner
>             Fix For: 1.5.0
>
>         Attachments: owbdecorator.zip
>
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)