[ https://issues.apache.org/jira/browse/OWB-865?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13667723#comment-13667723 ]
Reinis Vicups commented on OWB-865: ----------------------------------- Do I understand you correctly that the abstract class is invisible for CDI? But what does your comment "abstract producers are supported" mean? I removed all annotations, changed parent class to abstract and left in now abstract base class the producer method - now I receive UnsatisfiedResolutionException since although BaseBarProducer is extended by SpecializedBarProducer, the producer method is not "seen" by CDI. I would expect that CDI discovers producer method from base class through the public api of specialized class, but it does not happen. Alternative is to override producer method in specialized class and inside overriden method call super.produceBar(); but this is imho really bad design that basically destroy my intent to define a template method within base class. Or do I missunderstand this? > @Typed disables specializing class > ---------------------------------- > > Key: OWB-865 > URL: https://issues.apache.org/jira/browse/OWB-865 > Project: OpenWebBeans > Issue Type: Bug > Components: Inheritance, Specialization > Affects Versions: 1.2.1 > Reporter: Reinis Vicups > Attachments: specializes.zip > > > The SpecializedBarProducer @Specializes BaseBarProducer. > Now, annotating both classes with @Typed(Object.class) cause > SpecializedBarProducer beeing ignored (or in other words - the @Specializes > being ignored). See attached testcase BarTest. > If only BaseBarProducer is being annotated with @Typed(Object.class) > following excpetion is thrown: > org.apache.webbeans.exception.WebBeansDeploymentException: > org.apache.webbeans.exception.inject.InconsistentSpecializationException: > WebBean component class : de.orbitx.specializes.SpecializedBarProducer is not > enabled for specialized by the class > de.orbitx.specializes.SpecializedBarProducer class > at > org.apache.webbeans.config.BeansDeployer.checkSpecializations(BeansDeployer.java:709) > at > org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:188) > at > org.apache.openejb.cdi.OpenEJBLifecycle.startApplication(OpenEJBLifecycle.java:182) > at > org.apache.openejb.cdi.ThreadSingletonServiceImpl.initialize(ThreadSingletonServiceImpl.java:158) > at org.apache.openejb.cdi.CdiBuilder.build(CdiBuilder.java:43) > at > org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:798) > at > org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:612) > at > org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:608) > at > org.apache.openejb.testing.ApplicationComposers.before(ApplicationComposers.java:580) > at > org.apache.openejb.testing.ApplicationComposers.evaluate(ApplicationComposers.java:664) > at > org.apache.openejb.junit.ApplicationComposer$DeployApplication.evaluate(ApplicationComposer.java:64) > at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) > at org.junit.runners.ParentRunner.run(ParentRunner.java:300) > at > org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) > at > org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) > Caused by: > org.apache.webbeans.exception.inject.InconsistentSpecializationException: > WebBean component class : de.orbitx.specializes.SpecializedBarProducer is not > enabled for specialized by the class > de.orbitx.specializes.SpecializedBarProducer class > at > org.apache.webbeans.util.WebBeansUtil.configureSpecializations(WebBeansUtil.java:784) > at > org.apache.webbeans.util.WebBeansUtil.configureSpecializations(WebBeansUtil.java:643) > at > org.apache.webbeans.config.BeansDeployer.checkSpecializations(BeansDeployer.java:700) > ... 25 more > All in all the behavior appears to me inconsistent, because either > - annotating both classes as @Typed shall not lead to ignoring the extending > class or > - annotating only the base class shall not lead to exception (since as I > understood the spec @Specializes shall inherit all annotations from the base > class); -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira