Author: dallen6
Date: 2009-07-21 12:17:35 -0400 (Tue, 21 Jul 2009)
New Revision: 3116
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/Car.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/Government.java
ri/trunk/version-matrix/pom.xml
Log:
Removed validation rules related to deployment types and precedence
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java 2009-07-21 15:31:30 UTC
(rev 3115)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/Validator.java 2009-07-21 16:17:35 UTC
(rev 3116)
@@ -91,15 +91,11 @@
private void validateRIBean(RIBean<?> bean, BeanManagerImpl beanManager,
List<RIBean<?>> specializedBeans)
{
validateBean(bean, beanManager);
- if (!(bean instanceof NewSimpleBean) && !(bean instanceof
NewEnterpriseBean))
+ if (!(bean instanceof NewSimpleBean<?>) && !(bean instanceof
NewEnterpriseBean<?>))
{
RIBean<?> abstractBean = bean;
if (abstractBean.isSpecializing())
{
- if (!hasHigherPrecedence(bean.getDeploymentType(),
abstractBean.getSpecializedBean().getDeploymentType(), beanManager))
- {
- throw new InconsistentSpecializationException("Specializing bean must
have a higher precedence deployment type than the specialized bean: " + bean);
- }
if (specializedBeans.contains(abstractBean.getSpecializedBean()))
{
throw new InconsistentSpecializationException("Two beans cannot
specialize the same bean: " + bean);
@@ -136,7 +132,7 @@
ParameterizedType parameterizedType = (ParameterizedType) ij.getType();
for (Type type : parameterizedType.getActualTypeArguments())
{
- if (type instanceof TypeVariable)
+ if (type instanceof TypeVariable<?>)
{
throw new DefinitionException("Injection point cannot have a type
variable type parameter " + ij);
}
@@ -170,7 +166,7 @@
}
if (Beans.isPassivatingScope(ij.getBean(), beanManager) &&
(!ij.isTransient()) && !Beans.isPassivationCapableBean(resolvedBean))
{
- if (resolvedBean.getScopeType().equals(Dependent.class) && resolvedBean
instanceof AbstractProducerBean)
+ if (resolvedBean.getScopeType().equals(Dependent.class) && resolvedBean
instanceof AbstractProducerBean<?,?>)
{
throw new IllegalProductException("The bean " + ij.getBean() +
" declares a passivating scope but the producer returned a non-serializable bean for
injection: " + resolvedBean);
}
@@ -231,12 +227,6 @@
}
}
- private static boolean hasHigherPrecedence(Class<? extends Annotation>
deploymentType, Class<? extends Annotation> otherDeploymentType, BeanManagerImpl
manager)
- {
- Comparator<Class<? extends Annotation>> comparator = new
ListComparator<Class<? extends
Annotation>>(manager.getEnabledDeploymentTypes());
- return comparator.compare(deploymentType, otherDeploymentType) > 0;
- }
-
private static void checkFacadeInjectionPoint(InjectionPoint injectionPoint,
Class<?> type)
{
if (injectionPoint.getAnnotated().getBaseType().equals(type))
@@ -244,7 +234,7 @@
if (injectionPoint.getType() instanceof ParameterizedType)
{
ParameterizedType parameterizedType = (ParameterizedType)
injectionPoint.getType();
- if (parameterizedType.getActualTypeArguments()[0] instanceof TypeVariable)
+ if (parameterizedType.getActualTypeArguments()[0] instanceof
TypeVariable<?>)
{
throw new DefinitionException("An injection point of type " +
type + " cannot have a type variable type parameter " + injectionPoint);
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
===================================================================
---
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-07-21
15:31:30 UTC (rev 3115)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-07-21
16:17:35 UTC (rev 3116)
@@ -79,6 +79,26 @@
@Override
protected abstract WBMember<T, S> getAnnotatedItem();
+ @Override
+ // Overriden to provide the class of the bean that declares the producer method/field
+ public Class<?> getBeanClass()
+ {
+ return getDeclaringBean().getBeanClass();
+ }
+
+ @Override
+ public String getId()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void destroy(T instance, CreationalContext<T> creationalContext)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
/**
* Gets the deployment types
*
@@ -377,7 +397,7 @@
{
buffer.append("simple producer bean '" + getName() +
"'");
}
- buffer.append(" [" + getType().getName() + "] API types " +
getTypes() + ", binding types " + getBindings());
+ buffer.append(" [" + getBeanClass().getName() + "] for class type
[" + getType().getName() + "] API types " + getTypes() + ", binding
types " + getBindings());
return buffer.toString();
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java 2009-07-21
15:31:30 UTC (rev 3115)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerFieldBean.java 2009-07-21
16:17:35 UTC (rev 3116)
@@ -131,8 +131,7 @@
{
buffer.append("simple producer field bean '" + getName() +
"'");
}
- buffer.append(" [" + getType().getName() + "] ");
- buffer.append("API types " + getTypes() + ", binding types " +
getBindings());
+ buffer.append(" [" + getBeanClass().getName() + "] for class type
[" + getType().getName() + "] API types " + getTypes() + ", binding
types " + getBindings());
return buffer.toString();
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-07-21
15:31:30 UTC (rev 3115)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-07-21
16:17:35 UTC (rev 3116)
@@ -240,8 +240,7 @@
{
buffer.append("simple producer method bean '" + getName() +
"'");
}
- buffer.append(" [" + getType().getName() + "] ");
- buffer.append("API types " + getTypes() + ", binding types " +
getBindings());
+ buffer.append(" [" + getBeanClass().getName() + "] for class type
[" + getType().getName() + "] API types " + getTypes() + ", binding
types " + getBindings());
return buffer.toString();
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java 2009-07-21 15:31:30 UTC
(rev 3115)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java 2009-07-21 16:17:35 UTC
(rev 3116)
@@ -31,6 +31,7 @@
import org.jboss.webbeans.BeanManagerImpl;
import org.jboss.webbeans.DefinitionException;
+import org.jboss.webbeans.bean.AbstractProducerBean;
import org.jboss.webbeans.bean.EnterpriseBean;
import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.injection.FieldInjectionPoint;
@@ -80,6 +81,10 @@
{
return ((EnterpriseBean<?>) bean).getEjbDescriptor().isStateful();
}
+ else if (bean instanceof AbstractProducerBean<?, ?>)
+ {
+ return Reflections.isSerializable(((AbstractProducerBean<?, ?>)
bean).getType());
+ }
else
{
return Reflections.isSerializable(bean.getBeanClass());
Modified:
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/Car.java
===================================================================
---
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/Car.java 2009-07-21
15:31:30 UTC (rev 3115)
+++
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/Car.java 2009-07-21
16:17:35 UTC (rev 3116)
@@ -5,4 +5,6 @@
public class Car implements Serializable
{
+ private static final long serialVersionUID = 1L;
+
}
Modified:
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/Government.java
===================================================================
---
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/Government.java 2009-07-21
15:31:30 UTC (rev 3115)
+++
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/Government.java 2009-07-21
16:17:35 UTC (rev 3116)
@@ -8,6 +8,8 @@
public class Government implements Serializable
{
+ private static final long serialVersionUID = 1L;
+
@Important Car governmentCar;
public void destabilize()
Modified: ri/trunk/version-matrix/pom.xml
===================================================================
--- ri/trunk/version-matrix/pom.xml 2009-07-21 15:31:30 UTC (rev 3115)
+++ ri/trunk/version-matrix/pom.xml 2009-07-21 16:17:35 UTC (rev 3116)
@@ -51,7 +51,7 @@
<webbeans.version>1.0.0-SNAPSHOT</webbeans.version>
<webbeans.servlet.version>1.0.0.CR1</webbeans.servlet.version>
<webbeans.se.version>1.0.0.BETA1</webbeans.se.version>
- <jboss.test.harness.version>1.0.0.BETA3</jboss.test.harness.version>
+
<jboss.test.harness.version>1.0.0-SNAPSHOT</jboss.test.harness.version>
</properties>
<dependencyManagement>