Author: akazakov
Date: 2010-08-31 11:22:49 -0400 (Tue, 31 Aug 2010)
New Revision: 24578
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
Log:
https://jira.jboss.org/browse/JBIDE-6950 Improved CDI injection point incremental
validation.
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-08-31
15:12:05 UTC (rev 24577)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-08-31
15:22:49 UTC (rev 24578)
@@ -434,6 +434,10 @@
Set<IInjectionPoint> points = bean.getInjectionPoints();
for (IInjectionPoint point : points) {
+ IType type = getTypeOfInjection(point);
+ if(type!=null && !type.isBinary()) {
+ getValidationContext().addLinkedCoreResource(beanPath, type.getPath(), false);
+ }
validateInjectionPoint(point);
}
@@ -459,6 +463,11 @@
validateSpecializingBean(bean);
}
+ private IType getTypeOfInjection(IInjectionPoint injection) {
+ IParametedType parametedType = injection.getType();
+ return parametedType==null?null:parametedType.getType();
+ }
+
private void addLinkedStereotypes(String beanPath, IStereotyped stereotyped) {
Set<IStereotypeDeclaration> stereotypeDeclarations =
stereotyped.getStereotypeDeclarations();
for (IStereotypeDeclaration stereotypeDeclaration : stereotypeDeclarations) {
@@ -1192,7 +1201,8 @@
* 5.2.1. Unsatisfied and ambiguous dependencies
* - If an unsatisfied or unresolvable ambiguous dependency exists, the container
automatically detects the problem and treats it as a deployment problem.
*/
- if(beans.isEmpty()) {
+ IType type = getTypeOfInjection(injection);
+ if(type!=null && beans.isEmpty()) {
addError(CDIValidationMessages.UNSATISFIED_INJECTION_POINTS,
CDIPreferences.UNSATISFIED_INJECTION_POINTS, reference, injection.getResource());
} else if(beans.size()>1) {
addError(CDIValidationMessages.AMBIGUOUS_INJECTION_POINTS,
CDIPreferences.AMBIGUOUS_INJECTION_POINTS, reference, injection.getResource());
@@ -1220,7 +1230,6 @@
* 5.5.7. Injection point metadata
* - bean that declares any scope other than @Dependent has an injection point of
type InjectionPoint and qualifier @Default
*/
- IType type = injection.getType() == null ? null : injection.getType().getType();
if(type!=null &&
CDIConstants.INJECTIONPOINT_TYPE_NAME.equals(type.getFullyQualifiedName())) {
IScope beanScope = injection.getClassBean().getScope();
if(injection.hasDefaultQualifier() && beanScope!=null &&
!CDIConstants.DEPENDENT_ANNOTATION_TYPE_NAME.equals(beanScope.getSourceType().getFullyQualifiedName()))
{