Author: akazakov
Date: 2011-02-05 08:34:42 -0500 (Sat, 05 Feb 2011)
New Revision: 29026
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/ITestBean.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/TestBeanBroken.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/TestBeanImpl.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/TestBeanImpl2.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/TestBeanImpl2.validation
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/TestBeanImpl2Original.validation
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DeploymentProblemsValidationTests.java
Log:
https://issues.jboss.org/browse/JBIDE-8325 - fixed
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java 2011-02-04
20:44:22 UTC (rev 29025)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java 2011-02-05
13:34:42 UTC (rev 29026)
@@ -110,9 +110,9 @@
* {@linkplain javax.enterprise.inject.Default default qualifier} is
* assumed.
*
- * @param fullQualifiedBeanType
+ * @param fullyQualifiedBeanType
* the required bean type
- * @param fullQualifiedQualifiersTypes
+ * @param fullyQualifiedQualifiersTypes
* the required qualifiers
* @param attemptToResolveAmbiguousDependency
* if there are a few beans with the given type and qualifiers
@@ -401,16 +401,16 @@
/**
* Returns the source reference to <stereotype>...</stereotype> or
<class>...<class> element of
- * <alternatives> of beans.xml by its full qualified type name. For example:
+ * <alternatives> of beans.xml by its fully qualified type name. For example:
* <alternatives>
* <stereotype>org.compony.Log</stereotype>
* <class>org.compony.Item</class>
* </alternatives>
*
* @return the source reference to <stereotype>...</stereotype> or
<class>...</class> element of
- * <alternatives> of beans.xml by its full qualified type name
+ * <alternatives> of beans.xml by its fully qualified type name
*/
- List<INodeReference> getAlternatives(String fullQualifiedTypeName);
+ List<INodeReference> getAlternatives(String fullyQualifiedTypeName);
/**
* Returns the source reference to <class>...</class> element of
@@ -426,15 +426,15 @@
/**
* Returns the source reference to <class>...</class> element of
- * <decorators> of beans.xml by its full qualified type name. For example:
+ * <decorators> of beans.xml by its fully qualified type name. For example:
* <decorators>
* <class>org.compony.Item</class>
* </decorators>
*
* @return the source reference to <class>...</class> element of
- * <decorators> of beans.xml by its full qualified type name.
+ * <decorators> of beans.xml by its fully qualified type name.
*/
- List<INodeReference> getDecoratorClasses(String fullQualifiedTypeName);
+ List<INodeReference> getDecoratorClasses(String fullyQualifiedTypeName);
/**
* Returns the source reference to <class>...</class> element of
@@ -450,15 +450,15 @@
/**
* Returns the source reference to <class>...</class> element of
- * <interceptors> of beans.xml by its full qualified type name. For example:
+ * <interceptors> of beans.xml by its fully qualified type name. For example:
* <interceptors>
* <class>org.compony.Item</class>
* </interceptors>
*
* @return the source reference to <class>...</class> element of
- * <interceptors> of beans.xml by its full qualified type name.
+ * <interceptors> of beans.xml by its fully qualified type name.
*/
- List<INodeReference> getInterceptorClasses(String fullQualifiedTypeName);
+ List<INodeReference> getInterceptorClasses(String fullyQualifiedTypeName);
/**
* Returns set of injection points with declared type exactly equal to
fullyQualifiedTypeName.
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2011-02-04
20:44:22 UTC (rev 29025)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2011-02-05
13:34:42 UTC (rev 29026)
@@ -245,6 +245,8 @@
}
}
}
+
+ collectAllRelatedInjections(currentFile, resources);
}
}
@@ -1281,6 +1283,26 @@
}
}
+ private void collectAllRelatedInjections(IFile validatingResource, Set<IPath>
relatedResources) {
+ Set<IBean> beans = cdiProject.getBeans(validatingResource.getFullPath());
+ for (IBean bean : beans) {
+ if(bean instanceof IClassBean) {
+ Set<IParametedType> types = bean.getAllTypes();
+ for (IParametedType type : types) {
+ IType superType = type.getType();
+ if(superType!=null) {
+ Set<IInjectionPoint> injections =
cdiProject.getInjections(superType.getFullyQualifiedName());
+ for (IInjectionPoint injection : injections) {
+ if(!injection.getClassBean().getBeanClass().isBinary() &&
injection.getClassBean()!=bean) {
+ relatedResources.add(injection.getResource().getFullPath());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
private void validateInjectionPoint(IInjectionPoint injection) {
/*
* 3.11. The qualifier @Named at injection points
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/ITestBean.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/ITestBean.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/ITestBean.java 2011-02-05
13:34:42 UTC (rev 29026)
@@ -0,0 +1,5 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.inject.revalidation;
+
+public interface ITestBean {
+
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/ITestBean.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/TestBeanBroken.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/TestBeanBroken.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/TestBeanBroken.java 2011-02-05
13:34:42 UTC (rev 29026)
@@ -0,0 +1,11 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.inject.revalidation;
+
+import javax.inject.Inject;
+
+public abstract class TestBeanBroken {
+
+ @Inject ITestBean foo;
+
+ public TestBeanBroken() {
+ }
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/TestBeanBroken.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/TestBeanImpl.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/TestBeanImpl.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/TestBeanImpl.java 2011-02-05
13:34:42 UTC (rev 29026)
@@ -0,0 +1,5 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.inject.revalidation;
+
+public class TestBeanImpl implements ITestBean {
+
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/TestBeanImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/TestBeanImpl2.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/TestBeanImpl2.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/TestBeanImpl2.java 2011-02-05
13:34:42 UTC (rev 29026)
@@ -0,0 +1,5 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.inject.revalidation;
+
+public class TestBeanImpl2 {
+
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/TestBeanImpl2.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/TestBeanImpl2.validation
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/TestBeanImpl2.validation
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/TestBeanImpl2.validation 2011-02-05
13:34:42 UTC (rev 29026)
@@ -0,0 +1,5 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.inject.revalidation;
+
+public class TestBeanImpl2 implements ITestBean {
+
+}
\ No newline at end of file
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/TestBeanImpl2Original.validation
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/TestBeanImpl2Original.validation
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/validation/inject/revalidation/TestBeanImpl2Original.validation 2011-02-05
13:34:42 UTC (rev 29026)
@@ -0,0 +1,5 @@
+package org.jboss.jsr299.tck.tests.jbt.validation.inject.revalidation;
+
+public class TestBeanImpl2 {
+
+}
\ No newline at end of file
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DeploymentProblemsValidationTests.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DeploymentProblemsValidationTests.java 2011-02-04
20:44:22 UTC (rev 29025)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DeploymentProblemsValidationTests.java 2011-02-05
13:34:42 UTC (rev 29026)
@@ -14,7 +14,11 @@
import java.text.MessageFormat;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.jboss.tools.cdi.internal.core.validation.CDIValidationMessages;
+import org.jboss.tools.test.util.JobUtils;
+import org.jboss.tools.test.util.ResourcesUtils;
/**
* @author Alexey Kazakov
@@ -242,4 +246,39 @@
IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/decorators/definition/broken/finalBeanMethod/TimestampLogger.java");
assertMarkerIsCreated(file,
MessageFormat.format(CDIValidationMessages.DECORATOR_RESOLVES_TO_FINAL_METHOD,
"MockLogger", "log(String string)"), 31);
}
+
+ /**
+ * See
https://issues.jboss.org/browse/JBIDE-8325
+ * @throws Exception
+ */
+ public void testInjectionPointRevalidation() throws Exception {
+ boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
+ JobUtils.waitForIdle();
+
+ IFile testInjection =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/inject/revalidation/TestBeanBroken.java");
+ assertMarkerIsNotCreated(testInjection,
CDIValidationMessages.AMBIGUOUS_INJECTION_POINTS, 7);
+ assertMarkerIsNotCreated(testInjection,
CDIValidationMessages.UNSATISFIED_INJECTION_POINTS, 7);
+
+ IFile testBean =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/inject/revalidation/TestBeanImpl2.java");
+ IFile testBeanImpl =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/inject/revalidation/TestBeanImpl2.validation");
+ testBean.setContents(testBeanImpl.getContents(), IFile.FORCE, new
NullProgressMonitor());
+ JobUtils.waitForIdle(1000);
+ tckProject.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new
NullProgressMonitor());
+ JobUtils.waitForIdle(1000);
+
+ assertMarkerIsCreated(testInjection, CDIValidationMessages.AMBIGUOUS_INJECTION_POINTS,
7);
+
+ testBeanImpl =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/inject/revalidation/TestBeanImpl2.java");
+ testBean =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/validation/inject/revalidation/TestBeanImpl2Original.validation");
+ testBeanImpl.setContents(testBean.getContents(), IFile.FORCE, new
NullProgressMonitor());
+ JobUtils.waitForIdle(1000);
+ tckProject.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, new
NullProgressMonitor());
+ JobUtils.waitForIdle(1000);
+
+ assertMarkerIsNotCreated(testInjection,
CDIValidationMessages.AMBIGUOUS_INJECTION_POINTS, 7);
+ assertMarkerIsNotCreated(testInjection,
CDIValidationMessages.UNSATISFIED_INJECTION_POINTS, 7);
+
+ ResourcesUtils.setBuildAutomatically(saveAutoBuild);
+ JobUtils.waitForIdle();
+ }
}
\ No newline at end of file