[jbosstools-commits] JBoss Tools SVN: r35862 - in trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi: internal/core/validation and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Oct 20 15:28:27 EDT 2011


Author: scabanovich
Date: 2011-10-20 15:28:27 -0400 (Thu, 20 Oct 2011)
New Revision: 35862

Added:
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IBeanKeyProvider.java
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/CDIValidationMessages.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties
Log:
JBIDE-9244
https://issues.jboss.org/browse/JBIDE-9244
Linking of files with identical default beans added. Message about invalid type restriction is modified to be consistent with different kinds of restriction.

Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IBeanKeyProvider.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IBeanKeyProvider.java	                        (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IBeanKeyProvider.java	2011-10-20 19:28:27 UTC (rev 35862)
@@ -0,0 +1,7 @@
+package org.jboss.tools.cdi.core.extension.feature;
+
+import org.jboss.tools.cdi.core.IBean;
+
+public interface IBeanKeyProvider extends ICDIFeature {
+	public String getKey(IBean bean);
+}


Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IBeanKeyProvider.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

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-10-20 19:23:53 UTC (rev 35861)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java	2011-10-20 19:28:27 UTC (rev 35862)
@@ -80,6 +80,7 @@
 import org.jboss.tools.cdi.core.IStereotype;
 import org.jboss.tools.cdi.core.IStereotypeDeclaration;
 import org.jboss.tools.cdi.core.IStereotyped;
+import org.jboss.tools.cdi.core.extension.feature.IBeanKeyProvider;
 import org.jboss.tools.cdi.core.extension.feature.IInjectionPointValidatorFeature;
 import org.jboss.tools.cdi.core.extension.feature.IValidatorFeature;
 import org.jboss.tools.cdi.core.preferences.CDIPreferences;
@@ -661,12 +662,19 @@
 		if(beans.isEmpty()) {
 			return Collections.emptySet();
 		}
+		Set<IBeanKeyProvider> ps = cdiProject.getNature().getExtensionManager().getFeatures(IBeanKeyProvider.class);
 		Set<String> result = new HashSet<String>();
 		for (IBean bean : beans) {
 			String name = bean.getName();
 			if(name!=null) {
 				result.add(name);
 			}
+			for (IBeanKeyProvider p: ps) {
+				String key = p.getKey(bean);
+				if(key != null) {
+					result.add(key);
+				}
+			}
 		}
 		return result;
 	}
@@ -2204,13 +2212,7 @@
 						}
 					}
 					if (!typeWasFound) {
-						String message = bean instanceof IClassBean
-							? CDIValidationMessages.ILLEGAL_TYPE_IN_TYPED_DECLARATION_IN_BEAN_CLASS
-							: bean instanceof IProducerField
-							? CDIValidationMessages.ILLEGAL_TYPE_IN_TYPED_DECLARATION_IN_PRODUCER_FIELD
-							: bean instanceof IProducerMethod
-							? CDIValidationMessages.ILLEGAL_TYPE_IN_TYPED_DECLARATION_IN_PRODUCER_METHOD
-							: CDIValidationMessages.ILLEGAL_TYPE_IN_TYPED_DECLARATION;
+						String message = CDIValidationMessages.ILLEGAL_TYPE_IN_TYPED_DECLARATION;
 						addError(message, CDIPreferences.ILLEGAL_TYPE_IN_TYPED_DECLARATION, typedDeclaration, bean.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	2011-10-20 19:23:53 UTC (rev 35861)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIValidationMessages.java	2011-10-20 19:28:27 UTC (rev 35862)
@@ -38,9 +38,6 @@
 	public static String UNRESOLVABLE_EL_NAME;
 
 	public static String ILLEGAL_TYPE_IN_TYPED_DECLARATION;
-	public static String ILLEGAL_TYPE_IN_TYPED_DECLARATION_IN_BEAN_CLASS;
-	public static String ILLEGAL_TYPE_IN_TYPED_DECLARATION_IN_PRODUCER_METHOD;
-	public static String ILLEGAL_TYPE_IN_TYPED_DECLARATION_IN_PRODUCER_FIELD;
 	public static String PRODUCER_METHOD_RETURN_TYPE_HAS_WILDCARD;
 	public static String PRODUCER_METHOD_RETURN_TYPE_IS_VARIABLE;
 	public static String PRODUCER_FIELD_TYPE_HAS_WILDCARD;

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	2011-10-20 19:23:53 UTC (rev 35861)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/messages.properties	2011-10-20 19:28:27 UTC (rev 35862)
@@ -16,10 +16,7 @@
 DECORATOR_RESOLVES_TO_FINAL_CLASS=Decorator must not be bound to a managed bean implemented by a class {0} which is declared final [JSR-299 §8.3]
 DECORATOR_RESOLVES_TO_FINAL_METHOD=Decorator matches a managed bean {0} with a non-static, non-private, final method {1}, and the decorator also implements that method  [JSR-299 §8.3]
 
-ILLEGAL_TYPE_IN_TYPED_DECLARATION=Bean 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 [JSR-299 §2.2.2]
-ILLEGAL_TYPE_IN_TYPED_DECLARATION_IN_BEAN_CLASS=Bean class 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 [JSR-299 §2.2.2]
-ILLEGAL_TYPE_IN_TYPED_DECLARATION_IN_PRODUCER_METHOD=Producer method 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 [JSR-299 §2.2.2]
-ILLEGAL_TYPE_IN_TYPED_DECLARATION_IN_PRODUCER_FIELD=Producer 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 [JSR-299 §2.2.2]
+ILLEGAL_TYPE_IN_TYPED_DECLARATION=Bean specifies a type restriction which does not correspond to a type in the unrestricted set of bean types of a bean [JSR-299 §2.2.2]
 PRODUCER_METHOD_RETURN_TYPE_HAS_WILDCARD=Producer method return type must not contain a wildcard type parameter [JSR-299 §3.3]
 PRODUCER_METHOD_RETURN_TYPE_IS_VARIABLE=Producer method return type cannot be a type variable [JSR-299 §3.3]
 PRODUCER_FIELD_TYPE_HAS_WILDCARD=Producer field type must not contain a wildcard type parameter [JSR-299 §3.4]



More information about the jbosstools-commits mailing list