Author: pete.muir(a)jboss.org
Date: 2010-02-16 16:55:26 -0500 (Tue, 16 Feb 2010)
New Revision: 5854
Added:
core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/
core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Alternatives2Test.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/AlternativesTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Consumer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Foo.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Producer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Test.java
core/trunk/tests/src/test/resources/org/jboss/weld/tests/alternatives/
core/trunk/tests/src/test/resources/org/jboss/weld/tests/alternatives/beans.xml
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerField.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerMethod.java
Log:
WELD-429
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 2010-02-16
21:20:00 UTC (rev 5853)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerField.java 2010-02-16
21:55:26 UTC (rev 5854)
@@ -16,9 +16,7 @@
*/
package org.jboss.weld.bean;
-import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
-import java.util.Collections;
import java.util.Set;
import javax.enterprise.context.spi.CreationalContext;
@@ -170,10 +168,4 @@
return false;
}
- @Override
- public Set<Class<? extends Annotation>> getStereotypes()
- {
- return Collections.emptySet();
- }
-
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerMethod.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerMethod.java 2010-02-16
21:20:00 UTC (rev 5853)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/ProducerMethod.java 2010-02-16
21:55:26 UTC (rev 5854)
@@ -21,10 +21,8 @@
import static org.jboss.weld.logging.messages.BeanMessage.MULTIPLE_DISPOSAL_METHODS;
import static
org.jboss.weld.logging.messages.BeanMessage.PRODUCER_METHOD_NOT_SPECIALIZING;
-import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
-import java.util.Collections;
import java.util.Set;
import javax.enterprise.context.spi.CreationalContext;
@@ -298,10 +296,4 @@
return id;
}
- @Override
- public Set<Class<? extends Annotation>> getStereotypes()
- {
- return Collections.emptySet();
- }
-
}
Added:
core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Alternatives2Test.java
===================================================================
---
core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Alternatives2Test.java
(rev 0)
+++
core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Alternatives2Test.java 2010-02-16
21:55:26 UTC (rev 5854)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.tests.alternatives;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.weld.test.AbstractWeldTest;
+import org.testng.annotations.Test;
+
+@Artifact
+public class Alternatives2Test extends AbstractWeldTest
+{
+
+ @Test
+ public void testAlternativesOnProducers()
+ {
+ assert getReference(Consumer.class).getFoo().getName().equals("Normal");
+ }
+
+}
Property changes on:
core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Alternatives2Test.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added:
core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/AlternativesTest.java
===================================================================
---
core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/AlternativesTest.java
(rev 0)
+++
core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/AlternativesTest.java 2010-02-16
21:55:26 UTC (rev 5854)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.tests.alternatives;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.jboss.weld.test.AbstractWeldTest;
+import org.testng.annotations.Test;
+
+@Artifact
+(a)BeansXml("beans.xml")
+public class AlternativesTest extends AbstractWeldTest
+{
+
+ @Test
+ public void testAlternativesOnProducers()
+ {
+ assert getReference(Consumer.class).getFoo().getName().equals("Test");
+ }
+
+}
Property changes on:
core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/AlternativesTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Consumer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Consumer.java
(rev 0)
+++
core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Consumer.java 2010-02-16
21:55:26 UTC (rev 5854)
@@ -0,0 +1,15 @@
+package org.jboss.weld.tests.alternatives;
+
+import javax.inject.Inject;
+
+public class Consumer
+{
+
+ @Inject Foo foo;
+
+ public Foo getFoo()
+ {
+ return foo;
+ }
+
+}
Property changes on:
core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Consumer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Foo.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Foo.java
(rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Foo.java 2010-02-16
21:55:26 UTC (rev 5854)
@@ -0,0 +1,18 @@
+package org.jboss.weld.tests.alternatives;
+
+public class Foo
+{
+
+ private final String name;
+
+ public Foo(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+}
Property changes on:
core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Foo.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Producer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Producer.java
(rev 0)
+++
core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Producer.java 2010-02-16
21:55:26 UTC (rev 5854)
@@ -0,0 +1,20 @@
+package org.jboss.weld.tests.alternatives;
+
+import javax.enterprise.inject.Produces;
+
+public class Producer
+{
+
+ @Produces @Test
+ public Foo getFoo()
+ {
+ return new Foo("Test");
+ }
+
+ @Produces
+ public Foo getManager()
+ {
+ return new Foo("Normal");
+ }
+
+}
Property changes on:
core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Producer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Test.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Test.java
(rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Test.java 2010-02-16
21:55:26 UTC (rev 5854)
@@ -0,0 +1,15 @@
+package org.jboss.weld.tests.alternatives;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Stereotype;
+
+@Stereotype
+@Alternative
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
+public @interface Test {}
\ No newline at end of file
Property changes on:
core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Test.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: core/trunk/tests/src/test/resources/org/jboss/weld/tests/alternatives/beans.xml
===================================================================
--- core/trunk/tests/src/test/resources/org/jboss/weld/tests/alternatives/beans.xml
(rev 0)
+++
core/trunk/tests/src/test/resources/org/jboss/weld/tests/alternatives/beans.xml 2010-02-16
21:55:26 UTC (rev 5854)
@@ -0,0 +1,6 @@
+<beans
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+ <alternatives>
+ <stereotype>org.jboss.weld.tests.alternatives.Test</stereotype>
+ </alternatives>
+</beans>
\ No newline at end of file
Property changes on:
core/trunk/tests/src/test/resources/org/jboss/weld/tests/alternatives/beans.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain