[weld-commits] Weld SVN: r5873 - cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterizedTypeWithTypeParameter and 4 other directories.

weld-commits at lists.jboss.org weld-commits at lists.jboss.org
Wed Feb 17 17:34:55 EST 2010


Author: pete.muir at jboss.org
Date: 2010-02-17 17:34:54 -0500 (Wed, 17 Feb 2010)
New Revision: 5873

Removed:
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterizedTypeWithTypeParameter/Spider.java
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterizedTypeWithTypeParameter/SpiderListProducer.java
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/SpiderListProducer.java
Modified:
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/ProducerFieldDefinitionTest.java
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterizedTypeWithTypeParameter/GeneralListProducer.java
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterizedTypeWithTypeParameter/ParameterizedReturnTypeWithTypeVariableTest.java
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/GeneralListProducer.java
   cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java
   core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java
   core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/BeanMessage.java
   core/trunk/impl/src/main/resources/org/jboss/weld/messages/bean_en.properties
Log:
WELD-426, WELD-428, WELD-431

Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/ProducerFieldDefinitionTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/ProducerFieldDefinitionTest.java	2010-02-17 21:52:15 UTC (rev 5872)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/field/definition/ProducerFieldDefinitionTest.java	2010-02-17 22:34:54 UTC (rev 5873)
@@ -219,7 +219,6 @@
    @SuppressWarnings("serial")
    @Test(groups = "producerField")
    @SpecAssertion(section = "3.4", id = "fb")
