Weld SVN: r4767 - api/trunk/cdi/src/main/java/javax/enterprise/util.
by weld-commits@lists.jboss.org
Author: gavin.king(a)jboss.com
Date: 2009-11-08 03:29:57 -0500 (Sun, 08 Nov 2009)
New Revision: 4767
Modified:
api/trunk/cdi/src/main/java/javax/enterprise/util/AnnotationLiteral.java
api/trunk/cdi/src/main/java/javax/enterprise/util/TypeLiteral.java
Log:
make them serializable, and improve
Modified: api/trunk/cdi/src/main/java/javax/enterprise/util/AnnotationLiteral.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/util/AnnotationLiteral.java 2009-11-08 01:46:00 UTC (rev 4766)
+++ api/trunk/cdi/src/main/java/javax/enterprise/util/AnnotationLiteral.java 2009-11-08 08:29:57 UTC (rev 4767)
@@ -17,6 +17,7 @@
package javax.enterprise.util;
+import java.io.Serializable;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -50,31 +51,23 @@
* @see javax.enterprise.event.Event#select(Annotation...)
*
*/
-public abstract class AnnotationLiteral<T extends Annotation> implements
- Annotation
+public abstract class AnnotationLiteral<T extends Annotation>
+ implements Annotation, Serializable
{
- private Class<T> annotationType;
- private Method[] members;
+ private transient Class<T> annotationType;
+ private transient Method[] members;
- protected AnnotationLiteral()
+ protected AnnotationLiteral() {}
+
+ private Method[] getMembers()
{
- Class<?> annotationLiteralSubclass = getAnnotationLiteralSubclass(this.getClass());
- if (annotationLiteralSubclass == null)
- {
- throw new RuntimeException(getClass() + "is not a subclass of AnnotationLiteral ");
+ if (members==null) {
+ members = annotationType().getDeclaredMethods();
}
-
- annotationType = getTypeParameter(annotationLiteralSubclass);
-
- if (annotationType == null)
- {
- throw new RuntimeException(getClass() + " is missing type parameter in AnnotationLiteral");
- }
-
- this.members = annotationType.getDeclaredMethods();
+ return members;
}
-
+
private static Class<?> getAnnotationLiteralSubclass(Class<?> clazz)
{
Class<?> superclass = clazz.getSuperclass();
@@ -110,25 +103,87 @@
public Class<? extends Annotation> annotationType()
{
+ if (annotationType==null)
+ {
+ Class<?> annotationLiteralSubclass = getAnnotationLiteralSubclass(this.getClass());
+ if (annotationLiteralSubclass == null)
+ {
+ throw new RuntimeException(getClass() + "is not a subclass of AnnotationLiteral");
+ }
+ annotationType = getTypeParameter(annotationLiteralSubclass);
+ if (annotationType == null)
+ {
+ throw new RuntimeException(getClass() + " is missing type parameter in AnnotationLiteral");
+ }
+ }
return annotationType;
}
@Override
public String toString()
{
- String string = "@" + annotationType().getName() + "(";
- for (int i = 0; i < members.length; i++)
- {
- string += members[i].getName() + "=";
- string += invoke(members[i], this);
- if (i < members.length - 1)
- {
- string += ",";
- }
- }
- return string + ")";
+ StringBuilder string = new StringBuilder();
+ string.append('@').append(annotationType().getName()).append('(');
+ for (int i = 0; i < getMembers().length; i++)
+ {
+ string.append(getMembers()[i].getName()).append('=');
+ Object value = invoke(getMembers()[i], this);
+ if (value instanceof boolean[])
+ {
+ appendInBraces(string, Arrays.toString((boolean[])value));
+ }
+ else if (value instanceof byte[])
+ {
+ appendInBraces(string, Arrays.toString((byte[])value));
+ }
+ else if (value instanceof short[])
+ {
+ appendInBraces(string, Arrays.toString((short[])value));
+ }
+ else if (value instanceof int[])
+ {
+ appendInBraces(string, Arrays.toString((int[])value));
+ }
+ else if (value instanceof long[])
+ {
+ appendInBraces(string, Arrays.toString((long[])value));
+ }
+ else if (value instanceof float[])
+ {
+ appendInBraces(string, Arrays.toString((float[])value));
+ }
+ else if (value instanceof double[])
+ {
+ appendInBraces(string, Arrays.toString((double[])value));
+ }
+ else if (value instanceof char[])
+ {
+ appendInBraces(string, Arrays.toString((char[])value));
+ }
+ else if (value instanceof Object[])
+ {
+ appendInBraces(string, Arrays.toString((Object[])value));
+ }
+ /*else if (value instanceof Class<?>)
+ {
+ string.append(((Class<?>)value).getName()).append(".class");
+ }*/
+ else
+ {
+ string.append(value);
+ }
+ if (i < getMembers().length - 1)
+ {
+ string.append(',');
+ }
+ }
+ return string.append(')').toString();
}
+ private void appendInBraces(StringBuilder buf, String s) {
+ buf.append('{').append(s.substring(1,s.length()-1)).append('}');
+ }
+
@Override
public boolean equals(Object other)
{
@@ -137,12 +192,13 @@
Annotation that = (Annotation) other;
if (this.annotationType().equals(that.annotationType()))
{
- for (Method member : members)
+ for (Method member : getMembers())
{
Object thisValue = invoke(member, this);
Object thatValue = invoke(member, that);
if (thisValue.getClass().isArray() && thatValue.getClass().isArray())
{
+ //TODO: broken for primitive arrays!
if (!Arrays.equals(Object[].class.cast(thisValue), Object[].class.cast(thatValue)))
{
return false;
@@ -163,10 +219,11 @@
public int hashCode()
{
int hashCode = 0;
- for (Method member : members)
+ for (Method member : getMembers())
{
int memberNameHashCode = 127 * member.getName().hashCode();
Object value = invoke(member, this);
+ //TODO: broken for primitive arrays!
int memberValueHashCode = value.getClass().isArray() ? Arrays.hashCode(Object[].class.cast(value)) : value.hashCode();
hashCode += memberNameHashCode ^ memberValueHashCode;
}
@@ -193,4 +250,5 @@
throw new RuntimeException("Error checking value of member method " + method.getName() + " on " + method.getDeclaringClass(), e);
}
}
+
}
Modified: api/trunk/cdi/src/main/java/javax/enterprise/util/TypeLiteral.java
===================================================================
--- api/trunk/cdi/src/main/java/javax/enterprise/util/TypeLiteral.java 2009-11-08 01:46:00 UTC (rev 4766)
+++ api/trunk/cdi/src/main/java/javax/enterprise/util/TypeLiteral.java 2009-11-08 08:29:57 UTC (rev 4767)
@@ -17,6 +17,7 @@
package javax.enterprise.util;
+import java.io.Serializable;
import java.lang.reflect.GenericArrayType;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
@@ -41,35 +42,36 @@
* @see javax.enterprise.event.Event#select(TypeLiteral, Annotation...)
*
*/
-public abstract class TypeLiteral<T>
+public abstract class TypeLiteral<T> implements Serializable
{
- private Type actualType;
+ private transient Type actualType;
- protected TypeLiteral()
- {
- Class<?> typeLiteralSubclass = getTypeLiteralSubclass(this.getClass());
- if (typeLiteralSubclass == null)
- {
- throw new RuntimeException(getClass() + " is not a subclass of TypeLiteral");
- }
- actualType = getTypeParameter(typeLiteralSubclass);
- if (actualType == null)
- {
- throw new RuntimeException(getClass() + " is missing type parameter in TypeLiteral");
- }
- }
+ protected TypeLiteral() {}
/**
- * @return the actual type represented by type literal
+ * @return the actual type represented by this object
*/
public final Type getType()
{
+ if (actualType==null)
+ {
+ Class<?> typeLiteralSubclass = getTypeLiteralSubclass(this.getClass());
+ if (typeLiteralSubclass == null)
+ {
+ throw new RuntimeException(getClass() + " is not a subclass of TypeLiteral");
+ }
+ actualType = getTypeParameter(typeLiteralSubclass);
+ if (actualType == null)
+ {
+ throw new RuntimeException(getClass() + " is missing type parameter in TypeLiteral");
+ }
+ }
return actualType;
}
/**
- * @return the raw type represented by the type literal
+ * @return the raw type represented by this object
*/
@SuppressWarnings("unchecked")
public final Class<T> getRawType() {
@@ -123,5 +125,25 @@
return null;
}
- // TODO: equals(), hashCode()
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof TypeLiteral<?>)
+ {
+ TypeLiteral<?> that = (TypeLiteral<?>) obj;
+ return this.getType().equals(that.getType());
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return getType().hashCode();
+ }
+
+ @Override
+ public String toString()
+ {
+ return getType().toString();
+ }
+
}
16 years, 5 months
Weld SVN: r4766 - in cdi-tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/deployment/packaging/bundledLibrary and 12 other directories.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-11-07 20:46:00 -0500 (Sat, 07 Nov 2009)
New Revision: 4766
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/DecoratorInvocationTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/packaging/bundledLibrary/LibraryMissingBeansXmlTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/ObserverTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/typeWithParameters/CheckTypeParametersWhenResolvingObserversTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/ContainerEventTest.java
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/simple/lifecycle/SimpleBeanLifecycleTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/interceptorOrder/InterceptorOrderTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ResolutionByTypeTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/DecoratorNotResolvedTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/interceptor/InterceptorNotResolvedTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/parameterized/AssignabilityOfRawAndParameterizedTypesTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/policy/PolicyAvailabilityTest.java
cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml
Log:
fix mess in audit
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/DecoratorInvocationTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/DecoratorInvocationTest.java 2009-11-08 00:32:46 UTC (rev 4765)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/DecoratorInvocationTest.java 2009-11-08 01:46:00 UTC (rev 4766)
@@ -41,7 +41,6 @@
@SpecAssertion(section="8.4", id="b"),
@SpecAssertion(section="8.1.3", id="d"),
@SpecAssertion(section="8.1.2", id="f"),
- @SpecAssertion(section="8.1.2", id="b"),
@SpecAssertion(section="7.2", id="b")
})
public void testDecoratorInvocation()
@@ -63,7 +62,6 @@
//@SpecAssertion(section="8.4", id="a"),
@SpecAssertion(section="8.1.3", id="d"),
@SpecAssertion(section="8.1.2", id="f"),
- @SpecAssertion(section="8.1.2", id="b"),
@SpecAssertion(section="7.2", id="kb")
})
public void testChainedDecoratorInvocation()
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/packaging/bundledLibrary/LibraryMissingBeansXmlTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/packaging/bundledLibrary/LibraryMissingBeansXmlTest.java 2009-11-08 00:32:46 UTC (rev 4765)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/packaging/bundledLibrary/LibraryMissingBeansXmlTest.java 2009-11-08 01:46:00 UTC (rev 4766)
@@ -56,7 +56,7 @@
@Test(groups = {})
@SpecAssertions({
- @SpecAssertion(section = "12.1", id="ca")
+ @SpecAssertion(section = "12.1", id="bbc")
})
public void test()
{
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/ObserverTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/ObserverTest.java 2009-11-08 00:32:46 UTC (rev 4765)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/observer/ObserverTest.java 2009-11-08 01:46:00 UTC (rev 4766)
@@ -19,7 +19,7 @@
{
@Test(groups = { "events" })
@SpecAssertions( {
- @SpecAssertion(section = "10.2", id = "h"),
+ @SpecAssertion(section = "10.2", id = "i"),
@SpecAssertion(section = "10.5", id = "aa")
})
public void testObserverNotifiedWhenEventTypeAndAllBindingsMatch()
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/typeWithParameters/CheckTypeParametersWhenResolvingObserversTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/typeWithParameters/CheckTypeParametersWhenResolvingObserversTest.java 2009-11-08 00:32:46 UTC (rev 4765)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/resolve/typeWithParameters/CheckTypeParametersWhenResolvingObserversTest.java 2009-11-08 01:46:00 UTC (rev 4766)
@@ -52,7 +52,7 @@
@Test(groups = { "events" })
@SpecAssertions({
- @SpecAssertion(section = "10.4.1", id = "a"),
+ @SpecAssertion(section = "10.2.1", id = "b"),
@SpecAssertion(section = "11.3.10", id = "a")
})
public void testResolvingChecksTypeParameters()
@@ -64,7 +64,7 @@
@Test(groups = { "events" })
@SpecAssertions({
- @SpecAssertion(section = "10.2", id = "h"),
+ @SpecAssertion(section = "10.2.1", id = "a"),
@SpecAssertion(section = "10.4", id = "aa")
// FIXME also 10.3.1, which does not yet have spec assertions cataloged
})
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/ContainerEventTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/ContainerEventTest.java 2009-11-08 00:32:46 UTC (rev 4765)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/ContainerEventTest.java 2009-11-08 01:46:00 UTC (rev 4766)
@@ -131,8 +131,8 @@
@Test
@SpecAssertions({
@SpecAssertion(section="11.5.8", id="c"),
- @SpecAssertion(section="12.3", id="fb"),
- @SpecAssertion(section="12.3", id="g")})
+ @SpecAssertion(section="12.3", id="fb")
+ })
public void testProcessSessionBeanFiredForStatefulSessionBean() {
assert ProcessBeanObserver.getProcessStatefulSessionBeanEvent() != null;
validateStatefulSessionBean(ProcessBeanObserver.getProcessStatefulSessionBeanEvent().getAnnotatedBeanClass());
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 2009-11-08 00:32:46 UTC (rev 4765)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java 2009-11-08 01:46:00 UTC (rev 4766)
@@ -231,8 +231,7 @@
@Test
@SpecAssertions({
@SpecAssertion(section = "2.3.5", id = "a"),
- @SpecAssertion(section = "3.3.2", id = "i"),
- @SpecAssertion(section = "3.3.3", id = "h")
+ @SpecAssertion(section = "3.3.2", id = "i")
})
public void testBindingTypesAppliedToProducerMethodParameters()
{
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/SimpleBeanLifecycleTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/SimpleBeanLifecycleTest.java 2009-11-08 00:32:46 UTC (rev 4765)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/SimpleBeanLifecycleTest.java 2009-11-08 01:46:00 UTC (rev 4766)
@@ -34,8 +34,7 @@
@SpecAssertions({
@SpecAssertion(section = "3.7.1", id = "f"),
@SpecAssertion(section = "3.7.1", id = "g"),
- @SpecAssertion(section = "2.3.5", id = "d"),
- @SpecAssertion(section = "5.6.3", id = "a")
+ @SpecAssertion(section = "2.3.5", id = "d")
})
public void testInjectionOfParametersIntoBeanConstructor()
{
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/interceptorOrder/InterceptorOrderTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/interceptorOrder/InterceptorOrderTest.java 2009-11-08 00:32:46 UTC (rev 4765)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/interceptors/definition/interceptorOrder/InterceptorOrderTest.java 2009-11-08 01:46:00 UTC (rev 4766)
@@ -15,8 +15,7 @@
{
@Test
@SpecAssertions({
- @SpecAssertion(section = "9.4", id = "b"),
- @SpecAssertion(section = "9.5", id = "ea")
+ @SpecAssertion(section = "9.4", id = "b")
})
public void testInterceptorsCalledInOrderDefinedByBeansXml()
{
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ResolutionByTypeTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ResolutionByTypeTest.java 2009-11-08 00:32:46 UTC (rev 4765)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ResolutionByTypeTest.java 2009-11-08 01:46:00 UTC (rev 4766)
@@ -202,8 +202,9 @@
assert !classes.contains(Sole.class);
}
- @Test(groups = { "policy" })
- @SpecAssertion(section = "5.1", id = "a")
+ @Test(groups = { "policy", "rewrite" })
+ // TODO Needs to be rewritten to use injection PLM
+ @SpecAssertion(section = "5.1.4", id = "i")
public void testPolicyNotAvailableInNonDeploymentArchive() throws Exception
{
Set<Bean<Spider>> spiders = getBeans(Spider.class);
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/DecoratorNotResolvedTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/DecoratorNotResolvedTest.java 2009-11-08 00:32:46 UTC (rev 4765)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/decorator/DecoratorNotResolvedTest.java 2009-11-08 01:46:00 UTC (rev 4766)
@@ -35,9 +35,9 @@
public class DecoratorNotResolvedTest extends AbstractJSR299Test
{
- @Test(groups = { "resolution" })
- @SpecAssertion(section = "5.2", id = "hb")
- // WBRI-296
+ @Test(groups = { "resolution", "rewrite" })
+ @SpecAssertion(section = "5.1.4", id = "a")
+ // TODO PLM should check injection, not resolution
public void testDecoratorNotResolved()
{
Set<Type> types = new HashSet<Type>();
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/interceptor/InterceptorNotResolvedTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/interceptor/InterceptorNotResolvedTest.java 2009-11-08 00:32:46 UTC (rev 4765)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/interceptor/InterceptorNotResolvedTest.java 2009-11-08 01:46:00 UTC (rev 4766)
@@ -35,8 +35,9 @@
public class InterceptorNotResolvedTest extends AbstractJSR299Test
{
- @Test(groups = { "resolution" })
- @SpecAssertion(section = "5.2", id = "hq")
+ @Test(groups = { "resolution", "rewrite" })
+ // TODO PLM should check injection, not resolution
+ @SpecAssertion(section = "5.1.4", id = "b")
public void testInterceptorNotResolved()
{
Set<Type> types = new HashSet<Type>();
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/parameterized/AssignabilityOfRawAndParameterizedTypesTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/parameterized/AssignabilityOfRawAndParameterizedTypesTest.java 2009-11-08 00:32:46 UTC (rev 4765)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/parameterized/AssignabilityOfRawAndParameterizedTypesTest.java 2009-11-08 01:46:00 UTC (rev 4766)
@@ -37,7 +37,7 @@
@Test(groups = { "resolution" })
@SpecAssertions({
- @SpecAssertion(section = "5.2.3", id = "a"),
+ @SpecAssertion(section = "5.2", id = "kb"),
@SpecAssertion(section = "2.2.1", id = "f"),
@SpecAssertion(section = "2.2.1", id = "g")
})
@@ -48,7 +48,7 @@
}
@Test(groups= {"resolution"})
- @SpecAssertion(section = "5.2.3", id = "b")
+ @SpecAssertion(section = "5.2.3", id = "ba")
public void testAssignabilityOfParameterizedTypeWithActualTypesToParameterizedTypeWithActualTypes()
{
assert getBeans(new TypeLiteral<Map<Integer, Integer>>(){}).size() == 2;
@@ -74,7 +74,7 @@
}
@Test(groups = { "resolution" })
- @SpecAssertion(section = "5.2.3", id = "d")
+ @SpecAssertion(section = "5.2.3", id = "da")
public void testAssignabilityOfParameterizedTypeWithTypeVariablesToParameterizedTypeWithWildcards()
{
Set<Bean<Result<? extends Throwable, ? super Exception>>> beans = getBeans(new TypeLiteral<Result<? extends Throwable, ? super Exception>>(){});
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/policy/PolicyAvailabilityTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/policy/PolicyAvailabilityTest.java 2009-11-08 00:32:46 UTC (rev 4765)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/policy/PolicyAvailabilityTest.java 2009-11-08 01:46:00 UTC (rev 4766)
@@ -39,7 +39,7 @@
@Test(groups = {"policy"})
@SpecAssertions( {
- @SpecAssertion(section = "5.1", id = "b"),
+ @SpecAssertion(section = "5.1", id = "e"),
@SpecAssertion(section = "5.1.1", id = "c"),
@SpecAssertion(section = "5.1.1", id = "ea"),
@SpecAssertion(section = "2.6", id = "a"),
Modified: cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml 2009-11-08 00:32:46 UTC (rev 4765)
+++ cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml 2009-11-08 01:46:00 UTC (rev 4766)
@@ -2111,13 +2111,10 @@
</section>
<section id="5.1.2" title="Enabled and disabled beans">
- <assertion id="a">
+ <assertion id="a" testable="false">
<text>A bean is said to be enabled if it is deployed in a bean deployment archive, as defined by Section 12.1, "Bean deployment archives", and it is not a producer method or field of a disabled bean, and it is not specialized by any other enabled bean, as defined in Section 4.3, "Specialization", and either it is not an alternative, or it is a selected alternative of at least one bean deployment archive. Otherwise, the bean is said to be disabled.</text>
+ <note>Tested in 5.1.4</note>
</assertion>
-
- <assertion id="b">
- <text>Section 3.12, "@New qualified beans" defines a special rule that determines whether a |@New| qualified bean is enabled or disabled. This rule applies as only to |@New| qualified beans, as an exception to the normal rule defined here.</text>
- </assertion>
</section>
<section id="5.1.3" title="Inconsistent specialization">
@@ -2127,16 +2124,92 @@
</section>
<section id="5.1.4" title="Inter-module injection">
- <assertion id="a">
- <text>A bean is available for injection in a certain Java EE module or library if the bean is enabled, the bean is either not an alternative, or the module or library is a bean deployment archive and the bean is a selected alternative of the bean deployment archive, and the bean class is required to be accessible to classes in the module or library, according to the class loading requirements of the Java EE platform and Java Servlet specifications.</text>
- </assertion>
+ <group>
+ <text>A bean is available for injection in a certain Java EE module or library if the bean is not an interceptor or decorator, the bean is enabled, the bean is either not an alternative, or the module or library is a bean deployment archive and the bean is a selected alternative of the bean deployment archive, and the bean class is required to be accessible to classes in the module or library, according to the class loading requirements of the Java EE platform and Java Servlet specifications.</text>
+
+ <assertion id="a">
+ <text>Check a decorator can not be injected</text>
+ </assertion>
+
+ <assertion id="b">
+ <text>Check an interceptor can not be injected</text>
+ </assertion>
+
+ <assertion id="c">
+ <text>Check an enabled managed bean can be injected</text>
+ </assertion>
+
+ <assertion id="d">
+ <text>Check an enabled session bean can be injected</text>
+ </assertion>
+
+ <assertion id="e">
+ <text>Check an enabled producer field can be injected</text>
+ </assertion>
+
+ <assertion id="f">
+ <text>Check an enabled producer method can be injected</text>
+ </assertion>
+
+ <assertion id="g">
+ <text>Check producer method of a disabled bean is not injectable</text>
+ </assertion>
+
+ <assertion id="h">
+ <text>Check producer field of a disabled bean is not injectable</text>
+ </assertion>
+
+ <assertion id="i">
+ <text>Check a disabled managed bean is not injectable</text>
+ </assertion>
+
+ <assertion id="j">
+ <text>Check a disabled session bean is not injectable</text>
+ </assertion>
+
+ <assertion id="k">
+ <text>Check a specialized session bean is not injectable</text>
+ </assertion>
+
+ <assertion id="l">
+ <text>Check a specialized managed bean is not injectable</text>
+ </assertion>
+
+ <assertion id="m">
+ <text>Check a specialized producer field is not injectable</text>
+ </assertion>
+
+ <assertion id="n">
+ <text>Check a specialized producer method is not injectable</text>
+ </assertion>
+
+ <assertion id="o">
+ <text>Check a selected alternative is injected for a managed bean</text>
+ </assertion>
+
+ <assertion id="p">
+ <text>Check a selected alternative is injected for a session bean</text>
+ </assertion>
+
+ </group>
- <assertion id="b">
+ <group>
<text>For a custom implementation of the |Bean| interface defined in Section 11.1, "The Bean interface, the container calls |getBeanClass()| to determine the bean class of the bean and |InjectionPoint.getMember()| and then |Member.getDeclaringClass()| to determine the class that declares an injection point.</text>
- </assertion>
+ <assertion id="d">
+ <text>Check |Bean.getBeanClass()| is used to determine the bean class</text>
+ </assertion>
+
+ <assertion id="e">
+ <text>Check |InjectionPoint.getMember().getDeclaringClass()| is used to determine the class declaring the injection point</text>
+ </assertion>
+ </group>
</section>
- <section id="5.2" title="Typesafe resolution">
+ <section id="5.2" title="Typesafe resolution">
+
+ <assertion id="hc" implied="true">
+ <text>Check multiple types resolve to a single getBeans()</text>
+ </assertion>
<group>
<text>A bean is assignable to a given injection point if the bean has a bean type that matches the required type. For this purpose, primitive types are considered to match their corresponding wrapper types in |java.lang| and array types are considered to match only if their element types are identical. Parameterized and raw types are considered to match if they are identical or if the bean type is assignable to the required type, as defined in Section 5.2.3, "Assignability of raw and parameterized types".</text>
@@ -2224,29 +2297,46 @@
</section>
<section id="5.2.3" title="Assignability of raw and parameterized types">
- <assertion id="a">
- <text>A parameterized bean type is considered assignable to a raw required type if the raw types are identical and all type parameters of the bean type are either unbounded type variables or |java.lang.Object|.</text>
- </assertion>
+
+ <group>
+ <text>A parameterized bean type is considered assignable to a parameterized required type if they have identical raw type and for each parameter: the required type parameter and the bean type parameter are actual types with identical raw type, and, if the type is parameterized, the bean type parameter is assignable to the required type parameter according to these rules, or the required type parameter is a wildcard, the bean type parameter is an actual type and the actual type is assignable to the upper bound, if any, of the wildcard and assignable from the lower bound, if any, of the wildcard, or the required type parameter is a wildcard, the bean type parameter is a type variable and the upper bound of the type variable is assignable to or assignable from the upper bound, if any, of the wildcard and assignable from the lower bound, if any, of the wildcard, or the required type parameter is an actual type, the bean type parameter is a type variable and the actual typ!
e is as- signable to the upper bound, if any, of the type variable, or the required type parameter and the bean type parameter are both type variables and the upper bound of the required type parameter is assignable to the upper bound, if any, of the bean type parameter.</text>
+ <assertion id="aa">
+ <text>Check all type parameters of the bean type and required type are unbounded type variables.</text>
+ </assertion>
+
+ <assertion id="ab">
+ <text>Check all type parameters of the bean type and required type are |java.lang.Object|s.</text>
+ </assertion>
- <assertion id="b">
- <text>A parameterized bean type is considered assignable to a parameterized required type if they have identical raw type and for each parameter the required type parameter and the bean type parameter are actual types with identical raw type, and, if the type is parameterized, the bean type parameter is assignable to the required type according to these rules.</text>
- </assertion>
+ <assertion id="ba">
+ <text>Check the required type parameter and the bean type parameter are actual types with identical raw type</text>
+ </assertion>
+
+ <assertion id="bb">
+ <text>Check the required type parameter and the bean type parameter are actual types with identical raw type for nested type parameters</text>
+ </assertion>
+
+ <assertion id="c">
+ <text>Check the required type parameter is a wildcard, the bean type parameter is an actual type and the actual type is assignable to the upper bound of the wildcard and assignable from the lower bound of the wildcard</text>
+ </assertion>
- <assertion id="c">
- <text>A parameterized bean type is considered assignable to a parameterized required type if they have identical raw type and for each parameter the required type parameter is a wildcard, the bean type parameter is an actual type and the actual type is assignable to the upper bound, if any, of the wildcard and assignable from the lower bound, if any, of the wildcard.</text>
- </assertion>
+ <assertion id="da">
+ <text>Check the required type parameter is a wildcard, the bean type parameter is a type variable and the upper bound of the type variable is _assignable to_ the upper bound of the wildcard and assignable from the lower bound of the wildcard</text>
+ </assertion>
+
+ <assertion id="db">
+ <text>Check the required type parameter is a wildcard, the bean type parameter is a type variable and the upper bound of the type variable is _assignable from_ the upper bound of the wildcard and assignable from the lower bound of the wildcard</text>
+ </assertion>
- <assertion id="d">
- <text>A parameterized bean type is considered assignable to a parameterized required type if they have identical raw type and for each parameter the required type parameter is a wildcard, the bean type parameter is a type variable and the upper bound of the type variable is assignable to the upper bound, if any, of the wildcard and assignable from the lower bound, if any, of the wildcard.</text>
- </assertion>
+ <assertion id="e">
+ <text>Check the required type parameter is an actual type, the bean type parameter is a type variable and the actual type is assignable to the upper bound of the type variable</text>
+ </assertion>
- <assertion id="e">
- <text>A parameterized bean type is considered assignable to a parameterized required type if they have identical raw type and for each parameter the required type parameter is an actual type, the bean type parameter is a type variable and the actual type is assignable to the upper bound, if any, of the type variable.</text>
- </assertion>
-
- <assertion id="f">
- <text>A parameterized bean type is considered assignable to a parameterized required type if they have identical raw type and for each parameter the required type parameter and the bean type parameter are both type variables and the upper bound of the required type parameter is assignable to the upper bound, if any, of the bean type parameter.</text>
- </assertion>
+ <assertion id="f">
+ <text>Check the required type parameter and the bean type parameter are both type variables and the upper bound of the required type parameter is assignable to the upper bound of the bean type parameter.</text>
+ </assertion>
+ </group>
+
</section>
<section id="5.2.4" title="Primitive types and null values">
@@ -4220,6 +4310,7 @@
<assertion id="g">
<text>If a decorator invokes the delegate object at any other time, the invoked method throws an |IllegalStateException|.</text>
</assertion>
+
</section>
<section id="8.1.3" title="Decorated types of a decorator">
@@ -4290,7 +4381,51 @@
<text>For a custom implementation of the Decorator interface defined in Section 11.1.1, "The Decorator interface", the container calls |getDelegateType()|, |getDelegateQualifiers()| and |getDecoratedTypes()| to determine the delegate type and qualifiers and decorated types of the decorator.</text>
</assertion>
</section>
+
+ <section id="8.3.1">
+ <group>
+ <text>A raw bean type is considered assignable to a parameterized delegate type if the raw types are identical and all type parameters of the delegate type are either unbounded type variables or java.lang.Object.</text>
+
+ <assertion id="a">
+ <text>Check all type parameters are unbounded type variables</text>
+ </assertion>
+
+ <assertion id="b">
+ <text>Check all type parameters are Object</text>
+ </assertion>
+ </group>
+
+ <group>
+ <text>A parameterized bean type is considered assignable to a parameterized delegate type if they have identical raw type and for each parameter: the delegate type parameter and the bean type parameter are actual types with identical raw type, and, if the type is parameterized, the bean type parameter is assignable to the delegate type parameter according to these rules, or the delegate type parameter is a wildcard, the bean type parameter is an actual type and the actual type is assignable to the upper bound, if any, of the wildcard and assignable from the lower bound, if any, of the wildcard, or the delegate type parameter is a wildcard, the bean type parameter is a type variable and the upper bound of the type variable is assignable to the upper bound, if any, of the wildcard and assignable from the lower bound, if any, of the wildcard, or the delegate type parameter and the bean type parameter are both type variables and the upper bound of the bean type parameter !
is assignable to the upper bound, if any, of the delegate type parameter, or the delegate type parameter is a type variable, the bean type parameter is an actual type, and the actual type is as- signable to the upper bound, if any, of the type variable.</text>
+
+ <assertion id="c">
+ <text>Check both have identical type parameters</text>
+ </assertion>
+
+ <assertion id="d">
+ <text>Check nested identical type parameters</text>
+ </assertion>
+
+ <assertion id="e">
+ <text>Check delegate type parameter is a wildcard, the bean type parameter is an actual type and the actual type is assignable to the upper bound of the wildcard and assignable from the lower bound of the wildcard</text>
+ </assertion>
+
+ <assertion id="f">
+ <text>Check delegate type parameter is a wildcard, the bean type parameter is a type variable and the upper bound of the type variable is assignable to the upper bound of the wildcard and assignable from the lower bound of the wildcard</text>
+ </assertion>
+
+ <assertion id="g">
+ <text>Check the delegate type parameter and the bean type parameter are both type variables and the upper bound of the bean type parameter is assignable to the upper bound of the delegate type parameter</text>
+ </assertion>
+
+ <assertion id="h">
+ <text>Check the delegate type parameter is a type variable, the bean type parameter is an actual type, and the actual type is as- signable to the upper bound of the type variable</text>
+ </assertion>
+ </group>
+
+ </section>
+
<section id="8.4" title="Decorator invocation">
<assertion id="a">
<text>Whenever a business method is invoked on an instance of a bean with decorators, the container intercepts the business method invocation and, after processing all interceptors of the method, invokes decorators of the bean. The container searches for the first decorator of the instance that implements the method that is being invoked as a business method.</text>
@@ -4561,12 +4696,14 @@
</section>
<section id="10.2" title="Observer resolution">
- <assertion id="a">
+ <assertion id="a" testable="false">
<text>The process of matching an event to its observer methods is called observer resolution. The container considers event type and qualifiers when resolving observers.</text>
+ <note>Statement of intent</note>
</assertion>
- <assertion id="b">
+ <assertion id="b" testable="false">
<text>Observer resolution usually occurs at runtime.</text>
+ <note>Describes non-portable behavior</note>
</assertion>
<assertion id="i">
16 years, 5 months
Weld SVN: r4765 - in cdi-tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/decorators/custom/broken and 4 other directories.
by weld-commits@lists.jboss.org
Author: jharting
Date: 2009-11-07 19:32:46 -0500 (Sat, 07 Nov 2009)
New Revision: 4765
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/AfterBeanDiscoveryObserver.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/Bus.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/BusGarage.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/CustomDecoratorImplementation.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/CustomDecoratorMatchingBeanWithFinalClassTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/Truck.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/Vehicle.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/VehicleDecorator.java
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/custom/broken/
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/beans.xml
cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/javax.enterprise.inject.spi.Extension
Log:
Another test for registration of a custom implementation of the decorator interface
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/AfterBeanDiscoveryObserver.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/AfterBeanDiscoveryObserver.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/AfterBeanDiscoveryObserver.java 2009-11-08 00:32:46 UTC (rev 4765)
@@ -0,0 +1,38 @@
+package org.jboss.jsr299.tck.tests.decorators.custom.broken.finalBeanClass;
+
+import java.util.Set;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+
+public class AfterBeanDiscoveryObserver implements Extension
+{
+
+ private static CustomDecoratorImplementation decorator;
+
+ @SuppressWarnings("unchecked")
+ public void addInterceptors(@Observes AfterBeanDiscovery event,BeanManager beanManager)
+ {
+ AnnotatedType<VehicleDecorator> type = beanManager.createAnnotatedType(VehicleDecorator.class);
+ Set<AnnotatedField<? super VehicleDecorator>> annotatedFields = type.getFields();
+ AnnotatedField<? super VehicleDecorator> annotatedField = annotatedFields.iterator().next();
+ decorator = new CustomDecoratorImplementation(annotatedField, beanManager);
+
+ event.addBean(decorator);
+ }
+
+ public void vetoVehicleDecorator(@Observes ProcessAnnotatedType<VehicleDecorator> event)
+ {
+ event.veto();
+ }
+
+ public static CustomDecoratorImplementation getDecorator()
+ {
+ return decorator;
+ }
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/Bus.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/Bus.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/Bus.java 2009-11-08 00:32:46 UTC (rev 4765)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.decorators.custom.broken.finalBeanClass;
+
+final class Bus implements Vehicle
+{
+
+ public void start()
+ {
+ }
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/BusGarage.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/BusGarage.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/BusGarage.java 2009-11-08 00:32:46 UTC (rev 4765)
@@ -0,0 +1,14 @@
+package org.jboss.jsr299.tck.tests.decorators.custom.broken.finalBeanClass;
+
+import javax.inject.Inject;
+
+class BusGarage
+{
+ @Inject
+ private Bus bus;
+
+ public Bus getBus()
+ {
+ return bus;
+ }
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/CustomDecoratorImplementation.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/CustomDecoratorImplementation.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/CustomDecoratorImplementation.java 2009-11-08 00:32:46 UTC (rev 4765)
@@ -0,0 +1,170 @@
+package org.jboss.jsr299.tck.tests.decorators.custom.broken.finalBeanClass;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Member;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.Decorator;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.jboss.jsr299.tck.literals.DefaultLiteral;
+
+class CustomDecoratorImplementation implements Decorator<VehicleDecorator>
+{
+
+ private boolean getDecoratedTypesCalled = false;
+ private boolean getDelegateQualifiersCalled = false;
+ private boolean getDelegateTypeCalled = false;
+
+ private AnnotatedField<? super VehicleDecorator> annotatedField;
+ private Set<Type> decoratedTypes;
+ private Set<InjectionPoint> injectionPoints;
+ private BeanManager beanManager;
+
+ public CustomDecoratorImplementation(AnnotatedField<? super VehicleDecorator> annotatedField, BeanManager beanManager)
+ {
+ this.annotatedField = annotatedField;
+ this.beanManager = beanManager;
+ decoratedTypes = Collections.singleton((Type) Vehicle.class);
+ injectionPoints = Collections.singleton((InjectionPoint) new CustomInjectionPoint());
+ }
+
+ public Set<Type> getDecoratedTypes()
+ {
+ getDecoratedTypesCalled = true;
+ return decoratedTypes;
+ }
+
+ public Set<Annotation> getDelegateQualifiers()
+ {
+ getDelegateQualifiersCalled = true;
+ return Collections.emptySet();
+ }
+
+ public Type getDelegateType()
+ {
+ getDelegateTypeCalled = true;
+ return Vehicle.class;
+ }
+
+ public Class<?> getBeanClass()
+ {
+ return VehicleDecorator.class;
+ }
+
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return injectionPoints;
+ }
+
+ public String getName()
+ {
+ return null;
+ }
+
+ public Set<Annotation> getQualifiers()
+ {
+ return Collections.emptySet();
+ }
+
+ public Class<? extends Annotation> getScope()
+ {
+ return Dependent.class;
+ }
+
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
+
+ public Set<Type> getTypes()
+ {
+ return new HashSet<Type>(Arrays.asList(VehicleDecorator.class, Object.class));
+ }
+
+ public boolean isAlternative()
+ {
+ return false;
+ }
+
+ public boolean isNullable()
+ {
+ return false;
+ }
+
+ public VehicleDecorator create(CreationalContext<VehicleDecorator> ctx)
+ {
+ VehicleDecorator decorator = new VehicleDecorator();
+ decorator.delegate = (Vehicle) beanManager.getInjectableReference(getInjectionPoints().iterator().next(), ctx);
+ return decorator;
+ }
+
+ public void destroy(VehicleDecorator arg0, CreationalContext<VehicleDecorator> arg1)
+ {
+ arg1.release();
+ }
+
+ public boolean isGetDecoratedTypesCalled()
+ {
+ return getDecoratedTypesCalled;
+ }
+
+ public boolean isGetDelegateQualifiersCalled()
+ {
+ return getDelegateQualifiersCalled;
+ }
+
+ public boolean isGetDelegateTypeCalled()
+ {
+ return getDelegateTypeCalled;
+ }
+
+ class CustomInjectionPoint implements InjectionPoint
+ {
+
+ public boolean isTransient()
+ {
+ return false;
+ }
+
+ public boolean isDelegate()
+ {
+ return true;
+ }
+
+ public Type getType()
+ {
+ return Vehicle.class;
+ }
+
+ public Set<Annotation> getQualifiers()
+ {
+ return Collections.singleton((Annotation) new DefaultLiteral());
+ }
+
+ public Member getMember()
+ {
+ return annotatedField.getJavaMember();
+ }
+
+ public Bean<?> getBean()
+ {
+ return CustomDecoratorImplementation.this;
+ }
+
+ public Annotated getAnnotated()
+ {
+ return annotatedField;
+ }
+ };
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/CustomDecoratorMatchingBeanWithFinalClassTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/CustomDecoratorMatchingBeanWithFinalClassTest.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/CustomDecoratorMatchingBeanWithFinalClassTest.java 2009-11-08 00:32:46 UTC (rev 4765)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, 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.decorators.custom.broken.finalBeanClass;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.DeploymentError;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.jboss.testharness.impl.packaging.jsr299.Extension;
+import org.testng.annotations.Test;
+
+@Artifact
+@BeansXml("beans.xml")
+@SpecVersion(spec = "cdi", version = "20091101")
+@IntegrationTest
+@Extension("javax.enterprise.inject.spi.Extension")
+(a)ExpectedDeploymentException(DeploymentError.class)
+public class CustomDecoratorMatchingBeanWithFinalClassTest extends AbstractJSR299Test
+{
+ @Test(groups = "ri-broken")
+ @SpecAssertion(section = "8.3", id = "ab")
+ // WELD-274
+ public void testCustomDecoratorDecoratingFinalBean()
+ {
+ assert false;
+ }
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/Truck.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/Truck.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/Truck.java 2009-11-08 00:32:46 UTC (rev 4765)
@@ -0,0 +1,10 @@
+package org.jboss.jsr299.tck.tests.decorators.custom.broken.finalBeanClass;
+
+class Truck implements Vehicle
+{
+
+ public void start()
+ {
+ }
+
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/Vehicle.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/Vehicle.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/Vehicle.java 2009-11-08 00:32:46 UTC (rev 4765)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.decorators.custom.broken.finalBeanClass;
+
+interface Vehicle
+{
+ void start();
+}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/VehicleDecorator.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/VehicleDecorator.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/VehicleDecorator.java 2009-11-08 00:32:46 UTC (rev 4765)
@@ -0,0 +1,15 @@
+package org.jboss.jsr299.tck.tests.decorators.custom.broken.finalBeanClass;
+
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+class VehicleDecorator implements Vehicle
+{
+ @Inject @Delegate
+ Vehicle delegate;
+
+ public void start()
+ {
+ delegate.start();
+ }
+}
Added: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/beans.xml
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/beans.xml (rev 0)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/beans.xml 2009-11-08 00:32:46 UTC (rev 4765)
@@ -0,0 +1,5 @@
+<beans>
+ <decorators>
+ <class>org.jboss.jsr299.tck.tests.decorators.custom.broken.finalBeanClass.VehicleDecorator</class>
+ </decorators>
+</beans>
Added: cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/javax.enterprise.inject.spi.Extension
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/javax.enterprise.inject.spi.Extension (rev 0)
+++ cdi-tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/decorators/custom/broken/finalBeanClass/javax.enterprise.inject.spi.Extension 2009-11-08 00:32:46 UTC (rev 4765)
@@ -0,0 +1 @@
+org.jboss.jsr299.tck.tests.decorators.custom.broken.finalBeanClass.AfterBeanDiscoveryObserver
\ No newline at end of file
16 years, 5 months
Weld SVN: r4764 - cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event and 4 other directories.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-11-07 19:24:46 -0500 (Sat, 07 Nov 2009)
New Revision: 4764
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractJSR299Test.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/ContainerEventTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ContainerEventTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/EnterpriseResolutionByTypeTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ResolutionByTypeTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/parameterized/AssignabilityOfRawAndParameterizedTypesTest.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java
Log:
WELD-264
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractJSR299Test.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractJSR299Test.java 2009-11-08 00:05:24 UTC (rev 4763)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractJSR299Test.java 2009-11-08 00:24:46 UTC (rev 4764)
@@ -92,7 +92,7 @@
return annotationTypeList.size() == 0;
}
- public boolean typeSetMatches(Set<Type> types, Class<?>... requiredTypes)
+ public boolean rawTypeSetMatches(Set<Type> types, Class<?>... requiredTypes)
{
List<Class<?>> typeList = new ArrayList<Class<?>>();
typeList.addAll(Arrays.asList(requiredTypes));
@@ -109,6 +109,12 @@
}
return typeList.size() == 0;
}
+
+ public boolean typeSetMatches(Set<Type> types, Type... requiredTypes)
+ {
+ List<Type> typeList = Arrays.asList(requiredTypes);
+ return types.containsAll(typeList);
+ }
public <T> Bean<T> getUniqueBean(Class<T> type, Annotation... bindings)
{
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/ContainerEventTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/ContainerEventTest.java 2009-11-08 00:05:24 UTC (rev 4763)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/container/event/ContainerEventTest.java 2009-11-08 00:24:46 UTC (rev 4764)
@@ -154,20 +154,20 @@
private void validateStatelessSessionBean(Annotated type) {
assert type.getBaseType().equals(Sheep.class);
- assert typeSetMatches(type.getTypeClosure(), Sheep.class, SheepLocal.class, Object.class);
+ assert rawTypeSetMatches(type.getTypeClosure(), Sheep.class, SheepLocal.class, Object.class);
assert type.getAnnotations().size() == 2;
assert annotationSetMatches(type.getAnnotations(), Tame.class, Stateless.class); //TODO Check
}
private void validateStatefulSessionBean(Annotated type) {
assert type.getBaseType().equals(Cow.class);
- assert typeSetMatches(type.getTypeClosure(), Cow.class, CowLocal.class, Object.class);
+ assert rawTypeSetMatches(type.getTypeClosure(), Cow.class, CowLocal.class, Object.class);
assert type.getAnnotations().size() == 0;
}
private void validateSessionBeanInterceptor(AnnotatedType<SheepInterceptor> type) {
assert type.getBaseType().equals(SheepInterceptor.class);
- assert typeSetMatches(type.getTypeClosure(), SheepInterceptor.class, Object.class);
+ assert rawTypeSetMatches(type.getTypeClosure(), SheepInterceptor.class, Object.class);
assert type.getAnnotations().size() == 0;
assert type.getFields().size() == 0;
assert type.getMethods().size() == 1;
@@ -175,7 +175,7 @@
private void validateManagedBean(AnnotatedType<Farm> type) {
assert type.getBaseType().equals(Farm.class);
- assert typeSetMatches(type.getTypeClosure(), Farm.class, Object.class);
+ assert rawTypeSetMatches(type.getTypeClosure(), Farm.class, Object.class);
assert type.getFields().size() == 1;
assert type.getFields().iterator().next().isAnnotationPresent(Produces.class);
assert type.getMethods().size() == 1;
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ContainerEventTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ContainerEventTest.java 2009-11-08 00:05:24 UTC (rev 4763)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/ContainerEventTest.java 2009-11-08 00:24:46 UTC (rev 4764)
@@ -200,14 +200,14 @@
private void validateTagHandlerAnnotatedType(AnnotatedType<TestTagHandler> type) {
assert type.getBaseType().equals(TestTagHandler.class);
- assert typeSetMatches(type.getTypeClosure(), TestTagHandler.class, SimpleTagSupport.class, SimpleTag.class, JspTag.class);
+ assert rawTypeSetMatches(type.getTypeClosure(), TestTagHandler.class, SimpleTagSupport.class, SimpleTag.class, JspTag.class);
assert type.getAnnotations().size() == 1;
assert type.isAnnotationPresent(Any.class);
}
private void validateTagLibraryListenerAnnotatedType(AnnotatedType<TagLibraryListener> type) {
assert type.getBaseType().equals(TagLibraryListener.class);
- assert typeSetMatches(type.getTypeClosure(), TagLibraryListener.class, ServletContextListener.class, EventListener.class, Object.class);
+ assert rawTypeSetMatches(type.getTypeClosure(), TagLibraryListener.class, ServletContextListener.class, EventListener.class, Object.class);
assert type.getFields().size() == 1;
assert type.getFields().iterator().next().getJavaMember().getName().equals("sheep");
assert type.getConstructors().size() == 1;
@@ -216,13 +216,13 @@
private void validateServletAnnotatedType(AnnotatedType<TestServlet> type) {
assert type.getBaseType().equals(TestServlet.class);
- assert typeSetMatches(type.getTypeClosure(), TestServlet.class, HttpServlet.class, GenericServlet.class, Servlet.class, ServletConfig.class, Object.class);
+ assert rawTypeSetMatches(type.getTypeClosure(), TestServlet.class, HttpServlet.class, GenericServlet.class, Servlet.class, ServletConfig.class, Object.class);
assert type.getAnnotations().isEmpty();
}
private void validateFilterAnnotatedType(AnnotatedType<TestFilter> type) {
assert type.getBaseType().equals(TestFilter.class);
- assert typeSetMatches(type.getTypeClosure(), TestFilter.class, Filter.class, Object.class);
+ assert rawTypeSetMatches(type.getTypeClosure(), TestFilter.class, Filter.class, Object.class);
assert type.getFields().size() == 2;
assert type.getConstructors().size() == 1;
assert type.getConstructors().iterator().next().getParameters().isEmpty();
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/EnterpriseResolutionByTypeTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/EnterpriseResolutionByTypeTest.java 2009-11-08 00:05:24 UTC (rev 4763)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/EnterpriseResolutionByTypeTest.java 2009-11-08 00:24:46 UTC (rev 4764)
@@ -39,8 +39,7 @@
assert getBeans(CapercaillieLocal.class).size() == 1;
assert getBeans(ScottishBirdLocal.class).isEmpty();
Bean<CapercaillieLocal> bean = getUniqueBean(CapercaillieLocal.class);
- assert bean.getTypes().size() == 1;
- assert bean.getTypes().iterator().next().equals(CapercaillieLocal.class);
+ assert rawTypeSetMatches(bean.getTypes(), CapercaillieLocal.class, Object.class);
}
}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ResolutionByTypeTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ResolutionByTypeTest.java 2009-11-08 00:05:24 UTC (rev 4763)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ResolutionByTypeTest.java 2009-11-08 00:24:46 UTC (rev 4764)
@@ -225,8 +225,7 @@
assert getBeans(Canary.class).size() == 1;
Bean<Canary> bean = getUniqueBean(Canary.class);
assert getBeans(Bird.class).isEmpty();
- assert bean.getTypes().size() == 1;
- assert bean.getTypes().iterator().next().equals(Canary.class);
+ assert typeSetMatches(bean.getTypes(), Canary.class, Object.class);
}
@Test
@@ -237,8 +236,7 @@
assert getBeans(Emu.class).isEmpty();
assert getBeans(EUROPEAN_FLIGHTLESS_BIRD).isEmpty();
Bean<FlightlessBird<Australian>> bean = getUniqueBean(AUSTRALIAN_FLIGHTLESS_BIRD);
- assert bean.getTypes().size() == 1;
- assert bean.getTypes().iterator().next().equals(AUSTRALIAN_FLIGHTLESS_BIRD.getType());
+ assert typeSetMatches(bean.getTypes(), AUSTRALIAN_FLIGHTLESS_BIRD.getType(), Object.class);
}
@Test
@@ -248,8 +246,7 @@
assert getBeans(Parrot.class).size() == 1;
assert getBeans(Bird.class).isEmpty();
Bean<Parrot> bean = getUniqueBean(Parrot.class);
- assert bean.getTypes().size() == 1;
- assert bean.getTypes().iterator().next().equals(Parrot.class);
+ assert typeSetMatches(bean.getTypes(), Parrot.class, Object.class);
}
@Test
@@ -259,8 +256,7 @@
assert getBeans(EUROPEAN_CAT, TAME).size() == 1;
assert getBeans(DomesticCat.class, TAME).isEmpty();
Bean<Cat<European>> bean = getUniqueBean(EUROPEAN_CAT, TAME);
- assert bean.getTypes().size() == 1;
- assert bean.getTypes().iterator().next().equals(EUROPEAN_CAT.getType());
+ assert typeSetMatches(bean.getTypes(), EUROPEAN_CAT.getType(), Object.class);
}
@Test
@@ -270,18 +266,16 @@
assert getBeans(AFRICAN_CAT, WILD).size() == 1;
assert getBeans(Lion.class, WILD).isEmpty();
Bean<Cat<African>> bean = getUniqueBean(AFRICAN_CAT, WILD);
- assert bean.getTypes().size() == 1;
- assert bean.getTypes().iterator().next().equals(AFRICAN_CAT.getType());
+ assert typeSetMatches(bean.getTypes(), AFRICAN_CAT.getType(), Object.class);
}
@Test
@SpecAssertion(section = "2.2.2", id = "d")
- public void testGeeBeanTypesOnProducerField()
+ public void testBeanTypesOnProducerField()
{
assert getBeans(Dove.class).size() == 1;
assert getBeans(Bird.class).isEmpty();
Bean<Dove> bean = getUniqueBean(Dove.class);
- assert bean.getTypes().size() == 1;
- assert bean.getTypes().iterator().next().equals(Dove.class);
+ assert typeSetMatches(bean.getTypes(), Dove.class, Object.class);
}
}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/parameterized/AssignabilityOfRawAndParameterizedTypesTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/parameterized/AssignabilityOfRawAndParameterizedTypesTest.java 2009-11-08 00:05:24 UTC (rev 4763)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/parameterized/AssignabilityOfRawAndParameterizedTypesTest.java 2009-11-08 00:24:46 UTC (rev 4764)
@@ -79,7 +79,7 @@
{
Set<Bean<Result<? extends Throwable, ? super Exception>>> beans = getBeans(new TypeLiteral<Result<? extends Throwable, ? super Exception>>(){});
assert beans.size() == 1;
- assert typeSetMatches(beans.iterator().next().getTypes(), Result.class, Object.class);
+ assert rawTypeSetMatches(beans.iterator().next().getTypes(), Result.class, Object.class);
}
@Test(groups = { "resolution" })
@@ -88,7 +88,7 @@
{
Set<Bean<Result<Exception, Exception>>> beans = getBeans(new TypeLiteral<Result<Exception, Exception>>(){});
assert beans.size() == 1;
- assert typeSetMatches(beans.iterator().next().getTypes(), Result.class, Object.class);
+ assert rawTypeSetMatches(beans.iterator().next().getTypes(), Result.class, Object.class);
}
@Test(groups = { "resolution" })
@@ -97,7 +97,7 @@
{
Set<Bean<Result<T1, T2>>> beans = getBeans(new TypeLiteral<Result<T1, T2>>(){});
assert beans.size() == 1;
- assert typeSetMatches(beans.iterator().next().getTypes(), Result.class, Object.class);
+ assert rawTypeSetMatches(beans.iterator().next().getTypes(), Result.class, Object.class);
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java 2009-11-08 00:05:24 UTC (rev 4763)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java 2009-11-08 00:24:46 UTC (rev 4764)
@@ -221,6 +221,7 @@
types.add(typeClosure.get(specifiedClass));
}
}
+ types.add(Object.class);
return types;
}
16 years, 5 months
Weld SVN: r4763 - in core/trunk/impl/src/main: java/org/jboss/weld/bean and 6 other directories.
by weld-commits@lists.jboss.org
Author: dallen6
Date: 2009-11-07 19:05:24 -0500 (Sat, 07 Nov 2009)
New Revision: 4763
Added:
core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenArgumentException.java
core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenStateException.java
core/trunk/impl/src/main/java/org/jboss/weld/InvalidOperationException.java
core/trunk/impl/src/main/java/org/jboss/weld/WeldException.java
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/DefinitionException.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/AbstractFacade.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/DefaultValidatorBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/DefaultValidatorFactoryBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/EEResourceProducerField.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/PrincipalBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/UserTransactionBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/InterceptorBindingsAdapter.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/DecoratorProxyMethodHandler.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/EnterpriseBeanProxyMethodHandler.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:
Changed some of the exception messages to resource bundles
Modified: core/trunk/impl/src/main/java/org/jboss/weld/DefinitionException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/DefinitionException.java 2009-11-07 23:55:17 UTC (rev 4762)
+++ core/trunk/impl/src/main/java/org/jboss/weld/DefinitionException.java 2009-11-08 00:05:24 UTC (rev 4763)
@@ -16,6 +16,9 @@
*/
package org.jboss.weld;
+import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
+import ch.qos.cal10n.IMessageConveyor;
+
/**
* Thrown if the definition of a bean is incorrect
*
@@ -25,11 +28,24 @@
{
private static final long serialVersionUID = 8014646336322875707L;
+ // Exception messages
+ private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+
public DefinitionException()
{
super();
}
+ public <E extends Enum<?>> DefinitionException(E key, Object... args)
+ {
+ super(messageConveyer.getMessage(key, args));
+ }
+
+ public <E extends Enum<?>> DefinitionException(E key, Throwable throwable, Object... args)
+ {
+ super(messageConveyer.getMessage(key, args), throwable);
+ }
+
public DefinitionException(String message, Throwable throwable)
{
super(message, throwable);
Added: core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenArgumentException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenArgumentException.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenArgumentException.java 2009-11-08 00:05:24 UTC (rev 4763)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, 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.weld;
+
+import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
+import ch.qos.cal10n.IMessageConveyor;
+
+/**
+ * This exception is used when the specification calls for an
+ * {@link java.lang.IllegalArgumentException}.
+ *
+ * @author David Allen
+ */
+public class ForbiddenArgumentException extends IllegalArgumentException
+{
+
+ private static final long serialVersionUID = 1L;
+
+ // Exception messages
+ private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+
+ public <E extends Enum<?>> ForbiddenArgumentException(E key, Object... args)
+ {
+ super(messageConveyer.getMessage(key, args));
+ }
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenArgumentException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenStateException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenStateException.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenStateException.java 2009-11-08 00:05:24 UTC (rev 4763)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, 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.weld;
+
+import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
+import ch.qos.cal10n.IMessageConveyor;
+
+/**
+ * This exception is used when the specification calls for an
+ * {@link java.lang.IllegalStateException}.
+ *
+ * @author David Allen
+ */
+public class ForbiddenStateException extends IllegalStateException
+{
+ private static final long serialVersionUID = 1L;
+
+ // Exception messages
+ private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+
+ public <E extends Enum<?>> ForbiddenStateException(E key, Object... args)
+ {
+ super(messageConveyer.getMessage(key, args));
+ }
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/ForbiddenStateException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: core/trunk/impl/src/main/java/org/jboss/weld/InvalidOperationException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/InvalidOperationException.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/InvalidOperationException.java 2009-11-08 00:05:24 UTC (rev 4763)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, 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.weld;
+
+import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
+import ch.qos.cal10n.IMessageConveyor;
+
+/**
+ * An exception used for unsupported operations or invocations of operations
+ * that are invalid in certain contexts.
+ *
+ * @author David Allen
+ *
+ */
+public class InvalidOperationException extends UnsupportedOperationException
+{
+
+ private static final long serialVersionUID = 1L;
+
+ // Exception messages
+ private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+
+ public <E extends Enum<?>> InvalidOperationException(E key, Object... args)
+ {
+ super(messageConveyer.getMessage(key, args));
+ }
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/InvalidOperationException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: core/trunk/impl/src/main/java/org/jboss/weld/WeldException.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/WeldException.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/WeldException.java 2009-11-08 00:05:24 UTC (rev 4763)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, 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.weld;
+
+import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
+import ch.qos.cal10n.IMessageConveyor;
+
+/**
+ * A general run-time exception used by the JSR-299 reference implementation Weld.
+ *
+ * @author David Allen
+ */
+public class WeldException extends RuntimeException
+{
+ private static final long serialVersionUID = 1L;
+
+ // Exception messages
+ private static final IMessageConveyor messageConveyer = loggerFactory().getMessageConveyor();
+
+ public <E extends Enum<?>> WeldException(E key, Object... args)
+ {
+ super(messageConveyer.getMessage(key, args));
+ }
+
+ public <E extends Enum<?>> WeldException(E key, Throwable throwable, Object... args)
+ {
+ super(messageConveyer.getMessage(key, args), throwable);
+ }
+
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/WeldException.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java 2009-11-07 23:55:17 UTC (rev 4762)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java 2009-11-08 00:05:24 UTC (rev 4763)
@@ -19,7 +19,11 @@
import static org.jboss.weld.logging.Category.BEAN;
import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
import static org.jboss.weld.logging.messages.BeanMessage.CREATING_BEAN;
+import static org.jboss.weld.logging.messages.BeanMessage.DELEGATE_NOT_ON_DECORATOR;
+import static org.jboss.weld.logging.messages.BeanMessage.MULTIPLE_SCOPES_FOUND_FROM_STEREOTYPES;
+import static org.jboss.weld.logging.messages.BeanMessage.NAME_NOT_ALLOWED_ON_SPECIALIZATION;
import static org.jboss.weld.logging.messages.BeanMessage.QUALIFIERS_USED;
+import static org.jboss.weld.logging.messages.BeanMessage.TYPED_CLASS_NOT_IN_HIERARCHY;
import static org.jboss.weld.logging.messages.BeanMessage.USING_DEFAULT_NAME;
import static org.jboss.weld.logging.messages.BeanMessage.USING_DEFAULT_QUALIFIER;
import static org.jboss.weld.logging.messages.BeanMessage.USING_NAME;
@@ -154,7 +158,7 @@
{
if (this.delegateInjectionPoints.size() > 0)
{
- throw new DefinitionException("Cannot place @Decorates at an injection point which is not on a Decorator " + this);
+ throw new DefinitionException(DELEGATE_NOT_ON_DECORATOR, this);
}
}
@@ -210,7 +214,7 @@
{
if (!typeClosure.containsKey(specifiedClass))
{
- throw new DefinitionException("@Typed class " + specifiedClass.getName() + " is not present in the type hierarchy " + rawType);
+ throw new DefinitionException(TYPED_CLASS_NOT_IN_HIERARCHY, specifiedClass.getName(), rawType);
}
else
{
@@ -337,7 +341,7 @@
}
else if (possibleScopeTypes.size() > 1)
{
- throw new DefinitionException("All stereotypes must specify the same scope OR a scope must be specified on " + getAnnotatedItem());
+ throw new DefinitionException(MULTIPLE_SCOPES_FOUND_FROM_STEREOTYPES, getAnnotatedItem());
}
else
{
@@ -349,7 +353,7 @@
{
if (getAnnotatedItem().isAnnotationPresent(Named.class) && getSpecializedBean().getAnnotatedItem().isAnnotationPresent(Named.class))
{
- throw new DefinitionException("Cannot put name on specializing and specialized class " + getAnnotatedItem());
+ throw new DefinitionException(NAME_NOT_ALLOWED_ON_SPECIALIZATION, getAnnotatedItem());
}
this.bindings.addAll(getSpecializedBean().getQualifiers());
if (isSpecializing() && getSpecializedBean().getAnnotatedItem().isAnnotationPresent(Named.class))
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java 2009-11-07 23:55:17 UTC (rev 4762)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java 2009-11-08 00:05:24 UTC (rev 4763)
@@ -18,6 +18,9 @@
import static org.jboss.weld.logging.Category.BEAN;
import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
+import static org.jboss.weld.logging.messages.BeanMessage.NON_CONTAINER_DECORATOR;
+import static org.jboss.weld.logging.messages.BeanMessage.PROXY_INSTANTIATION_BEAN_ACCESS_FAILED;
+import static org.jboss.weld.logging.messages.BeanMessage.PROXY_INSTANTIATION_FAILED;
import static org.jboss.weld.logging.messages.BeanMessage.USING_DEFAULT_SCOPE;
import static org.jboss.weld.logging.messages.BeanMessage.USING_SCOPE;
@@ -49,9 +52,14 @@
import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.DefinitionException;
import org.jboss.weld.DeploymentException;
+import org.jboss.weld.ForbiddenStateException;
+import org.jboss.weld.WeldException;
import org.jboss.weld.bean.proxy.DecoratorProxyMethodHandler;
import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
import org.jboss.weld.context.SerializableContextualImpl;
+import org.jboss.weld.bean.proxy.DecoratorProxyMethodHandler;
+import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
+import org.jboss.weld.context.SerializableContextualImpl;
import org.jboss.weld.context.SerializableContextualInstanceImpl;
import org.jboss.weld.ejb.EJBApiAbstraction;
import org.jboss.weld.injection.FieldInjectionPoint;
@@ -198,7 +206,7 @@
ip = Beans.getDelegateInjectionPoint(decorator);
if (ip == null)
{
- throw new IllegalStateException("Cannot operate on non container provided decorator " + decorator);
+ throw new ForbiddenStateException(NON_CONTAINER_DECORATOR, decorator);
}
}
}
@@ -220,11 +228,11 @@
}
catch (InstantiationException e)
{
- throw new RuntimeException("Could not instantiate decorator proxy for " + toString(), e);
+ throw new WeldException(PROXY_INSTANTIATION_FAILED, e, this);
}
catch (IllegalAccessException e)
{
- throw new RuntimeException("Could not access bean correctly when creating decorator proxy for " + toString(), e);
+ throw new WeldException(PROXY_INSTANTIATION_BEAN_ACCESS_FAILED, e, this);
}
finally
{
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/AbstractFacade.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/AbstractFacade.java 2009-11-07 23:55:17 UTC (rev 4762)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/AbstractFacade.java 2009-11-08 00:05:24 UTC (rev 4763)
@@ -16,6 +16,8 @@
*/
package org.jboss.weld.bean.builtin;
+import static org.jboss.weld.logging.messages.BeanMessage.TYPE_PARAMETER_MUST_BE_CONCRETE;
+
import java.io.Serializable;
import java.lang.annotation.Annotation;
import java.lang.reflect.ParameterizedType;
@@ -25,6 +27,7 @@
import javax.enterprise.inject.spi.InjectionPoint;
import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.ForbiddenStateException;
/**
* Common implementation for binding-type-based helpers
@@ -45,7 +48,7 @@
}
else
{
- throw new IllegalStateException("Must have concrete type argument " + injectionPoint);
+ throw new ForbiddenStateException(TYPE_PARAMETER_MUST_BE_CONCRETE, injectionPoint);
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/DefaultValidatorBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/DefaultValidatorBean.java 2009-11-07 23:55:17 UTC (rev 4762)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/DefaultValidatorBean.java 2009-11-08 00:05:24 UTC (rev 4763)
@@ -16,10 +16,13 @@
*/
package org.jboss.weld.bean.builtin.ee;
+import static org.jboss.weld.logging.messages.BeanMessage.VALIDATION_SERVICE_NOT_AVAILABLE;
+
import javax.validation.Validator;
import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.Container;
+import org.jboss.weld.ForbiddenStateException;
import org.jboss.weld.validation.spi.ValidationServices;
/**
@@ -47,7 +50,7 @@
}
else
{
- throw new IllegalStateException("ValidationServices not available");
+ throw new ForbiddenStateException(VALIDATION_SERVICE_NOT_AVAILABLE);
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/DefaultValidatorFactoryBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/DefaultValidatorFactoryBean.java 2009-11-07 23:55:17 UTC (rev 4762)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/DefaultValidatorFactoryBean.java 2009-11-08 00:05:24 UTC (rev 4763)
@@ -16,9 +16,12 @@
*/
package org.jboss.weld.bean.builtin.ee;
+import static org.jboss.weld.logging.messages.BeanMessage.VALIDATION_SERVICE_NOT_AVAILABLE;
+
import javax.validation.ValidatorFactory;
import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.ForbiddenStateException;
import org.jboss.weld.validation.spi.ValidationServices;
/**
@@ -46,7 +49,7 @@
}
else
{
- throw new IllegalStateException("ValidationServices not available");
+ throw new ForbiddenStateException(VALIDATION_SERVICE_NOT_AVAILABLE);
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/EEResourceProducerField.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/EEResourceProducerField.java 2009-11-07 23:55:17 UTC (rev 4762)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/EEResourceProducerField.java 2009-11-08 00:05:24 UTC (rev 4763)
@@ -16,12 +16,15 @@
*/
package org.jboss.weld.bean.builtin.ee;
+import static org.jboss.weld.logging.messages.BeanMessage.INVALID_RESOURCE_PRODUCER_FIELD;
+
import java.io.Serializable;
import javax.enterprise.context.spi.Contextual;
import javax.enterprise.context.spi.CreationalContext;
import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.ForbiddenStateException;
import org.jboss.weld.Container;
import org.jboss.weld.bean.AbstractClassBean;
import org.jboss.weld.bean.ProducerField;
@@ -142,7 +145,7 @@
WSApiAbstraction wsApiAbstraction = manager.getServices().get(WSApiAbstraction.class);
if (!(getAnnotatedItem().isAnnotationPresent(ejbApiAbstraction.RESOURCE_ANNOTATION_CLASS) || getAnnotatedItem().isAnnotationPresent(persistenceApiAbstraction.PERSISTENCE_CONTEXT_ANNOTATION_CLASS) || getAnnotatedItem().isAnnotationPresent(persistenceApiAbstraction.PERSISTENCE_UNIT_ANNOTATION_CLASS) || getAnnotatedItem().isAnnotationPresent(ejbApiAbstraction.EJB_ANNOTATION_CLASS)) || getAnnotatedItem().isAnnotationPresent(wsApiAbstraction.WEB_SERVICE_REF_ANNOTATION_CLASS))
{
- throw new IllegalStateException("Tried to create an EEResourceProducerField, but no @Resource, @PersistenceContext, @PersistenceUnit, @WebServiceRef or @EJB is present " + getAnnotatedItem());
+ throw new ForbiddenStateException(INVALID_RESOURCE_PRODUCER_FIELD, getAnnotatedItem());
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/PrincipalBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/PrincipalBean.java 2009-11-07 23:55:17 UTC (rev 4762)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/PrincipalBean.java 2009-11-08 00:05:24 UTC (rev 4763)
@@ -16,9 +16,12 @@
*/
package org.jboss.weld.bean.builtin.ee;
+import static org.jboss.weld.logging.messages.BeanMessage.SECURITY_SERVICES_NOT_AVAILABLE;
+
import java.security.Principal;
import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.ForbiddenStateException;
import org.jboss.weld.security.spi.SecurityServices;
/**
@@ -46,7 +49,7 @@
}
else
{
- throw new IllegalStateException("SecurityServices not available");
+ throw new ForbiddenStateException(SECURITY_SERVICES_NOT_AVAILABLE);
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/UserTransactionBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/UserTransactionBean.java 2009-11-07 23:55:17 UTC (rev 4762)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/builtin/ee/UserTransactionBean.java 2009-11-08 00:05:24 UTC (rev 4763)
@@ -16,9 +16,12 @@
*/
package org.jboss.weld.bean.builtin.ee;
+import static org.jboss.weld.logging.messages.BeanMessage.TRANSACTION_SERVICES_NOT_AVAILABLE;
+
import javax.transaction.UserTransaction;
import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.ForbiddenStateException;
import org.jboss.weld.transaction.spi.TransactionServices;
/**
@@ -46,7 +49,7 @@
}
else
{
- throw new IllegalStateException("TransactionServices not available");
+ throw new ForbiddenStateException(TRANSACTION_SERVICES_NOT_AVAILABLE);
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/InterceptorBindingsAdapter.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/InterceptorBindingsAdapter.java 2009-11-07 23:55:17 UTC (rev 4762)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/InterceptorBindingsAdapter.java 2009-11-08 00:05:24 UTC (rev 4763)
@@ -17,17 +17,24 @@
package org.jboss.weld.bean.interceptor;
+import static org.jboss.weld.logging.messages.BeanMessage.INTERCEPTION_MODEL_NULL;
+import static org.jboss.weld.logging.messages.BeanMessage.INTERCEPTION_TYPE_LIFECYCLE;
+import static org.jboss.weld.logging.messages.BeanMessage.INTERCEPTION_TYPE_NOT_LIFECYCLE;
+import static org.jboss.weld.logging.messages.BeanMessage.INTERCEPTION_TYPE_NULL;
+import static org.jboss.weld.logging.messages.BeanMessage.METHOD_NULL;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import java.util.ArrayList;
-import java.lang.reflect.Method;
+import javax.enterprise.inject.spi.InterceptionType;
import javax.enterprise.inject.spi.Interceptor;
-import javax.enterprise.inject.spi.InterceptionType;
+import org.jboss.interceptor.model.InterceptionModel;
+import org.jboss.weld.ForbiddenArgumentException;
import org.jboss.weld.ejb.spi.InterceptorBindings;
import org.jboss.weld.serialization.spi.helpers.SerializableContextual;
-import org.jboss.interceptor.model.InterceptionModel;
/**
* @author Marius Bogoevici
@@ -41,7 +48,7 @@
{
if (interceptionModel == null)
{
- throw new IllegalArgumentException("Interception model must not be null");
+ throw new ForbiddenArgumentException(INTERCEPTION_MODEL_NULL);
}
this.interceptionModel = interceptionModel;
}
@@ -56,19 +63,19 @@
{
if (interceptionType == null)
{
- throw new IllegalArgumentException("InterceptionType must not be null");
+ throw new ForbiddenArgumentException(INTERCEPTION_TYPE_NULL);
}
if (method == null)
{
- throw new IllegalArgumentException("Method must not be null");
+ throw new ForbiddenArgumentException(METHOD_NULL);
}
org.jboss.interceptor.model.InterceptionType internalInterceptionType = org.jboss.interceptor.model.InterceptionType.valueOf(interceptionType.name());
if (internalInterceptionType.isLifecycleCallback())
{
- throw new IllegalArgumentException("Interception type must not be lifecycle, but it is " + interceptionType.name());
+ throw new ForbiddenArgumentException(INTERCEPTION_TYPE_LIFECYCLE, interceptionType.name());
}
return toInterceptorList(interceptionModel.getInterceptors(internalInterceptionType, method));
@@ -79,14 +86,14 @@
{
if (interceptionType == null)
{
- throw new IllegalArgumentException("InterceptionType must not be null");
+ throw new ForbiddenArgumentException(INTERCEPTION_TYPE_NULL);
}
org.jboss.interceptor.model.InterceptionType internalInterceptionType = org.jboss.interceptor.model.InterceptionType.valueOf(interceptionType.name());
if (!internalInterceptionType.isLifecycleCallback())
{
- throw new IllegalArgumentException("Interception type must be lifecycle, but it is " + interceptionType.name());
+ throw new ForbiddenArgumentException(INTERCEPTION_TYPE_NOT_LIFECYCLE, interceptionType.name());
}
return toInterceptorList(interceptionModel.getInterceptors(internalInterceptionType, null));
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java 2009-11-07 23:55:17 UTC (rev 4762)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ClientProxyProvider.java 2009-11-08 00:05:24 UTC (rev 4763)
@@ -16,6 +16,9 @@
*/
package org.jboss.weld.bean.proxy;
+import static org.jboss.weld.logging.messages.BeanMessage.BEAN_ID_CREATION_FAILED;
+import static org.jboss.weld.logging.messages.BeanMessage.PROXY_INSTANTIATION_FAILED;
+
import java.io.Serializable;
import java.util.concurrent.Callable;
@@ -24,6 +27,8 @@
import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.Container;
import org.jboss.weld.DefinitionException;
+import org.jboss.weld.WeldException;
+import org.jboss.weld.logging.messages.BeanMessage;
import org.jboss.weld.serialization.spi.ContextualStore;
import org.jboss.weld.util.Proxies;
import org.jboss.weld.util.Proxies.TypeInfo;
@@ -76,11 +81,11 @@
}
catch (InstantiationException e)
{
- throw new RuntimeException("Could not instantiate client proxy for " + bean, e);
+ throw new WeldException(PROXY_INSTANTIATION_FAILED, e, bean);
}
catch (IllegalAccessException e)
{
- throw new RuntimeException("Could not access bean correctly when creating client proxy for " + bean, e);
+ throw new WeldException(BeanMessage.PROXY_INSTANTIATION_BEAN_ACCESS_FAILED, e, bean);
}
}
@@ -103,7 +108,7 @@
String id = Container.instance().deploymentServices().get(ContextualStore.class).putIfAbsent(bean);
if (id == null)
{
- throw new DefinitionException("There was an error creating an id for " + bean);
+ throw new DefinitionException(BEAN_ID_CREATION_FAILED, bean);
}
return createClientProxy(bean, manager, id);
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/DecoratorProxyMethodHandler.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/DecoratorProxyMethodHandler.java 2009-11-07 23:55:17 UTC (rev 4762)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/DecoratorProxyMethodHandler.java 2009-11-08 00:05:24 UTC (rev 4763)
@@ -16,6 +16,7 @@
*/
package org.jboss.weld.bean.proxy;
+import static org.jboss.weld.logging.messages.BeanMessage.UNEXPECTED_UNWRAPPED_CUSTOM_DECORATOR;
import static org.jboss.weld.util.Reflections.ensureAccessible;
import java.lang.reflect.Method;
@@ -24,6 +25,7 @@
import javax.enterprise.inject.spi.Decorator;
import org.jboss.interceptor.util.proxy.TargetInstanceProxyMethodHandler;
+import org.jboss.weld.ForbiddenStateException;
import org.jboss.weld.bean.AnnotatedItemProvidingDecoratorWrapper;
import org.jboss.weld.bean.DecoratorImpl;
import org.jboss.weld.introspector.MethodSignature;
@@ -90,7 +92,7 @@
}
else
{
- throw new IllegalStateException("Unexpected unwrapped custom decorator instance: " + beanInstance.getContextual().get());
+ throw new ForbiddenStateException(UNEXPECTED_UNWRAPPED_CUSTOM_DECORATOR, beanInstance.getContextual().get());
}
if (decoratorMethod != null)
{
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/EnterpriseBeanProxyMethodHandler.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/EnterpriseBeanProxyMethodHandler.java 2009-11-07 23:55:17 UTC (rev 4762)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/EnterpriseBeanProxyMethodHandler.java 2009-11-08 00:05:24 UTC (rev 4763)
@@ -20,6 +20,7 @@
import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
import static org.jboss.weld.logging.messages.BeanMessage.CALL_PROXIED_METHOD;
import static org.jboss.weld.logging.messages.BeanMessage.CREATED_SESSION_BEAN_PROXY;
+import static org.jboss.weld.logging.messages.BeanMessage.INVALID_REMOVE_METHOD_INVOCATION;
import java.io.Serializable;
import java.lang.reflect.Method;
@@ -29,6 +30,7 @@
import javax.enterprise.context.spi.CreationalContext;
+import org.jboss.weld.InvalidOperationException;
import org.jboss.weld.bean.SessionBean;
import org.jboss.weld.ejb.api.SessionObjectReference;
import org.jboss.weld.introspector.MethodSignature;
@@ -112,7 +114,7 @@
MethodSignature methodSignature = new MethodSignatureImpl(method);
if (removeMethodSignatures.contains(methodSignature))
{
- throw new UnsupportedOperationException("Cannot call EJB remove method directly on non-dependent scoped bean " + method );
+ throw new InvalidOperationException(INVALID_REMOVE_METHOD_INVOCATION, method );
}
}
Class<?> businessInterface = getBusinessInterface(method);
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 2009-11-07 23:55:17 UTC (rev 4762)
+++ core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/BeanMessage.java 2009-11-08 00:05:24 UTC (rev 4763)
@@ -38,6 +38,28 @@
@MessageId("000017") USING_DEFAULT_SCOPE,
@MessageId("000018") CIRCULAR_CALL,
@MessageId("000019") ERROR_DESTROYING,
- @MessageId("000020") DELEGATE_INJECTION_POINT_NOT_FOUND
+ @MessageId("000020") DELEGATE_INJECTION_POINT_NOT_FOUND,
+ @MessageId("000021") ANNOTATION_NOT_BINDING,
+ @MessageId("000022") DUPLICATE_BINDING,
+ @MessageId("000023") TYPE_PARAMETER_MUST_BE_CONCRETE,
+ @MessageId("000024") VALIDATION_SERVICE_NOT_AVAILABLE,
+ @MessageId("000025") INVALID_RESOURCE_PRODUCER_FIELD,
+ @MessageId("000026") SECURITY_SERVICES_NOT_AVAILABLE,
+ @MessageId("000027") TRANSACTION_SERVICES_NOT_AVAILABLE,
+ @MessageId("000028") INTERCEPTION_MODEL_NULL,
+ @MessageId("000029") INTERCEPTION_TYPE_NULL,
+ @MessageId("000030") METHOD_NULL,
+ @MessageId("000031") INTERCEPTION_TYPE_LIFECYCLE,
+ @MessageId("000032") INTERCEPTION_TYPE_NOT_LIFECYCLE,
+ @MessageId("000033") PROXY_INSTANTIATION_FAILED,
+ @MessageId("000034") PROXY_INSTANTIATION_BEAN_ACCESS_FAILED,
+ @MessageId("000035") BEAN_ID_CREATION_FAILED,
+ @MessageId("000036") UNEXPECTED_UNWRAPPED_CUSTOM_DECORATOR,
+ @MessageId("000037") INVALID_REMOVE_METHOD_INVOCATION,
+ @MessageId("000038") DELEGATE_NOT_ON_DECORATOR,
+ @MessageId("000039") TYPED_CLASS_NOT_IN_HIERARCHY,
+ @MessageId("000040") MULTIPLE_SCOPES_FOUND_FROM_STEREOTYPES,
+ @MessageId("000041") NAME_NOT_ALLOWED_ON_SPECIALIZATION,
+ @MessageId("000042") NON_CONTAINER_DECORATOR
}
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 2009-11-07 23:55:17 UTC (rev 4762)
+++ core/trunk/impl/src/main/resources/org/jboss/weld/messages/bean_en.properties 2009-11-08 00:05:24 UTC (rev 4763)
@@ -19,3 +19,25 @@
CIRCULAR_CALL=Executing producer field or method {0} on incomplete declaring bean {1} due to circular injection
ERROR_DESTROYING=Error destroying an instance {0} of {1}
DELEGATE_INJECTION_POINT_NOT_FOUND=Delegate injection point not found on decorator {0}
+ANNOTATION_NOT_BINDING=The annotation {0} is not a binding for {1}
+DUPLICATE_BINDING=The annotation {0} is already present in the bindings list for {1}
+TYPE_PARAMETER_MUST_BE_CONCRETE=Type parameter must be a concrete type\: {0}
+VALIDATION_SERVICE_NOT_AVAILABLE=ValidationServices are not available
+INVALID_RESOURCE_PRODUCER_FIELD=Tried to create an EEResourceProducerField, but no @Resource, @PersistenceContext, @PersistenceUnit, @WebServiceRef or @EJB is present {0}
+SECURITY_SERVICES_NOT_AVAILABLE=SecurityServices not available
+TRANSACTION_SERVICES_NOT_AVAILABLE=TransactionServices not available
+INTERCEPTION_MODEL_NULL=Interception model must not be null
+INTERCEPTION_TYPE_NULL=InterceptionType must not be null
+METHOD_NULL=Method must not be null
+INTERCEPTION_TYPE_LIFECYCLE=InterceptionType must not be lifecycle, but it is {0}
+PROXY_INSTANTIATION_FAILED=Could not instantiate client proxy for {0}
+PROXY_INSTANTIATION_BEAN_ACCESS_FAILED=Could not access bean correctly when creating client proxy for {0}
+BEAN_ID_CREATION_FAILED=There was an error creating an id for {0}
+UNEXPECTED_UNWRAPPED_CUSTOM_DECORATOR=Unexpected unwrapped custom decorator instance\: {0}
+INVALID_REMOVE_METHOD_INVOCATION=Cannot call EJB remove method directly on non-dependent scoped bean {0}
+DELEGATE_NOT_ON_DECORATOR=Cannot place @Delegate at an injection point which is not on a Decorator\: {0}
+TYPED_CLASS_NOT_IN_HIERARCHY=@Typed class {0} is not present in the type hierarchy {1}
+MULTIPLE_SCOPES_FOUND_FROM_STEREOTYPES=All stereotypes must specify the same scope OR a scope must be specified on {0}
+NON_CONTAINER_DECORATOR=Cannot operate on non container provided decorator {0}
+NAME_NOT_ALLOWED_ON_SPECIALIZATION=Cannot put name on specializing and specialized class {0}
+INTERCEPTION_TYPE_NOT_LIFECYCLE=InterceptionType must be lifecycle, but it is {0}
16 years, 5 months
Weld SVN: r4762 - cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom.
by weld-commits@lists.jboss.org
Author: jharting
Date: 2009-11-07 18:55:17 -0500 (Sat, 07 Nov 2009)
New Revision: 4762
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/CustomDecoratorTest.java
Log:
minor
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/CustomDecoratorTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/CustomDecoratorTest.java 2009-11-07 23:38:29 UTC (rev 4761)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/CustomDecoratorTest.java 2009-11-07 23:55:17 UTC (rev 4762)
@@ -42,7 +42,7 @@
public void testCustomImplementationOfDecoratorInterface()
{
assert getInstanceByType(Vehicle.class).start().equals("Bus started and decorated.");
- assert getInstanceByType(Vehicle.class).start().equals("Bus stopped and decorated.");
+ assert getInstanceByType(Vehicle.class).stop().equals("Bus stopped and decorated.");
assert AfterBeanDiscoveryObserver.getDecorator().isGetDecoratedTypesCalled();
assert AfterBeanDiscoveryObserver.getDecorator().isGetDelegateQualifiersCalled();
assert AfterBeanDiscoveryObserver.getDecorator().isGetDelegateTypeCalled();
16 years, 5 months
Weld SVN: r4761 - cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom.
by weld-commits@lists.jboss.org
Author: jharting
Date: 2009-11-07 18:38:29 -0500 (Sat, 07 Nov 2009)
New Revision: 4761
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/CustomDecoratorImplementation.java
Log:
minor
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/CustomDecoratorImplementation.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/CustomDecoratorImplementation.java 2009-11-07 23:13:41 UTC (rev 4760)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/custom/CustomDecoratorImplementation.java 2009-11-07 23:38:29 UTC (rev 4761)
@@ -17,6 +17,8 @@
import javax.enterprise.inject.spi.Decorator;
import javax.enterprise.inject.spi.InjectionPoint;
+import org.jboss.jsr299.tck.literals.DefaultLiteral;
+
class CustomDecoratorImplementation implements Decorator<VehicleDecorator>
{
@@ -147,24 +149,17 @@
public Set<Annotation> getQualifiers()
{
- return Collections.emptySet();
+ return Collections.singleton((Annotation) new DefaultLiteral());
}
public Member getMember()
{
- try
- {
- return VehicleDecorator.class.getDeclaredField("delegate");
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
+ return annotatedField.getJavaMember();
}
public Bean<?> getBean()
{
- return AfterBeanDiscoveryObserver.getDecorator();
+ return CustomDecoratorImplementation.this;
}
public Annotated getAnnotated()
16 years, 5 months
Weld SVN: r4760 - in cdi-tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/decorators/definition/broken/finalBeanMethod and 1 other directories.
by weld-commits@lists.jboss.org
Author: jharting
Date: 2009-11-07 18:13:41 -0500 (Sat, 07 Nov 2009)
New Revision: 4760
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/definition/broken/finalBeanClass/FinalBeanClassTest.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/definition/broken/finalBeanMethod/FinalBeanMethodTest.java
cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml
Log:
Matched tests with assertions.
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/definition/broken/finalBeanClass/FinalBeanClassTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/definition/broken/finalBeanClass/FinalBeanClassTest.java 2009-11-07 23:06:36 UTC (rev 4759)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/definition/broken/finalBeanClass/FinalBeanClassTest.java 2009-11-07 23:13:41 UTC (rev 4760)
@@ -17,7 +17,7 @@
package org.jboss.jsr299.tck.tests.decorators.definition.broken.finalBeanClass;
import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.jsr299.tck.DefinitionError;
+import org.jboss.jsr299.tck.DeploymentError;
import org.jboss.test.audit.annotations.SpecAssertion;
import org.jboss.test.audit.annotations.SpecVersion;
import org.jboss.testharness.impl.packaging.Artifact;
@@ -30,17 +30,18 @@
*
*/
@Artifact
-(a)ExpectedDeploymentException(DefinitionError.class)
+(a)ExpectedDeploymentException(DeploymentError.class)
@BeansXml("beans.xml")
@SpecVersion(spec="cdi", version="20091101")
public class FinalBeanClassTest extends AbstractJSR299Test
{
- @Test
- @SpecAssertion(section="8.1.2", id="d")
+ @Test(groups = "ri-broken")
+ @SpecAssertion(section="8.3", id="ab")
+ // WELD-272
public void testAppliesToFinalManagedBeanClass()
{
-
+ assert false;
}
}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/definition/broken/finalBeanMethod/FinalBeanMethodTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/definition/broken/finalBeanMethod/FinalBeanMethodTest.java 2009-11-07 23:06:36 UTC (rev 4759)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/definition/broken/finalBeanMethod/FinalBeanMethodTest.java 2009-11-07 23:13:41 UTC (rev 4760)
@@ -17,7 +17,7 @@
package org.jboss.jsr299.tck.tests.decorators.definition.broken.finalBeanMethod;
import org.jboss.jsr299.tck.AbstractJSR299Test;
-import org.jboss.jsr299.tck.DefinitionError;
+import org.jboss.jsr299.tck.DeploymentError;
import org.jboss.test.audit.annotations.SpecAssertion;
import org.jboss.test.audit.annotations.SpecVersion;
import org.jboss.testharness.impl.packaging.Artifact;
@@ -30,17 +30,18 @@
*
*/
@Artifact
-(a)ExpectedDeploymentException(DefinitionError.class)
+(a)ExpectedDeploymentException(DeploymentError.class)
@BeansXml("beans.xml")
@SpecVersion(spec="cdi", version="20091101")
public class FinalBeanMethodTest extends AbstractJSR299Test
{
- @Test
- @SpecAssertion(section="8.1.2", id="e")
+ @Test(groups = "ri-broken")
+ @SpecAssertion(section="8.3", id="ac")
+ // WELD-272
public void testAppliesToFinalMethodOnManagedBeanClass()
{
-
+ assert false;
}
}
Modified: cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml 2009-11-07 23:06:36 UTC (rev 4759)
+++ cdi-tck/trunk/impl/src/main/resources/tck-audit-cdi.xml 2009-11-07 23:13:41 UTC (rev 4760)
@@ -4275,9 +4275,17 @@
<section id="8.3" title="Decorator resolution">
<assertion id="aa">
- <text>The process of matching decorators to a certain bean is called decorator resolution. A decorator is bound to a bean if the bean is assignable to the delegate injection point according to the rules defined in Section 5.3, "Typesafe resolution", and the decorator is enabled in the bean deployment archive of the bean. If a decorator matches a managed bean, and the managed bean class is declared final, the container automatically detects the problem and treats it as a deployment problem.</text>
+ <text>The process of matching decorators to a certain bean is called decorator resolution. A decorator is bound to a bean if the bean is assignable to the delegate injection point according to the rules defined in Section 5.3, "Typesafe resolution", and the decorator is enabled in the bean deployment archive of the bean.</text>
</assertion>
+ <assertion id="ab">
+ <text>If a decorator matches a managed bean, and the managed bean class is declared final, the container automatically detects the problem and treats it as a deployment problem.</text>
+ </assertion>
+
+ <assertion id="ac">
+ <text>If a decorator matches a managed bean with a non-static, non-private, final method, and the decorator also implements that method, the container automatically detects the problem and treats it as a deployment problem.</text>
+ </assertion>
+
<assertion id="b">
<text>For a custom implementation of the Decorator interface defined in Section 11.1.1, "The Decorator interface", the container calls |getDelegateType()|, |getDelegateQualifiers()| and |getDecoratedTypes()| to determine the delegate type and qualifiers and decorated types of the decorator.</text>
</assertion>
16 years, 5 months
Weld SVN: r4759 - core/trunk/impl/src/main/java/org/jboss/weld/bean.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-11-07 18:06:36 -0500 (Sat, 07 Nov 2009)
New Revision: 4759
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java
Log:
WELD-62
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java 2009-11-07 22:31:57 UTC (rev 4758)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java 2009-11-07 23:06:36 UTC (rev 4759)
@@ -18,8 +18,8 @@
import static org.jboss.weld.logging.Category.BEAN;
import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
+import static org.jboss.weld.logging.messages.BeanMessage.DELEGATE_INJECTION_POINT_NOT_FOUND;
import static org.jboss.weld.logging.messages.BeanMessage.ERROR_DESTROYING;
-import static org.jboss.weld.logging.messages.BeanMessage.DELEGATE_INJECTION_POINT_NOT_FOUND;
import java.util.ArrayList;
import java.util.List;
@@ -296,7 +296,7 @@
boolean passivating = manager.getServices().get(MetaAnnotationStore.class).getScopeModel(scopeType).isPassivating();
if (passivating && !Reflections.isSerializable(getBeanClass()))
{
- throw new DefinitionException("Simple bean declaring a passivating scope must have a serializable implementation class " + toString());
+ throw new DefinitionException("Managed bean declaring a passivating scope must have a serializable implementation class. Bean: " + toString());
}
if (hasDecorators())
{
16 years, 5 months
Weld SVN: r4758 - cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/alternative/metadata.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-11-07 17:31:57 -0500 (Sat, 07 Nov 2009)
New Revision: 4758
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/alternative/metadata/AlternativeMetadataTest.java
Log:
WELD-219
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/alternative/metadata/AlternativeMetadataTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/alternative/metadata/AlternativeMetadataTest.java 2009-11-07 22:29:20 UTC (rev 4757)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/alternative/metadata/AlternativeMetadataTest.java 2009-11-07 22:31:57 UTC (rev 4758)
@@ -108,18 +108,15 @@
assert getInstanceByType(Grocery.class, new AnyLiteral()).isConstructorWithParameterUsed();
}
- @Test(groups = "ri-broken")
+ @Test
@SpecAssertion(section = "11.4", id = "t")
- // WELD-219
public void testPreviouslyNonInjectAnnotatedFieldIsInjected()
{
assert getInstanceByType(Grocery.class, new AnyLiteral()).isVegetablesInjected();
}
@SuppressWarnings("unchecked")
- @Test(groups = "ri-broken")
@SpecAssertion(section = "11.4", id = "u")
- // WELD-219
public void testExtraQualifierIsAppliedToInjectedField()
{
assert getInstanceByType(Grocery.class, new AnyLiteral()).getFruit() != null;
16 years, 5 months