[ https://issues.apache.org/jira/browse/OWB-737?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mark Struberg resolved OWB-737. ------------------------------- Resolution: Fixed Fix Version/s: 1.5.0 Assignee: Mark Struberg > @specializes @alternative child class disables super class even when not > enabled when using stereotypes > ------------------------------------------------------------------------------------------------------- > > Key: OWB-737 > URL: https://issues.apache.org/jira/browse/OWB-737 > Project: OpenWebBeans > Issue Type: Bug > Components: Core > Affects Versions: 1.1.6 > Environment: OS X 10.7.5 / Tomcat 7.0.22; Windows 7 / IBM WebSphere > Application Server 7.x; > Reporter: Teemu Andersén > Assignee: Mark Struberg > Labels: alternative, specializes > Fix For: 1.5.0 > > Attachments: src.zip > > > When using stereotypes to select alternatives the OWB doesn't recognize a > Bean as an alternative when it processes specialized classes. This causes the > super class to be always disabled. > Not sure if this is a bug or not but in most other cases the same class would > be recognized as an alternative even if it was marked as one via stereotype > and not directly using the @Alternative annotation. > Steps to reproduce: > 1) create a test alternative stereotype > 2) create a service > 3) create an alternative test service > - extend the production service > - annotate with test alternative stereotype and specializes > 4) Don't enable the test alternative stereotype > Expected: > The production service is enabled > What happens: > Both services are disabled > Example (also in the src.zip): > @Stereotype > @Alternative > @Retention(RetentionPolicy.RUNTIME) > @Target({ METHOD, FIELD, PARAMETER, TYPE }) > public @interface Development { > } > public class ServiceBean implements Serializable { > public String getMessage() { > return "Production"; > } > } > /** > * Alternative implementation that is enabled by Development stereotype. > */ > // @Alternative - When this annotation is commented this class is not > recognized as an alternative when processing specialized classes. > @Development > @Specializes > public class DevelopmentService extends Service { > @Override > public String getMessage() { > return "Development"; > } > } > ==== > Problem area: > org.apache.webbeans.util.WebBeansUtil [1477-1486]: > if (!AnnotationUtil.hasClassAnnotation(specializedClass, Alternative.class)) > { > //disable superbean if the current bean is not an alternative > ((AbstractOwbBean<?>)superBean).setEnabled(false); > } > else if(altManager.isClassAlternative(specializedClass)) > { > //disable superbean if the current bean is an enabled alternative > ((AbstractOwbBean<?>)superBean).setEnabled(false); > } -- This message was sent by Atlassian JIRA (v6.3.4#6332)