Author: scabanovich
Date: 2012-08-15 20:09:09 -0400 (Wed, 15 Aug 2012)
New Revision: 43051
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/IBean.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/ICDIAnnotation.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IClassBean.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IDecorator.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInjectionPoint.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInterceptorBinded.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IObserverMethod.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IParameter.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScoped.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IStereotyped.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el/CdiElResolver.java
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/BeanMethod.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIAnnotationElement.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/impl/CDIProjectAsYouType.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/DecoratorBean.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/EventBean.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBindingElement.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/NewBean.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ObserverMethod.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/Parameter.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/StereotypeElement.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/MethodDefinition.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIMarkerResolutionUtils.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIRefactoringProcessor.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/DeleteAllDisposerAnnotationsProcessor.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/DeleteAllInjectedConstructorsProcessor.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/AnnotationValidationDelegate.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
Log:
JBIDE-12417
https://issues.jboss.org/browse/JBIDE-12417
Replaced Set by Collection in interfaces.
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 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDIUtil.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -245,7 +245,7 @@
*
* @param beans
*/
- public static List<IBean> sortBeans(Set<IBean> beans) {
+ public static List<IBean> sortBeans(Collection<IBean> beans) {
Set<IBean> alternativeBeans = new HashSet<IBean>();
Set<IBean> selectedAlternativeBeans = new HashSet<IBean>();
Set<IBean> nonAlternativeBeans = new HashSet<IBean>();
@@ -577,8 +577,7 @@
public static Set<IType> getLocalInterfaces(ISessionBean bean) {
Set<IType> sourceTypes = new HashSet<IType>();
try {
- Set<IParametedType> types = bean.getLegalTypes();
- for (IParametedType type : types) {
+ for (IParametedType type : bean.getLegalTypes()) {
IType sourceType = type.getType();
if (sourceType == null) {
continue;
@@ -657,8 +656,7 @@
if (Flags.isStatic(method.getMethod().getFlags())) {
return null;
}
- Set<IParametedType> types = bean.getLegalTypes();
- for (IParametedType type : types) {
+ for (IParametedType type : bean.getLegalTypes()) {
IType sourceType = type.getType();
if (sourceType == null || sourceType.isInterface()) {
continue;
@@ -724,7 +722,7 @@
* @return
*/
public static Set<IInjectionPointParameter> getInjectionPointParameters(IClassBean
bean) {
- Set<IInjectionPoint> points = bean.getInjectionPoints();
+ Collection<IInjectionPoint> points = bean.getInjectionPoints();
Set<IInjectionPointParameter> params = new
HashSet<IInjectionPointParameter>();
for (IInjectionPoint injection : points) {
if(injection instanceof IInjectionPointParameter) {
@@ -985,7 +983,7 @@
* @return
*/
public static boolean containsDefaultQualifier(IInjectionPoint point) {
- Set<IQualifierDeclaration> declarations = point.getQualifierDeclarations();
+ Collection<IQualifierDeclaration> declarations =
point.getQualifierDeclarations();
if(declarations.isEmpty()) {
return true;
}
@@ -1010,8 +1008,7 @@
}
boolean resolved = cdiNature.isStorageResolved();
if(resolved) {
- Set<CDICoreNature> ps = cdiNature.getCDIProjects(true);
- for (CDICoreNature p: ps) {
+ for (CDICoreNature p: cdiNature.getCDIProjects(true)) {
if(!p.isStorageResolved()) {
resolved = false;
break;
@@ -1057,10 +1054,9 @@
return cdiNature;
}
- public static Set<IInterceptorBinding>
getAllInterceptorBindings(IInterceptorBinded binded) {
- Set<IInterceptorBindingDeclaration> ds =
collectAdditionalInterceptorBindingDeclaratios(binded, new
HashSet<IInterceptorBindingDeclaration>());
- Set<IInterceptorBinding> result = new HashSet<IInterceptorBinding>();
- for (IInterceptorBindingDeclaration d: ds) {
+ public static Collection<IInterceptorBinding>
getAllInterceptorBindings(IInterceptorBinded binded) {
+ Collection<IInterceptorBinding> result = new
ArrayList<IInterceptorBinding>();
+ for (IInterceptorBindingDeclaration d:
collectAdditionalInterceptorBindingDeclaratios(binded, new
HashSet<IInterceptorBindingDeclaration>())) {
IInterceptorBinding b = d.getInterceptorBinding();
if(b != null) result.add(b);
}
@@ -1073,13 +1069,12 @@
*
* @return
*/
- public static Set<IInterceptorBindingDeclaration>
getAllInterceptorBindingDeclaratios(IInterceptorBinded binded) {
+ public static Collection<IInterceptorBindingDeclaration>
getAllInterceptorBindingDeclaratios(IInterceptorBinded binded) {
return collectAdditionalInterceptorBindingDeclaratios(binded, new
HashSet<IInterceptorBindingDeclaration>());
}
- private static Set<IInterceptorBindingDeclaration>
collectAdditionalInterceptorBindingDeclaratios(IInterceptorBinded binded,
Set<IInterceptorBindingDeclaration> result) {
- Set<IInterceptorBindingDeclaration> declarations =
binded.getInterceptorBindingDeclarations(true);
- for (IInterceptorBindingDeclaration declaration : declarations) {
+ private static Collection<IInterceptorBindingDeclaration>
collectAdditionalInterceptorBindingDeclaratios(IInterceptorBinded binded,
Set<IInterceptorBindingDeclaration> result) {
+ for (IInterceptorBindingDeclaration declaration :
binded.getInterceptorBindingDeclarations(true)) {
if(!result.contains(declaration)) {
result.add(declaration);
IInterceptorBinding binding = declaration.getInterceptorBinding();
@@ -1107,8 +1102,7 @@
}
private static Set<IStereotypeDeclaration>
collectInheritedStereotypDeclarations(IStereotyped stereotyped,
Set<IStereotypeDeclaration> result) {
- Set<IStereotypeDeclaration> declarations =
stereotyped.getStereotypeDeclarations();
- for (IStereotypeDeclaration declaration : declarations) {
+ for (IStereotypeDeclaration declaration : stereotyped.getStereotypeDeclarations()) {
if(!result.contains(declaration)) {
result.add(declaration);
collectInheritedStereotypDeclarations(declaration.getStereotype(), result);
@@ -1199,12 +1193,11 @@
* @param injectionPoint
* @return
*/
- public static Set<IBean> getFilteredBeans(ICDIProject cdiProject, boolean
attemptToResolveAmbiguousDependency, IInjectionPoint injectionPoint){
- Set<IBean> beans = cdiProject.getBeans(attemptToResolveAmbiguousDependency,
injectionPoint);
+ public static Collection<IBean> getFilteredBeans(ICDIProject cdiProject, boolean
attemptToResolveAmbiguousDependency, IInjectionPoint injectionPoint){
HashSet<IJavaElement> elements = new HashSet<IJavaElement>();
- HashSet<IBean> result = new HashSet<IBean>();
+ Collection<IBean> result = new ArrayList<IBean>();
- for(IBean bean : beans){
+ for(IBean bean : cdiProject.getBeans(attemptToResolveAmbiguousDependency,
injectionPoint)){
IJavaElement element = getJavaElement(bean);
if(!elements.contains(element)){
elements.add(element);
@@ -1221,12 +1214,11 @@
* @param path
* @return
*/
- public static Set<IBean> getFilteredBeans(ICDIProject cdiProject, IPath path){
- Set<IBean> beans = cdiProject.getBeans(path);
+ public static Collection<IBean> getFilteredBeans(ICDIProject cdiProject, IPath
path){
HashSet<IJavaElement> elements = new HashSet<IJavaElement>();
- HashSet<IBean> result = new HashSet<IBean>();
+ Collection<IBean> result = new ArrayList<IBean>();
- for(IBean bean : beans){
+ for(IBean bean : cdiProject.getBeans(path)){
IJavaElement element = getJavaElement(bean);
if(!elements.contains(element)){
elements.add(element);
@@ -1238,12 +1230,12 @@
}
public static List<IBean> getSortedBeans(ICDIProject cdiProject, boolean
attemptToResolveAmbiguousDependency, IInjectionPoint injectionPoint){
- Set<IBean> beans = getFilteredBeans(cdiProject,
attemptToResolveAmbiguousDependency, injectionPoint);
+ Collection<IBean> beans = getFilteredBeans(cdiProject,
attemptToResolveAmbiguousDependency, injectionPoint);
return sortBeans(beans);
}
public static List<IBean> getSortedBeans(ICDIProject cdiProject, IPath path){
- Set<IBean> beans = getFilteredBeans(cdiProject, path);
+ Collection<IBean> beans = getFilteredBeans(cdiProject, path);
return sortBeans(beans);
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBean.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBean.java 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBean.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.core;
+import java.util.Collection;
import java.util.Set;
import org.eclipse.jdt.core.IType;
@@ -59,7 +60,7 @@
*
* @return the legal types
*/
- Set<IParametedType> getLegalTypes();
+ Collection<IParametedType> getLegalTypes();
/**
* Obtains all the types of the bean class or producer method or
@@ -67,7 +68,7 @@
*
* @return the legal types
*/
- Set<IParametedType> getAllTypes();
+ Collection<IParametedType> getAllTypes();
/**
* Obtains all the type declarations of the bean class or producer method or
@@ -75,7 +76,7 @@
*
* @return the type declarations
*/
- Set<ITypeDeclaration> getAllTypeDeclarations();
+ Collection<ITypeDeclaration> getAllTypeDeclarations();
/**
* Obtains the type declarations of the bean class or producer method or
@@ -84,7 +85,7 @@
*
* @return the type declarations
*/
- Set<ITypeDeclaration> getRestrictedTypeDeclaratios();
+ Collection<ITypeDeclaration> getRestrictedTypeDeclaratios();
/**
* Obtains the qualifier declarations of the bean class or producer method or field.
@@ -92,7 +93,7 @@
*
* @return the qualifiers
*/
- Set<IQualifierDeclaration> getQualifierDeclarations();
+ Collection<IQualifierDeclaration> getQualifierDeclarations();
/**
* Obtains the qualifier declarations of the bean class or producer method
@@ -101,7 +102,7 @@
* @param includeInherited if "true" then the result includes declarations of
inherited qualifiers.
* @return the qualifiers
*/
- Set<IQualifierDeclaration> getQualifierDeclarations(boolean includeInherited);
+ Collection<IQualifierDeclaration> getQualifierDeclarations(boolean
includeInherited);
/**
* Obtains the qualifiers of the bean class or producer method or field.
@@ -110,7 +111,7 @@
*
* @return the qualifiers
*/
- Set<IQualifier> getQualifiers();
+ Collection<IQualifier> getQualifiers();
/**
* Determines if the bean is an alternative.
@@ -141,7 +142,7 @@
*
* @return the set of injection points of the bean
*/
- Set<IInjectionPoint> getInjectionPoints();
+ Collection<IInjectionPoint> getInjectionPoints();
/**
* Returns the bean which is specialized by this bean. May return null.
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 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -10,8 +10,8 @@
******************************************************************************/
package org.jboss.tools.cdi.core;
+import java.util.Collection;
import java.util.List;
-import java.util.Set;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IJavaElement;
@@ -44,7 +44,7 @@
* both beans would be included in the result list.
* @return all @Named beans
*/
- Set<IBean> getNamedBeans(boolean attemptToResolveAmbiguousNames);
+ Collection<IBean> getNamedBeans(boolean attemptToResolveAmbiguousNames);
/**
* Returns the set of beans which match the given EL name.
@@ -60,7 +60,7 @@
* alternatives.
* @return the matched beans
*/
- Set<IBean> getBeans(String name, boolean attemptToResolveAmbiguousNames);
+ Collection<IBean> getBeans(String name, boolean attemptToResolveAmbiguousNames);
/**
* Returns the set of beans which have the given required type and qualifier
@@ -82,7 +82,7 @@
*
* @return the resulting set of beans
*/
- Set<IBean> getBeans(boolean attemptToResolveAmbiguousDependency, IParametedType
beanType, IQualifierDeclaration... qualifiers);
+ Collection<IBean> getBeans(boolean attemptToResolveAmbiguousDependency,
IParametedType beanType, IQualifierDeclaration... qualifiers);
/**
* Returns the set of beans which have the given required type and qualifier
@@ -104,7 +104,7 @@
*
* @return the resulting set of beans
*/
- Set<IBean> getBeans(boolean attemptToResolveAmbiguousDependency, IParametedType
beanType, IType... qualifiers);
+ Collection<IBean> getBeans(boolean attemptToResolveAmbiguousDependency,
IParametedType beanType, IType... qualifiers);
/**
* Returns the set of beans which have the given required type and qualifier
@@ -126,7 +126,7 @@
*
* @return the resulting set of beans
*/
- Set<IBean> getBeans(boolean attemptToResolveAmbiguousDependency, String
fullyQualifiedBeanType, String... fullyQualifiedQualifiersTypes);
+ Collection<IBean> getBeans(boolean attemptToResolveAmbiguousDependency, String
fullyQualifiedBeanType, String... fullyQualifiedQualifiersTypes);
/**
* Returns the set of beans which are eligible for the given injection
@@ -143,7 +143,7 @@
* @return the resulting set of beans
*/
- Set<IBean> getBeans(boolean attemptToResolveAmbiguousDependency, IInjectionPoint
injectionPoint);
+ Collection<IBean> getBeans(boolean attemptToResolveAmbiguousDependency,
IInjectionPoint injectionPoint);
/**
* Returns the bean which is declared in the given IType.
@@ -159,7 +159,7 @@
* @param resource path
* @return the set of beans by resource path.
*/
- Set<IBean> getBeans(IPath path);
+ Collection<IBean> getBeans(IPath path);
/**
* Returns the set of beans based on the Java element.
@@ -168,7 +168,7 @@
* @param element
* @return
*/
- public Set<IBean> getBeans(IJavaElement element);
+ public Collection<IBean> getBeans(IJavaElement element);
/**
* Returns all the available qualifiers.
*
@@ -280,7 +280,7 @@
*
* @return names of all available scope annotations
*/
- Set<String> getScopeNames();
+ Collection<String> getScopeNames();
/**
* Returns scope model element for fully qualified name of scope annotation
@@ -307,7 +307,7 @@
* @return the set of observers for an event which is injected by given
* injection point
*/
- Set<IObserverMethod> resolveObserverMethods(IInjectionPoint injectionPoint);
+ Collection<IObserverMethod> resolveObserverMethods(IInjectionPoint
injectionPoint);
/**
* Returns the set of injection points with event type observed by given
@@ -317,7 +317,7 @@
* @return the set of injection points with event type observed by given
* parameter of an observer method
*/
- public Set<IInjectionPoint> findObservedEvents(IParameter
observedEventParameter);
+ public Collection<IInjectionPoint> findObservedEvents(IParameter
observedEventParameter);
/**
* Applies the ambiguous dependency resolution rules to a set of beans.
@@ -326,7 +326,7 @@
* a set of beans
* @return resolved beans
*/
- Set<IBean> resolve(Set<IBean> beans);
+ Collection<IBean> resolve(Collection<IBean> beans);
/**
* Return the disposer methods which are bound to the producer method.
@@ -336,7 +336,7 @@
*
* @return bound disposer methods
*/
- Set<IBeanMethod> resolveDisposers(IProducerMethod producer);
+ Collection<IBeanMethod> resolveDisposers(IProducerMethod producer);
/**
* Tests the given annotation type to determine if it is a scope type.
@@ -476,5 +476,5 @@
* @param fullyQualifiedTypeName
* @return
*/
- Set<IInjectionPoint> getInjections(String fullyQualifiedTypeName);
+ Collection<IInjectionPoint> getInjections(String fullyQualifiedTypeName);
}
\ No newline at end of file
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIAnnotation.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIAnnotation.java 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIAnnotation.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.core;
-import java.util.Set;
+import java.util.Collection;
import org.eclipse.jdt.core.IMethod;
import org.jboss.tools.common.java.IAnnotationDeclaration;
@@ -38,5 +38,5 @@
*
* @return set of members annotated with @Nonbinding
*/
- Set<IMethod> getNonBindingMethods();
+ Collection<IMethod> getNonBindingMethods();
}
\ No newline at end of file
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IClassBean.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IClassBean.java 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IClassBean.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -11,7 +11,6 @@
package org.jboss.tools.cdi.core;
import java.util.Collection;
-import java.util.Set;
import org.jboss.tools.common.java.IJavaReference;
@@ -27,35 +26,35 @@
*
* @return a set of producers that are declared in this bean class.
*/
- Set<IProducer> getProducers();
+ Collection<IProducer> getProducers();
/**
* Returns a set of disposer methods that are declared in this bean class.
*
* @return a set of disposer methods that are declared in this bean class.
*/
- Set<IBeanMethod> getDisposers();
+ Collection<IBeanMethod> getDisposers();
/**
* Returns a set of bean constructors of the bean.
*
* @return a set of bean constructors of the bean.
*/
- Set<IBeanMethod> getBeanConstructors();
+ Collection<IBeanMethod> getBeanConstructors();
/**
* Returns a set of the methods that are declared in this bean class.
*
* @return a set of the methods that are declared in this bean class.
*/
- Set<IBeanMethod> getAllMethods();
+ Collection<IBeanMethod> getAllMethods();
/**
* Returns a set of observer methods of the bean.
*
* @return a set of observer methods of the bean
*/
- Set<IObserverMethod> getObserverMethods();
+ Collection<IObserverMethod> getObserverMethods();
/**
* Returns all the directly derived classes that declare annotation @Specializes
@@ -76,7 +75,7 @@
*
* @return the initializer methods of the class bean
*/
- Set<IInitializerMethod> getInitializers();
+ Collection<IInitializerMethod> getInitializers();
/**
* Returns injection points declared in the bean class.
@@ -88,5 +87,5 @@
* @param all
* @return
*/
- Set<IInjectionPoint> getInjectionPoints(boolean all);
+ Collection<IInjectionPoint> getInjectionPoints(boolean all);
}
\ No newline at end of file
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IDecorator.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IDecorator.java 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IDecorator.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.core;
-import java.util.Set;
+import java.util.Collection;
import org.jboss.tools.common.java.IAnnotationDeclaration;
import org.jboss.tools.common.java.IParametedType;
@@ -34,5 +34,5 @@
*
* @return the set of decorated types
*/
- Set<IParametedType> getDecoratedTypes();
+ Collection<IParametedType> getDecoratedTypes();
}
\ No newline at end of file
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInjectionPoint.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInjectionPoint.java 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInjectionPoint.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.core;
+import java.util.Collection;
import java.util.Set;
import org.jboss.tools.common.java.IAnnotationDeclaration;
@@ -42,7 +43,7 @@
*
* @return the required qualifiers
*/
- Set<IQualifierDeclaration> getQualifierDeclarations();
+ Collection<IQualifierDeclaration> getQualifierDeclarations();
/**
* Returns true if the injection point declares @Default qualifier or doesn't
declare any qualifier at all.
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInterceptorBinded.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInterceptorBinded.java 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInterceptorBinded.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.core;
+import java.util.Collection;
import java.util.Set;
/**
@@ -26,12 +27,12 @@
*
* @return the set of interceptor binding declarations
*/
- Set<IInterceptorBindingDeclaration> getInterceptorBindingDeclarations(boolean
includeInherited);
+ Collection<IInterceptorBindingDeclaration>
getInterceptorBindingDeclarations(boolean includeInherited);
/**
* Obtains the interceptor bindings of the bean class or method or stereotype or
interceptor binding type.
*
* @return the set of interceptor bindings
*/
- Set<IInterceptorBinding> getInterceptorBindings();
+ Collection<IInterceptorBinding> getInterceptorBindings();
}
\ No newline at end of file
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IObserverMethod.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IObserverMethod.java 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IObserverMethod.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.core;
-import java.util.Set;
+import java.util.Collection;
/**
* Represents an observer method of a bean.
@@ -24,5 +24,5 @@
*
* @return the set of parameters of this method with @Observes annotation
*/
- Set<IParameter> getObservedParameters();
+ Collection<IParameter> getObservedParameters();
}
\ No newline at end of file
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IParameter.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IParameter.java 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IParameter.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.core;
+import java.util.Collection;
import java.util.Set;
import org.jboss.tools.common.java.IParametedType;
@@ -46,5 +47,5 @@
*
* @return qualifier declarations for this parameter
*/
- public Set<IQualifierDeclaration> getQualifierDeclarations();
+ public Collection<IQualifierDeclaration> getQualifierDeclarations();
}
\ No newline at end of file
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScoped.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScoped.java 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IScoped.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.core;
+import java.util.Collection;
import java.util.Set;
/**
@@ -36,5 +37,5 @@
*
* @return the scope
*/
- Set<IScopeDeclaration> getScopeDeclarations();
+ Collection<IScopeDeclaration> getScopeDeclarations();
}
\ No newline at end of file
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IStereotyped.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IStereotyped.java 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IStereotyped.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.core;
+import java.util.Collection;
import java.util.Set;
import org.jboss.tools.common.java.IAnnotated;
@@ -27,5 +28,5 @@
*
* @return the set of stereotype declarations
*/
- Set<IStereotypeDeclaration> getStereotypeDeclarations();
+ Collection<IStereotypeDeclaration> getStereotypeDeclarations();
}
\ No newline at end of file
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el/CdiElResolver.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el/CdiElResolver.java 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/el/CdiElResolver.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -11,6 +11,7 @@
package org.jboss.tools.cdi.internal.core.el;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -116,7 +117,7 @@
String varName = expr.toString();
- Set<IBean> resolvedBeans = null;
+ Collection<IBean> resolvedBeans = null;
if (varName != null) {
CDICoreNature nature = CDIUtil.getCDINatureWithProgress(project);
if(nature!=null) {
@@ -201,8 +202,7 @@
IProject project = element.getJavaProject().getProject();
ICDIProject cdi = CDICorePlugin.getCDIProject(project, true);
if(cdi != null) {
- Set<IBean> beans = cdi.getBeans(element);
- for (IBean b: beans) {
+ for (IBean b: cdi.getBeans(element)) {
if(b.getName() != null) {
names.add(b.getName());
}
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 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/AbstractBeanElement.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.cdi.internal.core.impl;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -18,7 +20,6 @@
import java.util.Set;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IType;
@@ -125,30 +126,27 @@
protected AnnotationDeclaration findNamedAnnotation() {
AnnotationDeclaration named = getDefinition().getNamedAnnotation();
if(named != null) return named;
- Set<IStereotypeDeclaration> ds = getStereotypeDeclarations(true);
- for (IStereotypeDeclaration d: ds) {
+ for (IStereotypeDeclaration d: getStereotypeDeclarations(true)) {
StereotypeElement s = (StereotypeElement)d.getStereotype();
- if(s == null) continue;
- if(s.getNameDeclaration() != null) return s.getNameDeclaration();
+ if(s != null && s.getNameDeclaration() != null) return
s.getNameDeclaration();
}
return null;
}
public boolean isAlternative() {
if(getDefinition().getAlternativeAnnotation() != null) return true;
- Set<IStereotypeDeclaration> ds = getStereotypeDeclarations();
- for (IStereotypeDeclaration d: ds) {
+ for (IStereotypeDeclaration d: getStereotypeDeclarations()) {
IStereotype s = d.getStereotype();
if(s != null && s.isAlternative()) return true;
}
return false;
}
- public Set<IStereotypeDeclaration> getStereotypeDeclarations() {
+ public Collection<IStereotypeDeclaration> getStereotypeDeclarations() {
return getStereotypeDeclarations(false);
}
- public Set<IStereotypeDeclaration> getStereotypeDeclarations(boolean
includeInherited) {
+ public Collection<IStereotypeDeclaration> getStereotypeDeclarations(boolean
includeInherited) {
Set<IStereotypeDeclaration> result = new
HashSet<IStereotypeDeclaration>();
Set<IStereotype> ss = new HashSet<IStereotype>();
for (IAnnotationDeclaration d: definition.getAnnotations()) {
@@ -164,8 +162,7 @@
for (IStereotypeDeclaration d: delta1) {
IStereotype s = d.getStereotype();
if(s == null) continue;
- Set<IStereotypeDeclaration> ds = s.getStereotypeDeclarations();
- for (IStereotypeDeclaration d1: ds) {
+ for (IStereotypeDeclaration d1: s.getStereotypeDeclarations()) {
if(d1.getStereotype() != null) {
if(!result.contains(d1) && !delta2.contains(d1)) delta2.add(d1);
}
@@ -194,12 +191,12 @@
return Collections.emptySet();
}
- public Set<IQualifierDeclaration> getQualifierDeclarations() {
+ public Collection<IQualifierDeclaration> getQualifierDeclarations() {
return getQualifierDeclarations(false);
}
- public Set<IQualifierDeclaration> getQualifierDeclarations(boolean
includeInherited) {
- Set<IQualifierDeclaration> result = new HashSet<IQualifierDeclaration>();
+ public Collection<IQualifierDeclaration> getQualifierDeclarations(boolean
includeInherited) {
+ Collection<IQualifierDeclaration> result = new
ArrayList<IQualifierDeclaration>();
Set<IQualifier> qs = new HashSet<IQualifier>();
for(IAnnotationDeclaration a: definition.getAnnotations()) {
int k = getCDIProject().getNature().getDefinitions().getAnnotationKind(a.getType());
@@ -210,8 +207,7 @@
}
}
if(includeInherited) {
- Set<IQualifierDeclaration> ds = getInheritedQualifierDeclarations();
- for (IQualifierDeclaration d : ds) {
+ for (IQualifierDeclaration d : getInheritedQualifierDeclarations()) {
if (d.getQualifier() != null && !qs.contains(d.getQualifier())) {
result.add(d);
}
@@ -222,22 +218,21 @@
return result;
}
- protected Set<IQualifierDeclaration> getInheritedQualifierDeclarations() {
- return Collections.emptySet();
+ protected Collection<IQualifierDeclaration> getInheritedQualifierDeclarations() {
+ return Collections.emptyList();
}
- protected Set<IInterceptorBindingDeclaration>
getInheritedInterceptorBindingDeclarations() {
- return Collections.emptySet();
+ protected Collection<IInterceptorBindingDeclaration>
getInheritedInterceptorBindingDeclarations() {
+ return Collections.emptyList();
}
- public Set<IQualifier> getQualifiers() {
+ public Collection<IQualifier> getQualifiers() {
IQualifier any = getCDIProject().getQualifier(CDIConstants.ANY_QUALIFIER_TYPE_NAME);
IQualifier def =
getCDIProject().getQualifier(CDIConstants.DEFAULT_QUALIFIER_TYPE_NAME);
IQualifier name =
getCDIProject().getQualifier(CDIConstants.NAMED_QUALIFIER_TYPE_NAME);
Set<IQualifier> result = new HashSet<IQualifier>();
- Set<IQualifierDeclaration> ds = getQualifierDeclarations(true);
- for (IQualifierDeclaration d: ds) {
+ for (IQualifierDeclaration d: getQualifierDeclarations(true)) {
IQualifier q = d.getQualifier();
if(q != null) result.add(q);
}
@@ -260,15 +255,14 @@
* (non-Javadoc)
* @see org.jboss.tools.cdi.core.IClassBean#getInterceptorBindingDeclarations()
*/
- public Set<IInterceptorBindingDeclaration>
getInterceptorBindingDeclarations(boolean includeInherited) {
- Set<IInterceptorBindingDeclaration> result =
ClassBean.getInterceptorBindingDeclarations(definition);
+ public Collection<IInterceptorBindingDeclaration>
getInterceptorBindingDeclarations(boolean includeInherited) {
+ Collection<IInterceptorBindingDeclaration> result =
ClassBean.getInterceptorBindingDeclarations(definition);
if(includeInherited) {
Set<IInterceptorBinding> qs = new HashSet<IInterceptorBinding>();
for (IInterceptorBindingDeclaration d: result) {
if(d.getInterceptorBinding() != null) qs.add(d.getInterceptorBinding());
}
- Set<IInterceptorBindingDeclaration> ds =
getInheritedInterceptorBindingDeclarations();
- for (IInterceptorBindingDeclaration d : ds) {
+ for (IInterceptorBindingDeclaration d : getInheritedInterceptorBindingDeclarations())
{
if (d.getInterceptorBinding() != null &&
!qs.contains(d.getInterceptorBinding())) {
result.add(d);
}
@@ -292,12 +286,12 @@
return result;
}
- public Set<ITypeDeclaration>
getRestrictedTypeDeclarations(Set<IParametedType> alltypes) {
+ public Collection<ITypeDeclaration>
getRestrictedTypeDeclarations(Collection<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>();
+ Collection<ITypeDeclaration> result = new ArrayList<ITypeDeclaration>();
AnnotationDeclaration typed = getDefinition().getTypedAnnotation();
if(typed != null) {
int s = typed.getStartPosition();
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeanMethod.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeanMethod.java 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/BeanMethod.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -11,8 +11,8 @@
package org.jboss.tools.cdi.internal.core.impl;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
-import java.util.Set;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IMember;
@@ -107,7 +107,7 @@
* (non-Javadoc)
* @see org.jboss.tools.cdi.core.IInterceptorBinded#getInterceptorBindings()
*/
- public Set<IInterceptorBinding> getInterceptorBindings() {
+ public Collection<IInterceptorBinding> getInterceptorBindings() {
return CDIUtil.getAllInterceptorBindings(this);
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIAnnotationElement.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIAnnotationElement.java 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIAnnotationElement.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -11,9 +11,9 @@
package org.jboss.tools.cdi.internal.core.impl;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashSet;
import java.util.List;
-import java.util.Set;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IType;
@@ -33,7 +33,7 @@
protected AnnotationDefinition definition;
- Set<IMethod> nonbindingMethods = null;
+ Collection<IMethod> nonbindingMethods = null;
public CDIAnnotationElement() {}
@@ -41,15 +41,17 @@
this.definition = definition;
}
- public Set<IMethod> getNonBindingMethods() {
+ public Collection<IMethod> getNonBindingMethods() {
if(nonbindingMethods == null) {
- Set<IMethod> result = new HashSet<IMethod>();
- List<AnnotationMemberDefinition> ms = definition.getMethods();
- for (AnnotationMemberDefinition m: ms) {
+ Collection<IMethod> result = new ArrayList<IMethod>();
+ for (AnnotationMemberDefinition m: definition.getMethods()) {
if(m.getNonbindingAnnotation() != null) {
result.add(m.getMethod());
}
}
+ if(result.size() > 5) {
+ result = new HashSet<IMethod>(result);
+ }
nonbindingMethods = result;
}
return nonbindingMethods;
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 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -206,8 +206,8 @@
return allBeans.toArray(new IBean[allBeans.size()]);
}
- public synchronized Set<IBean> getDeclaredBeans() {
- return new HashSet<IBean>(declaredBeans);
+ public synchronized Collection<IBean> getDeclaredBeans() {
+ return new ArrayList<IBean>(declaredBeans);
}
public List<INodeReference> getAlternativeClasses() {
@@ -374,10 +374,9 @@
beans.addAll(allBeans);
}
for (IBean b: beans) {
- Set<IParametedType> types = b.getLegalTypes();
- if(containsType(types, type)) {
+ if(containsType(b.getLegalTypes(), type)) {
try {
- Set<IQualifierDeclaration> qsb = b.getQualifierDeclarations(true);
+ Collection<IQualifierDeclaration> qsb = b.getQualifierDeclarations(true);
if(areMatchingQualifiers(qsb, qs)) {
result.add(b);
}
@@ -394,7 +393,7 @@
* (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) {
+ public Collection<IBean> getBeans(boolean attemptToResolveAmbiguousDependency,
IInjectionPoint injectionPoint) {
if(injectionPoint.getDeclaringProject() != getDeclaringProject()) {
return
injectionPoint.getDeclaringProject().getBeans(attemptToResolveAmbiguousDependency,
injectionPoint);
}
@@ -425,13 +424,12 @@
}
}
- Set<IQualifierDeclaration> qs = injectionPoint.getQualifierDeclarations();
+ Collection<IQualifierDeclaration> qs =
injectionPoint.getQualifierDeclarations();
for (IQualifierDeclaration d: qs) {
if(CDIConstants.NEW_QUALIFIER_TYPE_NAME.equals(d.getTypeName())) {
IBean b = createNewBean(type, d);
if(b != null) {
- Set<IParametedType> types = b.getLegalTypes();
- if(containsType(types, type)) {
+ if(containsType(b.getLegalTypes(), type)) {
result.add(b);
}
}
@@ -448,8 +446,7 @@
String injectionPointName = injectionPoint.getBeanName();
for (IBean b: beans) {
- Set<IParametedType> types = b.getLegalTypes();
- if(containsType(types, type)) {
+ if(containsType(b.getLegalTypes(), type)) {
try {
if(delegateInjectionPoint && b == injectionPoint.getClassBean()) {
continue;
@@ -458,7 +455,7 @@
//
continue;
}
- Set<IQualifierDeclaration> qsb = b.getQualifierDeclarations(true);
+ Collection<IQualifierDeclaration> qsb = b.getQualifierDeclarations(true);
if(areMatchingQualifiers(qsb, qs)) {
result.add(b);
}
@@ -553,7 +550,7 @@
return null;
}
- public static boolean containsType(Set<IParametedType> types, IParametedType type)
{
+ public static boolean containsType(Collection<IParametedType> types,
IParametedType type) {
if(type == null) {
return false;
}
@@ -612,7 +609,7 @@
* @return
* @throws CoreException
*/
- public static boolean areMatchingQualifiers(Set<IQualifierDeclaration>
beanQualifiers, IType... injectionQualifiers) throws CoreException {
+ public static boolean areMatchingQualifiers(Collection<IQualifierDeclaration>
beanQualifiers, IType... injectionQualifiers) throws CoreException {
if(!beanQualifiers.isEmpty() || injectionQualifiers.length != 0) {
TreeSet<String> injectionKeys = new TreeSet<String>();
@@ -647,7 +644,7 @@
return true;
}
- public static boolean areMatchingEventQualifiers(Set<IQualifierDeclaration>
eventQualifiers, Set<IQualifierDeclaration> paramQualifiers) throws CoreException {
+ public static boolean areMatchingEventQualifiers(Collection<IQualifierDeclaration>
eventQualifiers, Collection<IQualifierDeclaration> paramQualifiers) throws
CoreException {
if(!paramQualifiers.isEmpty()) {
TreeSet<String> paramKeys = new TreeSet<String>();
@@ -673,12 +670,12 @@
public static String getAnnotationDeclarationKey(IAnnotationDeclaration d) throws
CoreException {
ICDIAnnotation annotation = (ICDIAnnotation)d.getAnnotation();
- Set<IMethod> nb = annotation == null ? new HashSet<IMethod>() :
annotation.getNonBindingMethods();
+ Collection<IMethod> nb = annotation == null ? new HashSet<IMethod>() :
annotation.getNonBindingMethods();
return getAnnotationDeclarationKey(d, nb);
}
- private static String getAnnotationDeclarationKey(IAnnotationDeclaration d,
Set<IMethod> ignoredMembers) throws CoreException {
- Set<IMethod> nb = ignoredMembers == null ? new HashSet<IMethod>() :
ignoredMembers;
+ private static String getAnnotationDeclarationKey(IAnnotationDeclaration d,
Collection<IMethod> ignoredMembers) throws CoreException {
+ Collection<IMethod> nb = ignoredMembers == null ? new ArrayList<IMethod>()
: ignoredMembers;
IType type = d.getType();
StringBuffer result = new StringBuffer();
result.append(type.getFullyQualifiedName());
@@ -929,7 +926,7 @@
return result;
}
- public Set<IBean> resolve(Set<IBean> beans) {
+ public Collection<IBean> resolve(Collection<IBean> beans) {
if(beans.size() <= 1) {
return beans;
}
@@ -947,8 +944,8 @@
* This method looks for observed methods in all the set of related projects.
* To this end, it activates all CDI projects in workspace.
*/
- public Set<IObserverMethod> resolveObserverMethods(IInjectionPoint injectionPoint)
{
- Set<IObserverMethod> result = new HashSet<IObserverMethod>();
+ public Collection<IObserverMethod> resolveObserverMethods(IInjectionPoint
injectionPoint) {
+ Collection<IObserverMethod> result = new ArrayList<IObserverMethod>();
IParametedType eventType = getEventType(injectionPoint);
if(eventType != null) {
synchronized(this) {
@@ -978,9 +975,9 @@
return result;
}
- private void collectObserverMethods(IClassBean b, IParametedType eventType,
IInjectionPoint injectionPoint, Set<IObserverMethod> result) {
+ private void collectObserverMethods(IClassBean b, IParametedType eventType,
IInjectionPoint injectionPoint, Collection<IObserverMethod> result) {
for (IObserverMethod m: b.getObserverMethods()) {
- Set<IParameter> params = m.getObservedParameters();
+ Collection<IParameter> params = m.getObservedParameters();
if(!params.isEmpty()) {
IParameter param = params.iterator().next();
IParametedType paramType = param.getType();
@@ -1054,7 +1051,7 @@
}
private void collectObserverEvents(IClassBean b, IParameter observedEventParameter,
Map<IField, IInjectionPoint> result) {
- Set<IInjectionPoint> ps = b.getInjectionPoints();
+ Collection<IInjectionPoint> ps = b.getInjectionPoints();
for (IInjectionPoint p: ps) {
if(p instanceof IInjectionPointField) {
IParametedType eventType = getEventType(p);
@@ -1072,11 +1069,10 @@
IClassBean cb = producer.getClassBean();
if(cb != null) {
- Set<IParametedType> types = producer.getLegalTypes();
- Set<IQualifierDeclaration> qs = producer.getQualifierDeclarations(true);
+ Collection<IParametedType> types = producer.getLegalTypes();
+ Collection<IQualifierDeclaration> qs = producer.getQualifierDeclarations(true);
- Set<IBeanMethod> ds = cb.getDisposers();
- for (IBeanMethod m: ds) {
+ for (IBeanMethod m: cb.getDisposers()) {
List<IParameter> ps = m.getParameters();
IParameter match = null;
for (IParameter p: ps) {
@@ -1328,8 +1324,7 @@
beans.add(bean);
}
- Set<IProducer> ps = bean.getProducers();
- for (IProducer producer: ps) {
+ for (IProducer producer: bean.getProducers()) {
beans.add(producer);
}
}
@@ -1466,7 +1461,7 @@
}
synchronized void buildInjectionPoinsByType(IBean b) {
- Set<IInjectionPoint> ps = b.getInjectionPoints();
+ Collection<IInjectionPoint> ps = b.getInjectionPoints();
for (IInjectionPoint p: ps) {
IParametedType t = p.getType();
if(t == null || t.getType() == null) continue;
@@ -1549,10 +1544,9 @@
beans.addAll(allBeans);
}
for (IBean b: beans) {
- Set<IParametedType> types = b.getLegalTypes();
- if(containsType(types, type)) {
+ if(containsType(b.getLegalTypes(), type)) {
try {
- Set<IQualifierDeclaration> qsb = b.getQualifierDeclarations(true);
+ Collection<IQualifierDeclaration> qsb = b.getQualifierDeclarations(true);
if(areMatchingQualifiers(qsb, qualifiers)) {
result.add(b);
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProjectAsYouType.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProjectAsYouType.java 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProjectAsYouType.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -11,6 +11,7 @@
package org.jboss.tools.cdi.internal.core.impl;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -22,7 +23,6 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IPackageDeclaration;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
@@ -250,8 +250,7 @@
beans.add(bean);
}
- Set<IProducer> ps = bean.getProducers();
- for (IProducer producer: ps) {
+ for (IProducer producer: bean.getProducers()) {
beans.add(producer);
}
}
@@ -285,37 +284,37 @@
}
@Override
- public Set<IBean> getNamedBeans(boolean attemptToResolveAmbiguousNames) {
+ public Collection<IBean> getNamedBeans(boolean attemptToResolveAmbiguousNames) {
return project.getNamedBeans(attemptToResolveAmbiguousNames);
}
@Override
- public Set<IBean> getBeans(String name,
+ public Collection<IBean> getBeans(String name,
boolean attemptToResolveAmbiguousNames) {
return project.getBeans(name, attemptToResolveAmbiguousNames);
}
@Override
- public Set<IBean> getBeans(boolean attemptToResolveAmbiguousDependency,
+ public Collection<IBean> getBeans(boolean attemptToResolveAmbiguousDependency,
IParametedType beanType, IQualifierDeclaration... qualifiers) {
return project.getBeans(attemptToResolveAmbiguousDependency, beanType, qualifiers);
}
@Override
- public Set<IBean> getBeans(boolean attemptToResolveAmbiguousDependency,
+ public Collection<IBean> getBeans(boolean attemptToResolveAmbiguousDependency,
IParametedType beanType, IType... qualifiers) {
return project.getBeans(attemptToResolveAmbiguousDependency, beanType, qualifiers);
}
@Override
- public Set<IBean> getBeans(boolean attemptToResolveAmbiguousDependency,
+ public Collection<IBean> getBeans(boolean attemptToResolveAmbiguousDependency,
String fullyQualifiedBeanType,
String... fullyQualifiedQualifiersTypes) {
return project.getBeans(attemptToResolveAmbiguousDependency, fullyQualifiedBeanType,
fullyQualifiedQualifiersTypes);
}
@Override
- public Set<IBean> getBeans(boolean attemptToResolveAmbiguousDependency,
+ public Collection<IBean> getBeans(boolean attemptToResolveAmbiguousDependency,
IInjectionPoint injectionPoint) {
return project.getBeans(attemptToResolveAmbiguousDependency, injectionPoint);
}
@@ -326,7 +325,7 @@
}
@Override
- public Set<IBean> getBeans(IPath path) {
+ public Collection<IBean> getBeans(IPath path) {
if(path.equals(file.getFullPath())) {
return beans;
}
@@ -334,12 +333,11 @@
}
@Override
- public Set<IBean> getBeans(IJavaElement element) {
+ public Collection<IBean> getBeans(IJavaElement element) {
if(element.getResource() != null &&
element.getResource().getFullPath().equals(file.getFullPath())) {
Set<IBean> result = new HashSet<IBean>();
for (IBean bean: beans) {
if(bean instanceof IJavaReference) {
- IMember m = ((IJavaReference)bean).getSourceMember();
if(((IJavaReference)bean).getSourceMember().equals(element)) {
result.add(bean);
}
@@ -425,7 +423,7 @@
}
@Override
- public Set<String> getScopeNames() {
+ public Collection<String> getScopeNames() {
return project.getScopeNames();
}
@@ -443,24 +441,24 @@
}
@Override
- public Set<IObserverMethod> resolveObserverMethods(IInjectionPoint injectionPoint)
{
+ public Collection<IObserverMethod> resolveObserverMethods(IInjectionPoint
injectionPoint) {
// TODO resolve in file
return project.resolveObserverMethods(injectionPoint);
}
@Override
- public Set<IInjectionPoint> findObservedEvents(IParameter observedEventParameter)
{
+ public Collection<IInjectionPoint> findObservedEvents(IParameter
observedEventParameter) {
// TODO find in file
return project.findObservedEvents(observedEventParameter);
}
@Override
- public Set<IBean> resolve(Set<IBean> beans) {
+ public Collection<IBean> resolve(Collection<IBean> beans) {
return project.resolve(beans);
}
@Override
- public Set<IBeanMethod> resolveDisposers(IProducerMethod producer) {
+ public Collection<IBeanMethod> resolveDisposers(IProducerMethod producer) {
return project.resolveDisposers(producer);
}
@@ -525,7 +523,7 @@
}
@Override
- public Set<IInjectionPoint> getInjections(String fullyQualifiedTypeName) {
+ public Collection<IInjectionPoint> getInjections(String fullyQualifiedTypeName) {
return project.getInjections(fullyQualifiedTypeName);
}
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 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ClassBean.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -144,8 +144,8 @@
return result;
}
- public Set<IBeanMethod> getBeanConstructors() {
- Set<IBeanMethod> result = new HashSet<IBeanMethod>();
+ public Collection<IBeanMethod> getBeanConstructors() {
+ Collection<IBeanMethod> result = new ArrayList<IBeanMethod>();
IBeanMethod defaultConstructor = null;
for (BeanMethod m: methods) {
if(m.getDefinition().isConstructor()) {
@@ -223,8 +223,8 @@
return superClassBean;
}
- public Set<IBeanMethod> getDisposers() {
- Set<IBeanMethod> result = new HashSet<IBeanMethod>();
+ public Collection<IBeanMethod> getDisposers() {
+ Collection<IBeanMethod> result = new ArrayList<IBeanMethod>();
for (BeanMethod m: methods) {
if(m.isDisposer()) {
result.add(m);
@@ -233,7 +233,7 @@
return result;
}
- public static Set<IInterceptorBindingDeclaration>
getInterceptorBindingDeclarations(AbstractMemberDefinition definition) {
+ public static Collection<IInterceptorBindingDeclaration>
getInterceptorBindingDeclarations(AbstractMemberDefinition definition) {
Set<IInterceptorBindingDeclaration> result = new
HashSet<IInterceptorBindingDeclaration>();
List<IAnnotationDeclaration> as = definition.getAnnotations();
for (IAnnotationDeclaration a: as) {
@@ -248,12 +248,12 @@
* (non-Javadoc)
* @see org.jboss.tools.cdi.core.IClassBean#getInterceptorBindings()
*/
- public Set<IInterceptorBinding> getInterceptorBindings() {
+ public Collection<IInterceptorBinding> getInterceptorBindings() {
return CDIUtil.getAllInterceptorBindings(this);
}
- public Set<IObserverMethod> getObserverMethods() {
- Set<IObserverMethod> result = new HashSet<IObserverMethod>();
+ public Collection<IObserverMethod> getObserverMethods() {
+ Collection<IObserverMethod> result = new ArrayList<IObserverMethod>();
for (BeanMethod m: methods) {
if(m.isObserver() && m instanceof IObserverMethod) {
result.add((IObserverMethod)m);
@@ -262,8 +262,8 @@
return result;
}
- public Set<IProducer> getProducers() {
- Set<IProducer> result = new HashSet<IProducer>();
+ public Collection<IProducer> getProducers() {
+ Collection<IProducer> result = new ArrayList<IProducer>();
for (BeanMethod m: methods) {
if(m instanceof IProducer) {
result.add((IProducer)m);
@@ -277,7 +277,7 @@
return result;
}
- public Set<ITypeDeclaration> getAllTypeDeclarations() {
+ public Collection<ITypeDeclaration> getAllTypeDeclarations() {
Set<IParametedType> ps = getDefinition().getInheritedTypes();
Set<ITypeDeclaration> result = new HashSet<ITypeDeclaration>();
for (IParametedType p: ps) {
@@ -303,8 +303,8 @@
}
@Override
- public Set<IInitializerMethod> getInitializers() {
- Set<IInitializerMethod> result = new HashSet<IInitializerMethod>();
+ public Collection<IInitializerMethod> getInitializers() {
+ Collection<IInitializerMethod> result = new
ArrayList<IInitializerMethod>();
for (BeanMethod m: methods) {
if(m instanceof IInitializerMethod) {
result.add((IInitializerMethod)m);
@@ -313,7 +313,7 @@
return result;
}
- public Set<IInjectionPoint> getInjectionPoints() {
+ public Collection<IInjectionPoint> getInjectionPoints() {
return getInjectionPoints(true);
}
@@ -323,8 +323,8 @@
* @param all
* @return
*/
- public Set<IInjectionPoint> getInjectionPoints(boolean all) {
- Set<IInjectionPoint> result = new HashSet<IInjectionPoint>();
+ public Collection<IInjectionPoint> getInjectionPoints(boolean all) {
+ Collection<IInjectionPoint> result = new ArrayList<IInjectionPoint>();
for (BeanField f: fields) {
if(f instanceof IInjectionPoint) {
result.add((IInjectionPoint)f);
@@ -345,13 +345,12 @@
return result;
}
- public Set<IParametedType> getLegalTypes() {
+ public Collection<IParametedType> getLegalTypes() {
Set<IParametedType> result = new HashSet<IParametedType>();
AnnotationDeclaration d = getDefinition().getTypedAnnotation();
- Set<IParametedType> all = getAllTypes();
+ Collection<IParametedType> all = getAllTypes();
if(d != null) {
- Set<ITypeDeclaration> ts = getRestrictedTypeDeclarations(all);
- result.addAll(ts);
+ result.addAll(getRestrictedTypeDeclarations(all));
ParametedType object = getObjectType(getBeanClass());
if(object != null) {
result.add(object);
@@ -365,11 +364,11 @@
* (non-Javadoc)
* @see org.jboss.tools.cdi.core.IBean#getAllTypes()
*/
- public Set<IParametedType> getAllTypes() {
+ public Collection<IParametedType> getAllTypes() {
return getDefinition().getAllTypes();
}
- public Set<ITypeDeclaration> getRestrictedTypeDeclaratios() {
+ public Collection<ITypeDeclaration> getRestrictedTypeDeclaratios() {
return getRestrictedTypeDeclarations(getAllTypes());
}
@@ -438,8 +437,7 @@
if(getCDIProject().isClassAlternativeActivated(getDefinition().getQualifiedName())) {
return true;
}
- Set<IStereotypeDeclaration> ds = getStereotypeDeclarations(true);
- for (IStereotypeDeclaration d: ds) {
+ for (IStereotypeDeclaration d: getStereotypeDeclarations(true)) {
IStereotype s = d.getStereotype();
if(s != null && s.isAlternative() &&
!getCDIProject().getAlternatives(s.getSourceType().getFullyQualifiedName()).isEmpty()) {
return true;
@@ -485,8 +483,7 @@
}
//3. Get default scope from stereotype.
Set<IScope> defaults = new HashSet<IScope>();
- Set<IStereotypeDeclaration> ss = getStereotypeDeclarations();
- for (IStereotypeDeclaration d: ss) {
+ for (IStereotypeDeclaration d: getStereotypeDeclarations()) {
IStereotype s = d.getStereotype();
IScope sc = s.getScope();
if(sc != null) {
@@ -495,8 +492,7 @@
}
scb = getSuperClassBean();
while(scb != null) {
- ss = scb.getStereotypeDeclarations();
- for (IStereotypeDeclaration d: ss) {
+ for (IStereotypeDeclaration d: scb.getStereotypeDeclarations()) {
IStereotype s = d.getStereotype();
if(s.getInheritedDeclaration() == null) {
continue;
@@ -518,11 +514,10 @@
}
}
- protected Set<IQualifierDeclaration> getInheritedQualifierDeclarations() {
+ protected Collection<IQualifierDeclaration> getInheritedQualifierDeclarations() {
if(superClassBean == null) return Collections.emptySet();
- Set<IQualifierDeclaration> result = new HashSet<IQualifierDeclaration>();
- Set<IQualifierDeclaration> ds = superClassBean.getQualifierDeclarations(true);
- for (IQualifierDeclaration d: ds) {
+ Collection<IQualifierDeclaration> result = new
ArrayList<IQualifierDeclaration>();
+ for (IQualifierDeclaration d: superClassBean.getQualifierDeclarations(true)) {
if(d.getQualifier() != null && d.getQualifier().getInheritedDeclaration() !=
null) {
result.add(d);
} else if(isSpecializing()) {
@@ -532,11 +527,10 @@
return result;
}
- protected Set<IInterceptorBindingDeclaration>
getInheritedInterceptorBindingDeclarations() {
- if(superClassBean == null) return Collections.emptySet();
+ protected Collection<IInterceptorBindingDeclaration>
getInheritedInterceptorBindingDeclarations() {
+ if(superClassBean == null) return Collections.emptyList();
Set<IInterceptorBindingDeclaration> result = new
HashSet<IInterceptorBindingDeclaration>();
- Set<IInterceptorBindingDeclaration> ds =
superClassBean.getInterceptorBindingDeclarations(true);
- for (IInterceptorBindingDeclaration d: ds) {
+ for (IInterceptorBindingDeclaration d:
superClassBean.getInterceptorBindingDeclarations(true)) {
if(d.getInterceptorBinding() != null &&
d.getInterceptorBinding().getInheritedDeclaration() != null) {
result.add(d);
} else if(isSpecializing()) {
@@ -549,8 +543,7 @@
public Set<IStereotypeDeclaration> getInheritedStereotypDeclarations() {
if(superClassBean == null) return Collections.emptySet();
Set<IStereotypeDeclaration> result = new
HashSet<IStereotypeDeclaration>();
- Set<IStereotypeDeclaration> ds = superClassBean.getStereotypeDeclarations(true);
- for (IStereotypeDeclaration d: ds) {
+ for (IStereotypeDeclaration d: superClassBean.getStereotypeDeclarations(true)) {
if(d.getStereotype() != null && d.getStereotype().getInheritedDeclaration() !=
null) {
result.add(d);
} else if(isSpecializing()) {
@@ -576,8 +569,7 @@
if(getDefinition().getAlternativeAnnotation() != null &&
getCDIProject().isTypeAlternative(getBeanClass().getFullyQualifiedName())) {
return true;
}
- Set<IStereotypeDeclaration> ds = getStereotypeDeclarations(true);
- for (IStereotypeDeclaration d: ds) {
+ for (IStereotypeDeclaration d: getStereotypeDeclarations(true)) {
IStereotype s = d.getStereotype();
if(s != null && s.isAlternative() &&
getCDIProject().isStereotypeAlternative(s.getSourceType().getFullyQualifiedName()) )
return true;
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/DecoratorBean.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/DecoratorBean.java 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/DecoratorBean.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -10,8 +10,8 @@
******************************************************************************/
package org.jboss.tools.cdi.internal.core.impl;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.ArrayList;
+import java.util.Collection;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
@@ -33,11 +33,10 @@
* (non-Javadoc)
* @see org.jboss.tools.cdi.core.IDecorator#getDecoratedTypes()
*/
- public Set<IParametedType> getDecoratedTypes() {
- Set<IParametedType> result = new HashSet<IParametedType>();
+ public Collection<IParametedType> getDecoratedTypes() {
+ Collection<IParametedType> result = new ArrayList<IParametedType>();
- Set<IParametedType> legalTypes = getLegalTypes();
- for (IParametedType pt: legalTypes) {
+ for (IParametedType pt: getLegalTypes()) {
IType t = pt.getType();
try {
if(!t.isInterface()) continue;
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/EventBean.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/EventBean.java 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/EventBean.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -11,6 +11,7 @@
package org.jboss.tools.cdi.internal.core.impl;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -44,7 +45,7 @@
public class EventBean extends CDIElement implements IBean {
IParametedType type;
IInjectionPoint point = null;
- Set<IQualifier> qualifiers = null;
+ Collection<IQualifier> qualifiers = null;
public EventBean(IParametedType type, IInjectionPoint point) {
this.type = type;
@@ -59,7 +60,7 @@
return new HashSet<IScopeDeclaration>();
}
- public Set<IStereotypeDeclaration> getStereotypeDeclarations() {
+ public Collection<IStereotypeDeclaration> getStereotypeDeclarations() {
return new HashSet<IStereotypeDeclaration>();
}
@@ -105,19 +106,19 @@
return new HashSet<ITypeDeclaration>();
}
- public Set<ITypeDeclaration> getRestrictedTypeDeclaratios() {
- return new HashSet<ITypeDeclaration>();
+ public Collection<ITypeDeclaration> getRestrictedTypeDeclaratios() {
+ return new ArrayList<ITypeDeclaration>();
}
- public Set<IQualifierDeclaration> getQualifierDeclarations() {
- return new HashSet<IQualifierDeclaration>();
+ public Collection<IQualifierDeclaration> getQualifierDeclarations() {
+ return new ArrayList<IQualifierDeclaration>();
}
- public Set<IQualifierDeclaration> getQualifierDeclarations(boolean
includeInherited) {
- return new HashSet<IQualifierDeclaration>();
+ public Collection<IQualifierDeclaration> getQualifierDeclarations(boolean
includeInherited) {
+ return new ArrayList<IQualifierDeclaration>();
}
- public Set<IQualifier> getQualifiers() {
+ public Collection<IQualifier> getQualifiers() {
if(qualifiers == null) {
computeQualifiers();
}
@@ -125,17 +126,15 @@
}
void computeQualifiers() {
- Set<IQualifier> qs = new HashSet<IQualifier>();
+ Collection<IQualifier> qs = null;
- boolean isParameter = point instanceof InjectionPointParameter;
-
- if(isParameter) {
+ if(point instanceof InjectionPointParameter) {
qs = ((InjectionPointParameter)point).getQualifiers();
} else if(point != null) {
- Set<IQualifierDeclaration> ds = point.getQualifierDeclarations();
- for (IQualifierDeclaration d: ds) {
+ qs = new ArrayList<IQualifier>();
+ for (IQualifierDeclaration d: point.getQualifierDeclarations()) {
IQualifier q = d.getQualifier();
- if(q != null) qs.add(q);
+ if(q != null && !qs.contains(q)) qs.add(q);
}
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBindingElement.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBindingElement.java 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/InterceptorBindingElement.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.internal.core.impl;
-import java.util.Set;
+import java.util.Collection;
import org.jboss.tools.cdi.core.CDIUtil;
import org.jboss.tools.cdi.core.IInterceptorBinding;
@@ -29,11 +29,11 @@
* (non-Javadoc)
* @see org.jboss.tools.cdi.core.IInterceptorBinded#getInterceptorBindings()
*/
- public Set<IInterceptorBinding> getInterceptorBindings() {
+ public Collection<IInterceptorBinding> getInterceptorBindings() {
return CDIUtil.getAllInterceptorBindings(this);
}
- public Set<IInterceptorBindingDeclaration>
getInterceptorBindingDeclarations(boolean includeInherited) {
+ public Collection<IInterceptorBindingDeclaration>
getInterceptorBindingDeclarations(boolean includeInherited) {
return ClassBean.getInterceptorBindingDeclarations(definition);
}
}
\ No newline at end of file
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/NewBean.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/NewBean.java 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/NewBean.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -10,8 +10,8 @@
******************************************************************************/
package org.jboss.tools.cdi.internal.core.impl;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.ArrayList;
+import java.util.Collection;
import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.IBeanMethod;
@@ -34,8 +34,8 @@
return true;
}
- public Set<IQualifier> getQualifiers() {
- Set<IQualifier> result = new HashSet<IQualifier>();
+ public Collection<IQualifier> getQualifiers() {
+ Collection<IQualifier> result = new ArrayList<IQualifier>(1);
IQualifier q = getCDIProject().getQualifier(CDIConstants.NEW_QUALIFIER_TYPE_NAME);
if(q != null) {
result.add(q);
@@ -51,15 +51,15 @@
return false;
}
- public Set<IObserverMethod> getObserverMethods() {
- return new HashSet<IObserverMethod>();
+ public Collection<IObserverMethod> getObserverMethods() {
+ return new ArrayList<IObserverMethod>();
}
- public Set<IProducer> getProducers() {
- return new HashSet<IProducer>();
+ public Collection<IProducer> getProducers() {
+ return new ArrayList<IProducer>();
}
- public Set<IBeanMethod> getDisposers() {
- return new HashSet<IBeanMethod>();
+ public Collection<IBeanMethod> getDisposers() {
+ return new ArrayList<IBeanMethod>();
}
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ObserverMethod.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ObserverMethod.java 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ObserverMethod.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -10,8 +10,8 @@
******************************************************************************/
package org.jboss.tools.cdi.internal.core.impl;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.ArrayList;
+import java.util.Collection;
import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.IObserverMethod;
@@ -28,8 +28,8 @@
return new InjectionPointParameter();
}
- public Set<IParameter> getObservedParameters() {
- Set<IParameter> result = new HashSet<IParameter>();
+ public Collection<IParameter> getObservedParameters() {
+ Collection<IParameter> result = new
ArrayList<IParameter>(parameters.size());
for (IParameter p: parameters) {
if(p.isAnnotationPresent(CDIConstants.OBSERVERS_ANNOTATION_TYPE_NAME)) result.add(p);
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/Parameter.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/Parameter.java 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/Parameter.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.cdi.internal.core.impl;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -99,10 +101,9 @@
return beanMethod;
}
- public Set<IQualifier> getQualifiers() {
- Set<IQualifier> result = new HashSet<IQualifier>();
- Set<String> as = getAnnotationTypes();
- for (String s: as) {
+ public Collection<IQualifier> getQualifiers() {
+ Collection<IQualifier> result = new ArrayList<IQualifier>();
+ for (String s: getAnnotationTypes()) {
IQualifier q = getCDIProject().getQualifier(s);
if (q != null) result.add(q);
}
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 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerField.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.internal.core.impl;
+import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@@ -63,8 +64,7 @@
AnnotationDeclaration d = getDefinition().getTypedAnnotation();
Set<IParametedType> all = getAllTypes();
if(d != null) {
- Set<ITypeDeclaration> ts = getRestrictedTypeDeclarations(all);
- result.addAll(ts);
+ result.addAll(getRestrictedTypeDeclarations(all));
ParametedType object = getObjectType(getBeanClass());
if(object != null) {
result.add(object);
@@ -85,7 +85,7 @@
return new HashSet<IParametedType>();
}
- public Set<ITypeDeclaration> getRestrictedTypeDeclaratios() {
+ public Collection<ITypeDeclaration> getRestrictedTypeDeclaratios() {
return getRestrictedTypeDeclarations(getAllTypes());
}
@@ -125,8 +125,7 @@
if(classBean != null &&
!getCDIProject().getAlternatives(classBean.getBeanClass().getFullyQualifiedName()).isEmpty())
{
return true;
}
- Set<IStereotypeDeclaration> ds = getStereotypeDeclarations();
- for (IStereotypeDeclaration d: ds) {
+ for (IStereotypeDeclaration d: getStereotypeDeclarations()) {
IStereotype s = d.getStereotype();
if(s != null && s.isAlternative() &&
!getCDIProject().getAlternatives(s.getSourceType().getFullyQualifiedName()).isEmpty()) {
return true;
@@ -146,9 +145,8 @@
if(!ds.isEmpty()) {
return ds.iterator().next().getScope();
}
- Set<IStereotypeDeclaration> ss = getStereotypeDeclarations();
Set<IScope> defaults = new HashSet<IScope>();
- for (IStereotypeDeclaration d: ss) {
+ for (IStereotypeDeclaration d: getStereotypeDeclarations()) {
IStereotype s = d.getStereotype();
IScope sc = s.getScope();
if(sc != null) {
@@ -175,8 +173,7 @@
if(getCDIProject().isTypeAlternative(getBeanClass().getFullyQualifiedName())) {
return true;
}
- Set<IStereotypeDeclaration> ds = getStereotypeDeclarations();
- for (IStereotypeDeclaration d: ds) {
+ for (IStereotypeDeclaration d: getStereotypeDeclarations()) {
IStereotype s = d.getStereotype();
if(s != null && s.isAlternative() &&
getCDIProject().isStereotypeAlternative(s.getSourceType().getFullyQualifiedName()) )
return true;
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 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/ProducerMethod.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.internal.core.impl;
+import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -89,8 +90,7 @@
AnnotationDeclaration d = getDefinition().getTypedAnnotation();
Set<IParametedType> all = getAllTypes();
if(d != null) {
- Set<ITypeDeclaration> ts = getRestrictedTypeDeclarations(all);
- result.addAll(ts);
+ result.addAll(getRestrictedTypeDeclarations(all));
ParametedType object = getObjectType(getBeanClass());
if(object != null) {
result.add(object);
@@ -111,7 +111,7 @@
return new HashSet<IParametedType>();
}
- public Set<ITypeDeclaration> getRestrictedTypeDeclaratios() {
+ public Collection<ITypeDeclaration> getRestrictedTypeDeclaratios() {
return getRestrictedTypeDeclarations(getAllTypes());
}
@@ -190,8 +190,7 @@
if(classBean != null &&
!getCDIProject().getAlternatives(classBean.getBeanClass().getFullyQualifiedName()).isEmpty())
{
return true;
}
- Set<IStereotypeDeclaration> ds = getStereotypeDeclarations();
- for (IStereotypeDeclaration d: ds) {
+ for (IStereotypeDeclaration d: getStereotypeDeclarations()) {
IStereotype s = d.getStereotype();
if(s != null && s.isAlternative() &&
!getCDIProject().getAlternatives(s.getSourceType().getFullyQualifiedName()).isEmpty()) {
return true;
@@ -212,9 +211,8 @@
if(!ds.isEmpty()) {
return ds.iterator().next().getScope();
}
- Set<IStereotypeDeclaration> ss = getStereotypeDeclarations();
Set<IScope> defaults = new HashSet<IScope>();
- for (IStereotypeDeclaration d: ss) {
+ for (IStereotypeDeclaration d: getStereotypeDeclarations()) {
IStereotype s = d.getStereotype();
IScope sc = s.getScope();
if(sc != null) {
@@ -241,8 +239,7 @@
if(getCDIProject().isTypeAlternative(getBeanClass().getFullyQualifiedName())) {
return true;
}
- Set<IStereotypeDeclaration> ds = getStereotypeDeclarations();
- for (IStereotypeDeclaration d: ds) {
+ for (IStereotypeDeclaration d: getStereotypeDeclarations()) {
IStereotype s = d.getStereotype();
if(s != null && s.isAlternative() &&
getCDIProject().isStereotypeAlternative(s.getSourceType().getFullyQualifiedName()) )
return true;
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeElement.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeElement.java 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/StereotypeElement.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.internal.core.impl;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@@ -54,7 +55,7 @@
* (non-Javadoc)
* @see org.jboss.tools.cdi.core.IInterceptorBinded#getInterceptorBindingDeclarations()
*/
- public Set<IInterceptorBindingDeclaration>
getInterceptorBindingDeclarations(boolean includeInherited) {
+ public Collection<IInterceptorBindingDeclaration>
getInterceptorBindingDeclarations(boolean includeInherited) {
return ClassBean.getInterceptorBindingDeclarations(definition);
}
@@ -62,7 +63,7 @@
* (non-Javadoc)
* @see org.jboss.tools.cdi.core.IInterceptorBinded#getInterceptorBindings()
*/
- public Set<IInterceptorBinding> getInterceptorBindings() {
+ public Collection<IInterceptorBinding> getInterceptorBindings() {
return CDIUtil.getAllInterceptorBindings(this);
}
@@ -70,7 +71,7 @@
* (non-Javadoc)
* @see org.jboss.tools.cdi.core.IStereotype#getStereotypeDeclarations()
*/
- public Set<IStereotypeDeclaration> getStereotypeDeclarations() {
+ public Collection<IStereotypeDeclaration> getStereotypeDeclarations() {
Set<IStereotypeDeclaration> result = new
HashSet<IStereotypeDeclaration>();
for (IAnnotationDeclaration d: definition.getAnnotations()) {
if(d instanceof IStereotypeDeclaration) {
@@ -86,8 +87,7 @@
*/
public boolean isAlternative() {
if(getAlternativeDeclaration() != null) return true;
- Set<IStereotypeDeclaration> ds = getStereotypeDeclarations();
- for (IStereotypeDeclaration d: ds) {
+ for (IStereotypeDeclaration d: getStereotypeDeclarations()) {
IStereotype s = d.getStereotype();
if(s != null && s.isAlternative()) return true;
}
@@ -103,8 +103,7 @@
if(!ss.isEmpty()) {
return ss.iterator().next().getScope();
}
- Set<IStereotypeDeclaration> ds = getStereotypeDeclarations();
- for (IStereotypeDeclaration d: ds) {
+ for (IStereotypeDeclaration d: getStereotypeDeclarations()) {
IStereotype s = d.getStereotype();
IScope result = s.getScope();
if(result != null) {
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/MethodDefinition.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/MethodDefinition.java 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/MethodDefinition.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -12,7 +12,7 @@
import java.util.ArrayList;
-import java.util.HashSet;
+import java.util.Collection;
import java.util.List;
import java.util.Set;
@@ -107,10 +107,9 @@
return super.isCDIAnnotated() || isDisposer() || isObserver() || getPreDestroyMethod()
!= null || getPostConstructorMethod() != null || !getInterceptorBindings().isEmpty() ||
hasStereotypeDeclarations();
}
- public Set<IInterceptorBinding> getInterceptorBindings() {
- Set<IInterceptorBinding> result = new HashSet<IInterceptorBinding>();
- Set<IInterceptorBindingDeclaration> declarations =
ClassBean.getInterceptorBindingDeclarations(this);
- for (IInterceptorBindingDeclaration declaration: declarations) {
+ public Collection<IInterceptorBinding> getInterceptorBindings() {
+ Collection<IInterceptorBinding> result = new
ArrayList<IInterceptorBinding>();
+ for (IInterceptorBindingDeclaration declaration:
ClassBean.getInterceptorBindingDeclarations(this)) {
result.add(declaration.getInterceptorBinding());
}
return result;
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIMarkerResolutionUtils.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIMarkerResolutionUtils.java 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIMarkerResolutionUtils.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -11,6 +11,7 @@
package org.jboss.tools.cdi.internal.core.refactoring;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -136,8 +137,7 @@
private static List<IQualifier> findQualifiersToDelete(IInjectionPoint
injectionPoint, List<ValuedQualifier> qualifiers){
ArrayList<IQualifier> list = new ArrayList<IQualifier>();
- Set<IQualifierDeclaration> declarations =
injectionPoint.getQualifierDeclarations();
- for(IQualifierDeclaration declaration : declarations){
+ for(IQualifierDeclaration declaration : injectionPoint.getQualifierDeclarations()){
if(!contains(declaration, qualifiers))
list.add(declaration.getQualifier());
}
@@ -280,8 +280,7 @@
private static boolean isBeanContainQualifier(IBean bean, ValuedQualifier
valuedQualifier){
- Set<IQualifier> qualifiers = bean.getQualifiers();
- for(IQualifier q : qualifiers){
+ for(IQualifier q : bean.getQualifiers()){
IQualifierDeclaration declaration =
CDIMarkerResolutionUtils.findQualifierDeclaration(bean, q);
ValuedQualifier vq = null;
if(declaration != null){
@@ -297,7 +296,7 @@
}
public static IQualifierDeclaration findQualifierDeclaration(IBean bean, IQualifier
qualifier){
- Set<IQualifierDeclaration> declarations = bean.getQualifierDeclarations();
+ Collection<IQualifierDeclaration> declarations =
bean.getQualifierDeclarations();
if(declarations == null)
return null;
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIRefactoringProcessor.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIRefactoringProcessor.java 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIRefactoringProcessor.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -63,9 +63,7 @@
if(cdiProject == null)
return null;
- Set<IBean> beans = cdiProject.getBeans(file.getFullPath());
-
- for(IBean bean : beans){
+ for(IBean bean : cdiProject.getBeans(file.getFullPath())) {
if(bean instanceof IClassBean)
return (IClassBean)bean;
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/DeleteAllDisposerAnnotationsProcessor.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/DeleteAllDisposerAnnotationsProcessor.java 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/DeleteAllDisposerAnnotationsProcessor.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -10,7 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.internal.core.refactoring;
-import java.util.HashSet;
+import java.util.Collection;
import java.util.Set;
import org.eclipse.core.resources.IFile;
@@ -39,18 +39,14 @@
}
private void changeDisposers(IClassBean bean) throws JavaModelException {
- Set<IBeanMethod> disposers = bean.getDisposers();
- if (disposers.isEmpty()) {
+ if (bean.getDisposers().isEmpty()) {
return;
}
- Set<IBeanMethod> boundDisposers = new HashSet<IBeanMethod>();
- Set<IProducer> producers = bean.getProducers();
- for (IProducer producer : producers) {
+ for (IProducer producer : bean.getProducers()) {
if (producer instanceof IProducerMethod) {
IProducerMethod producerMethod = (IProducerMethod) producer;
- Set<IBeanMethod> disposerMethods =
producer.getCDIProject().resolveDisposers(producerMethod);
- boundDisposers.addAll(disposerMethods);
+ Collection<IBeanMethod> disposerMethods =
producer.getCDIProject().resolveDisposers(producerMethod);
ICompilationUnit original = producerMethod.getMethod().getCompilationUnit();
ICompilationUnit compilationUnit = original.getWorkingCopy(new
NullProgressMonitor());
for (IBeanMethod disposerMethod : disposerMethods) {
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/DeleteAllInjectedConstructorsProcessor.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/DeleteAllInjectedConstructorsProcessor.java 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/DeleteAllInjectedConstructorsProcessor.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.cdi.internal.core.refactoring;
+import java.util.Collection;
import java.util.Set;
import org.eclipse.core.resources.IFile;
@@ -36,7 +37,7 @@
}
private void changeConstructors(IClassBean bean) throws JavaModelException {
- Set<IBeanMethod> constructors = bean.getBeanConstructors();
+ Collection<IBeanMethod> constructors = bean.getBeanConstructors();
if(constructors.size()>1) {
ICompilationUnit original =
constructors.iterator().next().getMethod().getCompilationUnit();
ICompilationUnit compilationUnit = original.getWorkingCopy(new
NullProgressMonitor());
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/AnnotationValidationDelegate.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/AnnotationValidationDelegate.java 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/AnnotationValidationDelegate.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -11,7 +11,7 @@
package org.jboss.tools.cdi.internal.core.validation;
-import java.util.Set;
+import java.util.Collection;
import org.eclipse.core.resources.IResource;
import org.eclipse.jdt.core.JavaModelException;
@@ -78,8 +78,7 @@
* - Stereotypes declared @Target(TYPE) may not be applied to stereotypes declared
@Target({TYPE, METHOD, FIELD}),
* @Target(METHOD), @Target(FIELD) or @Target({METHOD, FIELD}).
*/
- Set<IStereotypeDeclaration> stereotypes =
stereotype.getStereotypeDeclarations();
- for (IStereotypeDeclaration stereotypeDeclaration : stereotypes) {
+ for (IStereotypeDeclaration stereotypeDeclaration :
stereotype.getStereotypeDeclarations()) {
IStereotype superStereotype = stereotypeDeclaration.getStereotype();
if(superStereotype!=null) {
Boolean result = CDIUtil.checkTargetAnnotation(superStereotype, TYPE_VARIANTS);
@@ -112,7 +111,7 @@
* 9.1.2. Interceptor bindings for stereotypes
* - If a stereotype declares interceptor bindings, it must be defined as
@Target(TYPE).
*/
- Set<IInterceptorBindingDeclaration> interceptorBindingDeclarations =
stereotype.getInterceptorBindingDeclarations(false);
+ Collection<IInterceptorBindingDeclaration> interceptorBindingDeclarations =
stereotype.getInterceptorBindingDeclarations(false);
if(!interceptorBindingDeclarations.isEmpty() &&
!CDIUtil.checkTargetAnnotation(target, TYPE_VARIANTS)) {
StringBuffer bindings = new StringBuffer();
boolean first = true;
@@ -135,7 +134,7 @@
* - Interceptor binding types declared @Target(TYPE) may not be applied to interceptor
binding types declared
* @Target({TYPE, METHOD}).
*/
- Set<IInterceptorBindingDeclaration> declarations =
binding.getInterceptorBindingDeclarations(false);
+ Collection<IInterceptorBindingDeclaration> declarations =
binding.getInterceptorBindingDeclarations(false);
if(!declarations.isEmpty()) {
IAnnotationDeclaration target =
binding.getAnnotationDeclaration(CDIConstants.TARGET_ANNOTATION_TYPE_NAME);
if(target!=null) {
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 2012-08-15
23:42:28 UTC (rev 43050)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2012-08-16
00:09:09 UTC (rev 43051)
@@ -449,8 +449,7 @@
}
}
- Set<String> scopes = rootCdiProject.getScopeNames();
- for (String scopeName: scopes) {
+ for (String scopeName: rootCdiProject.getScopeNames()) {
IScope scope = rootCdiProject.getScope(scopeName);
IResource resource = scope.getResource();
if(shouldValidateResourceOfElement(resource) && notValidatedYet(resource)) {
@@ -562,7 +561,7 @@
beansXmlValidator.validateBeansXml(context, file);
}
} else {
- Set<IBean> beans = cdiProject.getBeans(file.getFullPath());
+ Collection<IBean> beans = cdiProject.getBeans(file.getFullPath());
for (IBean bean : beans) {
validateBean(context, bean);
}
@@ -643,7 +642,7 @@
String beanPath = null;
if(!isAsYouTypeValidation()) {
beanPath = bean.getResource().getFullPath().toOSString();
- Set<IScopeDeclaration> scopeDeclarations = bean.getScopeDeclarations();
+ Collection<IScopeDeclaration> scopeDeclarations = bean.getScopeDeclarations();
for (IScopeDeclaration scopeDeclaration : scopeDeclarations) {
IScope scope = scopeDeclaration.getScope();
if (shouldValidateType(scope.getSourceType())) {
@@ -651,7 +650,7 @@
}
}
addLinkedStereotypes(beanPath, bean);
- Set<IQualifierDeclaration> qualifierDeclarations =
bean.getQualifierDeclarations();
+ Collection<IQualifierDeclaration> qualifierDeclarations =
bean.getQualifierDeclarations();
for (IQualifierDeclaration qualifierDeclaration : qualifierDeclarations) {
IQualifier qualifier = qualifierDeclaration.getQualifier();
if (shouldValidateType(qualifier.getSourceType())) {
@@ -669,7 +668,7 @@
validateProducer(context, (IProducer) bean);
}
- Set<IInjectionPoint> points = bean.getInjectionPoints();
+ Collection<IInjectionPoint> points = bean.getInjectionPoints();
for (IInjectionPoint point : points) {
if(!isAsYouTypeValidation()) {
IType type = getTypeOfInjection(point);
@@ -694,7 +693,7 @@
IClassBean classBean = (IClassBean)bean;
if(!isAsYouTypeValidation()) {
addLinkedInterceptorBindings(beanPath, classBean);
- Set<IBeanMethod> methods = classBean.getAllMethods();
+ Collection<IBeanMethod> methods = classBean.getAllMethods();
for (IBeanMethod method : methods) {
addLinkedStereotypes(beanPath, method);
addLinkedInterceptorBindings(beanPath, method);
@@ -727,7 +726,7 @@
* Suppose two beans are both available for injection in a certain war, and
either:
* • the two beans have the same EL name and the name is not resolvable, or
*/
- Set<IBean> beans = context.getCdiProject().getBeans(name, true);
+ Collection<IBean> beans = context.getCdiProject().getBeans(name, true);
if(beans.size()>1 && beans.contains(bean)) {
ITextSourceReference reference = bean.getNameLocation(true);
Set<String> names = new HashSet<String>();
@@ -760,7 +759,7 @@
xName.append(st.nextToken());
if(st.hasMoreTokens()) {
String xNameAsString = xName.toString();
- Set<IBean> xBeans = context.getCdiProject().getBeans(xNameAsString, true);
+ Collection<IBean> xBeans = context.getCdiProject().getBeans(xNameAsString,
true);
if(!xBeans.isEmpty()) {
String yName = name.substring(xNameAsString.length()+1);
IStatus status = JavaConventions.validateJavaTypeName(yName,
CompilerOptions.VERSION_1_6, CompilerOptions.VERSION_1_6);
@@ -793,7 +792,7 @@
* Returns set of EL names which are declared in the resource
*/
private Set<String> getELNamesByResource(CDIValidationContext context, IPath
resourcePath) {
- Set<IBean> beans = context.getCdiProject().getBeans(resourcePath);
+ Collection<IBean> beans = context.getCdiProject().getBeans(resourcePath);
if(beans.isEmpty()) {
return Collections.emptySet();
}
@@ -821,8 +820,7 @@
private void addLinkedStereotypes(String beanPath, IStereotyped stereotyped) {
if(!isAsYouTypeValidation()) {
- Set<IStereotypeDeclaration> stereotypeDeclarations =
stereotyped.getStereotypeDeclarations();
- for (IStereotypeDeclaration stereotypeDeclaration : stereotypeDeclarations) {
+ for (IStereotypeDeclaration stereotypeDeclaration :
stereotyped.getStereotypeDeclarations()) {
IStereotype stereotype = stereotypeDeclaration.getStereotype();
if (shouldValidateType(stereotype.getSourceType())) {
getValidationContext().addLinkedCoreResource(SHORT_ID, beanPath,
stereotype.getResource().getFullPath(), false);
@@ -833,8 +831,7 @@
private void addLinkedInterceptorBindings(String beanPath, IInterceptorBinded binded) {
if(!isAsYouTypeValidation()) {
- Set<IInterceptorBindingDeclaration> bindingDeclarations =
CDIUtil.getAllInterceptorBindingDeclaratios(binded);
- for (IInterceptorBindingDeclaration bindingDeclaration : bindingDeclarations) {
+ for (IInterceptorBindingDeclaration bindingDeclaration :
CDIUtil.getAllInterceptorBindingDeclaratios(binded)) {
IInterceptorBinding binding = bindingDeclaration.getInterceptorBinding();
if (shouldValidateType(binding.getSourceType())) {
getValidationContext().addLinkedCoreResource(SHORT_ID, beanPath,
binding.getResource().getFullPath(), false);
@@ -871,8 +868,7 @@
ITextSourceReference reference =
CDIUtil.convertToSourceReference(bean.getBeanClass().getNameRange(), bean.getResource(),
bean.getBeanClass());
addProblem(CDIValidationMessages.CONFLICTING_INTERCEPTOR_BINDINGS,
CDIPreferences.CONFLICTING_INTERCEPTOR_BINDINGS, reference, bean.getResource());
}
- Set<IBeanMethod> methods = bean.getAllMethods();
- for (IBeanMethod method : methods) {
+ for (IBeanMethod method : bean.getAllMethods()) {
if(hasConflictedInterceptorBindings(method)) {
//TODO consider putting markers to interceptor bindings/stereotype declarations.
ITextSourceReference reference =
CDIUtil.convertToSourceReference(method.getMethod().getNameRange(), bean.getResource(),
method.getMethod());
@@ -887,7 +883,7 @@
}
private boolean hasConflictedInterceptorBindings(IInterceptorBinded binded) throws
CoreException {
- Set<IInterceptorBindingDeclaration> declarations =
CDIUtil.getAllInterceptorBindingDeclaratios(binded);
+ Collection<IInterceptorBindingDeclaration> declarations =
CDIUtil.getAllInterceptorBindingDeclaratios(binded);
if(declarations.size()>1) {
Map<String, String> keys = new HashMap<String, String>();
for (IInterceptorBindingDeclaration declaration : declarations) {
@@ -936,18 +932,13 @@
* 4.3.1. Direct and indirect specialization
* - X specializes Y but does not have some bean type of Y
*/
- Set<IParametedType> beanTypes = bean.getLegalTypes();
- Set<IParametedType> specializingBeanTypes = specializedBean.getLegalTypes();
+ Set<String> legalTypes = new HashSet<String>();
+ for (IParametedType type : bean.getLegalTypes()) {
+ if(type.getType() != null) legalTypes.add(type.getType().getFullyQualifiedName());
+ }
StringBuffer missingTypes = new StringBuffer();
- for (IParametedType specializingType : specializingBeanTypes) {
- boolean found = false;
- for (IParametedType type : beanTypes) {
- if(specializingType.getType().getFullyQualifiedName().equals(type.getType().getFullyQualifiedName()))
{
- found = true;
- break;
- }
- }
- if(!found) {
+ for (IParametedType specializingType : specializedBean.getLegalTypes()) {
+ if(!legalTypes.contains(specializingType.getType().getFullyQualifiedName())) {
if(missingTypes.length()>0) {
missingTypes.append(", ");
}
@@ -1004,9 +995,9 @@
}
private void validateConstructors(IClassBean bean) {
- Set<IBeanMethod> constructors = bean.getBeanConstructors();
+ Collection<IBeanMethod> constructors = bean.getBeanConstructors();
if(constructors.size()>1) {
- Set<IAnnotationDeclaration> injects = new
HashSet<IAnnotationDeclaration>();
+ Collection<IAnnotationDeclaration> injects = new
ArrayList<IAnnotationDeclaration>();
for (IBeanMethod constructor : constructors) {
IAnnotationDeclaration inject =
constructor.getAnnotation(CDIConstants.INJECT_ANNOTATION_TYPE_NAME);
if(inject!=null) {
@@ -1026,7 +1017,7 @@
}
private void validateObserves(IClassBean bean) {
- Set<IBeanMethod> observes = bean.getAllMethods();
+ Collection<IBeanMethod> observes = bean.getAllMethods();
if (observes.isEmpty()) {
return;
}
@@ -1035,7 +1026,7 @@
continue;
}
List<IParameter> params = observer.getParameters();
- Set<ITextSourceReference> declarations = new
HashSet<ITextSourceReference>();
+ Collection<ITextSourceReference> declarations = new
ArrayList<ITextSourceReference>();
for (IParameter param : params) {
ITextSourceReference declaration =
param.getAnnotationPosition(CDIConstants.OBSERVERS_ANNOTATION_TYPE_NAME);
if (declaration != null) {
@@ -1114,17 +1105,16 @@
}
private void validateDisposers(IClassBean bean) {
- Set<IBeanMethod> disposers = bean.getDisposers();
+ Collection<IBeanMethod> disposers = bean.getDisposers();
if (disposers.isEmpty()) {
return;
}
Set<IBeanMethod> boundDisposers = new HashSet<IBeanMethod>();
- Set<IProducer> producers = bean.getProducers();
- for (IProducer producer : producers) {
+ for (IProducer producer : bean.getProducers()) {
if (producer instanceof IProducerMethod && producer.exists()) {
IProducerMethod producerMethod = (IProducerMethod) producer;
- Set<IBeanMethod> disposerMethods =
producer.getCDIProject().resolveDisposers(producerMethod);
+ Collection<IBeanMethod> disposerMethods =
producer.getCDIProject().resolveDisposers(producerMethod);
boundDisposers.addAll(disposerMethods);
if (disposerMethods.size() > 1) {
/*
@@ -1151,7 +1141,7 @@
* 3.3.6. Declaring a disposer method
* - method has more than one parameter annotated @Disposes
*/
- Set<ITextSourceReference> disposerDeclarations = new
HashSet<ITextSourceReference>();
+ Collection<ITextSourceReference> disposerDeclarations = new
ArrayList<ITextSourceReference>();
for (IParameter param : params) {
ITextSourceReference declaration =
param.getAnnotationPosition(CDIConstants.DISPOSES_ANNOTATION_TYPE_NAME);
if (declaration != null && param.exists()) {
@@ -1171,7 +1161,7 @@
* 10.4.2. Declaring an observer method
* - a observer method has a parameter annotated @Disposes.
*/
- Set<ITextSourceReference> declarations = new
HashSet<ITextSourceReference>();
+ Collection<ITextSourceReference> declarations = new
ArrayList<ITextSourceReference>();
boolean observesExists = false;
declarations.addAll(disposerDeclarations);
for (IParameter param : params) {
@@ -1276,7 +1266,7 @@
* @param annotatedParams
* @param errorKey
*/
- private void validateSessionBeanMethod(IClassBean bean, IBeanMethod method,
Set<ITextSourceReference> annotatedParams, String errorMessage, String
preferencesKey, int id) {
+ private void validateSessionBeanMethod(IClassBean bean, IBeanMethod method,
Collection<ITextSourceReference> annotatedParams, String errorMessage, String
preferencesKey, int id) {
if (bean instanceof ISessionBean && annotatedParams != null) {
IMethod iMethod = CDIUtil.getBusinessMethodDeclaration((SessionBean)bean, method);
if(iMethod==null) {
@@ -1295,7 +1285,7 @@
private void validateProducer(CDIValidationContext context, IProducer producer) {
try {
- Set<ITypeDeclaration> typeDeclarations = producer.getAllTypeDeclarations();
+ Collection<ITypeDeclaration> typeDeclarations =
producer.getAllTypeDeclarations();
String[] typeVariables = producer.getBeanClass().getTypeParameterSignatures();
ITypeDeclaration typeDeclaration = null;
ITextSourceReference typeDeclarationReference = null;
@@ -1399,10 +1389,13 @@
} else {
IProducerMethod producerMethod = (IProducerMethod) producer;
List<IParameter> params = producerMethod.getParameters();
- Set<ITextSourceReference> observesDeclarations = new
HashSet<ITextSourceReference>();
- Set<ITextSourceReference> disposalDeclarations = new
HashSet<ITextSourceReference>();
- observesDeclarations.add(producerMethod.getAnnotation(CDIConstants.PRODUCES_ANNOTATION_TYPE_NAME));
- disposalDeclarations.add(producerMethod.getAnnotation(CDIConstants.PRODUCES_ANNOTATION_TYPE_NAME));
+ Collection<ITextSourceReference> observesDeclarations = new
ArrayList<ITextSourceReference>();
+ Collection<ITextSourceReference> disposalDeclarations = new
ArrayList<ITextSourceReference>();
+ IAnnotationDeclaration producesDeclaration =
producerMethod.getAnnotation(CDIConstants.PRODUCES_ANNOTATION_TYPE_NAME);
+ if(producesDeclaration != null) {
+ observesDeclarations.add(producesDeclaration);
+ disposalDeclarations.add(producesDeclaration);
+ }
for (IParameter param : params) {
/*
* 3.3.6. Declaring a disposer method
@@ -1494,7 +1487,7 @@
}
}
} else {
- Set<IBean> beans =
context.getCdiProject().getBeans(superType.getResource().getFullPath());
+ Collection<IBean> beans =
context.getCdiProject().getBeans(superType.getResource().getFullPath());
for (IBean iBean : beans) {
if(iBean instanceof IProducerMethod) {
IProducerMethod prMethod = (IProducerMethod)iBean;
@@ -1540,8 +1533,7 @@
private void saveAllSuperTypesAsLinkedResources(IClassBean bean) {
if(!isAsYouTypeValidation()) {
- Set<IParametedType> types = bean.getAllTypes();
- for (IParametedType type : types) {
+ for (IParametedType type : bean.getAllTypes()) {
IType superType = type.getType();
if(superType!=null && !superType.isBinary() &&
superType.getResource()!=null && superType!=bean.getBeanClass()) {
getValidationContext().addLinkedCoreResource(SHORT_ID,
bean.getSourcePath().toOSString(), superType.getResource().getFullPath(), false);
@@ -1584,14 +1576,11 @@
public void collectAllRelatedInjectionsForBean(IFile validatingResource,
Set<IPath> relatedResources) {
CDIValidationContext context = getCDIContext(validatingResource);
ICDIProject cdiProject = context.getCdiProject();
- Set<IBean> beans = cdiProject.getBeans(validatingResource.getFullPath());
- for (IBean bean : beans) {
- Set<IParametedType> types = bean.getAllTypes();
- for (IParametedType type : types) {
+ for (IBean bean : cdiProject.getBeans(validatingResource.getFullPath())) {
+ for (IParametedType type : bean.getAllTypes()) {
IType superType = type.getType();
if(superType!=null) {
- Set<IInjectionPoint> injections =
cdiProject.getInjections(superType.getFullyQualifiedName());
- for (IInjectionPoint injection : injections) {
+ for (IInjectionPoint injection :
cdiProject.getInjections(superType.getFullyQualifiedName())) {
if(!injection.getClassBean().getBeanClass().isBinary() &&
injection.getClassBean()!=bean) {
relatedResources.add(injection.getResource().getFullPath());
}
@@ -1608,8 +1597,7 @@
* @return
*/
private boolean shouldIgnoreInjection(CDIValidationContext context, IType
typeOfInjectionPoint, IInjectionPoint injection) {
- Set<IInjectionPointValidatorFeature> injectionValidationFeatures =
context.getInjectionValidationFeatures();
- for (IInjectionPointValidatorFeature feature : injectionValidationFeatures) {
+ for (IInjectionPointValidatorFeature feature :
context.getInjectionValidationFeatures()) {
if(feature.shouldIgnoreInjection(typeOfInjectionPoint, injection)) {
return true;
}
@@ -1618,8 +1606,7 @@
}
private void validateInitializers(IClassBean bean) {
- Set<IInitializerMethod> initializers = bean.getInitializers();
- for (IInitializerMethod initializer: initializers) {
+ for (IInitializerMethod initializer: bean.getInitializers()) {
validateInitializerMethod(initializer);
}
}
@@ -1689,7 +1676,7 @@
}
if(declaration!=null) {
- Set<IBean> beans = cdiProject.getBeans(true, injection);
+ Collection<IBean> beans = cdiProject.getBeans(true, injection);
ITextSourceReference reference = injection instanceof
IInjectionPointParameter?injection:declaration;
/*
* 5.2.1. Unsatisfied and ambiguous dependencies
@@ -1699,8 +1686,7 @@
if(!shouldIgnoreInjection(context, type, injection)) {
boolean instance = type!=null &&
CDIConstants.INSTANCE_TYPE_NAME.equals(type.getFullyQualifiedName());
if(!isAsYouTypeValidation()) {
- Set<IBean> allBeans = cdiProject.getBeans(false, injection);
- for (IBean bean : allBeans) {
+ for (IBean bean : cdiProject.getBeans(false, injection)) {
if(shouldValidateType(bean.getBeanClass())) {
try {
getValidationContext().addLinkedCoreResource(SHORT_ID,
injection.getSourcePath().toOSString(), bean.getResource().getFullPath(), false);
@@ -1839,7 +1825,7 @@
private void validateNormalBeanScope(IBean bean) {
if(bean.getScope()!=null && bean.getScope().isNorlmalScope()) {
ITextSourceReference reference = null;
- Set<IScopeDeclaration> scopes = bean.getScopeDeclarations();
+ Collection<IScopeDeclaration> scopes = bean.getScopeDeclarations();
if(!scopes.isEmpty()) {
reference = scopes.iterator().next();
} else {
@@ -2075,7 +2061,7 @@
* - managed bean has a class level interceptor binding and is declared final or has
a non-static, non-private, final method
* - non-static, non-private, final method of a managed bean has a method level
interceptor binding
*/
- Set<IInterceptorBinding> bindings = bean.getInterceptorBindings();
+ Collection<IInterceptorBinding> bindings = bean.getInterceptorBindings();
if(!bindings.isEmpty()) {
if(Flags.isFinal(bean.getBeanClass().getFlags())) {
ITextSourceReference reference =
CDIUtil.convertToSourceReference(bean.getBeanClass().getNameRange(), bean.getResource(),
bean.getBeanClass());
@@ -2091,8 +2077,7 @@
}
}
} else {
- Set<IBeanMethod> beanMethods = bean.getAllMethods();
- for (IBeanMethod method : beanMethods) {
+ for (IBeanMethod method : bean.getAllMethods()) {
if(!method.getInterceptorBindings().isEmpty()) {
if(Flags.isFinal(bean.getBeanClass().getFlags())) {
ITextSourceReference reference =
CDIUtil.convertToSourceReference(bean.getBeanClass().getNameRange(), bean.getResource(),
bean.getBeanClass());
@@ -2121,8 +2106,7 @@
boolean passivatingScope = "true".equalsIgnoreCase("" +
normalScopeDeclaration.getMemberValue("passivating"));
if(passivatingScope) {
boolean passivatingCapable = false;
- Set<IParametedType> supers = bean.getAllTypes();
- for (IParametedType type : supers) {
+ for (IParametedType type : bean.getAllTypes()) {
if("java.io.Serializable".equals(type.getType().getFullyQualifiedName()))
{
passivatingCapable = true;
break;
@@ -2180,15 +2164,14 @@
* 3.4.2. Declaring a producer field
* - interceptor has a field annotated @Produces
*/
- Set<IProducer> producers = interceptor.getProducers();
- for (IProducer producer : producers) {
+ for (IProducer producer : interceptor.getProducers()) {
addProblem(CDIValidationMessages.PRODUCER_IN_INTERCEPTOR,
CDIPreferences.PRODUCER_IN_INTERCEPTOR_OR_DECORATOR, producer.getProducesAnnotation(),
interceptor.getResource(), PRODUCER_IN_INTERCEPTOR_ID);
}
/*
* 9.2. Declaring the interceptor bindings of an interceptor
* - interceptor declared using @Interceptor does not declare any interceptor binding
(Non-Portable behavior)
*/
- Set<IInterceptorBinding> bindings = interceptor.getInterceptorBindings();
+ Collection<IInterceptorBinding> bindings = interceptor.getInterceptorBindings();
if(bindings.isEmpty()) {
ITextSourceReference declaration =
interceptor.getAnnotation(CDIConstants.INTERCEPTOR_ANNOTATION_TYPE_NAME);
if(declaration!=null) {
@@ -2207,8 +2190,7 @@
if(value instanceof Object[]) {
Object[] values = (Object[]) value;
if(values.length>1) {
- Set<IBeanMethod> methods = interceptor.getAllMethods();
- for (IBeanMethod method : methods) {
+ for (IBeanMethod method : interceptor.getAllMethods()) {
if(method.isLifeCycleCallbackMethod()) {
ITextSourceReference declaration = CDIUtil.getAnnotationDeclaration(interceptor,
binding);
if(declaration==null) {
@@ -2268,15 +2250,13 @@
* 3.4.2. Declaring a producer field
* - decorator has a field annotated @Produces
*/
- Set<IProducer> producers = decorator.getProducers();
- for (IProducer producer : producers) {
+ for (IProducer producer : decorator.getProducers()) {
addProblem(CDIValidationMessages.PRODUCER_IN_DECORATOR,
CDIPreferences.PRODUCER_IN_INTERCEPTOR_OR_DECORATOR, producer.getProducesAnnotation(),
decorator.getResource(), PRODUCER_IN_DECORATOR_ID);
}
- Set<IInjectionPoint> injections = decorator.getInjectionPoints(true);
Set<ITextSourceReference> delegates = new HashSet<ITextSourceReference>();
IInjectionPoint delegate = null;
- for (IInjectionPoint injection : injections) {
+ for (IInjectionPoint injection : decorator.getInjectionPoints(true)) {
ITextSourceReference delegateAnnotation = injection.getDelegateAnnotation();
if(delegateAnnotation!=null) {
if(injection instanceof IInjectionPointField) {
@@ -2324,12 +2304,11 @@
IType delegateType = delegateParametedType.getType();
if(delegateType != null) {
if(!checkTheOnlySuper(context, decorator, delegateParametedType)) {
- Set<IParametedType> decoratedParametedTypes = decorator.getDecoratedTypes();
List<String> supers = null;
if(!isAsYouTypeValidation() && shouldValidateType(delegateType)) {
getValidationContext().addLinkedCoreResource(SHORT_ID,
decorator.getResource().getFullPath().toOSString(),
delegateType.getResource().getFullPath(), false);
}
- for (IParametedType decoratedParametedType : decoratedParametedTypes) {
+ for (IParametedType decoratedParametedType : decorator.getDecoratedTypes()) {
IType decoratedType = decoratedParametedType.getType();
if(decoratedType==null) {
continue;
@@ -2394,9 +2373,8 @@
}
private List<String> getSuppers(IParametedType type) {
- Set<IParametedType> types = ((ParametedType)type).getAllTypes();
List<String> signatures = new ArrayList<String>();
- for (IParametedType superType : types) {
+ for (IParametedType superType : ((ParametedType)type).getAllTypes()) {
signatures.add(superType.getSignature());
}
signatures.add(type.getSignature());
@@ -2408,33 +2386,27 @@
* - 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
*/
private void validateTyped(IBean bean) {
- Set<ITypeDeclaration> typedDeclarations = bean.getRestrictedTypeDeclaratios();
+ Collection<ITypeDeclaration> typedDeclarations =
bean.getRestrictedTypeDeclaratios();
if (!typedDeclarations.isEmpty()) {
- Set<IParametedType> allTypes = bean.getAllTypes();
+ Set<String> allTypeNames = new HashSet<String>();
+ for (IParametedType type : bean.getAllTypes()) {
+ if(type.getType() != null) allTypeNames.add(type.getType().getFullyQualifiedName());
+ }
for (ITypeDeclaration typedDeclaration : typedDeclarations) {
IType typedType = typedDeclaration.getType();
- if (typedType != null) {
- boolean typeWasFound = false;
- for (IParametedType type : allTypes) {
- if (type != null &&
typedType.getFullyQualifiedName().equals(type.getType().getFullyQualifiedName())) {
- typeWasFound = true;
- break;
- }
- }
- if (!typeWasFound) {
- IMember e = bean instanceof IJavaReference ?
((IJavaReference)bean).getSourceMember() : bean.getBeanClass();
- ITextSourceReference typedDeclarationReference =
CDIUtil.convertToJavaSourceReference(typedDeclaration, e);
+ if (typedType != null &&
!allTypeNames.contains(typedType.getFullyQualifiedName())) {
+ IMember e = bean instanceof IJavaReference ?
((IJavaReference)bean).getSourceMember() : bean.getBeanClass();
+ ITextSourceReference typedDeclarationReference =
CDIUtil.convertToJavaSourceReference(typedDeclaration, e);
- String message = CDIValidationMessages.ILLEGAL_TYPE_IN_TYPED_DECLARATION;
- addProblem(message, CDIPreferences.ILLEGAL_TYPE_IN_TYPED_DECLARATION,
typedDeclarationReference, bean.getResource());
- }
+ String message = CDIValidationMessages.ILLEGAL_TYPE_IN_TYPED_DECLARATION;
+ addProblem(message, CDIPreferences.ILLEGAL_TYPE_IN_TYPED_DECLARATION,
typedDeclarationReference, bean.getResource());
}
}
}
}
private void validateBeanScope(IBean bean) {
- Set<IScopeDeclaration> scopes = bean.getScopeDeclarations();
+ Collection<IScopeDeclaration> scopes = bean.getScopeDeclarations();
// 2.4.3. Declaring the bean scope
// - bean class or producer method or field specifies multiple scope type
annotations
//
@@ -2457,7 +2429,7 @@
// Such bean definitions are invalid because they declares two
// stereotypes that have different default scopes and the bean does not
// explictly define a scope to resolve the conflict.
- Set<IStereotypeDeclaration> stereotypeDeclarations =
bean.getStereotypeDeclarations();
+ Collection<IStereotypeDeclaration> stereotypeDeclarations =
bean.getStereotypeDeclarations();
if (!stereotypeDeclarations.isEmpty() && scopes.isEmpty()) {
Map<String, IStereotypeDeclaration> declarationMap = new HashMap<String,
IStereotypeDeclaration>();
for (IStereotypeDeclaration stereotypeDeclaration : stereotypeDeclarations) {
@@ -2549,7 +2521,7 @@
// 2.7.1.1. Declaring the default scope for a stereotype
// - stereotype declares more than one scope
- Set<IScopeDeclaration> scopeDeclarations = stereotype.getScopeDeclarations();
+ Collection<IScopeDeclaration> scopeDeclarations =
stereotype.getScopeDeclarations();
if (scopeDeclarations.size() > 1) {
for (IScopeDeclaration scope : scopeDeclarations) {
addProblem(CDIValidationMessages.STEREOTYPE_DECLARES_MORE_THAN_ONE_SCOPE,
CDIPreferences.STEREOTYPE_DECLARES_MORE_THAN_ONE_SCOPE, scope, stereotype.getResource());