[webbeans-commits] Webbeans SVN: r1152 - tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/enterprise and 1 other directories.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Wed Jan 21 16:44:44 EST 2009
Author: dallen6
Date: 2009-01-21 16:44:44 -0500 (Wed, 21 Jan 2009)
New Revision: 1152
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/BeanValidation.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/enterprise/NewEnterpriseBeanTest.java
tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/simple/NewSimpleBeanTest.java
Log:
Added validation related to @New annotation and other bindings.
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/BeanValidation.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/BeanValidation.java 2009-01-21 20:29:00 UTC (rev 1151)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/BeanValidation.java 2009-01-21 21:44:44 UTC (rev 1152)
@@ -21,7 +21,9 @@
import java.util.Set;
import javax.webbeans.AmbiguousDependencyException;
+import javax.webbeans.DefinitionException;
import javax.webbeans.InjectionPoint;
+import javax.webbeans.New;
import javax.webbeans.NullableDependencyException;
import javax.webbeans.UnproxyableDependencyException;
import javax.webbeans.UnsatisfiedDependencyException;
@@ -54,6 +56,10 @@
for (InjectionPoint injectionPoint : bean.getInjectionPoints())
{
Class<?> type = (Class<?>) injectionPoint.getType();
+ if (injectionPoint.getAnnotation(New.class) != null && injectionPoint.getBindings().size() > 1)
+ {
+ throw new DefinitionException("The injection point " + injectionPoint + " is annotated with @New which cannot be combined with other binding types");
+ }
Annotation[] bindingTypes = injectionPoint.getBindings().toArray(new Annotation[0]);
Set<?> resolvedBeans = CurrentManager.rootManager().resolveByType(type, bindingTypes);
if (resolvedBeans.isEmpty())
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/enterprise/NewEnterpriseBeanTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/enterprise/NewEnterpriseBeanTest.java 2009-01-21 20:29:00 UTC (rev 1151)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/enterprise/NewEnterpriseBeanTest.java 2009-01-21 21:44:44 UTC (rev 1152)
@@ -30,10 +30,10 @@
/**
* When the built-in binding type @New is applied to an injection point, a
- * Web Bean is implicitly defined with: scope @Dependent, deployment type
+ * Web Bean is implicitly defined with: � scope @Dependent, � deployment type
*
- * @Standard, @New as the only binding annotation, no Web Bean name, no
- * stereotypes, and such that the implementation class is the
+ * @Standard, � @New as the only binding annotation, � no Web Bean name, � no
+ * stereotypes, and such that � the implementation class is the
* declared type of the injection point.
*/
@Test(groups = { "new" })
@@ -45,10 +45,10 @@
/**
* When the built-in binding type @New is applied to an injection point, a
- * Web Bean is implicitly defined with: scope @Dependent, deployment type
+ * Web Bean is implicitly defined with: � scope @Dependent, � deployment type
*
- * @Standard, @New as the only binding annotation, no Web Bean name, no
- * stereotypes, and such that the implementation class is the
+ * @Standard, � @New as the only binding annotation, � no Web Bean name, � no
+ * stereotypes, and such that � the implementation class is the
* declared type of the injection point.
*/
@Test(groups = { "new" })
@@ -60,10 +60,10 @@
/**
* When the built-in binding type @New is applied to an injection point, a
- * Web Bean is implicitly defined with: scope @Dependent, deployment type
+ * Web Bean is implicitly defined with: � scope @Dependent, � deployment type
*
- * @Standard, @New as the only binding annotation, no Web Bean name, no
- * stereotypes, and such that the implementation class is the
+ * @Standard, � @New as the only binding annotation, � no Web Bean name, � no
+ * stereotypes, and such that � the implementation class is the
* declared type of the injection point.
*/
@Test(groups = { "new" })
@@ -76,10 +76,10 @@
/**
* When the built-in binding type @New is applied to an injection point, a
- * Web Bean is implicitly defined with: scope @Dependent, deployment type
+ * Web Bean is implicitly defined with: � scope @Dependent, � deployment type
*
- * @Standard, @New as the only binding annotation, no Web Bean name, no
- * stereotypes, and such that the implementation class is the
+ * @Standard, � @New as the only binding annotation, � no Web Bean name, � no
+ * stereotypes, and such that � the implementation class is the
* declared type of the injection point.
*/
@Test(groups = { "new" })
@@ -91,10 +91,10 @@
/**
* When the built-in binding type @New is applied to an injection point, a
- * Web Bean is implicitly defined with: scope @Dependent, deployment type
+ * Web Bean is implicitly defined with: � scope @Dependent, � deployment type
*
- * @Standard, @New as the only binding annotation, no Web Bean name, no
- * stereotypes, and such that the implementation class is the
+ * @Standard, � @New as the only binding annotation, � no Web Bean name, � no
+ * stereotypes, and such that � the implementation class is the
* declared type of the injection point.
*/
@Test(groups = { "stub", "new" })
@@ -106,10 +106,10 @@
/**
* If the parameter type satisfies the definition of a simple Web Bean
- * implementation class, Section 3.2.1, Which Java classes are simple Web
- * Beans?, then the Web Bean is a simple Web Bean. If the parameter type
+ * implementation class, Section 3.2.1, �Which Java classes are simple Web
+ * Beans?�, then the Web Bean is a simple Web Bean. If the parameter type
* satisfies the definition of an enterprise Web Bean implementation class,
- * Section 3.3.2, Which EJBs are enterprise Web Beans?, then the Web Bean
+ * Section 3.3.2, �Which EJBs are enterprise Web Beans?�, then the Web Bean
* is an enterprise Web Bean.
*/
@Test(groups = { "new", "stub" })
@@ -120,15 +120,15 @@
}
/**
- * Furthermore, this Web Bean: has the same Web Bean constructor,
+ * Furthermore, this Web Bean: � has the same Web Bean constructor,
* initializer methods and injected fields as a Web Bean defined using
- * annotations that is, it has any Web Bean constructor, initializer method
+ * annotations� that is, it has any Web Bean constructor, initializer method
* or injected field declared by annotations that appear on the
- * implementation class, has no observer methods, producer methods or
- * fields or disposal methods, has the same interceptors as a Web Bean
- * defined using annotationsthat is, it has all the interceptor binding
+ * implementation class, � has no observer methods, producer methods or
+ * fields or disposal methods, � has the same interceptors as a Web Bean
+ * defined using annotations�that is, it has all the interceptor binding
* types declared by annotations that appear on the implementation class, and
- * has no decorators.
+ * � has no decorators.
*/
@Test(groups = { "new", "stub" })
@SpecAssertion(section = "3.9")
@@ -138,15 +138,15 @@
}
/**
- * Furthermore, this Web Bean: has the same Web Bean constructor,
+ * Furthermore, this Web Bean: � has the same Web Bean constructor,
* initializer methods and injected fields as a Web Bean defined using
- * annotations that is, it has any Web Bean constructor, initializer method
+ * annotations� that is, it has any Web Bean constructor, initializer method
* or injected field declared by annotations that appear on the
- * implementation class, has no observer methods, producer methods or
- * fields or disposal methods, has the same interceptors as a Web Bean
- * defined using annotationsthat is, it has all the interceptor binding
+ * implementation class, � has no observer methods, producer methods or
+ * fields or disposal methods, � has the same interceptors as a Web Bean
+ * defined using annotations�that is, it has all the interceptor binding
* types declared by annotations that appear on the implementation class, and
- * has no decorators.
+ * � has no decorators.
*/
@Test(groups = { "new", "stub" })
@SpecAssertion(section = "3.9")
@@ -156,15 +156,15 @@
}
/**
- * Furthermore, this Web Bean: has the same Web Bean constructor,
+ * Furthermore, this Web Bean: � has the same Web Bean constructor,
* initializer methods and injected fields as a Web Bean defined using
- * annotations that is, it has any Web Bean constructor, initializer method
+ * annotations� that is, it has any Web Bean constructor, initializer method
* or injected field declared by annotations that appear on the
- * implementation class, has no observer methods, producer methods or
- * fields or disposal methods, has the same interceptors as a Web Bean
- * defined using annotationsthat is, it has all the interceptor binding
+ * implementation class, � has no observer methods, producer methods or
+ * fields or disposal methods, � has the same interceptors as a Web Bean
+ * defined using annotations�that is, it has all the interceptor binding
* types declared by annotations that appear on the implementation class, and
- * has no decorators.
+ * � has no decorators.
*/
@Test(groups = {"new", "stub" })
@SpecAssertion(section = "3.9")
@@ -174,15 +174,15 @@
}
/**
- * Furthermore, this Web Bean: has the same Web Bean constructor,
+ * Furthermore, this Web Bean: � has the same Web Bean constructor,
* initializer methods and injected fields as a Web Bean defined using
- * annotations that is, it has any Web Bean constructor, initializer method
+ * annotations� that is, it has any Web Bean constructor, initializer method
* or injected field declared by annotations that appear on the
- * implementation class, has no observer methods, producer methods or
- * fields or disposal methods, has the same interceptors as a Web Bean
- * defined using annotationsthat is, it has all the interceptor binding
+ * implementation class, � has no observer methods, producer methods or
+ * fields or disposal methods, � has the same interceptors as a Web Bean
+ * defined using annotations�that is, it has all the interceptor binding
* types declared by annotations that appear on the implementation class, and
- * has no decorators.
+ * � has no decorators.
*/
@Test(groups = { "new", "stub" })
@SpecAssertion(section = "3.9")
@@ -192,15 +192,15 @@
}
/**
- * Furthermore, this Web Bean: has the same Web Bean constructor,
+ * Furthermore, this Web Bean: � has the same Web Bean constructor,
* initializer methods and injected fields as a Web Bean defined using
- * annotations that is, it has any Web Bean constructor, initializer method
+ * annotations� that is, it has any Web Bean constructor, initializer method
* or injected field declared by annotations that appear on the
- * implementation class, has no observer methods, producer methods or
- * fields or disposal methods, has the same interceptors as a Web Bean
- * defined using annotationsthat is, it has all the interceptor binding
+ * implementation class, � has no observer methods, producer methods or
+ * fields or disposal methods, � has the same interceptors as a Web Bean
+ * defined using annotations�that is, it has all the interceptor binding
* types declared by annotations that appear on the implementation class, and
- * has no decorators.
+ * � has no decorators.
*/
@Test(groups = { "new", "stub" })
@SpecAssertion(section = "3.9")
@@ -210,15 +210,15 @@
}
/**
- * Furthermore, this Web Bean: has the same Web Bean constructor,
+ * Furthermore, this Web Bean: � has the same Web Bean constructor,
* initializer methods and injected fields as a Web Bean defined using
- * annotations that is, it has any Web Bean constructor, initializer method
+ * annotations� that is, it has any Web Bean constructor, initializer method
* or injected field declared by annotations that appear on the
- * implementation class, has no observer methods, producer methods or
- * fields or disposal methods, has the same interceptors as a Web Bean
- * defined using annotationsthat is, it has all the interceptor binding
+ * implementation class, � has no observer methods, producer methods or
+ * fields or disposal methods, � has the same interceptors as a Web Bean
+ * defined using annotations�that is, it has all the interceptor binding
* types declared by annotations that appear on the implementation class, and
- * has no decorators.
+ * � has no decorators.
*/
@Test(groups = { "new", "stub" })
@SpecAssertion(section = "3.9")
@@ -228,15 +228,15 @@
}
/**
- * Furthermore, this Web Bean: has the same Web Bean constructor,
+ * Furthermore, this Web Bean: � has the same Web Bean constructor,
* initializer methods and injected fields as a Web Bean defined using
- * annotations that is, it has any Web Bean constructor, initializer method
+ * annotations� that is, it has any Web Bean constructor, initializer method
* or injected field declared by annotations that appear on the
- * implementation class, has no observer methods, producer methods or
- * fields or disposal methods, has the same interceptors as a Web Bean
- * defined using annotationsthat is, it has all the interceptor binding
+ * implementation class, � has no observer methods, producer methods or
+ * fields or disposal methods, � has the same interceptors as a Web Bean
+ * defined using annotations�that is, it has all the interceptor binding
* types declared by annotations that appear on the implementation class, and
- * has no decorators.
+ * � has no decorators.
*/
@Test(groups = { "stub", "new" })
@SpecAssertion(section = "3.9")
@@ -246,15 +246,15 @@
}
/**
- * Furthermore, this Web Bean: has the same Web Bean constructor,
+ * Furthermore, this Web Bean: � has the same Web Bean constructor,
* initializer methods and injected fields as a Web Bean defined using
- * annotations that is, it has any Web Bean constructor, initializer method
+ * annotations� that is, it has any Web Bean constructor, initializer method
* or injected field declared by annotations that appear on the
- * implementation class, has no observer methods, producer methods or
- * fields or disposal methods, has the same interceptors as a Web Bean
- * defined using annotationsthat is, it has all the interceptor binding
+ * implementation class, � has no observer methods, producer methods or
+ * fields or disposal methods, � has the same interceptors as a Web Bean
+ * defined using annotations�that is, it has all the interceptor binding
* types declared by annotations that appear on the implementation class, and
- * has no decorators.
+ * � has no decorators.
*/
@Test(groups = { "new" })
@SpecAssertion(section = "3.9")
@@ -335,7 +335,7 @@
* enterprise Web Bean implementation class, a DefinitionException is thrown
* by the container at deployment time.
*/
- @Test(groups = { "new" , "broken"}, expectedExceptions = DefinitionException.class)
+ @Test(groups = { "new" }, expectedExceptions = DefinitionException.class)
@SpecAssertion(section = "3.9")
public void testNewAnnotationCannotAppearInConjunctionWithOtherBindingType()
{
Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/simple/NewSimpleBeanTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/simple/NewSimpleBeanTest.java 2009-01-21 20:29:00 UTC (rev 1151)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/unit/implementation/simple/NewSimpleBeanTest.java 2009-01-21 21:44:44 UTC (rev 1152)
@@ -32,10 +32,10 @@
/**
* When the built-in binding type @New is applied to an injection point, a
- * Web Bean is implicitly defined with: scope @Dependent, deployment type
+ * Web Bean is implicitly defined with: � scope @Dependent, � deployment type
*
- * @Standard, @New as the only binding annotation, no Web Bean name, no
- * stereotypes, and such that the implementation class is the
+ * @Standard, � @New as the only binding annotation, � no Web Bean name, � no
+ * stereotypes, and such that � the implementation class is the
* declared type of the injection point.
*/
@Test(groups = { "new" })
@@ -47,10 +47,10 @@
/**
* When the built-in binding type @New is applied to an injection point, a
- * Web Bean is implicitly defined with: scope @Dependent, deployment type
+ * Web Bean is implicitly defined with: � scope @Dependent, � deployment type
*
- * @Standard, @New as the only binding annotation, no Web Bean name, no
- * stereotypes, and such that the implementation class is the
+ * @Standard, � @New as the only binding annotation, � no Web Bean name, � no
+ * stereotypes, and such that � the implementation class is the
* declared type of the injection point.
*/
@Test(groups = { "new" })
@@ -62,10 +62,10 @@
/**
* When the built-in binding type @New is applied to an injection point, a
- * Web Bean is implicitly defined with: scope @Dependent, deployment type
+ * Web Bean is implicitly defined with: � scope @Dependent, � deployment type
*
- * @Standard, @New as the only binding annotation, no Web Bean name, no
- * stereotypes, and such that the implementation class is the
+ * @Standard, � @New as the only binding annotation, � no Web Bean name, � no
+ * stereotypes, and such that � the implementation class is the
* declared type of the injection point.
*/
@Test(groups = { "new" })
@@ -78,10 +78,10 @@
/**
* When the built-in binding type @New is applied to an injection point, a
- * Web Bean is implicitly defined with: scope @Dependent, deployment type
+ * Web Bean is implicitly defined with: � scope @Dependent, � deployment type
*
- * @Standard, @New as the only binding annotation, no Web Bean name, no
- * stereotypes, and such that the implementation class is the
+ * @Standard, � @New as the only binding annotation, � no Web Bean name, � no
+ * stereotypes, and such that � the implementation class is the
* declared type of the injection point.
*/
@Test(groups = { "new" })
@@ -93,10 +93,10 @@
/**
* When the built-in binding type @New is applied to an injection point, a
- * Web Bean is implicitly defined with: scope @Dependent, deployment type
+ * Web Bean is implicitly defined with: � scope @Dependent, � deployment type
*
- * @Standard, @New as the only binding annotation, no Web Bean name, no
- * stereotypes, and such that the implementation class is the
+ * @Standard, � @New as the only binding annotation, � no Web Bean name, � no
+ * stereotypes, and such that � the implementation class is the
* declared type of the injection point.
*/
@Test(groups = { "stub", "new" })
@@ -107,15 +107,15 @@
}
/**
- * Furthermore, this Web Bean: has the same Web Bean constructor,
+ * Furthermore, this Web Bean: � has the same Web Bean constructor,
* initializer methods and injected fields as a Web Bean defined using
- * annotations that is, it has any Web Bean constructor, initializer method
+ * annotations� that is, it has any Web Bean constructor, initializer method
* or injected field declared by annotations that appear on the
- * implementation class, has no observer methods, producer methods or
- * fields or disposal methods, has the same interceptors as a Web Bean
- * defined using annotationsthat is, it has all the interceptor binding
+ * implementation class, � has no observer methods, producer methods or
+ * fields or disposal methods, � has the same interceptors as a Web Bean
+ * defined using annotations�that is, it has all the interceptor binding
* types declared by annotations that appear on the implementation class, and
- * has no decorators.
+ * � has no decorators.
*/
@Test(groups = {"new", "stub" })
@SpecAssertion(section = "3.9")
@@ -125,15 +125,15 @@
}
/**
- * Furthermore, this Web Bean: has the same Web Bean constructor,
+ * Furthermore, this Web Bean: � has the same Web Bean constructor,
* initializer methods and injected fields as a Web Bean defined using
- * annotations that is, it has any Web Bean constructor, initializer method
+ * annotations� that is, it has any Web Bean constructor, initializer method
* or injected field declared by annotations that appear on the
- * implementation class, has no observer methods, producer methods or
- * fields or disposal methods, has the same interceptors as a Web Bean
- * defined using annotationsthat is, it has all the interceptor binding
+ * implementation class, � has no observer methods, producer methods or
+ * fields or disposal methods, � has the same interceptors as a Web Bean
+ * defined using annotations�that is, it has all the interceptor binding
* types declared by annotations that appear on the implementation class, and
- * has no decorators.
+ * � has no decorators.
*/
@Test(groups = { "new", "stub" })
@SpecAssertion(section = "3.9")
@@ -143,15 +143,15 @@
}
/**
- * Furthermore, this Web Bean: has the same Web Bean constructor,
+ * Furthermore, this Web Bean: � has the same Web Bean constructor,
* initializer methods and injected fields as a Web Bean defined using
- * annotations that is, it has any Web Bean constructor, initializer method
+ * annotations� that is, it has any Web Bean constructor, initializer method
* or injected field declared by annotations that appear on the
- * implementation class, has no observer methods, producer methods or
- * fields or disposal methods, has the same interceptors as a Web Bean
- * defined using annotationsthat is, it has all the interceptor binding
+ * implementation class, � has no observer methods, producer methods or
+ * fields or disposal methods, � has the same interceptors as a Web Bean
+ * defined using annotations�that is, it has all the interceptor binding
* types declared by annotations that appear on the implementation class, and
- * has no decorators.
+ * � has no decorators.
*/
@Test(groups = { "new", "stub" })
@SpecAssertion(section = "3.9")
@@ -161,15 +161,15 @@
}
/**
- * Furthermore, this Web Bean: has the same Web Bean constructor,
+ * Furthermore, this Web Bean: � has the same Web Bean constructor,
* initializer methods and injected fields as a Web Bean defined using
- * annotations that is, it has any Web Bean constructor, initializer method
+ * annotations� that is, it has any Web Bean constructor, initializer method
* or injected field declared by annotations that appear on the
- * implementation class, has no observer methods, producer methods or
- * fields or disposal methods, has the same interceptors as a Web Bean
- * defined using annotationsthat is, it has all the interceptor binding
+ * implementation class, � has no observer methods, producer methods or
+ * fields or disposal methods, � has the same interceptors as a Web Bean
+ * defined using annotations�that is, it has all the interceptor binding
* types declared by annotations that appear on the implementation class, and
- * has no decorators.
+ * � has no decorators.
*/
@Test(groups = { "new" , "stub"})
@SpecAssertion(section = "3.9")
@@ -181,15 +181,15 @@
}
/**
- * Furthermore, this Web Bean: has the same Web Bean constructor,
+ * Furthermore, this Web Bean: � has the same Web Bean constructor,
* initializer methods and injected fields as a Web Bean defined using
- * annotations that is, it has any Web Bean constructor, initializer method
+ * annotations� that is, it has any Web Bean constructor, initializer method
* or injected field declared by annotations that appear on the
- * implementation class, has no observer methods, producer methods or
- * fields or disposal methods, has the same interceptors as a Web Bean
- * defined using annotationsthat is, it has all the interceptor binding
+ * implementation class, � has no observer methods, producer methods or
+ * fields or disposal methods, � has the same interceptors as a Web Bean
+ * defined using annotations�that is, it has all the interceptor binding
* types declared by annotations that appear on the implementation class, and
- * has no decorators.
+ * � has no decorators.
*/
@Test(groups = { "stub", "new" })
@SpecAssertion(section = "3.9")
@@ -199,15 +199,15 @@
}
/**
- * Furthermore, this Web Bean: has the same Web Bean constructor,
+ * Furthermore, this Web Bean: � has the same Web Bean constructor,
* initializer methods and injected fields as a Web Bean defined using
- * annotations that is, it has any Web Bean constructor, initializer method
+ * annotations� that is, it has any Web Bean constructor, initializer method
* or injected field declared by annotations that appear on the
- * implementation class, has no observer methods, producer methods or
- * fields or disposal methods, has the same interceptors as a Web Bean
- * defined using annotationsthat is, it has all the interceptor binding
+ * implementation class, � has no observer methods, producer methods or
+ * fields or disposal methods, � has the same interceptors as a Web Bean
+ * defined using annotations�that is, it has all the interceptor binding
* types declared by annotations that appear on the implementation class, and
- * has no decorators.
+ * � has no decorators.
*/
@Test(groups = { "new" })
@SpecAssertion(section = "3.9")
@@ -288,7 +288,7 @@
* enterprise Web Bean implementation class, a DefinitionException is thrown
* by the container at deployment time.
*/
- @Test(groups = { "new", "broken" }, expectedExceptions = DefinitionException.class)
+ @Test(groups = { "new" }, expectedExceptions = DefinitionException.class)
@SpecAssertion(section = "3.9")
public void testNewAnnotationCannotAppearInConjunctionWithOtherBindingType()
{
More information about the weld-commits
mailing list