Bug 922644 - Cannot find a specialized producer on JDK 1.7, it works on JDK 1.6
Summary: Cannot find a specialized producer on JDK 1.7, it works on JDK 1.6
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: CDI/Weld
Version: 6.0.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ER5
: EAP 6.1.0
Assignee: Stuart Douglas
QA Contact: Ron Šmeral
URL:
Whiteboard:
Depends On: 929389
Blocks: 927108
TreeView+ depends on / blocked
 
Reported: 2013-03-18 08:20 UTC by Osamu Nagano
Modified: 2018-12-01 16:18 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
: 927108 (view as bug list)
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)
Arquillian test case (5.42 KB, application/zip)
2013-03-18 08:20 UTC, Osamu Nagano
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker WELD-1368 0 Major Resolved Cannot find a specialized producer on JDK 1.7, it works on JDK 1.6 2016-11-02 00:56:20 UTC

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.


Note You need to log in before you can comment on or make changes to this bug.