Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 922644

Summary: Cannot find a specialized producer on JDK 1.7, it works on JDK 1.6
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Osamu Nagano <onagano>
Component: CDI/WeldAssignee: Stuart Douglas <sdouglas>
Status: CLOSED CURRENTRELEASE QA Contact: Ron Šmeral <rsmeral>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.0.1CC: amelicha, brian.stansberry, jdoyle, maschmid
Target Milestone: ER5   
Target Release: EAP 6.1.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 927108 (view as bug list) Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 929389    
Bug Blocks: 927108    
Attachments:
Description Flags
Arquillian test case none

Description Osamu Nagano 2013-03-18 08:20:22 UTC
Created attachment 711790 [details]
Arquillian test case

Description of problem:
Suppose there is a specialized producer method (with @Produces and @Specializes annotations) that overrides its superclass's producer method. If you add a method to the superclass, Weld fails to find the overridden producer method on JDK 1.7. The same program works on JDK 1.6.

Here is the stack trace from a test case.
-------------------------------------------------------------------------------
Test set: com.example.test.SpecializedProducerTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.845 sec <<< FAILURE!
com.example.test.SpecializedProducerTest Time elapsed: 0 sec <<< ERROR!
org.jboss.weld.exceptions.IllegalStateException: WELD-000078 Specialized producer method does not override a method on the direct superclass: Producer Method [TestBean3] with qualifiers [@Any @Default] declared as [[method] @Produces @Specializes public com.example.test.SpecializedProducer$TestProducer3.testBean()]
at org.jboss.weld.bean.ProducerMethod.specialize(ProducerMethod.java:252)
at org.jboss.weld.bean.AbstractBean.initialize(AbstractBean.java:125)
at org.jboss.weld.bean.AbstractReceiverBean.initialize(AbstractReceiverBean.java:50)
at org.jboss.weld.bean.AbstractProducerBean.initialize(AbstractProducerBean.java:182)
at org.jboss.weld.bean.ProducerMethod.initialize(ProducerMethod.java:115)
at org.jboss.weld.bootstrap.AbstractBeanDeployer.deploy(AbstractBeanDeployer.java:116)
at org.jboss.weld.bootstrap.BeanDeployment.deployBeans(BeanDeployment.java:217)
at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:357)
at org.jboss.arquillian.container.weld.se.embedded_1_1.WeldSEContainer.deploy(WeldSEContainer.java:136)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:161)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController$3.call(ContainerDeployController.java:128)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.executeOperation(ContainerDeployController.java:271)
at org.jboss.arquillian.container.impl.client.container.ContainerDeployController.deploy(ContainerDeployController.java:127)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
...


Version-Release number of selected component:
weld-core 1.1.10.Final bundled with EAP 6.0.1.
Also happens with weld-se-core 1.1.11.Final in the attached test case.


Steps to Reproduce:
1. Extract the attachment.
2. Execute the following command to run the test case.
$ cd reproducer
$ JAVA_HOME=/path/to/jdk1.6home mvn clean test -Dmaven.compiler.target=1.6 -Dmaven.compiler.sorce=1.6
(Test passed)
$ JAVA_HOME=/path/to/jdk1.7home mvn clean test -Dmaven.compiler.target=1.7 -Dmaven.compiler.sorce=1.7
(Error in Weld bootstrap process)

Comment 1 Osamu Nagano 2013-03-18 08:24:32 UTC
The attached test case is from the customer.  I slightly modified it to change the package name.

They also said the root cause is the 'different order of Class.getMethods() / getDeclaredMethods()' between JDK 1.6 and 1.7 though I'm not sure about this analysis.

Comment 2 JBoss JIRA Server 2013-03-18 09:50:41 UTC
Jozef Hartinger <jharting> made a comment on jira WELD-1368

Confirmed on 1.1.11.Final. I was not able to reproduce on Weld 2.0.0.Beta6 so the 2.0 branch does not seem to be affected.

Comment 4 JBoss JIRA Server 2013-03-22 09:38:16 UTC
Jozef Hartinger <jharting> made a comment on jira WELD-1368

https://github.com/stuartwdouglas/weld-core/compare/weld:1.1...stuartwdouglas:WELD-1368

Comment 5 JBoss JIRA Server 2013-03-25 08:04:17 UTC
Osamu Nagano <onagano> made a comment on jira WELD-1368

Thanks.  I confirmed that it fixes the bug.

Comment 7 JBoss JIRA Server 2013-03-28 23:09:08 UTC
Jozef Hartinger <jharting> updated the status of jira WELD-1368 to Resolved

Comment 8 Ron Šmeral 2013-04-29 14:45:09 UTC
Verified on EAP 6.1.0.ER5.