Author: akazakov
Date: 2010-12-20 12:47:56 -0500 (Mon, 20 Dec 2010)
New Revision: 27618
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
Log:
https://issues.jboss.org/browse/JBIDE-7949
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-20
16:37:38 UTC (rev 27617)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-12-20
17:47:56 UTC (rev 27618)
@@ -1328,14 +1328,17 @@
* - If an unsatisfied or unresolvable ambiguous dependency exists, the container
automatically detects the problem and treats it as a deployment problem.
*/
IType type = getTypeOfInjection(injection);
- if(type!=null && beans.isEmpty()) {
+ boolean instance = type!=null &&
CDIConstants.INSTANCE_TYPE_NAME.equals(type.getFullyQualifiedName());
+ 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) {
+ } else if(beans.size()>1 && !instance) {
addError(CDIValidationMessages.AMBIGUOUS_INJECTION_POINTS,
CDIPreferences.AMBIGUOUS_INJECTION_POINTS, reference, injection.getResource(),
AMBIGUOUS_INJECTION_POINTS_ID);
} else if(beans.size()==1) {
IBean bean = beans.iterator().next();
if(!bean.getBeanClass().isReadOnly()) {
- getValidationContext().addLinkedCoreResource(injection.getSourcePath().toOSString(),
bean.getResource().getFullPath(), false);
+ 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