[jbosstools-commits] JBoss Tools SVN: r22599 - in trunk/cdi: plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences and 6 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon Jun 7 10:05:13 EDT 2010


Author: akazakov
Date: 2010-06-07 10:05:12 -0400 (Mon, 07 Jun 2010)
New Revision: 22599

Modified:
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java
   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/preferences/CDIPreferenceInitializer.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferences.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
   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/CDIValidationMessages.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties
   trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlinkDetector.java
   trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointListHyperlink.java
   trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java
   trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.java
   trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.properties
   trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointQueryParticipant.java
   trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/QualifierDefinitionTest.java
   trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
Log:
https://jira.jboss.org/browse/JBIDE-6418

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java	2010-06-07 13:51:20 UTC (rev 22598)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java	2010-06-07 14:05:12 UTC (rev 22599)
@@ -117,9 +117,9 @@
 		Set<IBean> nonAlternativeBeans = new HashSet<IBean>();
 
 		for (IBean bean : beans) {
-			if (bean == null || bean instanceof IDecorator || bean instanceof IInterceptor) {
-				continue;
-			}
+//			if (bean == null || bean instanceof IDecorator || bean instanceof IInterceptor) {
+//				continue;
+//			}
 			if (bean.isAlternative()) {
 				alternativeBeans.add(bean);
 			} else {

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	2010-06-07 13:51:20 UTC (rev 22598)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java	2010-06-07 14:05:12 UTC (rev 22599)
@@ -37,7 +37,7 @@
 	 *            attemptToResolveAmbiguousNames==true the manager should try to
 	 *            resolve the EL name. If any of the beans are alternatives, the
 	 *            manager will eliminate all beans that are not alternatives,
-	 *            expect for producer methods and fields of beans that are
+	 *            except for producer methods and fields of beans that are
 	 *            alternatives. If the name of a bean is not resolvable then
 	 *            both beans would be included in the result list.  
 	 * @return all @Named beans
@@ -54,7 +54,7 @@
 	 *            attemptToResolveAmbiguousNames==true the manager should try to
 	 *            resolve the EL name. If any of the beans are alternatives, the
 	 *            manager will eliminate all beans that are not alternatives,
-	 *            expect for producer methods and fields of beans that are
+	 *            except for producer methods and fields of beans that are
 	 *            alternatives.
 	 * @return the matched beans
 	 */
@@ -75,7 +75,7 @@
 	 *            and attemptToResolveAmbiguousDependency==true the manager
 	 *            should try to resolve the ambiguity. If any of the beans are
 	 *            alternatives, the manager will eliminate all beans that are
-	 *            not alternatives, expect for producer methods and fields of
+	 *            not alternatives, except for producer methods and fields of
 	 *            beans that are alternatives.
 	 * 
 	 * @return the resulting set of beans
@@ -97,7 +97,7 @@
 	 *            and attemptToResolveAmbiguousDependency==true the manager
 	 *            should try to resolve the ambiguity. If any of the beans are
 	 *            alternatives, the manager will eliminate all beans that are
-	 *            not alternatives, expect for producer methods and fields of
+	 *            not alternatives, except for producer methods and fields of
 	 *            beans that are alternatives.
 	 * 
 	 * @return the resulting set of beans
@@ -119,7 +119,7 @@
 	 *            and attemptToResolveAmbiguousDependency==true the manager
 	 *            should try to resolve the ambiguity. If any of the beans are
 	 *            alternatives, the manager will eliminate all beans that are
-	 *            not alternatives, expect for producer methods and fields of
+	 *            not alternatives, except for producer methods and fields of
 	 *            beans that are alternatives.
 	 * 
 	 * @return the resulting set of beans
@@ -131,9 +131,17 @@
 	 * points.
 	 * 
 	 * @param injectionPoint
+	 * @param attemptToResolveAmbiguousDependency
+	 *            if there are a few beans which are eligible for the given injection
+	 *            and attemptToResolveAmbiguousDependency==true the manager
+	 *            should try to resolve the ambiguity. If any of the beans are
+	 *            alternatives, the manager will eliminate all beans that are
+	 *            not alternatives, except for producer methods and fields of
+	 *            beans that are alternatives.
+
 	 * @return the resulting set of beans
 	 */
-	Set<IBean> getBeans(IInjectionPoint injectionPoint);
+	Set<IBean> getBeans(boolean attemptToResolveAmbiguousDependency, IInjectionPoint injectionPoint);
 
 	/**
 	 * Returns the bean which is declared in the given IType.

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferenceInitializer.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferenceInitializer.java	2010-06-07 13:51:20 UTC (rev 22598)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferenceInitializer.java	2010-06-07 14:05:12 UTC (rev 22599)
@@ -39,5 +39,7 @@
 		defaultPreferences.put(CDIPreferences.INTERCEPTOR_ANNOTATED_SPECIALIZES, CDIPreferences.WARNING);
 		defaultPreferences.put(CDIPreferences.DECORATOR_ANNOTATED_SPECIALIZES, CDIPreferences.WARNING);
 		defaultPreferences.put(CDIPreferences.MISSING_NONBINDING_IN_QUALIFIER_TYPE_MEMBER, CDIPreferences.WARNING);
+		defaultPreferences.put(CDIPreferences.UNSATISFIED_INJECTION_POINTS, CDIPreferences.WARNING);
+		defaultPreferences.put(CDIPreferences.AMBIGUOUS_INJECTION_POINTS, CDIPreferences.WARNING);
 	}
 }
\ No newline at end of file

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferences.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferences.java	2010-06-07 13:51:20 UTC (rev 22598)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/preferences/CDIPreferences.java	2010-06-07 14:05:12 UTC (rev 22599)
@@ -46,6 +46,11 @@
 
 	//Type group
 
+//	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.
+	public static final String UNSATISFIED_INJECTION_POINTS = INSTANCE.createSeverityOption("unsatisfiedInjectionPoints"); //$NON-NLS-1$
+	public static final String AMBIGUOUS_INJECTION_POINTS = INSTANCE.createSeverityOption("ambiguousInjectionPoints"); //$NON-NLS-1$
 //	- bean class or producer method or field specifies a @Typed annotation, 
 //	  and the value member specifies a class which does not correspond to a type 
 //	  in the unrestricted set of bean types of a bean (2.2.2)

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java	2010-06-07 13:51:20 UTC (rev 22598)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java	2010-06-07 14:05:12 UTC (rev 22599)
@@ -241,21 +241,25 @@
 		return getResolvedBeans(result, attemptToResolveAmbiguousDependency);
 	}
 
-	public Set<IBean> getBeans(IInjectionPoint injectionPoints) {
+	/*
+	 * (non-Javadoc)
+	 * @see org.jboss.tools.cdi.core.IBeanManager#getBeans(boolean, org.jboss.tools.cdi.core.IInjectionPoint)
+	 */
+	public Set<IBean> getBeans(boolean attemptToResolveAmbiguousDependency, IInjectionPoint injectionPoint) {
 		Set<IBean> result = new HashSet<IBean>();
-		IParametedType type = injectionPoints.getType();
+		IParametedType type = injectionPoint.getType();
 		if(type == null) {
 			return result;
 		}
 		
-		boolean isParameter = injectionPoints instanceof InjectionPointParameter;
+		boolean isParameter = injectionPoint instanceof InjectionPointParameter;
 		boolean isNew = false;
 
-		Set<IQualifierDeclaration> qs = injectionPoints.getQualifierDeclarations();
+		Set<IQualifierDeclaration> qs = injectionPoint.getQualifierDeclarations();
 		List<IType> qs2 = null;
 		if(isParameter) {
 			qs2 = new ArrayList<IType>();
-			Set<IQualifier> qs_ = ((InjectionPointParameter)injectionPoints).getQualifiers();
+			Set<IQualifier> qs_ = ((InjectionPointParameter)injectionPoint).getQualifiers();
 			for (IQualifier q: qs_) {
 				IType t = q.getSourceType();
 				if(t != null) {
@@ -279,6 +283,8 @@
 		synchronized(allBeans) {
 			beans.addAll(allBeans);
 		}
+		boolean delegateInjectionPoint = injectionPoint.isDelegate();
+
 		for (IBean b: beans) {
 			if(isNew) {
 				//TODO improve
@@ -291,6 +297,9 @@
 			Set<IParametedType> types = b.getLegalTypes();
 			if(containsType(types, type)) {
 				try {
+					if(delegateInjectionPoint && b == injectionPoint.getClassBean()) {
+						continue;
+					}
 					Set<IQualifierDeclaration> qsb = b.getQualifierDeclarations(true);
 					if(isParameter) {
 						if(areMatchingQualifiers(qsb, qs2.toArray(new IType[0]))) {
@@ -307,7 +316,7 @@
 			}
 		}
 
-		return result;
+		return getResolvedBeans(result, attemptToResolveAmbiguousDependency);
 	}
 
 	public static boolean containsType(Set<IParametedType> types, IParametedType type) {

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-06-07 13:51:20 UTC (rev 22598)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java	2010-06-07 14:05:12 UTC (rev 22599)
@@ -953,14 +953,29 @@
 				addError(CDIValidationMessages.STATIC_METHOD_ANNOTATED_INJECT, CDIPreferences.GENERIC_METHOD_ANNOTATED_INJECT, declaration, injection.getResource());
 			}
 		}
+
+		IAnnotationDeclaration declaration = injection.getInjectAnnotation();
+
 		/*
 		 * 5.2.2. Legal injection point types
 		 *  - injection point type is a type variable
 		 */
 		if(!(injection instanceof IInjectionPointMethod) && CDIUtil.isTypeVariable(injection, false)) {
-			IAnnotationDeclaration declaration = injection.getInjectAnnotation();
 			addError(CDIValidationMessages.INJECTION_TYPE_IS_VARIABLE, CDIPreferences.INJECTION_TYPE_IS_VARIABLE, declaration, injection.getResource());
 		}
+
+		/*
+		 * 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(declaration!=null && !(injection instanceof IInjectionPointParameter)) {
+			Set<IBean> beans = cdiProject.getBeans(true, injection);
+			if(beans.isEmpty()) {
+				addError(CDIValidationMessages.UNSATISFIED_INJECTION_POINTS, CDIPreferences.UNSATISFIED_INJECTION_POINTS, declaration, injection.getResource());
+			} else if(beans.size()>1) {
+				addError(CDIValidationMessages.AMBIGUOUS_INJECTION_POINTS, CDIPreferences.AMBIGUOUS_INJECTION_POINTS, declaration, injection.getResource());
+			}
+		}
 	}
 
 	/**

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java	2010-06-07 13:51:20 UTC (rev 22598)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java	2010-06-07 14:05:12 UTC (rev 22599)
@@ -27,6 +27,8 @@
 	public static String INTERCEPTOR_HAS_NAME;
 	public static String DECORATOR_HAS_NAME;
 
+	public static String UNSATISFIED_INJECTION_POINTS;
+	public static String AMBIGUOUS_INJECTION_POINTS;
 	public static String ILLEGAL_TYPE_IN_TYPED_DECLARATION;
 	public static String PRODUCER_METHOD_RETURN_TYPE_HAS_WILDCARD;
 	public static String PRODUCER_METHOD_RETURN_TYPE_IS_VARIABLE;

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt	2010-06-07 13:51:20 UTC (rev 22598)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/errorList.txt	2010-06-07 14:05:12 UTC (rev 22599)
@@ -130,8 +130,12 @@
 
 
 
+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.
 
 
+
 5.5.7. Injection point metadata
 - bean that declares any scope other than @Dependent has an injection point of type 
   InjectionPoint and qualifier @Default

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties	2010-06-07 13:51:20 UTC (rev 22598)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties	2010-06-07 14:05:12 UTC (rev 22599)
@@ -6,6 +6,8 @@
 INTERCEPTOR_HAS_NAME=Interceptor has a name
 DECORATOR_HAS_NAME=Decorator has a name
 
+UNSATISFIED_INJECTION_POINTS=No bean is eligible for injection to the injection point
+AMBIGUOUS_INJECTION_POINTS=Multiple beans are eligible for injection to the injection point
 ILLEGAL_TYPE_IN_TYPED_DECLARATION=Bean class or producer method or field specifies a @Typed annotation, and the value member specifies a class which does not correspond to a type in the unrestricted set of bean types of a bean
 PRODUCER_METHOD_RETURN_TYPE_HAS_WILDCARD=Producer method return type contains a wildcard type parameter
 PRODUCER_METHOD_RETURN_TYPE_IS_VARIABLE=Producer method return type is a type variable

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlinkDetector.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlinkDetector.java	2010-06-07 13:51:20 UTC (rev 22598)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointHyperlinkDetector.java	2010-06-07 14:05:12 UTC (rev 22599)
@@ -127,7 +127,7 @@
 			return false;
 		}
 		
-		Set<IBean> resultBeanSet = cdiProject.getBeans(injectionPoint);
+		Set<IBean> resultBeanSet = cdiProject.getBeans(false, injectionPoint);
 		if(resultBeanSet.size() > 0)
 			return true;
 		

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointListHyperlink.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointListHyperlink.java	2010-06-07 13:51:20 UTC (rev 22598)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/InjectedPointListHyperlink.java	2010-06-07 14:05:12 UTC (rev 22599)
@@ -78,7 +78,7 @@
 			return;
 		}
 		
-		Set<IBean> resultBeanSet = cdiProject.getBeans(injectionPoint);
+		Set<IBean> resultBeanSet = cdiProject.getBeans(false, injectionPoint);
 		List<IBean> resultBeanList = CDIUtil.sortBeans(resultBeanSet);
 			
 		IHyperlink[] hyperlinks = new IHyperlink[resultBeanList.size()];

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java	2010-06-07 13:51:20 UTC (rev 22598)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java	2010-06-07 14:05:12 UTC (rev 22599)
@@ -42,6 +42,8 @@
 	private static SectionDescription SECTION_TYPE = new SectionDescription(
 		CDIPreferencesMessages.CDIValidatorConfigurationBlock_section_type,
 		new String[][]{
+			{CDIPreferences.UNSATISFIED_INJECTION_POINTS, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_unsatisfiedInjectionPoints_label},
+			{CDIPreferences.AMBIGUOUS_INJECTION_POINTS, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_ambiguousInjectionPoints_label},
 			{CDIPreferences.ILLEGAL_TYPE_IN_TYPED_DECLARATION, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalTypeInTypedDeclaration_label},
 			{CDIPreferences.PRODUCER_METHOD_RETURN_TYPE_HAS_WILDCARD, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_producerMethodReturnTypeHasWildcard_label},
 			{CDIPreferences.PRODUCER_METHOD_RETURN_TYPE_IS_VARIABLE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_producerMethodReturnTypeIsVariable_label},

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.java	2010-06-07 13:51:20 UTC (rev 22598)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.java	2010-06-07 14:05:12 UTC (rev 22599)
@@ -42,6 +42,8 @@
 
 	// Section Type
 	public static String CDIValidatorConfigurationBlock_section_type;
+	public static String CDIValidatorConfigurationBlock_pb_unsatisfiedInjectionPoints_label;
+	public static String CDIValidatorConfigurationBlock_pb_ambiguousInjectionPoints_label;
 	public static String CDIValidatorConfigurationBlock_pb_illegalTypeInTypedDeclaration_label;
 	public static String CDIValidatorConfigurationBlock_pb_producerMethodReturnTypeHasWildcard_label;
 	public static String CDIValidatorConfigurationBlock_pb_producerMethodReturnTypeIsVariable_label;

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.properties	2010-06-07 13:51:20 UTC (rev 22598)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.properties	2010-06-07 14:05:12 UTC (rev 22599)
@@ -31,6 +31,8 @@
 
 ##Section Type
 CDIValidatorConfigurationBlock_section_type=Type
+CDIValidatorConfigurationBlock_pb_unsatisfiedInjectionPoints_label=Unsatisfied dependencies for injection point:
+CDIValidatorConfigurationBlock_pb_ambiguousInjectionPoints_label=Ambiguous dependencies for injection point:
 CDIValidatorConfigurationBlock_pb_illegalTypeInTypedDeclaration_label=Illegal type in @Typed:
 CDIValidatorConfigurationBlock_pb_producerMethodReturnTypeHasWildcard_label=Wildcard in producer method return type:
 CDIValidatorConfigurationBlock_pb_producerMethodReturnTypeIsVariable_label=Variable in producer method return type:

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointQueryParticipant.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointQueryParticipant.java	2010-06-07 13:51:20 UTC (rev 22598)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/InjectionPointQueryParticipant.java	2010-06-07 14:05:12 UTC (rev 22599)
@@ -82,7 +82,7 @@
 						return;
 					IInjectionPoint injectionPoint = CDIUtil.findInjectionPoint(beans, element, 0);
 					if(injectionPoint != null){
-						Set<IBean> resultBeanSet = cdiProject.getBeans(injectionPoint);
+						Set<IBean> resultBeanSet = cdiProject.getBeans(false, injectionPoint);
 						List<IBean> resultBeanList = CDIUtil.sortBeans(resultBeanSet);
 						for(IBean bean : resultBeanList){
 							if(bean != null){

Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/QualifierDefinitionTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/QualifierDefinitionTest.java	2010-06-07 13:51:20 UTC (rev 22598)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/QualifierDefinitionTest.java	2010-06-07 14:05:12 UTC (rev 22599)
@@ -126,7 +126,7 @@
 		assertEquals("Wrong number of qualifier declarations.", 1, declarations.size());
 		assertLocationEquals(declarations, 914, 5);
 
-		Set<IBean> injectedBeans = cdiProject.getBeans(point);
+		Set<IBean> injectedBeans = cdiProject.getBeans(true, point);
 		assertEquals("Wrong number of beans.", 1, injectedBeans.size());
 		IBean injectedBean = injectedBeans.iterator().next();
 		IType beanClass = injectedBean.getBeanClass();

Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java	2010-06-07 13:51:20 UTC (rev 22598)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java	2010-06-07 14:05:12 UTC (rev 22599)
@@ -919,6 +919,18 @@
 	}
 
 	/**
+	 * 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.
+	 * 
+	 * @throws Exception
+	 */
+	public void testAmbiguousDependency() throws Exception {
+		IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/decorators/definition/inject/delegateField/TimestampLogger.java");
+		AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.AMBIGUOUS_INJECTION_POINTS, 34);
+		AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.UNSATISFIED_INJECTION_POINTS, 34);
+	}
+
+	/**
 	 * 10.4.2. Declaring an observer method
 	 *  - method has more than one parameter annotated @Observes
 	 *  



More information about the jbosstools-commits mailing list