[weld-issues] [JBoss JIRA] Created: (WELD-748) Incorrect DefinitionException fired for @Produces @Dependent WildCard<?> method() when bootstrapping.

Lincoln Baxter III (JIRA) jira-events at lists.jboss.org
Wed Nov 3 18:28:01 EDT 2010


Incorrect DefinitionException fired for @Produces @Dependent WildCard<?> method() when bootstrapping.
-----------------------------------------------------------------------------------------------------

                 Key: WELD-748
                 URL: https://jira.jboss.org/browse/WELD-748
             Project: Weld
          Issue Type: Bug
            Reporter: Lincoln Baxter III


In: org.jboss.weld.bean.AbstractProducerBean

The "else if" conditional also needs to check for "!Dependent.class.equals(getScope())"

         for (Type type : getWeldAnnotated().getActualTypeArguments())
         {
            if (!Dependent.class.equals(getScope()) && type instanceof TypeVariable<?>)
            {
               throw new DefinitionException(PRODUCER_METHOD_WITH_TYPE_VARIABLE_RETURN_TYPE_MUST_BE_DEPENDENT, getWeldAnnotated());
            }
            else if (type instanceof WildcardType)
            {
               throw new DefinitionException(PRODUCER_METHOD_WITH_WILDCARD_RETURN_TYPE_MUST_BE_DEPENDENT, getWeldAnnotated());
            }
         }


-------------------------SOURCE

public class ResourceProducer
{
   @Produces
   @Current
   @Dependent
   public Resource<?> getCurrentResource(InjectionPoint ip, Shell shell, BeanManager manager)
   {
       //...
   }


-------------------------EXCEPTION
org.jboss.arquillian.impl.event.FiredEventException: org.jboss.weld.exceptions.DefinitionException: WELD-000098 A producer method with a parameterized return type with a wildcard must be declared @Dependent scoped. Method [method] @Produces @Current @Dependent public org.jboss.seam.forge.shell.project.resources.ResourceProducer.getCurrentResource(InjectionPoint, Shell, BeanManager)  
	at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:68)
	at org.jboss.arquillian.impl.context.AbstractEventContext.fire(AbstractEventContext.java:115)
	at org.jboss.arquillian.impl.EventTestRunnerAdaptor.beforeClass(EventTestRunnerAdaptor.java:96)
	at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:162)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
	at org.jboss.arquillian.junit.Arquillian$3$1.evaluate(Arquillian.java:186)
	at org.jboss.arquillian.junit.Arquillian$MultiStatementExecutor.execute(Arquillian.java:297)
	at org.jboss.arquillian.junit.Arquillian$3.evaluate(Arquillian.java:182)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:127)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
	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.jboss.weld.exceptions.DefinitionException: WELD-000098 A producer method with a parameterized return type with a wildcard must be declared @Dependent scoped. Method [method] @Produces @Current @Dependent public org.jboss.seam.forge.shell.project.resources.ResourceProducer.getCurrentResource(InjectionPoint, Shell, BeanManager)  
	at org.jboss.weld.bean.AbstractProducerBean.checkProducerReturnType(AbstractProducerBean.java:186)
	at org.jboss.weld.bean.AbstractProducerBean.initialize(AbstractProducerBean.java:200)
	at org.jboss.weld.bean.ProducerMethod.initialize(ProducerMethod.java:120)
	at org.jboss.weld.bootstrap.AbstractBeanDeployer.deploy(AbstractBeanDeployer.java:110)
	at org.jboss.weld.bootstrap.BeanDeployment.deployBeans(BeanDeployment.java:189)
	at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:412)
	at org.jboss.arquillian.container.weld.ee.embedded_1_1.mock.MockLifecycle.beginApplication(MockLifecycle.java:87)
	at org.jboss.arquillian.container.weld.ee.embedded_1_1.mock.TestContainer.startContainer(TestContainer.java:264)
	at org.jboss.arquillian.container.weld.ee.embedded_1_1.WeldEEMockContainer.deploy(WeldEEMockContainer.java:81)
	at org.jboss.arquillian.impl.handler.ContainerDeployer.callback(ContainerDeployer.java:62)
	at org.jboss.arquillian.impl.handler.ContainerDeployer.callback(ContainerDeployer.java:50)
	at org.jboss.arquillian.impl.event.MapEventManager.fire(MapEventManager.java:63)
	... 15 more

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the weld-issues mailing list