-   //WELD-431
    public void testProducerFieldWithTypeVariable()
    {
       assert (getInstanceByType(new TypeLiteral<List<Spider>>(){})) != null;

Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterizedTypeWithTypeParameter/GeneralListProducer.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterizedTypeWithTypeParameter/GeneralListProducer.java	2010-02-17 21:52:15 UTC (rev 5872)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterizedTypeWithTypeParameter/GeneralListProducer.java	2010-02-17 22:34:54 UTC (rev 5873)
@@ -24,10 +24,6 @@
 
 public class GeneralListProducer<T>
 {
-   public GeneralListProducer(String name)
-   {
-      
-   }
    
    @Produces
    @RequestScoped

Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterizedTypeWithTypeParameter/ParameterizedReturnTypeWithTypeVariableTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterizedTypeWithTypeParameter/ParameterizedReturnTypeWithTypeVariableTest.java	2010-02-17 21:52:15 UTC (rev 5872)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterizedTypeWithTypeParameter/ParameterizedReturnTypeWithTypeVariableTest.java	2010-02-17 22:34:54 UTC (rev 5873)
@@ -32,7 +32,6 @@
 {   
    @Test
    @SpecAssertion(section = "3.3", id = "iab")
-   //WELD-428
    public void testNonDependentScopedProducerMethodWithParameterizedTypeWithTypeVariable()
    {
       assert false;

Deleted: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterizedTypeWithTypeParameter/Spider.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterizedTypeWithTypeParameter/Spider.java	2010-02-17 21:52:15 UTC (rev 5872)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterizedTypeWithTypeParameter/Spider.java	2010-02-17 22:34:54 UTC (rev 5873)
@@ -1,23 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,  
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.jsr299.tck.tests.implementation.producer.method.broken.parameterizedTypeWithTypeParameter;
-
-
-class Spider
-{
-
-}

Deleted: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterizedTypeWithTypeParameter/SpiderListProducer.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterizedTypeWithTypeParameter/SpiderListProducer.java	2010-02-17 21:52:15 UTC (rev 5872)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/broken/parameterizedTypeWithTypeParameter/SpiderListProducer.java	2010-02-17 22:34:54 UTC (rev 5873)
@@ -1,26 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,  
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.jsr299.tck.tests.implementation.producer.method.broken.parameterizedTypeWithTypeParameter;
-
-public class SpiderListProducer extends GeneralListProducer<Spider>
-{
-   public SpiderListProducer()
-   {
-      super(null);
-   }
-}
-

Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/GeneralListProducer.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/GeneralListProducer.java	2010-02-17 21:52:15 UTC (rev 5872)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/GeneralListProducer.java	2010-02-17 22:34:54 UTC (rev 5873)
@@ -23,10 +23,6 @@
 
 public class GeneralListProducer<T>
 {
-   public GeneralListProducer(String name)
-   {
-      
-   }
    
    @Produces
    public List<T> create()

Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java	2010-02-17 21:52:15 UTC (rev 5872)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java	2010-02-17 22:34:54 UTC (rev 5873)
@@ -275,7 +275,6 @@
    
    @Test
    @SpecAssertion(section = "3.3", id = "iaa")
-   //WELD-426
    public void testTypeVariableReturnType()
    {
       // should be created by SpiderListProducer

Deleted: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/SpiderListProducer.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/SpiderListProducer.java	2010-02-17 21:52:15 UTC (rev 5872)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/SpiderListProducer.java	2010-02-17 22:34:54 UTC (rev 5873)
@@ -1,26 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,  
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.jsr299.tck.tests.implementation.producer.method.definition;
-
-public class SpiderListProducer extends GeneralListProducer<Spider>
-{
-   public SpiderListProducer()
-   {
-      super(null);
-   }
-}
-

Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java	2010-02-17 21:52:15 UTC (rev 5872)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java	2010-02-17 22:34:54 UTC (rev 5873)
@@ -26,8 +26,9 @@
 import static org.jboss.weld.logging.messages.BeanMessage.NULL_NOT_ALLOWED_FROM_PRODUCER;
 import static org.jboss.weld.logging.messages.BeanMessage.ONLY_ONE_SCOPE_ALLOWED;
 import static org.jboss.weld.logging.messages.BeanMessage.PRODUCER_CAST_ERROR;
+import static org.jboss.weld.logging.messages.BeanMessage.PRODUCER_METHOD_WITH_TYPE_VARIABLE_RETURN_TYPE_MUST_BE_DEPENDENT;
+import static org.jboss.weld.logging.messages.BeanMessage.PRODUCER_METHOD_WITH_WILDCARD_RETURN_TYPE_MUST_BE_DEPENDENT;
 import static org.jboss.weld.logging.messages.BeanMessage.RETURN_TYPE_MUST_BE_CONCRETE;
-import static org.jboss.weld.logging.messages.BeanMessage.TYPE_PARAMETER_MUST_BE_CONCRETE;
 import static org.jboss.weld.logging.messages.BeanMessage.USING_DEFAULT_SCOPE;
 import static org.jboss.weld.logging.messages.BeanMessage.USING_SCOPE;
 
@@ -172,11 +173,18 @@
       {
          throw new DefinitionException(RETURN_TYPE_MUST_BE_CONCRETE, getWeldAnnotated().getBaseType());
       }
-      for (Type type : getWeldAnnotated().getActualTypeArguments())
+      else if (getWeldAnnotated().isParameterizedType())
       {
-         if (!(type instanceof Class<?>))
+         for (Type type : getWeldAnnotated().getActualTypeArguments())
          {
-            throw new DefinitionException(TYPE_PARAMETER_MUST_BE_CONCRETE, this.getWeldAnnotated());
+            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());
+            }
          }
       }
    }

Modified: core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/BeanMessage.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/BeanMessage.java	2010-02-17 21:52:15 UTC (rev 5872)
+++ core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/BeanMessage.java	2010-02-17 22:34:54 UTC (rev 5873)
@@ -130,6 +130,8 @@
    @MessageId("000093") CANNOT_READ_OBJECT,
    @MessageId("000094") INJECTED_FIELD_CANNOT_BE_PRODUCER,
    @MessageId("000095") GENERIC_SESSION_BEAN_MUST_BE_DEPENDENT,
-   @MessageId("000096") PRODUCER_FIELD_ON_SESSION_BEAN_MUST_BE_STATIC;
+   @MessageId("000096") PRODUCER_FIELD_ON_SESSION_BEAN_MUST_BE_STATIC,
+   @MessageId("000097") PRODUCER_METHOD_WITH_TYPE_VARIABLE_RETURN_TYPE_MUST_BE_DEPENDENT,
+   @MessageId("000098") PRODUCER_METHOD_WITH_WILDCARD_RETURN_TYPE_MUST_BE_DEPENDENT;
    
 }

Modified: core/trunk/impl/src/main/resources/org/jboss/weld/messages/bean_en.properties
===================================================================
--- core/trunk/impl/src/main/resources/org/jboss/weld/messages/bean_en.properties	2010-02-17 21:52:15 UTC (rev 5872)
+++ core/trunk/impl/src/main/resources/org/jboss/weld/messages/bean_en.properties	2010-02-17 22:34:54 UTC (rev 5873)
@@ -94,4 +94,6 @@
 CANNOT_READ_OBJECT=Cannot read object
 INJECTED_FIELD_CANNOT_BE_PRODUCER=Injected field {0} cannot be annotated @Produces on {1}
 GENERIC_SESSION_BEAN_MUST_BE_DEPENDENT=Session bean with generic class {0} must be @Depedent scope
-PRODUCER_FIELD_ON_SESSION_BEAN_MUST_BE_STATIC=Producer fields on session beans must be static. Field {0} declared on {1} 
+PRODUCER_FIELD_ON_SESSION_BEAN_MUST_BE_STATIC=Producer fields on session beans must be static. Field {0} declared on {1}
+PRODUCER_METHOD_WITH_TYPE_VARIABLE_RETURN_TYPE_MUST_BE_DEPENDENT=A producer method with a parameterized return type with a type variable must be declared @Dependent scoped. Method {0}
+PRODUCER_METHOD_WITH_WILDCARD_RETURN_TYPE_MUST_BE_DEPENDENT=A producer method with a parameterized return type with a wildcard must be declared @Dependent scoped. Method {0}  



More information about the weld-commits mailing list