Author: scabanovich
Date: 2011-10-19 19:05:17 -0400 (Wed, 19 Oct 2011)
New Revision: 35826
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest1/src/cdi/test/observers/CDIBeanTest.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest2/src/cdi/test/observers/TestBean.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/event/fires/DogWhisperer.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/DependentProjectTest.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ObserverMethodResolutionTest.java
Log:
JBIDE-9951
https://issues.jboss.org/browse/JBIDE-9951
Null pointer fixed.
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest1/src/cdi/test/observers/CDIBeanTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest1/src/cdi/test/observers/CDIBeanTest.java 2011-10-19
22:57:23 UTC (rev 35825)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest1/src/cdi/test/observers/CDIBeanTest.java 2011-10-19
23:05:17 UTC (rev 35826)
@@ -1,9 +1,12 @@
package cdi.test.observers;
import javax.enterprise.event.Observes;
+import javax.inject.Inject;
public class CDIBeanTest {
public void method(@Observes BaseDecoratedInterface event) {
}
+
+ @Inject BaseDecoratedInterface point;
}
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest2/src/cdi/test/observers/TestBean.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest2/src/cdi/test/observers/TestBean.java 2011-10-19
22:57:23 UTC (rev 35825)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/projects/CDITest2/src/cdi/test/observers/TestBean.java 2011-10-19
23:05:17 UTC (rev 35826)
@@ -1,9 +1,15 @@
package cdi.test.observers;
import javax.enterprise.event.Event;
+import javax.enterprise.event.Observes;
import javax.inject.Inject;
public class TestBean implements BaseDecoratedInterface {
@Inject
Event<TestBean> event;
+
+ public void observer(@Observes BaseDecoratedInterface event) {
+
+ }
+
}
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/event/fires/DogWhisperer.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/event/fires/DogWhisperer.java 2011-10-19
22:57:23 UTC (rev 35825)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/event/fires/DogWhisperer.java 2011-10-19
23:05:17 UTC (rev 35826)
@@ -22,6 +22,9 @@
class DogWhisperer
{
+ @Inject @Tame @Role("Master")
+ TamingCommand tamingCommand;
+
@Inject @Any @Tame @Role("Master")
Event<TamingCommand> tamingEvent;
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/DependentProjectTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/DependentProjectTest.java 2011-10-19
22:57:23 UTC (rev 35825)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/DependentProjectTest.java 2011-10-19
23:05:17 UTC (rev 35826)
@@ -389,6 +389,16 @@
assertTrue(p.getDeclaringProject() == CDICorePlugin.getCDIProject(project2, true));
}
+ /**
+ * This test checks that method resolveObserverMethods does not fail with exception (see
JBIDE-9951)
+ */
+ public void testNonrelevantInjectionPointAtResolvingObserverMethods() {
+ ICDIProject cdi1 = CDICorePlugin.getCDIProject(project1, true);
+ IInjectionPointField tamingEvent = getInjectionPointField(cdi1,
"/src/cdi/test/observers/CDIBeanTest.java", "point");
+ Set<IObserverMethod> observers =
tamingEvent.getCDIProject().resolveObserverMethods(tamingEvent);
+ assertTrue(observers.isEmpty());
+ }
+
public void testCleanDependentProject() throws CoreException, IOException {
ICDIProject cdi2 = CDICorePlugin.getCDIProject(project2, true);
boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ObserverMethodResolutionTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ObserverMethodResolutionTest.java 2011-10-19
22:57:23 UTC (rev 35825)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ObserverMethodResolutionTest.java 2011-10-19
23:05:17 UTC (rev 35826)
@@ -29,6 +29,12 @@
*/
public class ObserverMethodResolutionTest extends TCKTest {
+ public void testNonrelevantInjectionPoint() {
+ IInjectionPointField tamingEvent =
getInjectionPointField("JavaSource/org/jboss/jsr299/tck/tests/event/fires/DogWhisperer.java",
"tamingCommand");
+ Set<IObserverMethod> observers =
tamingEvent.getCDIProject().resolveObserverMethods(tamingEvent);
+ assertTrue(observers.isEmpty());
+ }
+
public void testObserverMethodResolution() {
IInjectionPointField tamingEvent =
getInjectionPointField("JavaSource/org/jboss/jsr299/tck/tests/event/fires/DogWhisperer.java",
"tamingEvent");
assertNotNull(tamingEvent);