Weld SVN: r4010 - cdi-tck/trunk.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-13 11:55:00 -0400 (Tue, 13 Oct 2009)
New Revision: 4010
Modified:
cdi-tck/trunk/pom.xml
Log:
fix
Modified: cdi-tck/trunk/pom.xml
===================================================================
--- cdi-tck/trunk/pom.xml 2009-10-13 15:49:56 UTC (rev 4009)
+++ cdi-tck/trunk/pom.xml 2009-10-13 15:55:00 UTC (rev 4010)
@@ -75,7 +75,6 @@
</modules>
<properties>
- <jsr299.tck.version>${project.version}</jsr299.tck.version>
<jboss.test.audit.version>1.0.0</jboss.test.audit.version>
<jboss.test.harness.version>1.1.0-CR1</jboss.test.harness.version>
<testng.version>5.9</testng.version>
@@ -214,7 +213,7 @@
<dependency>
<groupId>org.jboss.jsr299.tck</groupId>
<artifactId>jsr299-tck-api</artifactId>
- <version>${jsr299.tck.version}</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
15 years
Weld SVN: r4009 - core/trunk/inject-tck-runner.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-13 11:49:56 -0400 (Tue, 13 Oct 2009)
New Revision: 4009
Modified:
core/trunk/inject-tck-runner/
Log:
ignores
Property changes on: core/trunk/inject-tck-runner
___________________________________________________________________
Name: svn:ignore
- .settings
target
.project
test-output
.classpath
bin
+
.settings
target
.project
test-output
.classpath
bin
temp-testng-customsuite.xml
15 years
Weld SVN: r4008 - core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-13 11:45:50 -0400 (Tue, 13 Oct 2009)
New Revision: 4008
Modified:
core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Producers.java
Log:
minor
Modified: core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Producers.java
===================================================================
--- core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Producers.java 2009-10-13 15:44:15 UTC (rev 4007)
+++ core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Producers.java 2009-10-13 15:45:50 UTC (rev 4008)
@@ -87,7 +87,7 @@
}
/**
- * Producet method for bean with default qualifiers and type SpareTire only
+ * Producer method for bean with default qualifiers and type SpareTire only
*/
@Produces @BeanTypes(SpareTire.class)
public SpareTire produceSpareTire()
15 years
Weld SVN: r4007 - in core/trunk: impl/src/main/java/org/jboss/weld/introspector and 7 other directories.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-13 11:44:15 -0400 (Tue, 13 Oct 2009)
New Revision: 4007
Added:
core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Producers.java
core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/NonContextual.java
Removed:
core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/AbstractProducer.java
core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Any.java
core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/BeanDisambiguator.java
core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/DriversSeatProducer.java
core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Plain.java
core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Spare.java
core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/SpareTireProducer.java
core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotated.java
core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedCallable.java
core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedConstructor.java
core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedField.java
core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedMember.java
core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedMethod.java
core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedParameter.java
core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedType.java
core/trunk/inject-tck-runner/src/test/resources/META-INF/
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerField.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java
core/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWeldAnnotated.java
core/trunk/impl/src/main/java/org/jboss/weld/introspector/WeldAnnotated.java
core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/AbstractWeldAnnotated.java
core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeBeanResolver.java
core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeDecoratorResolver.java
core/trunk/impl/src/main/java/org/jboss/weld/util/Reflections.java
core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/AtInjectTCK.java
core/trunk/jboss-as/build.xml
Log:
support @BeanTypes, convert AtInject TCK to use it
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-10-13 15:42:46 UTC (rev 4006)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractBean.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -24,6 +24,7 @@
import javax.decorator.Decorates;
import javax.enterprise.context.Dependent;
import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.BeanTypes;
import javax.enterprise.inject.Specializes;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.stereotype.Stereotype;
@@ -45,6 +46,7 @@
import org.jboss.weld.metadata.cache.MergedStereotypes;
import org.jboss.weld.metadata.cache.MetaAnnotationStore;
import org.jboss.weld.util.Reflections;
+import org.jboss.weld.util.collections.Arrays2;
/**
* An abstract bean representation common for all beans
@@ -172,7 +174,14 @@
*/
protected void initTypes()
{
- types = getAnnotatedItem().getTypeClosure();
+ if (getAnnotatedItem().isAnnotationPresent(BeanTypes.class))
+ {
+ types = Arrays2.<Type>asSet(getAnnotatedItem().getAnnotation(BeanTypes.class).value());
+ }
+ else
+ {
+ types = getAnnotatedItem().getTypeClosure();
+ }
}
/**
@@ -419,18 +428,6 @@
}
/**
- * Checks if this beans annotated item is assignable from another annotated
- * item
- *
- * @param annotatedItem The other annotation to check
- * @return True if assignable, otherwise false
- */
- public boolean isAssignableFrom(WeldAnnotated<?, ?> annotatedItem)
- {
- return this.getAnnotatedItem().isAssignableFrom(annotatedItem);
- }
-
- /**
* Indicates if bean is nullable
*
* @return True if nullable, false otherwise
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java 2009-10-13 15:42:46 UTC (rev 4006)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractProducerBean.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -30,6 +30,7 @@
import javax.enterprise.context.Dependent;
import javax.enterprise.context.NormalScope;
import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.BeanTypes;
import javax.enterprise.inject.IllegalProductException;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.InjectionPoint;
@@ -47,6 +48,7 @@
import org.jboss.weld.util.Beans;
import org.jboss.weld.util.Names;
import org.jboss.weld.util.Reflections;
+import org.jboss.weld.util.collections.Arrays2;
/**
* The implicit producer bean
@@ -88,8 +90,12 @@
@Override
protected void initTypes()
{
- if (getType().isArray() || getType().isPrimitive())
+ if (getAnnotatedItem().isAnnotationPresent(BeanTypes.class))
{
+ types = Arrays2.<Type>asSet(getAnnotatedItem().getAnnotation(BeanTypes.class).value());
+ }
+ else if (getType().isArray() || getType().isPrimitive())
+ {
Set<Type> types = new HashSet<Type>();
types.add(getType());
types.add(Object.class);
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerField.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerField.java 2009-10-13 15:42:46 UTC (rev 4006)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerField.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -41,7 +41,6 @@
{
// The underlying field
private WeldField<T, X> field;
- private final String id;
/**
* Creates a producer field
@@ -65,12 +64,11 @@
*/
protected ProducerField(WeldField<T, X> field, AbstractClassBean<X> declaringBean, BeanManagerImpl manager)
{
- super(new StringBuilder().append(ProducerField.class.getSimpleName()).append(BEAN_ID_SEPARATOR).append(declaringBean.getAnnotatedItem().getName()).append(field.getName()).toString(), declaringBean, manager);
+ super(new StringBuilder().append(ProducerField.class.getSimpleName()).append(BEAN_ID_SEPARATOR).append(declaringBean.getAnnotatedItem().getName()).append(".").append(field.getName()).toString(), declaringBean, manager);
this.field = field;
initType();
initTypes();
initBindings();
- this.id = new StringBuilder().append(BEAN_ID_PREFIX).append(getClass().getSimpleName()).append(BEAN_ID_SEPARATOR).append(declaringBean.getAnnotatedItem().getName()).append(getAnnotatedItem().getName()).toString();
initStereotypes();
initPolicy();
}
@@ -168,12 +166,6 @@
{
return false;
}
-
- @Override
- public String getId()
- {
- return id;
- }
@Override
public Set<Class<? extends Annotation>> getStereotypes()
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java 2009-10-13 15:42:46 UTC (rev 4006)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -32,6 +32,7 @@
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.event.Observes;
+import javax.enterprise.inject.BeanTypes;
import javax.enterprise.inject.CreationException;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.enterprise.inject.spi.InjectionTarget;
@@ -40,12 +41,12 @@
import org.jboss.interceptor.model.InterceptionModel;
import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.DefinitionException;
-import org.jboss.weld.context.SerializableContextual;
import org.jboss.weld.bean.interceptor.InterceptorBindingsAdapter;
import org.jboss.weld.bean.proxy.EnterpriseBeanInstance;
import org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler;
import org.jboss.weld.bean.proxy.Marker;
import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
+import org.jboss.weld.context.SerializableContextual;
import org.jboss.weld.ejb.InternalEjbDescriptor;
import org.jboss.weld.ejb.api.SessionObjectReference;
import org.jboss.weld.ejb.spi.BusinessInterfaceDescriptor;
@@ -58,6 +59,7 @@
import org.jboss.weld.resources.ClassTransformer;
import org.jboss.weld.util.Beans;
import org.jboss.weld.util.Proxies;
+import org.jboss.weld.util.collections.Arrays2;
/**
* An enterprise bean representation
@@ -188,13 +190,20 @@
@Override
protected void initTypes()
{
- Set<Type> types = new LinkedHashSet<Type>();
- types.add(Object.class);
- for (BusinessInterfaceDescriptor<?> businessInterfaceDescriptor : ejbDescriptor.getLocalBusinessInterfaces())
+ if (getAnnotatedItem().isAnnotationPresent(BeanTypes.class))
{
- types.add(businessInterfaceDescriptor.getInterface());
+ types = Arrays2.<Type>asSet(getAnnotatedItem().getAnnotation(BeanTypes.class).value());
}
- super.types = types;
+ else
+ {
+ Set<Type> types = new LinkedHashSet<Type>();
+ types.add(Object.class);
+ for (BusinessInterfaceDescriptor<?> businessInterfaceDescriptor : ejbDescriptor.getLocalBusinessInterfaces())
+ {
+ types.add(businessInterfaceDescriptor.getInterface());
+ }
+ super.types = types;
+ }
}
protected void initProxyClass()
Modified: core/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWeldAnnotated.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWeldAnnotated.java 2009-10-13 15:42:46 UTC (rev 4006)
+++ core/trunk/impl/src/main/java/org/jboss/weld/introspector/ForwardingWeldAnnotated.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -73,16 +73,6 @@
return delegate().getJavaClass();
}
- public boolean isAssignableFrom(WeldAnnotated<?, ?> that)
- {
- return delegate().isAssignableFrom(that);
- }
-
- public boolean isAssignableFrom(Class<?> type, Type[] actualTypeArguments)
- {
- return delegate().isAssignableFrom(type, actualTypeArguments);
- }
-
public boolean isFinal()
{
return delegate().isFinal();
Modified: core/trunk/impl/src/main/java/org/jboss/weld/introspector/WeldAnnotated.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/introspector/WeldAnnotated.java 2009-10-13 15:42:46 UTC (rev 4006)
+++ core/trunk/impl/src/main/java/org/jboss/weld/introspector/WeldAnnotated.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -123,25 +123,6 @@
public Class<T> getJavaClass();
/**
- * Extends Java Class assignability such that actual type parameters are also
- * considered
- *
- * @param that The other item to check assignability against
- * @return True if assignable, false otherwise.
- */
- public boolean isAssignableFrom(WeldAnnotated<?, ?> that);
-
- /**
- * Extends Java Class assignability such that actual type parameters are also
- * considered
- *
- * @param type The type to compare against
- * @param actualTypeArguments The type arguments
- * @return True is assignable, false otherwise
- */
- public boolean isAssignableFrom(Class<?> type, Type[] actualTypeArguments);
-
- /**
* Gets the actual type arguments for any parameterized types that this
* AnnotatedItem represents.
*
Modified: core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/AbstractWeldAnnotated.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/AbstractWeldAnnotated.java 2009-10-13 15:42:46 UTC (rev 4006)
+++ core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/AbstractWeldAnnotated.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -19,7 +19,6 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
-import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
@@ -28,6 +27,7 @@
import org.jboss.weld.introspector.WeldAnnotated;
import org.jboss.weld.util.Proxies;
import org.jboss.weld.util.Reflections;
+import org.jboss.weld.util.collections.Arrays2;
/**
* Represents functionality common for all annotated items, mainly different
@@ -169,30 +169,6 @@
}
/**
- * Checks if this item is assignable from another annotated item (through
- * type and actual type arguments)
- *
- * @param that The other annotated item to check against
- * @return True if assignable, false otherwise
- *
- * @see org.jboss.weld.introspector.WeldAnnotated#isAssignableFrom(WeldAnnotated)
- */
- public boolean isAssignableFrom(WeldAnnotated<?, ?> that)
- {
- return isAssignableFrom(that.getJavaClass(), that.getActualTypeArguments());
- }
-
- public boolean isAssignableFrom(Class<?> type, Type[] actualTypeArguments)
- {
- return Reflections.isAssignableFrom(getJavaClass(), getActualTypeArguments(), type, actualTypeArguments);
- }
-
- public boolean isAssignableFrom(Type type)
- {
- return Reflections.isAssignableFrom(getBaseType(), type);
- }
-
- /**
* Gets the hash code of the actual type
*
* @return The hash code
@@ -260,7 +236,7 @@
public Type[] getActualTypeArguments()
{
- return Arrays.copyOf(actualTypeArguments, actualTypeArguments.length);
+ return Arrays2.copyOf(actualTypeArguments, actualTypeArguments.length);
}
public Set<Type> getInterfaceOnlyFlattenedTypeHierarchy()
Modified: core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeBeanResolver.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeBeanResolver.java 2009-10-13 15:42:46 UTC (rev 4006)
+++ core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeBeanResolver.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -61,7 +61,7 @@
@Override
protected boolean matches(Resolvable resolvable, T bean)
{
- return Reflections.isAssignableFrom(resolvable.getTypeClosure(), bean.getTypes()) && Beans.containsAllBindings(resolvable.getQualifiers(), bean.getQualifiers(), manager);
+ return Reflections.matches(resolvable.getTypeClosure(), bean.getTypes()) && Beans.containsAllBindings(resolvable.getQualifiers(), bean.getQualifiers(), manager);
}
/**
Modified: core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeDecoratorResolver.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeDecoratorResolver.java 2009-10-13 15:42:46 UTC (rev 4006)
+++ core/trunk/impl/src/main/java/org/jboss/weld/resolution/TypeSafeDecoratorResolver.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -41,7 +41,7 @@
@Override
protected boolean matches(Resolvable resolvable, DecoratorImpl<?> bean)
{
- return Reflections.isAssignableFrom(bean.getDelegateTypes(), resolvable.getTypeClosure()) && Beans.containsAllBindings(bean.getDelegateQualifiers(), resolvable.getQualifiers(), getManager()) && getManager().getEnabledDecoratorClasses().contains(bean.getType());
+ return Reflections.matches(bean.getDelegateTypes(), resolvable.getTypeClosure()) && Beans.containsAllBindings(bean.getDelegateQualifiers(), resolvable.getQualifiers(), getManager()) && getManager().getEnabledDecoratorClasses().contains(bean.getType());
}
@Override
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/Reflections.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/Reflections.java 2009-10-13 15:42:46 UTC (rev 4006)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/Reflections.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -51,30 +51,30 @@
*/
public class Reflections
{
-
+
private static final Log log = Logging.getLog(Reflections.class);
-
+
public static final Type[] EMPTY_TYPES = {};
-
+
public static final Annotation[] EMPTY_ANNOTATIONS = {};
public static class HierarchyDiscovery
{
-
+
private final Type type;
-
+
private Set<Type> types;
-
+
public HierarchyDiscovery(Type type)
{
this.type = type;
}
-
+
protected void add(Type type)
{
types.add(type);
}
-
+
public Set<Type> getFlattenedTypes()
{
if (types == null)
@@ -84,7 +84,7 @@
}
return types;
}
-
+
public Type getResolvedType()
{
if (type instanceof Class)
@@ -94,18 +94,18 @@
}
return type;
}
-
+
private void discoverTypes(Type type)
{
if (type != null)
- {
+ {
if (type instanceof Class)
{
Class<?> clazz = (Class<?>) type;
add(resolveType(clazz));
discoverFromClass(clazz);
}
- else
+ else
{
if (type instanceof ParameterizedType)
{
@@ -119,7 +119,7 @@
}
}
}
-
+
private Type resolveType(Class<?> clazz)
{
if (clazz.getTypeParameters().length > 0)
@@ -133,7 +133,7 @@
return clazz;
}
}
-
+
@SuppressWarnings("unchecked")
private void discoverFromClass(Class<?> clazz)
{
@@ -151,7 +151,7 @@
log.trace("Security exception scanning " + clazz.getName(), e);
}
}
-
+
/**
* Gets the actual types by resolving TypeParameters.
*
@@ -186,7 +186,7 @@
}
return type;
}
-
+
private Type resolveParameterizedType(ParameterizedType beanType, ParameterizedType parameterizedType)
{
Type rawType = parameterizedType.getRawType();
@@ -216,7 +216,7 @@
return resolveType(type, actualTypes[i]);
}
}
-
+
// step2. generic super class
Type genericSuperType = actualType.getGenericSuperclass();
Type type = resolveType(genericSuperType, typeVariable);
@@ -224,7 +224,7 @@
{
return type;
}
-
+
// step3. generic interfaces
for (Type interfaceType : actualType.getGenericInterfaces())
{
@@ -234,11 +234,11 @@
return resolvedType;
}
}
-
+
// don't resolve type variable
return typeVariable;
}
-
+
}
/**
@@ -320,7 +320,7 @@
{
return type.isPrimitive();
}
-
+
public static boolean isPackagePrivate(int mod)
{
return !(Modifier.isPrivate(mod) || Modifier.isProtected(mod) || Modifier.isPublic(mod));
@@ -439,7 +439,7 @@
{
return type.getTypeParameters().length > 0;
}
-
+
public static boolean isParamerterizedTypeWithWildcard(Class<?> type)
{
if (isParameterizedType(type))
@@ -451,7 +451,7 @@
return false;
}
}
-
+
public static boolean containsWildcards(Type[] types)
{
for (Type type : types)
@@ -463,7 +463,7 @@
}
return false;
}
-
+
public static Set<Type> createTypeClosure(Class<?> rawType, Type[] actualTypeArguments)
{
Type type = new ParameterizedTypeImpl(rawType, actualTypeArguments, rawType.getDeclaringClass());
@@ -498,7 +498,7 @@
throw new RuntimeException("Error invoking method " + method.getName() + " on " + method.getDeclaringClass(), e);
}
}
-
+
public static Object invokeAndWrap(String methodName, Object instance, Object... parameters)
{
Class<?>[] parameterTypes = new Class<?>[parameters.length];
@@ -542,7 +542,7 @@
throw new RuntimeException("Error getting field " + field.getName() + " on " + field.getDeclaringClass(), e);
}
}
-
+
public static Object getAndWrap(String fieldName, Object target)
{
try
@@ -578,7 +578,7 @@
throw new IllegalArgumentException(e);
}
}
-
+
/**
* Looks up a method in the type hierarchy of an instance
*
@@ -591,7 +591,7 @@
{
return lookupMethod(methodName, parameterTypes, instance.getClass());
}
-
+
private static Method lookupMethod(String methodName, Class<?>[] parameterTypes, Class<?> c) throws NoSuchMethodException
{
for (Class<? extends Object> clazz = c; clazz != null; clazz = clazz.getSuperclass())
@@ -623,11 +623,11 @@
}
throw new NoSuchMethodException("Method " + methodName + Arrays.asList(parameterTypes).toString().replace("[", "(").replace("]", ")") + " not implemented by instance " + c.getName());
}
-
+
/**
* Checks the bindingType to make sure the annotation was declared properly
- * as a binding type (annotated with @BindingType) and that it has
- * a runtime retention policy.
+ * as a binding type (annotated with @BindingType) and that it has a runtime
+ * retention policy.
*
* @param binding The binding type to check
* @return true only if the annotation is really a binding type
@@ -637,23 +637,23 @@
public static boolean isBindings(Annotation binding)
{
boolean isBindingAnnotation = false;
- if (binding.annotationType().isAnnotationPresent(Qualifier.class) &&
- binding.annotationType().isAnnotationPresent(Retention.class) &&
- binding.annotationType().getAnnotation(Retention.class).value().equals(RetentionPolicy.RUNTIME))
+ if (binding.annotationType().isAnnotationPresent(Qualifier.class) && binding.annotationType().isAnnotationPresent(Retention.class) && binding.annotationType().getAnnotation(Retention.class).value().equals(RetentionPolicy.RUNTIME))
{
isBindingAnnotation = true;
}
return isBindingAnnotation;
}
-
+
/**
* Check the assignability of one type to another, taking into account the
* actual type arguements
*
* @param rawType1 the raw type of the class to check
- * @param actualTypeArguments1 the actual type arguements to check, or an empty array if not a parameterized type
+ * @param actualTypeArguments1 the actual type arguements to check, or an
+ * empty array if not a parameterized type
* @param rawType2 the raw type of the class to check
- * @param actualTypeArguments2 the actual type arguements to check, or an empty array if not a parameterized type
+ * @param actualTypeArguments2 the actual type arguements to check, or an
+ * empty array if not a parameterized type
* @return
*/
public static boolean isAssignableFrom(Class<?> rawType1, Type[] actualTypeArguments1, Class<?> rawType2, Type[] actualTypeArguments2)
@@ -661,6 +661,11 @@
return Types.boxedClass(rawType1).isAssignableFrom(Types.boxedClass(rawType2)) && isAssignableFrom(actualTypeArguments1, actualTypeArguments2);
}
+ public static boolean matches(Class<?> rawType1, Type[] actualTypeArguments1, Class<?> rawType2, Type[] actualTypeArguments2)
+ {
+ return Types.boxedClass(rawType1).equals(Types.boxedClass(rawType2)) && isAssignableFrom(actualTypeArguments1, actualTypeArguments2);
+ }
+
public static boolean isAssignableFrom(Type[] actualTypeArguments1, Type[] actualTypeArguments2)
{
for (int i = 0; i < actualTypeArguments1.length; i++)
@@ -678,7 +683,7 @@
}
return true;
}
-
+
public static boolean isAssignableFrom(Type type1, Set<? extends Type> types2)
{
for (Type type2 : types2)
@@ -691,6 +696,18 @@
return false;
}
+ public static boolean matches(Type type1, Set<? extends Type> types2)
+ {
+ for (Type type2 : types2)
+ {
+ if (matches(type1, type2))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
public static boolean isAssignableFrom(Type type1, Type[] types2)
{
for (Type type2 : types2)
@@ -702,7 +719,7 @@
}
return false;
}
-
+
public static boolean isAssignableFrom(Type type1, Type type2)
{
if (type1 instanceof Class)
@@ -759,6 +776,62 @@
return false;
}
+ public static boolean matches(Type type1, Type type2)
+ {
+ if (type1 instanceof Class<?>)
+ {
+ Class<?> clazz = (Class<?>) type1;
+ if (matches(clazz, EMPTY_TYPES, type2))
+ {
+ return true;
+ }
+ }
+ if (type1 instanceof ParameterizedType)
+ {
+ ParameterizedType parameterizedType1 = (ParameterizedType) type1;
+ if (parameterizedType1.getRawType() instanceof Class)
+ {
+ if (matches((Class<?>) parameterizedType1.getRawType(), parameterizedType1.getActualTypeArguments(), type2))
+ {
+ return true;
+ }
+ }
+ }
+ if (type1 instanceof WildcardType)
+ {
+ WildcardType wildcardType = (WildcardType) type1;
+ if (isTypeBounded(type2, wildcardType.getLowerBounds(), wildcardType.getUpperBounds()))
+ {
+ return true;
+ }
+ }
+ if (type2 instanceof WildcardType)
+ {
+ WildcardType wildcardType = (WildcardType) type2;
+ if (isTypeBounded(type1, wildcardType.getUpperBounds(), wildcardType.getLowerBounds()))
+ {
+ return true;
+ }
+ }
+ if (type1 instanceof TypeVariable<?>)
+ {
+ TypeVariable<?> typeVariable = (TypeVariable<?>) type1;
+ if (isTypeBounded(type2, EMPTY_TYPES, typeVariable.getBounds()))
+ {
+ return true;
+ }
+ }
+ if (type2 instanceof TypeVariable<?>)
+ {
+ TypeVariable<?> typeVariable = (TypeVariable<?>) type2;
+ if (isTypeBounded(type1, typeVariable.getBounds(), EMPTY_TYPES))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
public static boolean isTypeBounded(Type type, Type[] lowerBounds, Type[] upperBounds)
{
if (lowerBounds.length > 0)
@@ -777,7 +850,7 @@
}
return true;
}
-
+
public static boolean isAssignableFrom(Class<?> rawType1, Type[] actualTypeArguments1, Type type2)
{
if (type2 instanceof ParameterizedType)
@@ -802,9 +875,33 @@
return false;
}
+ public static boolean matches(Class<?> rawType1, Type[] actualTypeArguments1, Type type2)
+ {
+ if (type2 instanceof ParameterizedType)
+ {
+ ParameterizedType parameterizedType = (ParameterizedType) type2;
+ if (parameterizedType.getRawType() instanceof Class<?>)
+ {
+ if (matches(rawType1, actualTypeArguments1, (Class<?>) parameterizedType.getRawType(), parameterizedType.getActualTypeArguments()))
+ {
+ return true;
+ }
+ }
+ }
+ else if (type2 instanceof Class<?>)
+ {
+ Class<?> clazz = (Class<?>) type2;
+ if (matches(rawType1, actualTypeArguments1, clazz, EMPTY_TYPES))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
/**
- * Check the assiginability of a set of <b>flattened</b> types. This algorithm
- * will check whether any of the types1 matches a type in types2
+ * Check the assiginability of a set of <b>flattened</b> types. This
+ * algorithm will check whether any of the types1 matches a type in types2
*
* @param types1
* @param types2
@@ -823,13 +920,32 @@
}
/**
- * Check the assiginability of a set of <b>flattened</b> types. This algorithm
- * will check whether any of the types1 matches a type in types2
+ * Check whether whether any of the types1 matches a type in types2
*
* @param types1
* @param types2
* @return
*/
+ public static boolean matches(Set<Type> types1, Set<Type> types2)
+ {
+ for (Type type : types1)
+ {
+ if (matches(type, types2))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Check the assiginability of a set of <b>flattened</b> types. This
+ * algorithm will check whether any of the types1 matches a type in types2
+ *
+ * @param types1
+ * @param types2
+ * @return
+ */
public static boolean isAssignableFrom(Set<Type> types1, Type type2)
{
for (Type type : types1)
@@ -841,7 +957,7 @@
}
return false;
}
-
+
public static boolean isAssignableFrom(Type[] types1, Type type2)
{
for (Type type : types1)
@@ -858,7 +974,7 @@
{
return clazz.isPrimitive() || Serializable.class.isAssignableFrom(clazz);
}
-
+
public static Field ensureAccessible(Field field)
{
if (!field.isAccessible() && !isIgnorePackage(field.getDeclaringClass().getPackage()))
@@ -867,7 +983,7 @@
}
return field;
}
-
+
public static Method ensureAccessible(Method method)
{
if (!method.isAccessible() && !isIgnorePackage(method.getDeclaringClass().getPackage()))
@@ -876,7 +992,7 @@
}
return method;
}
-
+
public static <T> Constructor<T> ensureAccessible(Constructor<T> constructor)
{
Class<?> c = constructor.getDeclaringClass();
@@ -887,7 +1003,7 @@
}
return constructor;
}
-
+
private static boolean isIgnorePackage(Package pkg)
{
if (pkg != null)
@@ -913,5 +1029,4 @@
}
}
-
}
Deleted: core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/AbstractProducer.java
===================================================================
--- core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/AbstractProducer.java 2009-10-13 15:42:46 UTC (rev 4006)
+++ core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/AbstractProducer.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -1,27 +0,0 @@
-package org.jboss.weld.atinject.tck;
-
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.InjectionTarget;
-
-public class AbstractProducer<T>
-{
-
- protected final InjectionTarget<T> injectionTarget;
- protected final BeanManager beanManager;
-
- public AbstractProducer(BeanManager beanManager, Class<T> type)
- {
- this.injectionTarget = beanManager.createInjectionTarget(beanManager.createAnnotatedType(type));
- this.beanManager = beanManager;
- }
-
- public T produce()
- {
- CreationalContext<T> ctx = beanManager.createCreationalContext(null);
- T instance = injectionTarget.produce(ctx);
- injectionTarget.inject(instance, ctx);
- return instance;
- }
-
-}
\ No newline at end of file
Deleted: core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Any.java
===================================================================
--- core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Any.java 2009-10-13 15:42:46 UTC (rev 4006)
+++ core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Any.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -1,47 +0,0 @@
-/*
- * 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.weld.atinject.tck;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-/**
- * A built-in binding type that is implicitly applied to all beans which do not
- * have the {@link New} built-in binding type.
- *
- * @author Gavin King
- * @author David Allen
- */
-
-@Qualifier
-@Retention(RUNTIME)
-@Target( { TYPE, METHOD, FIELD, PARAMETER })
-@Documented
-public @interface Any
-{
-
-}
Modified: core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/AtInjectTCK.java
===================================================================
--- core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/AtInjectTCK.java 2009-10-13 15:42:46 UTC (rev 4006)
+++ core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/AtInjectTCK.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -15,7 +15,6 @@
import org.atinject.tck.auto.Tire;
import org.atinject.tck.auto.V8Engine;
import org.atinject.tck.auto.accessories.Cupholder;
-import org.atinject.tck.auto.accessories.SpareTire;
import org.jboss.weld.mock.MockEELifecycle;
import org.jboss.weld.mock.TestContainer;
@@ -37,10 +36,8 @@
Cupholder.class,
FuelTank.class,
Tire.class,
- SpareTire.class,
- // Two producer method which allow us to expose SpareTire and Drivers seat with qualifiers
- DriversSeatProducer.class,
- SpareTireProducer.class
+ // Producer Methods allowing to expose DriversSeat, SpareTire, @Named("spare") SpareTire, @Drivers Seat
+ Producers.class
);
/**
Deleted: core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/BeanDisambiguator.java
===================================================================
--- core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/BeanDisambiguator.java 2009-10-13 15:42:46 UTC (rev 4006)
+++ core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/BeanDisambiguator.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -1,413 +0,0 @@
-package org.jboss.weld.atinject.tck;
-
-import java.lang.annotation.Annotation;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.AnnotationLiteral;
-import javax.enterprise.inject.spi.AnnotatedConstructor;
-import javax.enterprise.inject.spi.AnnotatedField;
-import javax.enterprise.inject.spi.AnnotatedMethod;
-import javax.enterprise.inject.spi.AnnotatedParameter;
-import javax.enterprise.inject.spi.AnnotatedType;
-import javax.enterprise.inject.spi.Extension;
-import javax.enterprise.inject.spi.ProcessAnnotatedType;
-import javax.inject.Inject;
-
-import org.atinject.tck.auto.Convertible;
-import org.atinject.tck.auto.Tire;
-import org.jboss.weld.atinject.tck.util.ForwardingAnnotatedConstructor;
-import org.jboss.weld.atinject.tck.util.ForwardingAnnotatedField;
-import org.jboss.weld.atinject.tck.util.ForwardingAnnotatedMethod;
-import org.jboss.weld.atinject.tck.util.ForwardingAnnotatedParameter;
-import org.jboss.weld.atinject.tck.util.ForwardingAnnotatedType;
-
-public class BeanDisambiguator implements Extension
-{
-
- private static final Annotation PLAIN_LITERAL = new AnnotationLiteral<Plain>()
- {
- };
-
- /**
- * Modufy the class metadata that 299 will use when building beans
- */
- public void observe(@Observes ProcessAnnotatedType<?> pat)
- {
- addPlainQualifierToTireBean(pat);
- addPlainQualifierToConvertibleConstructor(pat);
- addPlainQualifierToConvertiblePlainTireField(pat);
- addPlainQualifierToConvertibleInjectInstanceMethodWithManyArgs(pat);
- }
-
- /**
- * Adjust the injectInstanceMethodWithManyArgs injectable method on {@link Convertible} so that parameters
- * 2 and 6 ({@code plainTire} and {@code plainTireProvider}) additionally have the @Plain annotation
- */
- private <X> void addPlainQualifierToConvertibleInjectInstanceMethodWithManyArgs(ProcessAnnotatedType<X> pat)
- {
- if (pat.getAnnotatedType().getJavaClass().equals(Convertible.class))
- {
- final AnnotatedType<X> original = pat.getAnnotatedType();
-
- final Set<AnnotatedMethod<? super X>> methods = new HashSet<AnnotatedMethod<? super X>>();
- for (final AnnotatedMethod<? super X> method : original.getMethods())
- {
- if (method.getJavaMember().getName().equals("injectInstanceMethodWithManyArgs"))
- {
- methods.add(qualifyParameterWithPlain(method, 2, 6));
- }
- else
- {
- methods.add(method);
- }
- }
-
- pat.setAnnotatedType(new ForwardingAnnotatedType<X>()
- {
-
- @Override
- protected AnnotatedType<X> delegate()
- {
- return original;
- }
-
- @Override
- public Set<AnnotatedMethod<? super X>> getMethods()
- {
- return methods;
- }
-
- });
- }
- }
-
-
- /**
- * Add the @Plain qualifier to the field {@code fieldPlainTire} and @{code fieldPlainTireProvider} of {@link Convertible}
- *
- */
- private <X> void addPlainQualifierToConvertiblePlainTireField(ProcessAnnotatedType<X> pat)
- {
- if (pat.getAnnotatedType().getJavaClass().equals(Convertible.class))
- {
- final AnnotatedType<X> original = pat.getAnnotatedType();
-
- final Set<AnnotatedField<? super X>> fields = new HashSet<AnnotatedField<? super X>>();
-
- for (final AnnotatedField<? super X> field : original.getFields())
- {
- if (field.getJavaMember().getName().equals("fieldPlainTire") || field.getJavaMember().getName().equals("fieldPlainTireProvider"))
- {
- fields.add(addPlainQualifierToField(field));
- }
- else
- {
- fields.add(field);
- }
- }
-
- pat.setAnnotatedType(new ForwardingAnnotatedType<X>()
- {
-
- @Override
- public Set<AnnotatedField<? super X>> getFields()
- {
- return fields;
- }
-
- @Override
- protected AnnotatedType<X> delegate()
- {
- return original;
- }
-
- });
- }
- }
-
- /**
- * Add the @Plain qualifier to the parameters 2 and 6 ({@code plainTire} and {@code plainTireProvider}) of the constructor of {@link Convertible}
- *
- */
- private <X> void addPlainQualifierToConvertibleConstructor(ProcessAnnotatedType<X> pat)
- {
- if (pat.getAnnotatedType().getJavaClass().equals(Convertible.class))
- {
- final AnnotatedType<X> original = pat.getAnnotatedType();
-
- final Set<AnnotatedConstructor<X>> constructors = new HashSet<AnnotatedConstructor<X>>();
- for (final AnnotatedConstructor<X> constructor : original.getConstructors())
- {
- if (constructor.isAnnotationPresent(Inject.class))
- {
- constructors.add(qualifyParameterWithPlain(constructor, 2, 6));
- }
- else
- {
- constructors.add(constructor);
- }
- }
-
- pat.setAnnotatedType(new ForwardingAnnotatedType<X>()
- {
-
- @Override
- protected AnnotatedType<X> delegate()
- {
- return original;
- }
-
- @Override
- public Set<AnnotatedConstructor<X>> getConstructors()
- {
- return constructors;
- }
-
- });
- }
- }
-
- /**
- * Add the @Plain annotation to the {@link Tire} class
- *
- */
- private <X> void addPlainQualifierToTireBean(ProcessAnnotatedType<X> pat)
- {
- if (pat.getAnnotatedType().getJavaClass().equals(Tire.class))
- {
- final Set<Annotation> annotations = new HashSet<Annotation>();
- annotations.addAll(pat.getAnnotatedType().getAnnotations());
- annotations.add(PLAIN_LITERAL);
- final AnnotatedType<X> original = pat.getAnnotatedType();
- pat.setAnnotatedType(new ForwardingAnnotatedType<X>()
- {
-
- @Override
- protected AnnotatedType<X> delegate()
- {
- return original;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <A extends Annotation> A getAnnotation(Class<A> annotationType)
- {
- if (annotationType.equals(Plain.class))
- {
- return (A) PLAIN_LITERAL;
- }
- else
- {
- return delegate().getAnnotation(annotationType);
- }
- }
-
- @Override
- public Set<Annotation> getAnnotations()
- {
- return annotations;
- }
-
- @Override
- public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
- {
- if (annotationType.equals(Plain.class))
- {
- return true;
- }
- else
- {
- return delegate().isAnnotationPresent(annotationType);
- }
- }
-
- });
- }
- }
-
- /**
- * Utility method to add the @Plain qualifier to a list of parameters
- */
- private <X> List<AnnotatedParameter<X>> qualifyParameterWithPlain(final List<AnnotatedParameter<X>> parameters, Integer... position)
- {
- Collection<Integer> positions = Arrays.asList(position);
- final List<AnnotatedParameter<X>> newParameters = new ArrayList<AnnotatedParameter<X>>();
-
- for (final AnnotatedParameter<X> parameter : parameters)
- {
- if (positions.contains(parameter.getPosition()))
- {
- newParameters.add(addPlainQualifierToParameter(parameter));
- }
- else
- {
- newParameters.add(parameter);
- }
- }
-
- return newParameters;
-
- }
-
- /**
- * Utility method to add the @Plain qualifier to a method
- */
- private <X> AnnotatedMethod<X> qualifyParameterWithPlain(final AnnotatedMethod<X> method, Integer... position)
- {
- final List<AnnotatedParameter<X>> parameters = qualifyParameterWithPlain(method.getParameters(), position);
- return new ForwardingAnnotatedMethod<X>()
- {
-
- @Override
- public List<AnnotatedParameter<X>> getParameters()
- {
- return parameters;
- }
-
- @Override
- protected AnnotatedMethod<X> delegate()
- {
- return method;
- }
-
- };
- }
-
- /**
- * Utility method to add the @Plain qualifier to a constructor
- */
- private <X> AnnotatedConstructor<X> qualifyParameterWithPlain(final AnnotatedConstructor<X> constructor, Integer... position)
- {
- final List<AnnotatedParameter<X>> parameters = qualifyParameterWithPlain(constructor.getParameters(), position);
- return new ForwardingAnnotatedConstructor<X>()
- {
-
- @Override
- public List<AnnotatedParameter<X>> getParameters()
- {
- return parameters;
- }
-
- @Override
- protected AnnotatedConstructor<X> delegate()
- {
- return constructor;
- }
-
- };
- }
-
- /**
- * Utility method to add the @Plain qualifier to a parameter
- */
- private <X> AnnotatedParameter<X> addPlainQualifierToParameter(final AnnotatedParameter<X> parameter)
- {
- final Set<Annotation> annotations = new HashSet<Annotation>();
- annotations.addAll(parameter.getAnnotations());
- annotations.add(PLAIN_LITERAL);
- return new ForwardingAnnotatedParameter<X>()
- {
-
- @Override
- protected AnnotatedParameter<X> delegate()
- {
- return parameter;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <A extends Annotation> A getAnnotation(Class<A> annotationType)
- {
- if (annotationType.equals(Plain.class))
- {
- return (A) PLAIN_LITERAL;
- }
- else
- {
- return delegate().getAnnotation(annotationType);
- }
- }
-
- @Override
- public Set<Annotation> getAnnotations()
- {
- return annotations;
- }
-
- @Override
- public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
- {
- if (annotationType.equals(Plain.class))
- {
- return true;
- }
- else
- {
- return delegate().isAnnotationPresent(annotationType);
- }
- }
-
- };
- }
-
- /**
- * Utility method to add the @Plain qualifier to a field
- */
- private <X> AnnotatedField<X> addPlainQualifierToField(final AnnotatedField<X> field)
- {
- final Set<Annotation> annotations = new HashSet<Annotation>();
- annotations.addAll(field.getAnnotations());
- annotations.add(PLAIN_LITERAL);
- return new ForwardingAnnotatedField<X>()
- {
-
- @SuppressWarnings("unchecked")
- @Override
- public <A extends Annotation> A getAnnotation(Class<A> annotationType)
- {
- if (annotationType.equals(Plain.class))
- {
- return (A) PLAIN_LITERAL;
- }
- else
- {
- return delegate().getAnnotation(annotationType);
- }
- }
-
- @Override
- public Set<Annotation> getAnnotations()
- {
- return annotations;
- }
-
- @Override
- public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
- {
- if (annotationType.equals(Plain.class))
- {
- return true;
- }
- else
- {
- return delegate().isAnnotationPresent(annotationType);
- }
- }
-
- @Override
- protected AnnotatedField<X> delegate()
- {
- return field;
- }
-
- };
- }
-
-
-}
Deleted: core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/DriversSeatProducer.java
===================================================================
--- core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/DriversSeatProducer.java 2009-10-13 15:42:46 UTC (rev 4006)
+++ core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/DriversSeatProducer.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -1,26 +0,0 @@
-package org.jboss.weld.atinject.tck;
-
-import javax.enterprise.inject.Produces;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.inject.Inject;
-
-import org.atinject.tck.auto.Drivers;
-import org.atinject.tck.auto.DriversSeat;
-
-public class DriversSeatProducer extends AbstractProducer<DriversSeat>
-{
-
- @Inject
- public DriversSeatProducer(BeanManager beanManager)
- {
- super(beanManager, DriversSeat.class);
- }
-
- @Override
- @Produces @Drivers
- public DriversSeat produce()
- {
- return super.produce();
- }
-
-}
Deleted: core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Plain.java
===================================================================
--- core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Plain.java 2009-10-13 15:42:46 UTC (rev 4006)
+++ core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Plain.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -1,39 +0,0 @@
-/*
- * 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.weld.atinject.tck;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-@Qualifier
-@Retention(RUNTIME)
-@Target( { TYPE, METHOD, FIELD, PARAMETER })
-@Documented
-public @interface Plain
-{
-
-}
Copied: core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Producers.java (from rev 4003, core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/DriversSeatProducer.java)
===================================================================
--- core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Producers.java (rev 0)
+++ core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Producers.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -0,0 +1,98 @@
+package org.jboss.weld.atinject.tck;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.BeanTypes;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Qualifier;
+
+import org.atinject.tck.auto.Drivers;
+import org.atinject.tck.auto.DriversSeat;
+import org.atinject.tck.auto.Seat;
+import org.atinject.tck.auto.Tire;
+import org.atinject.tck.auto.accessories.SpareTire;
+import org.jboss.weld.atinject.tck.util.NonContextual;
+
+/**
+ * Producer methods for the @Inject TCK beans we need greater control over
+ *
+ * @author pmuir
+ *
+ */
+public class Producers
+{
+
+ private final NonContextual<SpareTire> spareTire;
+ private final NonContextual<DriversSeat> driversSeat;
+
+ @Inject
+ public Producers(BeanManager beanManager)
+ {
+ this.spareTire = new NonContextual<SpareTire>(beanManager, SpareTire.class);
+ this.driversSeat = new NonContextual<DriversSeat>(beanManager, DriversSeat.class);
+ }
+
+ /**
+ * Producer method for a bean with qualifier @Drivers and types Seat, Object
+ *
+ * @return
+ */
+ @Produces @Drivers
+ public Seat produceAtDriversSeat()
+ {
+ return driversSeat.newInstance().produce().inject().get();
+ }
+
+ /**
+ * Producer method for a bean with default qualifiers and type DriversSeat only
+ *
+ * @return
+ */
+ @Produces @BeanTypes(DriversSeat.class)
+ public DriversSeat produceDriversSeat()
+ {
+ return driversSeat.newInstance().produce().inject().get();
+ }
+
+ @Qualifier
+ @Retention(RUNTIME)
+ @Target( { TYPE, METHOD, FIELD, PARAMETER })
+ @Documented
+ private @interface Spare
+ {
+
+ }
+
+ /**
+ * Producer method for a bean with qualifier @Named("spare") and types Tire, Object.
+ *
+ * Use the @Spare qualifier to stop @Default being applied
+ *
+ */
+ @Produces @Named("spare") @Spare
+ public Tire produceAtNamedSpareTire()
+ {
+ return spareTire.newInstance().produce().inject().get();
+ }
+
+ /**
+ * Producet method for bean with default qualifiers and type SpareTire only
+ */
+ @Produces @BeanTypes(SpareTire.class)
+ public SpareTire produceSpareTire()
+ {
+ return spareTire.newInstance().produce().inject().get();
+ }
+
+}
Property changes on: core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Producers.java
___________________________________________________________________
Name: svn:eol-style
+ native
Deleted: core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Spare.java
===================================================================
--- core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Spare.java 2009-10-13 15:42:46 UTC (rev 4006)
+++ core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/Spare.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -1,39 +0,0 @@
-/*
- * 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.weld.atinject.tck;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-@Qualifier
-@Retention(RUNTIME)
-@Target( { TYPE, METHOD, FIELD, PARAMETER })
-@Documented
-public @interface Spare
-{
-
-}
Deleted: core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/SpareTireProducer.java
===================================================================
--- core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/SpareTireProducer.java 2009-10-13 15:42:46 UTC (rev 4006)
+++ core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/SpareTireProducer.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -1,26 +0,0 @@
-package org.jboss.weld.atinject.tck;
-
-import javax.enterprise.inject.Produces;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-import org.atinject.tck.auto.accessories.SpareTire;
-
-public class SpareTireProducer extends AbstractProducer<SpareTire>
-{
-
- @Inject
- public SpareTireProducer(BeanManager beanManager)
- {
- super(beanManager, SpareTire.class);
- }
-
- @Override
- @Produces @Named("spare") @Spare
- public SpareTire produce()
- {
- return super.produce();
- }
-
-}
Deleted: core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotated.java
===================================================================
--- core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotated.java 2009-10-13 15:42:46 UTC (rev 4006)
+++ core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotated.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -1,81 +0,0 @@
-/*
- * 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.weld.atinject.tck.util;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.Set;
-
-import javax.enterprise.inject.spi.Annotated;
-
-/**
- * Base class to allow implementation of the decorator pattern
- *
- * @author Pete Muir
- *
- * @param <T> the base type
- * @param <S> the annotated element type
- */
-public abstract class ForwardingAnnotated implements Annotated
-{
-
- protected abstract Annotated delegate();
-
- public <A extends Annotation> A getAnnotation(Class<A> annotationType)
- {
- return delegate().getAnnotation(annotationType);
- }
-
- public Set<Annotation> getAnnotations()
- {
- return delegate().getAnnotations();
- }
-
- public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
- {
- return delegate().isAnnotationPresent(annotationType);
- }
-
- public Type getBaseType()
- {
- return delegate().getBaseType();
- }
-
- public Set<Type> getTypeClosure()
- {
- return delegate().getTypeClosure();
- }
-
- @Override
- public boolean equals(Object obj)
- {
- return delegate().equals(obj);
- }
-
- @Override
- public int hashCode()
- {
- return delegate().hashCode();
- }
-
- @Override
- public String toString()
- {
- return delegate().toString();
- }
-
-}
\ No newline at end of file
Deleted: core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedCallable.java
===================================================================
--- core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedCallable.java 2009-10-13 15:42:46 UTC (rev 4006)
+++ core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedCallable.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -1,19 +0,0 @@
-package org.jboss.weld.atinject.tck.util;
-
-import java.util.List;
-
-import javax.enterprise.inject.spi.AnnotatedCallable;
-import javax.enterprise.inject.spi.AnnotatedParameter;
-
-public abstract class ForwardingAnnotatedCallable<X> extends ForwardingAnnotatedMember<X> implements AnnotatedCallable<X>
-{
-
- @Override
- protected abstract AnnotatedCallable<X> delegate();
-
- public List<AnnotatedParameter<X>> getParameters()
- {
- return delegate().getParameters();
- }
-
-}
Deleted: core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedConstructor.java
===================================================================
--- core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedConstructor.java 2009-10-13 15:42:46 UTC (rev 4006)
+++ core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedConstructor.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -1,19 +0,0 @@
-package org.jboss.weld.atinject.tck.util;
-
-import java.lang.reflect.Constructor;
-
-import javax.enterprise.inject.spi.AnnotatedConstructor;
-
-public abstract class ForwardingAnnotatedConstructor<X> extends ForwardingAnnotatedCallable<X> implements AnnotatedConstructor<X>
-{
-
- @Override
- protected abstract AnnotatedConstructor<X> delegate();
-
- @Override
- public Constructor<X> getJavaMember()
- {
- return delegate().getJavaMember();
- }
-
-}
Deleted: core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedField.java
===================================================================
--- core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedField.java 2009-10-13 15:42:46 UTC (rev 4006)
+++ core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedField.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -1,19 +0,0 @@
-package org.jboss.weld.atinject.tck.util;
-
-import java.lang.reflect.Field;
-
-import javax.enterprise.inject.spi.AnnotatedField;
-
-public abstract class ForwardingAnnotatedField<X> extends ForwardingAnnotatedMember<X> implements AnnotatedField<X>
-{
-
- @Override
- protected abstract AnnotatedField<X> delegate();
-
- @Override
- public Field getJavaMember()
- {
- return delegate().getJavaMember();
- }
-
-}
Deleted: core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedMember.java
===================================================================
--- core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedMember.java 2009-10-13 15:42:46 UTC (rev 4006)
+++ core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedMember.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -1,29 +0,0 @@
-package org.jboss.weld.atinject.tck.util;
-
-import java.lang.reflect.Member;
-
-import javax.enterprise.inject.spi.AnnotatedMember;
-import javax.enterprise.inject.spi.AnnotatedType;
-
-public abstract class ForwardingAnnotatedMember<X> extends ForwardingAnnotated implements AnnotatedMember<X>
-{
-
- @Override
- protected abstract AnnotatedMember<X> delegate();
-
- public AnnotatedType<X> getDeclaringType()
- {
- return delegate().getDeclaringType();
- }
-
- public Member getJavaMember()
- {
- return delegate().getJavaMember();
- }
-
- public boolean isStatic()
- {
- return delegate().isStatic();
- }
-
-}
Deleted: core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedMethod.java
===================================================================
--- core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedMethod.java 2009-10-13 15:42:46 UTC (rev 4006)
+++ core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedMethod.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -1,19 +0,0 @@
-package org.jboss.weld.atinject.tck.util;
-
-import java.lang.reflect.Method;
-
-import javax.enterprise.inject.spi.AnnotatedMethod;
-
-public abstract class ForwardingAnnotatedMethod<X> extends ForwardingAnnotatedCallable<X> implements AnnotatedMethod<X>
-{
-
- @Override
- protected abstract AnnotatedMethod<X> delegate();
-
- @Override
- public Method getJavaMember()
- {
- return delegate().getJavaMember();
- }
-
-}
Deleted: core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedParameter.java
===================================================================
--- core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedParameter.java 2009-10-13 15:42:46 UTC (rev 4006)
+++ core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedParameter.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -1,22 +0,0 @@
-package org.jboss.weld.atinject.tck.util;
-
-import javax.enterprise.inject.spi.AnnotatedCallable;
-import javax.enterprise.inject.spi.AnnotatedParameter;
-
-public abstract class ForwardingAnnotatedParameter<X> extends ForwardingAnnotated implements AnnotatedParameter<X>
-{
-
- @Override
- protected abstract AnnotatedParameter<X> delegate();
-
- public AnnotatedCallable<X> getDeclaringCallable()
- {
- return delegate().getDeclaringCallable();
- }
-
- public int getPosition()
- {
- return delegate().getPosition();
- }
-
-}
Deleted: core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedType.java
===================================================================
--- core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedType.java 2009-10-13 15:42:46 UTC (rev 4006)
+++ core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/ForwardingAnnotatedType.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -1,36 +0,0 @@
-package org.jboss.weld.atinject.tck.util;
-
-import java.util.Set;
-
-import javax.enterprise.inject.spi.AnnotatedConstructor;
-import javax.enterprise.inject.spi.AnnotatedField;
-import javax.enterprise.inject.spi.AnnotatedMethod;
-import javax.enterprise.inject.spi.AnnotatedType;
-
-public abstract class ForwardingAnnotatedType<X> extends ForwardingAnnotated implements AnnotatedType<X>
-{
-
- @Override
- protected abstract AnnotatedType<X> delegate();
-
- public Set<AnnotatedConstructor<X>> getConstructors()
- {
- return delegate().getConstructors();
- }
-
- public Set<AnnotatedField<? super X>> getFields()
- {
- return delegate().getFields();
- }
-
- public Class<X> getJavaClass()
- {
- return delegate().getJavaClass();
- }
-
- public Set<AnnotatedMethod<? super X>> getMethods()
- {
- return delegate().getMethods();
- }
-
-}
Added: core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/NonContextual.java
===================================================================
--- core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/NonContextual.java (rev 0)
+++ core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/NonContextual.java 2009-10-13 15:44:15 UTC (rev 4007)
@@ -0,0 +1,172 @@
+package org.jboss.weld.atinject.tck.util;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionTarget;
+
+/**
+ * Perform production, injection, lifecycle callbacks and cleanup on a non-contextual object
+ *
+ * @author pmuir
+ *
+ * @param <T>
+ */
+public class NonContextual<T>
+{
+
+ // Store the injection target. The CDI spec doesn't require an implementation
+ // to cache it, so we do
+ private final InjectionTarget<T> injectionTarget;
+
+ // Store a reference to the CDI BeanManager
+ private final BeanManager beanManager;
+
+ /**
+ * Create an injector for the given class
+ */
+ public NonContextual(BeanManager manager, Class<T> clazz)
+ {
+ this.beanManager = manager;
+
+ // Generate an "Annotated Type"
+ AnnotatedType<T> type = manager.createAnnotatedType(clazz);
+
+ // Generate the InjectionTarget
+ this.injectionTarget = manager.createInjectionTarget(type);
+ }
+
+ public Instance<T> newInstance()
+ {
+ return new Instance<T>(beanManager, injectionTarget);
+ }
+
+ /**
+ * Represents a non-contextual instance
+ *
+ * @author pmuir
+ *
+ * @param <T>
+ */
+ public static class Instance<T>
+ {
+
+ private final CreationalContext<T> ctx;
+ private final InjectionTarget<T> injectionTarget;
+ private T instance;
+ private boolean disposed = false;
+
+ private Instance(BeanManager beanManager, InjectionTarget<T> injectionTarget)
+ {
+ this.injectionTarget = injectionTarget;
+ this.ctx = beanManager.createCreationalContext(null);
+ }
+
+ /**
+ * Get the instance
+ *
+ * @return
+ */
+ public T get()
+ {
+ return instance;
+ }
+
+ /**
+ * Create the instance
+ *
+ * @return
+ */
+ public Instance<T> produce()
+ {
+ if (this.instance != null)
+ {
+ throw new IllegalStateException("Trying to call produce() on already constructed instance");
+ }
+ if (disposed)
+ {
+ throw new IllegalStateException("Trying to call produce() on an already disposed instance");
+ }
+ this.instance = injectionTarget.produce(ctx);
+ return this;
+ }
+
+ /**
+ * Inject the instance
+ *
+ * @return
+ */
+ public Instance<T> inject()
+ {
+ if (this.instance == null)
+ {
+ throw new IllegalStateException("Trying to call inject() before produce() was called");
+ }
+ if (disposed)
+ {
+ throw new IllegalStateException("Trying to call inject() on already disposed instance");
+ }
+ injectionTarget.inject(instance, ctx);
+ return this;
+ }
+
+ /**
+ * Call the @PostConstruct callback
+ *
+ * @return
+ */
+ public Instance<T> postConstruct()
+ {
+ if (this.instance == null)
+ {
+ throw new IllegalStateException("Trying to call postConstruct() before produce() was called");
+ }
+ if (disposed)
+ {
+ throw new IllegalStateException("Trying to call preDestroy() on already disposed instance");
+ }
+ injectionTarget.postConstruct(instance);
+ return this;
+ }
+
+ /**
+ * Call the @PreDestroy callback
+ *
+ * @return
+ */
+ public Instance<T> preDestroy()
+ {
+ if (this.instance == null)
+ {
+ throw new IllegalStateException("Trying to call preDestroy() before produce() was called");
+ }
+ if (disposed)
+ {
+ throw new IllegalStateException("Trying to call preDestroy() on already disposed instance");
+ }
+ injectionTarget.preDestroy(instance);
+ return this;
+ }
+
+ /**
+ * Dispose of the instance, doing any necessary cleanup
+ *
+ */
+ public Instance<T> dispose()
+ {
+ if (this.instance == null)
+ {
+ throw new IllegalStateException("Trying to call dispose() before produce() was called");
+ }
+ if (disposed)
+ {
+ throw new IllegalStateException("Trying to call dispose() on already disposed instance");
+ }
+ injectionTarget.dispose(instance);
+ ctx.release();
+ return this;
+ }
+
+ }
+
+}
\ No newline at end of file
Property changes on: core/trunk/inject-tck-runner/src/test/java/org/jboss/weld/atinject/tck/util/NonContextual.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: core/trunk/jboss-as/build.xml
===================================================================
--- core/trunk/jboss-as/build.xml 2009-10-13 15:42:46 UTC (rev 4006)
+++ core/trunk/jboss-as/build.xml 2009-10-13 15:44:15 UTC (rev 4007)
@@ -4,6 +4,8 @@
<path id="maven-ant-tasks.classpath" path="../lib/maven-ant-tasks.jar" />
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" classpathref="maven-ant-tasks.classpath" />
+ <echo message="${java.io.tmpdir}" />
+
<property name="maven.dir" location="${basedir}/lib/maven" />
<property file="local.build.properties" />
15 years
Weld SVN: r4006 - in core/trunk/impl/src/main/java/org/jboss/weld: util/collections and 1 other directories.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-13 11:42:46 -0400 (Tue, 13 Oct 2009)
New Revision: 4006
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/ConstructorSignatureImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/MethodSignatureImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/util/collections/Arrays2.java
core/trunk/impl/src/main/java/org/jboss/weld/util/reflection/ParameterizedTypeImpl.java
Log:
Remove jdk6 dep
Modified: core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/ConstructorSignatureImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/ConstructorSignatureImpl.java 2009-10-13 14:49:39 UTC (rev 4005)
+++ core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/ConstructorSignatureImpl.java 2009-10-13 15:42:46 UTC (rev 4006)
@@ -20,6 +20,7 @@
import org.jboss.weld.introspector.ConstructorSignature;
import org.jboss.weld.introspector.WeldConstructor;
+import org.jboss.weld.util.collections.Arrays2;
public class ConstructorSignatureImpl implements ConstructorSignature
{
@@ -60,7 +61,7 @@
public String[] getParameterTypes()
{
- return Arrays.copyOf(parameterTypes, parameterTypes.length);
+ return Arrays2.copyOf(parameterTypes, parameterTypes.length);
}
}
\ No newline at end of file
Modified: core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/MethodSignatureImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/MethodSignatureImpl.java 2009-10-13 14:49:39 UTC (rev 4005)
+++ core/trunk/impl/src/main/java/org/jboss/weld/introspector/jlr/MethodSignatureImpl.java 2009-10-13 15:42:46 UTC (rev 4006)
@@ -21,6 +21,7 @@
import org.jboss.weld.introspector.MethodSignature;
import org.jboss.weld.introspector.WeldMethod;
+import org.jboss.weld.util.collections.Arrays2;
public class MethodSignatureImpl implements MethodSignature
{
@@ -81,7 +82,7 @@
public String[] getParameterTypes()
{
- return Arrays.copyOf(parameterTypes, parameterTypes.length);
+ return Arrays2.copyOf(parameterTypes, parameterTypes.length);
}
@Override
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/collections/Arrays2.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/collections/Arrays2.java 2009-10-13 14:49:39 UTC (rev 4005)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/collections/Arrays2.java 2009-10-13 15:42:46 UTC (rev 4006)
@@ -16,6 +16,7 @@
*/
package org.jboss.weld.util.collections;
+import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
@@ -48,5 +49,59 @@
}
return result;
}
+
+ // Cloning
+ /**
+ * Copies the specified array, truncating or padding with nulls (if necessary)
+ * so the copy has the specified length. For all indices that are
+ * valid in both the original array and the copy, the two arrays will
+ * contain identical values. For any indices that are valid in the
+ * copy but not the original, the copy will contain <tt>null</tt>.
+ * Such indices will exist if and only if the specified length
+ * is greater than that of the original array.
+ * The resulting array is of exactly the same class as the original array.
+ *
+ * @param original the array to be copied
+ * @param newLength the length of the copy to be returned
+ * @return a copy of the original array, truncated or padded with nulls
+ * to obtain the specified length
+ * @throws NegativeArraySizeException if <tt>newLength</tt> is negative
+ * @throws NullPointerException if <tt>original</tt> is null
+ * @since 1.6
+ */
+ public static <T> T[] copyOf(T[] original, int newLength) {
+ return (T[]) copyOf(original, newLength, original.getClass());
+ }
+ /**
+ * Copies the specified array, truncating or padding with nulls (if necessary)
+ * so the copy has the specified length. For all indices that are
+ * valid in both the original array and the copy, the two arrays will
+ * contain identical values. For any indices that are valid in the
+ * copy but not the original, the copy will contain <tt>null</tt>.
+ * Such indices will exist if and only if the specified length
+ * is greater than that of the original array.
+ * The resulting array is of the class <tt>newType</tt>.
+ *
+ * @param original the array to be copied
+ * @param newLength the length of the copy to be returned
+ * @param newType the class of the copy to be returned
+ * @return a copy of the original array, truncated or padded with nulls
+ * to obtain the specified length
+ * @throws NegativeArraySizeException if <tt>newLength</tt> is negative
+ * @throws NullPointerException if <tt>original</tt> is null
+ * @throws ArrayStoreException if an element copied from
+ * <tt>original</tt> is not of a runtime type that can be stored in
+ * an array of class <tt>newType</tt>
+ * @since 1.6
+ */
+ public static <T,U> T[] copyOf(U[] original, int newLength, Class<? extends T[]> newType) {
+ T[] copy = ((Object)newType == (Object)Object[].class)
+ ? (T[]) new Object[newLength]
+ : (T[]) Array.newInstance(newType.getComponentType(), newLength);
+ System.arraycopy(original, 0, copy, 0,
+ Math.min(original.length, newLength));
+ return copy;
+ }
+
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/reflection/ParameterizedTypeImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/reflection/ParameterizedTypeImpl.java 2009-10-13 14:49:39 UTC (rev 4005)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/reflection/ParameterizedTypeImpl.java 2009-10-13 15:42:46 UTC (rev 4006)
@@ -20,6 +20,8 @@
import java.lang.reflect.Type;
import java.util.Arrays;
+import org.jboss.weld.util.collections.Arrays2;
+
public class ParameterizedTypeImpl implements ParameterizedType
{
private final Type[] actualTypeArguments;
@@ -28,14 +30,14 @@
public ParameterizedTypeImpl(Type rawType, Type[] actualTypeArguments, Type ownerType)
{
- this.actualTypeArguments = Arrays.copyOf(actualTypeArguments, actualTypeArguments.length);
+ this.actualTypeArguments = Arrays2.copyOf(actualTypeArguments, actualTypeArguments.length);
this.rawType = rawType;
this.ownerType = ownerType;
}
public Type[] getActualTypeArguments()
{
- return Arrays.copyOf(actualTypeArguments, actualTypeArguments.length);
+ return Arrays2.copyOf(actualTypeArguments, actualTypeArguments.length);
}
public Type getOwnerType()
15 years
Weld SVN: r4005 - in core/trunk: bom and 1 other directory.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-13 10:49:39 -0400 (Tue, 13 Oct 2009)
New Revision: 4005
Modified:
core/trunk/bom/pom.xml
core/trunk/pom.xml
Log:
use parent-2
Modified: core/trunk/bom/pom.xml
===================================================================
--- core/trunk/bom/pom.xml 2009-10-13 14:08:59 UTC (rev 4004)
+++ core/trunk/bom/pom.xml 2009-10-13 14:49:39 UTC (rev 4005)
@@ -9,7 +9,7 @@
<parent>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-parent</artifactId>
- <version>2-SNAPSHOT</version>
+ <version>2</version>
</parent>
<name>Weld Core BOM</name>
Modified: core/trunk/pom.xml
===================================================================
--- core/trunk/pom.xml 2009-10-13 14:08:59 UTC (rev 4004)
+++ core/trunk/pom.xml 2009-10-13 14:49:39 UTC (rev 4005)
@@ -9,7 +9,7 @@
<parent>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-parent</artifactId>
- <version>2-SNAPSHOT</version>
+ <version>2</version>
</parent>
<name>Weld Build Aggregator</name>
15 years
Weld SVN: r4004 - cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-13 10:08:59 -0400 (Tue, 13 Oct 2009)
New Revision: 4004
Added:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Bird.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Canary.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Capercaillie.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/CapercaillieLocal.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Dove.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/Parrot.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/PetShop.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ScottishBirdLocal.java
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ResolutionByTypeTest.java
Log:
add tests for @BeanTypes
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Bird.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Bird.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Bird.java 2009-10-13 14:08:59 UTC (rev 4004)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
+
+public interface Bird
+{
+
+}
Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Bird.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Canary.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Canary.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Canary.java 2009-10-13 14:08:59 UTC (rev 4004)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
+
+import javax.enterprise.inject.BeanTypes;
+
+(a)BeanTypes(Canary.class)
+public class Canary implements Bird
+{
+
+}
Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Canary.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Capercaillie.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Capercaillie.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Capercaillie.java 2009-10-13 14:08:59 UTC (rev 4004)
@@ -0,0 +1,11 @@
+package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
+
+import javax.ejb.Stateless;
+import javax.enterprise.inject.BeanTypes;
+
+@Stateless
+(a)BeanTypes(CapercaillieLocal.class)
+public class Capercaillie implements CapercaillieLocal
+{
+
+}
Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Capercaillie.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/CapercaillieLocal.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/CapercaillieLocal.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/CapercaillieLocal.java 2009-10-13 14:08:59 UTC (rev 4004)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
+
+import javax.ejb.Local;
+
+@Local
+public interface CapercaillieLocal
+{
+
+}
Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/CapercaillieLocal.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Dove.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Dove.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Dove.java 2009-10-13 14:08:59 UTC (rev 4004)
@@ -0,0 +1,8 @@
+package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
+
+public class Dove implements Bird
+{
+
+ public Dove(String name) {}
+
+}
Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Dove.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: 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 (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/EnterpriseResolutionByTypeTest.java 2009-10-13 14:08:59 UTC (rev 4004)
@@ -0,0 +1,46 @@
+/*
+ * 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.lookup.typesafe.resolution;
+
+import javax.enterprise.inject.spi.Bean;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+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.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
+import org.testng.annotations.Test;
+
+@Artifact
+@SpecVersion(spec="cdi", version="PFD2")
+(a)Packaging(PackagingType.EAR)
+public class EnterpriseResolutionByTypeTest extends AbstractJSR299Test
+{
+
+ @Test
+ @SpecAssertion(section = "TBD", id = "TBD")
+ public void testBeanTypesOnSessionBean()
+ {
+ 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);
+ }
+
+}
Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/EnterpriseResolutionByTypeTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Parrot.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Parrot.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Parrot.java 2009-10-13 14:08:59 UTC (rev 4004)
@@ -0,0 +1,8 @@
+package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
+
+public class Parrot implements Bird
+{
+
+ public Parrot(String name) {}
+
+}
Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/Parrot.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/PetShop.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/PetShop.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/PetShop.java 2009-10-13 14:08:59 UTC (rev 4004)
@@ -0,0 +1,18 @@
+package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
+
+import javax.enterprise.inject.BeanTypes;
+import javax.enterprise.inject.Produces;
+
+public class PetShop
+{
+
+ @Produces @BeanTypes(Dove.class)
+ private Dove dove = new Dove("charlie");
+
+ @Produces @BeanTypes(Parrot.class)
+ public Parrot getParrot()
+ {
+ return new Parrot("polly");
+ }
+
+}
Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/PetShop.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
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-10-13 12:32:09 UTC (rev 4003)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ResolutionByTypeTest.java 2009-10-13 14:08:59 UTC (rev 4004)
@@ -209,4 +209,38 @@
assert getCurrentManager().getBeans("crabSpider").size() == 0;
}
+
+ @Test
+ @SpecAssertion(section = "TBD", id = "TBD")
+ public void testBeanTypesOnManagedBean()
+ {
+ assert getBeans(Canary.class).size() == 1;
+ Set<Bean<Bird>> beans = getBeans(Bird.class);
+ Bean<Canary> bean = getUniqueBean(Canary.class);
+ assert getBeans(Bird.class).isEmpty();
+ assert bean.getTypes().size() == 1;
+ assert bean.getTypes().iterator().next().equals(Canary.class);
+ }
+
+ @Test
+ @SpecAssertion(section = "TBD", id = "TBD")
+ public void testBeanTypesOnProducerMethod()
+ {
+ 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);
+ }
+
+ @Test
+ @SpecAssertion(section = "TBD", id = "TBD")
+ 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);
+ }
}
Added: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ScottishBirdLocal.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ScottishBirdLocal.java (rev 0)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ScottishBirdLocal.java 2009-10-13 14:08:59 UTC (rev 4004)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.lookup.typesafe.resolution;
+
+import javax.ejb.Local;
+
+@Local
+public interface ScottishBirdLocal extends Bird
+{
+
+}
Property changes on: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/typesafe/resolution/ScottishBirdLocal.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
15 years
Weld SVN: r4003 - core/trunk/bom.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-13 08:32:09 -0400 (Tue, 13 Oct 2009)
New Revision: 4003
Modified:
core/trunk/bom/pom.xml
Log:
update various versions
Modified: core/trunk/bom/pom.xml
===================================================================
--- core/trunk/bom/pom.xml 2009-10-13 11:52:33 UTC (rev 4002)
+++ core/trunk/bom/pom.xml 2009-10-13 12:32:09 UTC (rev 4003)
@@ -72,13 +72,12 @@
</repositories>
<properties>
- <weld.api.version>1.0-SNAPSHOT</weld.api.version>
- <weld.core.version>1.0.0-SNAPSHOT</weld.core.version>
+ <weld.api.version>1.0-CR1</weld.api.version>
<google.collections.version>1.0-rc2</google.collections.version>
<javassist.version>3.11.0.GA</javassist.version>
<cdi.tck.version>1.0.0-SNAPSHOT</cdi.tck.version>
<atinject.tck.version>1.0.0-PFD-3</atinject.tck.version>
- <jboss.interceptor.version>1.0.0-SNAPSHOT</jboss.interceptor.version>
+ <jboss.interceptor.version>1.0.0-CR1</jboss.interceptor.version>
</properties>
<dependencyManagement>
@@ -101,25 +100,25 @@
<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-core</artifactId>
- <version>${weld.core.version}</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-porting-package</artifactId>
- <version>${weld.core.version}</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-logging</artifactId>
- <version>${weld.core.version}</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-core-test</artifactId>
- <version>${weld.core.version}</version>
+ <version>${project.version}</version>
</dependency>
<dependency>
15 years
Weld SVN: r4002 - cdi-tck/trunk.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-13 07:52:33 -0400 (Tue, 13 Oct 2009)
New Revision: 4002
Modified:
cdi-tck/trunk/pom.xml
Log:
update to non-snapshots
Modified: cdi-tck/trunk/pom.xml
===================================================================
--- cdi-tck/trunk/pom.xml 2009-10-13 00:26:45 UTC (rev 4001)
+++ cdi-tck/trunk/pom.xml 2009-10-13 11:52:33 UTC (rev 4002)
@@ -76,8 +76,8 @@
<properties>
<jsr299.tck.version>${project.version}</jsr299.tck.version>
- <jboss.test.audit.version>1.1.0-SNAPSHOT</jboss.test.audit.version>
- <jboss.test.harness.version>1.1.0-SNAPSHOT</jboss.test.harness.version>
+ <jboss.test.audit.version>1.0.0</jboss.test.audit.version>
+ <jboss.test.harness.version>1.1.0-CR1</jboss.test.harness.version>
<testng.version>5.9</testng.version>
<jsr250.api.version>1.0</jsr250.api.version>
<cdi.api.version>1.0-CR1</cdi.api.version>
@@ -99,8 +99,6 @@
<jws.api.version>1.0-MR1</jws.api.version>
<apache.httpclient.version>3.1</apache.httpclient.version>
<htmlunit.version>2.4</htmlunit.version>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<!-- Dependency management -->
15 years
Weld SVN: r4001 - in cdi-tck/trunk: dist/porting-package and 1 other directory.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-12 20:26:45 -0400 (Mon, 12 Oct 2009)
New Revision: 4001
Modified:
cdi-tck/trunk/dist/porting-package/pom.xml
cdi-tck/trunk/pom.xml
Log:
upgrade versions
Modified: cdi-tck/trunk/dist/porting-package/pom.xml
===================================================================
--- cdi-tck/trunk/dist/porting-package/pom.xml 2009-10-13 00:11:04 UTC (rev 4000)
+++ cdi-tck/trunk/dist/porting-package/pom.xml 2009-10-13 00:26:45 UTC (rev 4001)
@@ -15,7 +15,7 @@
<name>JSR-299 TCK Distribution - Weld Porting Package</name>
<properties>
- <weld.version>1.0.0-SNAPSHOT</weld.version>
+ <weld.version>1.0.0-CR1</weld.version>
</properties>
<dependencies>
Modified: cdi-tck/trunk/pom.xml
===================================================================
--- cdi-tck/trunk/pom.xml 2009-10-13 00:11:04 UTC (rev 4000)
+++ cdi-tck/trunk/pom.xml 2009-10-13 00:26:45 UTC (rev 4001)
@@ -11,7 +11,7 @@
<parent>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-parent</artifactId>
- <version>2-SNAPSHOT</version>
+ <version>2</version>
</parent>
<!-- Metadata -->
@@ -80,7 +80,7 @@
<jboss.test.harness.version>1.1.0-SNAPSHOT</jboss.test.harness.version>
<testng.version>5.9</testng.version>
<jsr250.api.version>1.0</jsr250.api.version>
- <cdi.api.version>1.0-SNAPSHOT</cdi.api.version>
+ <cdi.api.version>1.0-CR1</cdi.api.version>
<atinject.api.version>1.0-PFD-1</atinject.api.version>
<ejb.api.version>3.1.0-Alpha1</ejb.api.version>
<jsr250.api.version>1.0</jsr250.api.version>
@@ -94,7 +94,7 @@
<uel.api.version>2.1.2-b04</uel.api.version>
<jsf.api.version>1.2_13</jsf.api.version>
<jaxws.api.version>2.1</jaxws.api.version>
- <interceptor.api.version>3.1.0-SNAPSHOT</interceptor.api.version>
+ <interceptor.api.version>3.1.0-CR1</interceptor.api.version>
<log4j.version>1.2.14</log4j.version>
<jws.api.version>1.0-MR1</jws.api.version>
<apache.httpclient.version>3.1</apache.httpclient.version>
15 years, 1 month