[weld-commits] Weld SVN: r6066 - in core/trunk: tests/src/test/java/org/jboss/weld/tests/builtinBeans and 1 other directories.
weld-commits at lists.jboss.org
weld-commits at lists.jboss.org
Sat Mar 27 07:53:37 EDT 2010
Author: nickarls
Date: 2010-03-27 07:53:37 -0400 (Sat, 27 Mar 2010)
New Revision: 6066
Added:
core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/
core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/Bar.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/Foo.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/InstanceTest.java
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployerEnvironment.java
Log:
WELD-471
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployerEnvironment.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployerEnvironment.java 2010-03-24 21:21:46 UTC (rev 6065)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployerEnvironment.java 2010-03-27 11:53:37 UTC (rev 6066)
@@ -26,6 +26,8 @@
import java.util.Map;
import java.util.Set;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Instance;
import javax.enterprise.inject.New;
import org.jboss.weld.bean.AbstractBean;
@@ -88,12 +90,12 @@
this.newManagedBeanClasses = new HashSet<WeldClass<?>>();
this.newSessionBeanDescriptors = new HashSet<InternalEjbDescriptor<?>>();
}
-
+
public Set<WeldClass<?>> getNewManagedBeanClasses()
{
return newManagedBeanClasses;
}
-
+
public Set<InternalEjbDescriptor<?>> getNewSessionBeanDescriptors()
{
return newSessionBeanDescriptors;
@@ -113,7 +115,7 @@
return (ProducerMethod<X, T>) bean;
}
}
-
+
public AbstractClassBean<?> getClassBean(WeldClass<?> clazz)
{
if (!classBeanMap.containsKey(clazz))
@@ -133,22 +135,22 @@
producerMethodBeanMap.put(new WeldMethodKey(bean.getWeldAnnotated()), bean);
addAbstractBean(bean);
}
-
+
public void addProducerField(ProducerField<?, ?> bean)
{
addAbstractBean(bean);
}
-
+
public void addExtension(ExtensionBean bean)
{
beans.add(bean);
}
-
+
public void addBuiltInBean(AbstractBuiltInBean<?> bean)
{
beans.add(bean);
}
-
+
protected void addAbstractClassBean(AbstractClassBean<?> bean)
{
if (!(bean instanceof NewBean))
@@ -157,29 +159,29 @@
}
addAbstractBean(bean);
}
-
+
public void addManagedBean(ManagedBean<?> bean)
{
newManagedBeanClasses.add(bean.getWeldAnnotated());
addAbstractClassBean(bean);
}
-
+
public void addSessionBean(SessionBean<?> bean)
{
newSessionBeanDescriptors.add(bean.getEjbDescriptor());
addAbstractClassBean(bean);
}
-
+
public void addNewManagedBean(NewManagedBean<?> bean)
{
beans.add(bean);
}
-
+
public void addNewSessionBean(NewSessionBean<?> bean)
{
beans.add(bean);
}
-
+
protected void addAbstractBean(AbstractBean<?, ?> bean)
{
addNewBeansFromInjectionPoints(bean);
@@ -195,29 +197,33 @@
{
interceptors.add(bean);
}
-
+
public void addDisposesMethod(DisposalMethod<?, ?> bean)
{
allDisposalBeans.add(bean);
addNewBeansFromInjectionPoints(bean);
}
-
+
public void addObserverMethod(ObserverMethodImpl<?, ?> observer)
{
this.observers.add(observer);
addNewBeansFromInjectionPoints(observer.getNewInjectionPoints());
}
-
-
+
private void addNewBeansFromInjectionPoints(AbstractBean<?, ?> bean)
{
addNewBeansFromInjectionPoints(bean.getNewInjectionPoints());
}
-
+
private void addNewBeansFromInjectionPoints(Set<WeldInjectionPoint<?, ?>> newInjectionPoints)
{
for (WeldInjectionPoint<?, ?> injectionPoint : newInjectionPoints)
{
+ // FIXME: better check
+ if (injectionPoint.getJavaClass() == Instance.class || injectionPoint.getJavaClass() == Event.class)
+ {
+ continue;
+ }
New _new = injectionPoint.getAnnotation(New.class);
if (_new.value().equals(New.class))
{
@@ -227,10 +233,10 @@
{
addNewBeanFromInjecitonPoint(_new.value(), _new.value());
}
-
+
}
}
-
+
private void addNewBeanFromInjecitonPoint(Class<?> rawType, Type baseType)
{
if (getEjbDescriptors().contains(rawType))
@@ -247,7 +253,7 @@
{
return Collections.unmodifiableSet(beans);
}
-
+
public Set<DecoratorImpl<?>> getDecorators()
{
return Collections.unmodifiableSet(decorators);
@@ -263,7 +269,6 @@
return Collections.unmodifiableSet(observers);
}
-
public Set<DisposalMethod<?, ?>> getUnresolvedDisposalBeans()
{
Set<DisposalMethod<?, ?>> beans = new HashSet<DisposalMethod<?, ?>>(allDisposalBeans);
@@ -275,7 +280,7 @@
{
return ejbDescriptors;
}
-
+
/**
* Resolve the disposal method for the given producer method. Any resolved
* beans will be marked as such for the purpose of validating that all
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/Bar.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/Bar.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/Bar.java 2010-03-27 11:53:37 UTC (rev 6066)
@@ -0,0 +1,11 @@
+package org.jboss.weld.tests.builtinBeans.weld471;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.New;
+import javax.inject.Inject;
+
+ at ApplicationScoped
+public class Bar {
+ @Inject @New private Instance<Foo> foo;
+}
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/Foo.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/Foo.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/Foo.java 2010-03-27 11:53:37 UTC (rev 6066)
@@ -0,0 +1,8 @@
+package org.jboss.weld.tests.builtinBeans.weld471;
+
+import javax.enterprise.context.ApplicationScoped;
+
+ at ApplicationScoped
+public class Foo {
+
+}
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/InstanceTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/InstanceTest.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/InstanceTest.java 2010-03-27 11:53:37 UTC (rev 6066)
@@ -0,0 +1,13 @@
+package org.jboss.weld.tests.builtinBeans.weld471;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.weld.test.AbstractWeldTest;
+import org.testng.annotations.Test;
+
+ at Artifact
+public class InstanceTest extends AbstractWeldTest {
+
+ @Test
+ public void testNewInstance() {
+ }
+}
More information about the weld-commits
mailing list