Author: dazarov
Date: 2011-08-18 16:43:39 -0400 (Thu, 18 Aug 2011)
New Revision: 34071
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NamedStereotype.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NamedStereotypedDecoratorBroken.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NamedStereotypedInterceptorBroken.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/search/CDISearchParticipantTest.java
Log:
https://issues.jboss.org/browse/JBIDE-7636
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java 2011-08-18
19:34:52 UTC (rev 34070)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java 2011-08-18
20:43:39 UTC (rev 34071)
@@ -677,7 +677,7 @@
private boolean isMethodExists(IType interfaceType, IMethod method){
IMethod existingMethod = interfaceType.getMethod(method.getElementName(),
method.getParameterTypes());
- if(existingMethod != null && existingMethod.exists())
+ if(existingMethod.exists())
return true;
return false;
}
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java 2011-08-18
19:34:52 UTC (rev 34070)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MarkerResolutionUtils.java 2011-08-18
20:43:39 UTC (rev 34071)
@@ -174,7 +174,7 @@
IMember workingCopyMember = (IMember) workingCopyElement;
- IAnnotation annotation = getAnnotation(workingCopyMember, qualifiedName);
+ IAnnotation annotation = findAnnotation(workingCopyMember, qualifiedName);
if(annotation != null && annotation.exists())
return;
@@ -204,7 +204,7 @@
public static void addQualifier(String qualifiedName, ICompilationUnit compilationUnit,
IJavaElement element) throws JavaModelException{
if(!(element instanceof ISourceReference))
return;
- IAnnotation annotation = getAnnotation(element, qualifiedName);
+ IAnnotation annotation = findAnnotation(element, qualifiedName);
if(annotation != null && annotation.exists())
return;
@@ -218,7 +218,7 @@
if(duplicateShortName)
shortName = qualifiedName;
- annotation = getAnnotation(element, CDIConstants.INJECT_ANNOTATION_TYPE_NAME);
+ annotation = findAnnotation(element, CDIConstants.INJECT_ANNOTATION_TYPE_NAME);
if(annotation != null && annotation.exists())
buffer.replace(annotation.getSourceRange().getOffset()+annotation.getSourceRange().getLength(),
0, lineDelim+AT+shortName);
else
@@ -257,11 +257,11 @@
return list;
}
- public static IAnnotation getAnnotation(IJavaElement element, String qualifiedName){
+ public static IAnnotation findAnnotation(IJavaElement element, String qualifiedName){
if(element instanceof IAnnotatable){
String name = getShortName(qualifiedName);
IAnnotation annotation = ((IAnnotatable)element).getAnnotation(qualifiedName);
- if (annotation == null || !annotation.exists()) {
+ if (!annotation.exists()) {
annotation = ((IAnnotatable)element).getAnnotation(name);
}
IType type=null;
@@ -294,10 +294,10 @@
String fullName = qualifier.getSourceType().getFullyQualifiedName();
String shortName = getShortName(fullName);
IAnnotation annotation = ((IAnnotatable)element).getAnnotation(fullName);
- if(annotation == null || !annotation.exists()){
+ if(!annotation.exists()){
annotation = ((IAnnotatable)element).getAnnotation(shortName);
}
- if(annotation != null && annotation.exists()){
+ if(annotation.exists()){
IBuffer buffer = compilationUnit.getBuffer();
buffer.replace(annotation.getSourceRange().getOffset(),
annotation.getSourceRange().getLength(), "");
@@ -538,7 +538,7 @@
if(workingCopyElement == null)
return;
- IAnnotation annotation = getAnnotation(workingCopyElement, qualifiedName);
+ IAnnotation annotation = findAnnotation(workingCopyElement, qualifiedName);
if(annotation != null){
IBuffer buffer = compilationUnit.getBuffer();
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NamedStereotype.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NamedStereotype.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NamedStereotype.java 2011-08-18
20:43:39 UTC (rev 34071)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Stereotype;
+import javax.inject.Named;
+
+@Stereotype
+@Target( { TYPE, METHOD, FIELD })
+@Retention(RUNTIME)
+@RequestScoped
+@Inherited
+@Named
+@interface NamedStereotype {
+
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NamedStereotype.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NamedStereotypedDecoratorBroken.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NamedStereotypedDecoratorBroken.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NamedStereotypedDecoratorBroken.java 2011-08-18
20:43:39 UTC (rev 34071)
@@ -0,0 +1,13 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.enterprise.inject.Any;
+import javax.inject.Inject;
+
+@Decorator
+@NamedStereotype
+public class NamedStereotypedDecoratorBroken {
+
+ @Inject @Delegate @Any Object logger;
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NamedStereotypedDecoratorBroken.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NamedStereotypedInterceptorBroken.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NamedStereotypedInterceptorBroken.java
(rev 0)
+++
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NamedStereotypedInterceptorBroken.java 2011-08-18
20:43:39 UTC (rev 34071)
@@ -0,0 +1,10 @@
+package org.jboss.jsr299.tck.tests.jbt.quickfixes;
+
+import javax.interceptor.Interceptor;
+import javax.interceptor.InterceptorBinding;
+
+@Interceptor
+@NamedStereotype
+public class NamedStereotypedInterceptorBroken {
+
+}
\ No newline at end of file
Property changes on:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/resources/tck/tests/jbt/quickfixes/NamedStereotypedInterceptorBroken.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java 2011-08-18
19:34:52 UTC (rev 34070)
+++
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/marker/CDIMarkerResolutionTest.java 2011-08-18
20:43:39 UTC (rev 34071)
@@ -768,6 +768,18 @@
DeleteAnnotationMarkerResolution.class);
}
+ public void testNamedStereotypedInterceptorResolution() throws CoreException{
+ checkResolution(tckProject,
+ new String[]{
+ "JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/NamedStereotypedInterceptorBroken.java",
+ "JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/NamedStereotype.java"
+ },
+ CDICoreValidator.PROBLEM_TYPE,
+ CDIValidationErrorManager.MESSAGE_ID_ATTRIBUTE_NAME,
+ CDIValidationErrorManager.INTERCEPTOR_HAS_NAME_ID,
+ DeleteAnnotationMarkerResolution.class);
+ }
+
public void testNamedInDecoratorResolution() throws CoreException{
checkResolution(tckProject,
new String[]{
@@ -782,6 +794,18 @@
DeleteAnnotationMarkerResolution.class);
}
+ public void testNamedStereotypedDecoratorResolution() throws CoreException{
+ checkResolution(tckProject,
+ new String[]{
+ "JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/NamedStereotypedDecoratorBroken.java",
+ "JavaSource/org/jboss/jsr299/tck/tests/jbt/quickfixes/NamedStereotype.java"
+ },
+ CDICoreValidator.PROBLEM_TYPE,
+ CDIValidationErrorManager.MESSAGE_ID_ATTRIBUTE_NAME,
+ CDIValidationErrorManager.DECORATOR_HAS_NAME_ID,
+ DeleteAnnotationMarkerResolution.class);
+ }
+
public void testTypedInStereotypeResolution() throws CoreException{
checkResolution(tckProject,
new String[]{
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/search/CDISearchParticipantTest.java
===================================================================
---
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/search/CDISearchParticipantTest.java 2011-08-18
19:34:52 UTC (rev 34070)
+++
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/search/CDISearchParticipantTest.java 2011-08-18
20:43:39 UTC (rev 34071)
@@ -182,6 +182,7 @@
matches.add(new MatchStructure(InjectionPointField.class,
"FieldInjectionPointBean.injectedBean"));
matches.add(new MatchStructure(InjectionPointField.class,
"NamedDecoratorBroken.logger"));
matches.add(new MatchStructure(InjectionPointField.class,
"NamedStereotypedDecoratorBroken.logger"));
+ matches.add(new MatchStructure(InjectionPointField.class,
"NamedStereotypedDecoratorBroken.logger"));
matches.add(new MatchStructure(InjectionPointField.class,
"TransientFieldInjectionPointBean.injectedBean"));
matches.add(new MatchStructure(InjectionPointField.class,
"SpecializingDecoratorBroken.logger"));
matches.add(new MatchStructure(InjectionPointField.class,
"ObserverMethodInDecoratorBroken.logger"));