Author: scabanovich
Date: 2010-04-07 11:11:25 -0400 (Wed, 07 Apr 2010)
New Revision: 21312
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6157
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-04-07
15:10:36 UTC (rev 21311)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java 2010-04-07
15:11:25 UTC (rev 21312)
@@ -59,7 +59,7 @@
protected AnnotationDeclaration findNamedAnnotation() {
AnnotationDeclaration named = getDefinition().getNamedAnnotation();
if(named != null) return named;
- Set<IStereotypeDeclaration> ds = getStereotypeDeclarations();
+ Set<IStereotypeDeclaration> ds = getStereotypeDeclarations(true);
for (IStereotypeDeclaration d: ds) {
StereotypeElement s = (StereotypeElement)d.getStereotype();
if(s == null) continue;
@@ -79,6 +79,10 @@
}
public Set<IStereotypeDeclaration> getStereotypeDeclarations() {
+ return getStereotypeDeclarations(false);
+ }
+
+ public Set<IStereotypeDeclaration> getStereotypeDeclarations(boolean
includeInherited) {
Set<IStereotypeDeclaration> result = new
HashSet<IStereotypeDeclaration>();
for (AnnotationDeclaration d: definition.getAnnotations()) {
if(d instanceof IStereotypeDeclaration) {
@@ -87,6 +91,27 @@
}
}
}
+ if(includeInherited) {
+ Set<IStereotypeDeclaration> delta1 = result;
+ Set<IStereotypeDeclaration> delta2 = new
HashSet<IStereotypeDeclaration>();
+ while(!delta1.isEmpty()) {
+ for (IStereotypeDeclaration d: delta1) {
+ IStereotype s = d.getStereotype();
+ if(s == null) continue;
+ Set<IStereotypeDeclaration> ds = s.getStereotypeDeclarations();
+ for (IStereotypeDeclaration d1: ds) {
+ IStereotype s1 = d1.getStereotype();
+ if(s1 != null && s1.getInheritedDeclaration() != null) {
+ if(!result.contains(d1) && !delta2.contains(d1)) delta2.add(d1);
+ }
+ }
+ }
+ if(delta2.isEmpty()) break;
+ result.addAll(delta2);
+ delta1 = delta2;
+ delta2 = new HashSet<IStereotypeDeclaration>();
+ }
+ }
return result;
}