[jbosstools-commits] JBoss Tools SVN: r22769 - trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Jun 11 08:55:35 EDT 2010


Author: scabanovich
Date: 2010-06-11 08:55:34 -0400 (Fri, 11 Jun 2010)
New Revision: 22769

Modified:
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerField.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerMethod.java
Log:
https://jira.jboss.org/browse/JBIDE-6441

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java	2010-06-11 12:36:59 UTC (rev 22768)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java	2010-06-11 12:55:34 UTC (rev 22769)
@@ -11,8 +11,10 @@
 package org.jboss.tools.cdi.internal.core.impl;
 
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import org.eclipse.core.resources.IFile;
@@ -22,6 +24,7 @@
 import org.eclipse.jdt.core.IMemberValuePair;
 import org.eclipse.jdt.core.ISourceRange;
 import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.Signature;
 import org.jboss.tools.cdi.core.CDIConstants;
 import org.jboss.tools.cdi.core.CDICoreNature;
 import org.jboss.tools.cdi.core.CDICorePlugin;
@@ -29,6 +32,7 @@
 import org.jboss.tools.cdi.core.IAnnotationDeclaration;
 import org.jboss.tools.cdi.core.IBean;
 import org.jboss.tools.cdi.core.IInjectionPoint;
+import org.jboss.tools.cdi.core.IParametedType;
 import org.jboss.tools.cdi.core.IQualifier;
 import org.jboss.tools.cdi.core.IQualifierDeclaration;
 import org.jboss.tools.cdi.core.IScopeDeclaration;
@@ -205,7 +209,11 @@
 		return result;
 	}
 
-	public Set<ITypeDeclaration> getRestrictedTypeDeclaratios() {
+	public Set<ITypeDeclaration> getRestrictedTypeDeclarations(Set<IParametedType> alltypes) {
+		Map<String, IParametedType> map = new HashMap<String, IParametedType>();
+		for (IParametedType t: alltypes) {
+			map.put(t.getType().getFullyQualifiedName(), t);
+		}
 		Set<ITypeDeclaration> result = new HashSet<ITypeDeclaration>();
 		AnnotationDeclaration typed = getDefinition().getTypedAnnotation();
 		if(typed != null) {
@@ -245,6 +253,14 @@
 									length = rawTypeName.length();
 								}
 							}
+							IParametedType other = p.getType() == null ? null : map.get(p.getType().getFullyQualifiedName());
+							if(other != null) {
+								String s1 = p.getSignature();
+								String s2 = other.getSignature();
+								if(!s1.equals(s2) && Signature.getArrayCount(s1) == Signature.getArrayCount(s2)) {
+									p.setSignature(s2);
+								}
+							}
 							result.add(new TypeDeclaration(p, offset, length));
 						}
 					}
@@ -263,6 +279,14 @@
 								length = rawTypeName.length();
 							}
 						}
+						IParametedType other = p.getType() == null ? null : map.get(p.getType().getFullyQualifiedName());
+						if(other != null) {
+							String s1 = p.getSignature();
+							String s2 = other.getSignature();
+							if(!s1.equals(s2) && Signature.getArrayCount(s1) == Signature.getArrayCount(s2)) {
+								p.setSignature(s2);
+							}
+						}
 						result.add(new TypeDeclaration(p, offset, length));
 					}
 				}

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java	2010-06-11 12:36:59 UTC (rev 22768)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java	2010-06-11 12:55:34 UTC (rev 22769)
@@ -23,6 +23,7 @@
 import org.eclipse.jdt.core.IMemberValuePair;
 import org.eclipse.jdt.core.IType;
 import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
 import org.jboss.tools.cdi.core.CDIConstants;
 import org.jboss.tools.cdi.core.CDICorePlugin;
 import org.jboss.tools.cdi.core.IAnnotationDeclaration;
@@ -259,8 +260,9 @@
 	public Set<IParametedType> getLegalTypes() {
 		Set<IParametedType> result = new HashSet<IParametedType>();
 		AnnotationDeclaration d = getDefinition().getTypedAnnotation();
+		Set<IParametedType> all = getAllTypes();
 		if(d != null) {
-			Set<ITypeDeclaration> ts = getRestrictedTypeDeclaratios();
+			Set<ITypeDeclaration> ts = getRestrictedTypeDeclarations(all);
 			result.addAll(ts);
 			ParametedType object = getObjectType(getBeanClass());
 			if(object != null) {
@@ -268,7 +270,7 @@
 			}
 			return result;
 		}
-		return getAllTypes();
+		return all;
 	}
 
 	/*
@@ -279,6 +281,10 @@
 		return getDefinition().getAllTypes();
 	}
 
+	public Set<ITypeDeclaration> getRestrictedTypeDeclaratios() {
+		return getRestrictedTypeDeclarations(getAllTypes());
+	}
+
 	public String getName() {
 		ClassBean specialized = getSpecializedBean();
 		if(specialized != null) {
@@ -468,4 +474,5 @@
 		}		
 		return false;
 	}
+
 }
\ No newline at end of file

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerField.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerField.java	2010-06-11 12:36:59 UTC (rev 22768)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerField.java	2010-06-11 12:55:34 UTC (rev 22769)
@@ -64,8 +64,9 @@
 	public Set<IParametedType> getLegalTypes() {
 		Set<IParametedType> result = new HashSet<IParametedType>();
 		AnnotationDeclaration d = getDefinition().getTypedAnnotation();
+		Set<IParametedType> all = getAllTypes();
 		if(d != null) {
-			Set<ITypeDeclaration> ts = getRestrictedTypeDeclaratios();
+			Set<ITypeDeclaration> ts = getRestrictedTypeDeclarations(all);
 			result.addAll(ts);
 			ParametedType object = getObjectType(getBeanClass());
 			if(object != null) {
@@ -73,7 +74,7 @@
 			}
 			return result;
 		}
-		return getAllTypes();
+		return all;
 	}
 
 	/*
@@ -87,6 +88,10 @@
 		return new HashSet<IParametedType>();
 	}
 
+	public Set<ITypeDeclaration> getRestrictedTypeDeclaratios() {
+		return getRestrictedTypeDeclarations(getAllTypes());
+	}
+
 	public String getName() {
 		AnnotationDeclaration named = findNamedAnnotation();
 		if(named == null) return null;

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerMethod.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerMethod.java	2010-06-11 12:36:59 UTC (rev 22768)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerMethod.java	2010-06-11 12:55:34 UTC (rev 22769)
@@ -86,8 +86,9 @@
 	public Set<IParametedType> getLegalTypes() {
 		Set<IParametedType> result = new HashSet<IParametedType>();
 		AnnotationDeclaration d = getDefinition().getTypedAnnotation();
+		Set<IParametedType> all = getAllTypes();
 		if(d != null) {
-			Set<ITypeDeclaration> ts = getRestrictedTypeDeclaratios();
+			Set<ITypeDeclaration> ts = getRestrictedTypeDeclarations(all);
 			result.addAll(ts);
 			ParametedType object = getObjectType(getBeanClass());
 			if(object != null) {
@@ -95,7 +96,7 @@
 			}
 			return result;
 		}
-		return getAllTypes();
+		return all;
 	}
 
 	/*
@@ -109,6 +110,10 @@
 		return new HashSet<IParametedType>();
 	}
 
+	public Set<ITypeDeclaration> getRestrictedTypeDeclaratios() {
+		return getRestrictedTypeDeclarations(getAllTypes());
+	}
+
 	public String getName() {
 		ProducerMethod specialized = getSpecializedBean();
 		if(specialized != null) {



More information about the jbosstools-commits mailing list