[
https://issues.jboss.org/browse/WELD-921?page=com.atlassian.jira.plugin.s...
]
Craig Ringer updated WELD-921:
------------------------------
Attachment: jboss7-weld-ejb-abstract-local.zip
Here's a minimal test case that demonstrates the issue. I've confirmed that it
fails on JBoss AS 7 and passes on Glassfish 3.1.1b11. Downloading the latest JBoss AS 7
nightly to test with now.
The test case is nothing more than a base class that implements a method, and a @Stateless
EJB that extends the base class without overriding that method. If the method is invoked
on an instance of the EJB injected into something (in this case a @RequestScoped bean but
it doesn't seem to matter what) then the reported error is produced.
Jenkins tests that this suggests, based on the attached test case, are:
- The test case as-is, fails with AS7.0.0.
- The test case with the base class declared "abstract" . This fails with
AS7.0.0.
- The test case with the base class generified and the test method accepting and returning
an instance of the type parameter, eg "T doSomething(T t) { return t; }". This
fails with AS7.0.0.
- The test case with the subclass overriding the base class's implementation of
"doSomething()". This *passes* with AS 7.0.0 but should really be tested for,
since there's clearly not enough test coverage for inheritance in EJBs.
Incorrect handling of business interfaces for EJBs (where defining
class of business method is not the Business interface of the EJBs)
---------------------------------------------------------------------------------------------------------------------------------------
Key: WELD-921
URL:
https://issues.jboss.org/browse/WELD-921
Project: Weld
Issue Type: Bug
Components: Weld SPI
Affects Versions: 1.1.0.Final, 1.1.1.Final
Reporter: Sivakumar Thyagarajan
Fix For: 1.1.2.Final
Attachments: chat-log.txt, jboss7-weld-ejb-abstract-local.zip
This is based on the scenario described in
http://java.net/jira/browse/GLASSFISH-16186
- @Named @Stateless TimeProviderImpl extends SimpleTimeProvider implements
LocalTimeProvider.
- SimpleTimeProvider implements TimeProvider (the latter defining some methods, the
former implementing them. No annotations.)
- LocalTimeProvider is @Local and also extends TimeProvider and does nothing more.
So the Local Business interface is LocalTimeProvider.
The following injection is performed on a SessionScoped Bean
@Inject
private LocalTimeProvider timeProvider1;
The Weld bean proxy for the SessionBean Object reference being injected(timeProvider1)
tries to get [1] the BusinessObject when a method is invoked on it. Weld seems to use [2]
the declaring class of the method being invoked to determine the business interface.
Though the business interface of the Bean is set to com.dummy.time.LocalTimeProvider, the
class that declares the method being invoked ("getThisMonth()") is
com.dummy.time.TimeProvider.
Therefore, the Weld implementation calls
SessionObjectReferenceImpl.getBusinessObject("com.dummy.time.TimeProvider"),
which fails, as TimeProvider is not a Business interface. As per [3], the
businessInterfaceType must be a type of the business interface of the bean. Is Weld
incorrect in mapping the method to its declaring interface. Weld must instead use the
injected type as the business interface, while trying to get the business object.
[1]
https://github.com/weld/core/blob/76c31d311cf1ff449eb2d5c80943b913651bed9...
[
2]https://github.com/weld/core/blob/76c31d311cf1ff449eb2d5c80943b913651be...
[3]
https://github.com/weld/api/blob/master/weld-spi/src/main/java/org/jboss/...
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira