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

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Sep 13 16:39:41 EDT 2012


Author: scabanovich
Date: 2012-09-13 16:39:41 -0400 (Thu, 13 Sep 2012)
New Revision: 43669

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/definition/AbstractMemberDefinition.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationDefinition.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationMemberDefinition.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/BeanMemberDefinition.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/impl/definition/ParameterDefinition.java
   trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java
Log:
JBIDE-12446
https://issues.jboss.org/browse/JBIDE-12446
field access is replaced by method call.

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-09-13 20:21:38 UTC (rev 43668)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/Parameter.java	2012-09-13 20:39:41 UTC (rev 43669)
@@ -87,10 +87,6 @@
 		return getDefinition().getVariable();
 	}
 
-	public Collection<String> getAnnotationTypes() {
-		return getDefinition().getAnnotationTypes();
-	}
-
 	/*
 	 * (non-Javadoc)
 	 * @see org.jboss.tools.cdi.core.IParameter#getBeanMethod()
@@ -101,9 +97,11 @@
 
 	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);
+		for (IAnnotationDeclaration s: getAnnotations()) {
+			if(s instanceof IQualifierDeclaration) {
+				IQualifier q = ((IQualifierDeclaration)s).getQualifier();
+				if (q != null) result.add(q);
+			}
 		}
 		return result;
 	}

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java	2012-09-13 20:21:38 UTC (rev 43668)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AbstractMemberDefinition.java	2012-09-13 20:39:41 UTC (rev 43669)
@@ -157,7 +157,7 @@
 	}
 
 	public void annotationKindChanged(String typeName, IRootDefinitionContext context) {
-		AnnotationDeclaration a = annotationsByType.get(typeName);
+		AnnotationDeclaration a = getAnnotation(typeName);
 		if(a == null) return;
 		Iterator<IAnnotationDeclaration> it = annotations.iterator();
 		while(it.hasNext()) {
@@ -171,7 +171,7 @@
 
 	public void removeAnnotation(IAnnotationDeclaration a) {
 		String name = ((AnnotationDeclaration)a).getTypeName();
-		IAnnotationDeclaration b = annotationsByType.get(name);
+		IAnnotationDeclaration b = getAnnotation(name);
 		if(a == b) {
 			annotationsByType.remove(name);
 			annotations.remove(a);
@@ -211,19 +211,19 @@
 	}
 
 	public AnnotationDeclaration getNamedAnnotation() {
-		return annotationsByType.get(CDIConstants.NAMED_QUALIFIER_TYPE_NAME);
+		return getAnnotation(CDIConstants.NAMED_QUALIFIER_TYPE_NAME);
 	}
 
 	public AnnotationDeclaration getTypedAnnotation() {
-		return annotationsByType.get(CDIConstants.TYPED_ANNOTATION_TYPE_NAME);
+		return getAnnotation(CDIConstants.TYPED_ANNOTATION_TYPE_NAME);
 	}
 
 	public AnnotationDeclaration getAlternativeAnnotation() {
-		return annotationsByType.get(CDIConstants.ALTERNATIVE_ANNOTATION_TYPE_NAME);
+		return getAnnotation(CDIConstants.ALTERNATIVE_ANNOTATION_TYPE_NAME);
 	}
 
 	public AnnotationDeclaration getSpecializesAnnotation() {
-		return annotationsByType.get(CDIConstants.SPECIALIZES_ANNOTATION_TYPE_NAME);
+		return getAnnotation(CDIConstants.SPECIALIZES_ANNOTATION_TYPE_NAME);
 	}
 
 	public IResource getResource() {

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationDefinition.java	2012-09-13 20:21:38 UTC (rev 43668)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationDefinition.java	2012-09-13 20:39:41 UTC (rev 43669)
@@ -147,7 +147,7 @@
 	}
 
 	public AnnotationDeclaration getInheritedAnnotation() {
-		return annotationsByType.get(CDIConstants.INHERITED_ANNOTATION_TYPE_NAME);
+		return getAnnotation(CDIConstants.INHERITED_ANNOTATION_TYPE_NAME);
 	}
 
 }

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationMemberDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationMemberDefinition.java	2012-09-13 20:21:38 UTC (rev 43668)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/AnnotationMemberDefinition.java	2012-09-13 20:39:41 UTC (rev 43669)
@@ -48,7 +48,7 @@
 	}
 
 	public AnnotationDeclaration getNonbindingAnnotation() {
-		return annotationsByType.get(CDIConstants.NON_BINDING_ANNOTATION_TYPE_NAME);
+		return getAnnotation(CDIConstants.NON_BINDING_ANNOTATION_TYPE_NAME);
 	}
 
 }

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/BeanMemberDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/BeanMemberDefinition.java	2012-09-13 20:21:38 UTC (rev 43668)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/BeanMemberDefinition.java	2012-09-13 20:39:41 UTC (rev 43669)
@@ -41,14 +41,14 @@
 	}
 
 	public AnnotationDeclaration getProducesAnnotation() {
-		return annotationsByType.get(CDIConstants.PRODUCES_ANNOTATION_TYPE_NAME);
+		return getAnnotation(CDIConstants.PRODUCES_ANNOTATION_TYPE_NAME);
 	}
 
 	public AnnotationDeclaration getInjectAnnotation() {
-		return annotationsByType.get(CDIConstants.INJECT_ANNOTATION_TYPE_NAME);
+		return getAnnotation(CDIConstants.INJECT_ANNOTATION_TYPE_NAME);
 	}
 
 	public AnnotationDeclaration getDelegateAnnotation() {
-		return annotationsByType.get(CDIConstants.DELEGATE_STEREOTYPE_TYPE_NAME);
+		return getAnnotation(CDIConstants.DELEGATE_STEREOTYPE_TYPE_NAME);
 	}
 }
\ No newline at end of file

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-09-13 20:21:38 UTC (rev 43668)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/MethodDefinition.java	2012-09-13 20:39:41 UTC (rev 43669)
@@ -144,11 +144,11 @@
 	}
 
 	public AnnotationDeclaration getPreDestroyMethod() {
-		return annotationsByType.get(CDIConstants.PRE_DESTROY_TYPE_NAME);
+		return getAnnotation(CDIConstants.PRE_DESTROY_TYPE_NAME);
 	}
 
 	public AnnotationDeclaration getPostConstructorMethod() {
-		return annotationsByType.get(CDIConstants.POST_CONSTRUCTOR_TYPE_NAME);
+		return getAnnotation(CDIConstants.POST_CONSTRUCTOR_TYPE_NAME);
 	}
 
 }

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParameterDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParameterDefinition.java	2012-09-13 20:21:38 UTC (rev 43668)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/ParameterDefinition.java	2012-09-13 20:39:41 UTC (rev 43669)
@@ -10,16 +10,12 @@
  ******************************************************************************/
 package org.jboss.tools.cdi.internal.core.impl.definition;
 
-import java.util.Set;
-
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.jdt.core.ILocalVariable;
-import org.eclipse.jdt.core.ISourceRange;
 import org.eclipse.jdt.core.IType;
 import org.jboss.tools.cdi.core.IRootDefinitionContext;
 import org.jboss.tools.common.java.ParametedType;
 import org.jboss.tools.common.java.TypeDeclaration;
-import org.jboss.tools.common.text.ITextSourceReference;
 
 public class ParameterDefinition extends BeanMemberDefinition {
 	protected MethodDefinition methodDefinition;
@@ -67,10 +63,6 @@
 		return methodDefinition;
 	}
 
-	public Set<String> getAnnotationTypes() {
-		return annotationsByType.keySet();
-	}
-
 	public ILocalVariable getVariable() {
 		return variable;
 	}

Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java	2012-09-13 20:21:38 UTC (rev 43668)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/definition/TypeDefinition.java	2012-09-13 20:39:41 UTC (rev 43669)
@@ -135,22 +135,22 @@
 	}
 
 	public AnnotationDeclaration getDecoratorAnnotation() {
-		return annotationsByType.get(CDIConstants.DECORATOR_STEREOTYPE_TYPE_NAME);
+		return getAnnotation(CDIConstants.DECORATOR_STEREOTYPE_TYPE_NAME);
 	}
 
 	public AnnotationDeclaration getInterceptorAnnotation() {
-		return annotationsByType.get(CDIConstants.INTERCEPTOR_ANNOTATION_TYPE_NAME);
+		return getAnnotation(CDIConstants.INTERCEPTOR_ANNOTATION_TYPE_NAME);
 	}
 	
 	public AnnotationDeclaration getStatefulAnnotation() {
-		return annotationsByType.get(CDIConstants.STATEFUL_ANNOTATION_TYPE_NAME);
+		return getAnnotation(CDIConstants.STATEFUL_ANNOTATION_TYPE_NAME);
 	}
 
 	public AnnotationDeclaration getStatelessAnnotation() {
-		return annotationsByType.get(CDIConstants.STATELESS_ANNOTATION_TYPE_NAME);
+		return getAnnotation(CDIConstants.STATELESS_ANNOTATION_TYPE_NAME);
 	}
 
 	public AnnotationDeclaration getSingletonAnnotation() {
-		return annotationsByType.get(CDIConstants.SINGLETON_ANNOTATION_TYPE_NAME);
+		return getAnnotation(CDIConstants.SINGLETON_ANNOTATION_TYPE_NAME);
 	}
 }
\ No newline at end of file



More information about the jbosstools-commits mailing list