You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by "Bruno (JIRA)" <ji...@apache.org> on 2014/08/27 15:44:58 UTC
[jira] [Created] (OWB-992) Decorator generic delegate attribute
must be same with decorated type
Bruno created OWB-992:
-------------------------
Summary: 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
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);
}
}
<?xml version="1.0"?>
<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd http://jboss.org/schema/weld/beans http://jboss.org/schema/weld/beans_1_1.xsd">
<decorators>
<class>org.owb.decorator.sample.ServiceDecorator</class>
</decorators>
</beans>
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>
--
This message was sent by Atlassian JIRA
(v6.2#6252)