Author: akazakov
Date: 2010-12-21 07:33:34 -0500 (Tue, 21 Dec 2010)
New Revision: 27632
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/defaultconstructors/
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/defaultconstructors/AbstractProject.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/defaultconstructors/CurrentProject.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/defaultconstructors/Project.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/defaultconstructors/ProjectImpl.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/defaultconstructors/ProjectImpl2.java
Modified:
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-7967
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 2010-12-21
12:14:38 UTC (rev 27631)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-12-21
12:33:34 UTC (rev 27632)
@@ -1329,6 +1329,11 @@
*/
IType type = getTypeOfInjection(injection);
boolean instance = type!=null &&
CDIConstants.INSTANCE_TYPE_NAME.equals(type.getFullyQualifiedName());
+ for (IBean bean : beans) {
+ if(!bean.getBeanClass().isReadOnly()) {
+ getValidationContext().addLinkedCoreResource(injection.getSourcePath().toOSString(),
bean.getResource().getFullPath(), false);
+ }
+ }
if(type!=null && beans.isEmpty() && !instance) {
addError(CDIValidationMessages.UNSATISFIED_INJECTION_POINTS,
CDIPreferences.UNSATISFIED_INJECTION_POINTS, reference, injection.getResource(),
UNSATISFIED_INJECTION_POINTS_ID);
} else if(beans.size()>1 && !instance) {
@@ -1336,9 +1341,6 @@
} else if(beans.size()==1) {
IBean bean = beans.iterator().next();
if(!bean.getBeanClass().isReadOnly()) {
- if(!injection.getResource().equals(bean.getResource())) {
- getValidationContext().addLinkedCoreResource(injection.getSourcePath().toOSString(),
bean.getResource().getFullPath(), false);
- }
/*
* 5.2.4. Primitive types and null values
* - injection point of primitive type resolves to a bean that may have null
values, such as a producer method with a non-primitive return type or a producer field
with a non-primitive type
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/defaultconstructors/AbstractProject.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/defaultconstructors/AbstractProject.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/defaultconstructors/AbstractProject.java 2010-12-21
12:33:34 UTC (rev 27632)
@@ -0,0 +1,5 @@
+package org.jboss.jsr299.tck.tests.jbt.resolution.defaultconstructors;
+
+public abstract class AbstractProject implements Project {
+
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/defaultconstructors/AbstractProject.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/defaultconstructors/CurrentProject.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/defaultconstructors/CurrentProject.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/defaultconstructors/CurrentProject.java 2010-12-21
12:33:34 UTC (rev 27632)
@@ -0,0 +1,31 @@
+package org.jboss.jsr299.tck.tests.jbt.resolution.defaultconstructors;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
+@Singleton
+public class CurrentProject {
+
+ @Inject
+ Project project;
+
+ @Inject
+ ProjectImpl2 project2;
+
+ @Produces
+ @Default
+ @Dependent
+ public Project getCurrent() {
+ return null;
+ }
+
+ @Produces
+ @Default
+ @Dependent
+ public ProjectImpl2 getCurrent2() {
+ return null;
+ }
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/defaultconstructors/CurrentProject.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/defaultconstructors/Project.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/defaultconstructors/Project.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/defaultconstructors/Project.java 2010-12-21
12:33:34 UTC (rev 27632)
@@ -0,0 +1,5 @@
+package org.jboss.jsr299.tck.tests.jbt.resolution.defaultconstructors;
+
+public interface Project {
+
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/defaultconstructors/Project.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/defaultconstructors/ProjectImpl.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/defaultconstructors/ProjectImpl.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/defaultconstructors/ProjectImpl.java 2010-12-21
12:33:34 UTC (rev 27632)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.jbt.resolution.defaultconstructors;
+
+import java.io.File;
+
+public class ProjectImpl extends AbstractProject {
+
+ public ProjectImpl(final File rootDirectory) {
+ }
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/defaultconstructors/ProjectImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/defaultconstructors/ProjectImpl2.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/defaultconstructors/ProjectImpl2.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/defaultconstructors/ProjectImpl2.java 2010-12-21
12:33:34 UTC (rev 27632)
@@ -0,0 +1,12 @@
+package org.jboss.jsr299.tck.tests.jbt.resolution.defaultconstructors;
+
+import java.io.File;
+
+import javax.inject.Inject;
+
+public class ProjectImpl2 {
+
+ @Inject
+ public ProjectImpl2(final File rootDirectory) {
+ }
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/resolution/defaultconstructors/ProjectImpl2.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
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 2010-12-21
12:14:38 UTC (rev 27631)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/validation/DeploymentProblemsValidationTests.java 2010-12-21
12:33:34 UTC (rev 27632)
@@ -86,6 +86,18 @@
}
/**
+ *
https://issues.jboss.org/browse/JBIDE-7967
+ *
+ * @throws Exception
+ */
+ public void testBeansWithDefaultCounstructor() throws Exception {
+ IFile file =
tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/jbt/resolution/defaultconstructors/CurrentProject.java");
+ assertMarkerIsNotCreated(file, CDIValidationMessages.AMBIGUOUS_INJECTION_POINTS, 12);
+ assertMarkerIsNotCreated(file, CDIValidationMessages.UNSATISFIED_INJECTION_POINTS,
12);
+ assertMarkerIsCreated(file, CDIValidationMessages.AMBIGUOUS_INJECTION_POINTS, 15);
+ }
+
+ /**
* 5.2.4. Primitive types and null values
* - injection point of primitive type resolves to a bean that may have null values,
such as a producer method with a non-primitive return type or a producer field with a
non-primitive type
*