Skip to content

Commit

Permalink
Fixes to passivation tests
Browse files Browse the repository at this point in the history
git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@1685 1c488680-804c-0410-94cd-c6b725194a0e
  • Loading branch information
pmuir committed Feb 24, 2009
1 parent 581d706 commit 2a7752b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
18 changes: 0 additions & 18 deletions webbeans-ri/src/main/java/org/jboss/webbeans/BeanValidator.java
Expand Up @@ -24,7 +24,6 @@

import javax.inject.AmbiguousDependencyException;
import javax.inject.DefinitionException;
import javax.inject.IllegalProductException;
import javax.inject.InconsistentSpecializationException;
import javax.inject.New;
import javax.inject.NullableDependencyException;
Expand All @@ -34,11 +33,9 @@
import javax.inject.manager.Bean;
import javax.inject.manager.InjectionPoint;

import org.jboss.webbeans.bean.AbstractProducerBean;
import org.jboss.webbeans.bean.NewEnterpriseBean;
import org.jboss.webbeans.bean.NewSimpleBean;
import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.metadata.MetaDataCache;
import org.jboss.webbeans.util.Beans;
import org.jboss.webbeans.util.ListComparator;
Expand Down Expand Up @@ -101,21 +98,6 @@ public void validate()
{
throw new NullableDependencyException("The injection point " + injectionPoint + " has nullable dependencies");
}
if (MetaDataCache.instance().getScopeModel(bean.getScopeType()).isPassivating())
{
if (resolvedBean instanceof AbstractProducerBean)
{
AbstractProducerBean producerBean = (AbstractProducerBean) resolvedBean;
if ((injectionPoint instanceof AnnotatedField) && ((AnnotatedField<?>) injectionPoint).isTransient())
{
injectionPoint.getBean();
}
else if (producerBean.isDependent() && !Reflections.isSerializable(producerBean.getType()))
{
throw new IllegalProductException("Cannot inject @Depedent non-serializable type into " + injectionPoint);
}
}
}
}
else
{
Expand Down
Expand Up @@ -212,16 +212,16 @@ else if (injectionPoint.getMember() instanceof Method)
Method method = (Method) injectionPoint.getMember();
if (method.isAnnotationPresent(Initializer.class))
{
throw new IllegalProductException("Dependent scoped producers cannot produce non-serializable instances for injection into parameters of intializers of beans declaring passivating scope");
throw new IllegalProductException("Dependent scoped producers cannot produce non-serializable instances for injection into parameters of intializers of beans declaring passivating scope. Bean " + toString() + " being injected into " + injectionPoint.toString());
}
if (method.isAnnotationPresent(Produces.class))
{
throw new IllegalProductException("Dependent scoped producers cannot produce non-serializable instances for injection into parameters of producer methods declaring passivating scope");
throw new IllegalProductException("Dependent scoped producers cannot produce non-serializable instances for injection into parameters of producer methods declaring passivating scope. Bean " + toString() + " being injected into " + injectionPoint.toString());
}
}
else if (injectionPoint.getMember() instanceof Constructor)
{
throw new IllegalProductException("Dependent scoped producers cannot produce non-serializable instances for injection into parameters of constructors of beans declaring passivating scope");
throw new IllegalProductException("Dependent scoped producers cannot produce non-serializable instances for injection into parameters of constructors of beans declaring passivating scope. Bean " + toString() + " being injected into " + injectionPoint.toString());
}
}
}
Expand Down

0 comments on commit 2a7752b

Please sign in to comment.