This is an automated email from the ASF dual-hosted git repository.

dbalek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new 61795d6  Micronaut Data Finder completion ceck for @Repository 
annotation fixed. (#3346)
61795d6 is described below

commit 61795d673369f587d2ae2f50254b442a407b64c0
Author: Dusan Balek <dusan.ba...@oracle.com>
AuthorDate: Tue Nov 30 18:21:05 2021 +0100

    Micronaut Data Finder completion ceck for @Repository annotation fixed. 
(#3346)
---
 .../micronaut/completion/MicronautDataCompletionTask.java        | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git 
a/enterprise/micronaut/src/org/netbeans/modules/micronaut/completion/MicronautDataCompletionTask.java
 
b/enterprise/micronaut/src/org/netbeans/modules/micronaut/completion/MicronautDataCompletionTask.java
index e025394..4bfda64 100644
--- 
a/enterprise/micronaut/src/org/netbeans/modules/micronaut/completion/MicronautDataCompletionTask.java
+++ 
b/enterprise/micronaut/src/org/netbeans/modules/micronaut/completion/MicronautDataCompletionTask.java
@@ -28,6 +28,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -256,7 +257,7 @@ public class MicronautDataCompletionTask {
     private static TypeElement getEntityFor(CompilationInfo info, TreePath 
path) {
         TypeElement te = (TypeElement) info.getTrees().getElement(path);
         if (te.getModifiers().contains(Modifier.ABSTRACT)) {
-            if (checkForRepositoryAnnotation(te.getAnnotationMirrors())) {
+            if (checkForRepositoryAnnotation(te.getAnnotationMirrors(), new 
HashSet<>())) {
                 Types types = info.getTypes();
                 TypeMirror repositoryType = 
types.erasure(info.getElements().getTypeElement(REPOSITORY_TYPE_NAME).asType());
                 for (TypeMirror iface : te.getInterfaces()) {
@@ -275,10 +276,10 @@ public class MicronautDataCompletionTask {
         return null;
     }
 
-    private static boolean checkForRepositoryAnnotation(List<? extends 
AnnotationMirror> annotations) {
+    private static boolean checkForRepositoryAnnotation(List<? extends 
AnnotationMirror> annotations, HashSet<TypeElement> checked) {
         for (AnnotationMirror annotation : annotations) {
-            DeclaredType annotationType = annotation.getAnnotationType();
-            if (REPOSITORY_ANNOTATION_NAME.contentEquals(((TypeElement) 
annotationType.asElement()).getQualifiedName()) || 
checkForRepositoryAnnotation(annotationType.getAnnotationMirrors())) {
+            TypeElement annotationElement = (TypeElement) 
annotation.getAnnotationType().asElement();
+            if 
(REPOSITORY_ANNOTATION_NAME.contentEquals(annotationElement.getQualifiedName()) 
|| checked.add(annotationElement) && 
checkForRepositoryAnnotation(annotationElement.getAnnotationMirrors(), 
checked)) {
                 return true;
             }
         }

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to