Author: scabanovich
Date: 2010-02-05 07:08:54 -0500 (Fri, 05 Feb 2010)
New Revision: 20137
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/ParametedType.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
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5799
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-02-05
05:34:25 UTC (rev 20136)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java 2010-02-05
12:08:54 UTC (rev 20137)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.internal.core.impl;
+
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -17,7 +18,6 @@
import java.util.Map;
import java.util.Set;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.IMemberValuePair;
import org.eclipse.jdt.core.IType;
@@ -242,27 +242,7 @@
* @see org.jboss.tools.cdi.core.IBean#getAllTypes()
*/
public Set<IParametedType> getAllTypes() {
- Set<IParametedType> result = new HashSet<IParametedType>();
- IType type = getDefinition().getType();
- if(type != null) {
- ParametedType p = new ParametedType();
- p.setType(type);
- String[] ps = null;
- try {
- ps = type.getTypeParameterSignatures();
- p.setSignature("Q" + type.getFullyQualifiedName() + ',');
- } catch (CoreException e) {
- CDICorePlugin.getDefault().logError(e);
- //TODO
- }
- if(ps == null || ps.length == 0) {
- //type with parameters is not legal
- result.add(p);
- }
- }
- Set<IParametedType> inh = getDefinition().getAllInheritedTypes();
- if(inh != null) result.addAll(inh);
- return result;
+ return getDefinition().getAllTypes();
}
public String getName() {
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ParametedType.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ParametedType.java 2010-02-05
05:34:25 UTC (rev 20136)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ParametedType.java 2010-02-05
12:08:54 UTC (rev 20137)
@@ -36,7 +36,9 @@
boolean inheritanceIsBuilt = false;
protected ParametedType superType = null;
protected Set<IParametedType> inheritedTypes = new
HashSet<IParametedType>();
+ Set<IParametedType> allInheritedTypes = null;
+
public ParametedType() {}
public IType getType() {
@@ -165,4 +167,25 @@
return null;
}
+ public Set<IParametedType> getAllTypes() {
+ if(allInheritedTypes == null) {
+ allInheritedTypes = new HashSet<IParametedType>();
+ Set<String> processed = new HashSet<String>();
+ buildAllTypes(processed, this);
+ }
+ return allInheritedTypes;
+ }
+
+ void buildAllTypes(Set<String> processed, ParametedType p) {
+ IType t = p.getType();
+ if(t == null) return;
+ if(processed.contains(t.getFullyQualifiedName())) return;
+ processed.add(t.getFullyQualifiedName());
+ allInheritedTypes.add(p);
+ Set<IParametedType> ts = p.getInheritedTypes();
+ if(ts != null) for (IParametedType pp: ts) {
+ buildAllTypes(processed, (ParametedType)pp);
+ }
+ }
+
}
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-02-05
05:34:25 UTC (rev 20136)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerField.java 2010-02-05
12:08:54 UTC (rev 20137)
@@ -77,19 +77,10 @@
* @see org.jboss.tools.cdi.core.IBean#getAllTypes()
*/
public Set<IParametedType> getAllTypes() {
- Set<IParametedType> result = new HashSet<IParametedType>();
if(typeDeclaration != null) {
- IType type = typeDeclaration.getType();
- if(type != null) {
- ParametedType p = new ParametedType();
- p.setType(type);
- p.setSignature("Q" + type.getFullyQualifiedName() + ',');
- result.add(p);
- }
- Set<IParametedType> inh = typeDeclaration.getInheritedTypes();
- if(inh != null) result.addAll(inh);
+ return typeDeclaration.getAllTypes();
}
- return result;
+ return new HashSet<IParametedType>();
}
public String getName() {
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-02-05
05:34:25 UTC (rev 20136)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerMethod.java 2010-02-05
12:08:54 UTC (rev 20137)
@@ -86,28 +86,10 @@
* @see org.jboss.tools.cdi.core.IBean#getAllTypes()
*/
public Set<IParametedType> getAllTypes() {
- Set<IParametedType> result = new HashSet<IParametedType>();
if(typeDeclaration != null) {
- IType type = typeDeclaration.getType();
- if(type != null) {
- ParametedType p = new ParametedType();
- p.setType(type);
-// String[] ps = null;
-// try {
-// ps = type.getTypeParameterSignatures();
- p.setSignature("Q" + type.getFullyQualifiedName() + ',');
-// } catch (CoreException e) {
-// CDICorePlugin.getDefault().logError(e);
-// }
-// if(ps == null || ps.length == 0) {
-// //type with parameters is not legal
- result.add(p);
-// }
- }
- Set<IParametedType> inh = typeDeclaration.getInheritedTypes();
- if(inh != null) result.addAll(inh);
+ return typeDeclaration.getAllTypes();
}
- return result;
+ return new HashSet<IParametedType>();
}
public String getName() {
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java 2010-02-05
05:34:25 UTC (rev 20136)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractTypeDefinition.java 2010-02-05
12:08:54 UTC (rev 20137)
@@ -30,8 +30,6 @@
protected IType type;
protected ParametedType parametedType = null;
- Set<IParametedType> allInheritedTypes = null;
-
protected String content = null;
public AbstractTypeDefinition() {}
@@ -62,29 +60,12 @@
parametedType.setSignature("Q" + qualifiedName + ";");
}
- void buildAllInheritedTypes(Set<String> processed, ParametedType p) {
- IType t = p.getType();
- if(t == null) return;
- if(processed.contains(t.getFullyQualifiedName())) return;
- processed.add(t.getFullyQualifiedName());
- allInheritedTypes = new HashSet<IParametedType>();
- allInheritedTypes.add(p);
- Set<IParametedType> ts = p.getInheritedTypes();
- if(ts != null) for (IParametedType pp: ts) {
- buildAllInheritedTypes(processed, (ParametedType)pp);
- }
- }
-
public Set<IParametedType> getInheritedTypes() {
return parametedType == null ? new HashSet<IParametedType>() :
parametedType.getInheritedTypes();
}
- public Set<IParametedType> getAllInheritedTypes() {
- if(allInheritedTypes == null) {
- Set<String> processed = new HashSet<String>();
- buildAllInheritedTypes(processed, parametedType);
- }
- return allInheritedTypes;
+ public Set<IParametedType> getAllTypes() {
+ return parametedType == null ? new HashSet<IParametedType>() :
parametedType.getAllTypes();
}
public String getContent() {