move set of jakarta annotations to constants class

This commit is contained in:
Martin Lippert
2025-03-20 21:25:47 +01:00
parent 4588b0861c
commit 161276dbd6
2 changed files with 7 additions and 10 deletions

View File

@@ -114,5 +114,11 @@ public class Annotations {
"org.aspectj.lang.annotation.AfterThrowing", "AfterThrowing",
"org.aspectj.lang.annotation.DeclareParents", "DeclareParents"
);
public static final Set<String> JAKARTA_ANNOTATIONS = Set.of(
Annotations.RESOURCE_JAKARTA, Annotations.INJECT_JAKARTA, Annotations.NAMED_JAKARTA,
Annotations.RESOURCE_JAVAX, Annotations.INJECT_JAVAX, Annotations.NAMED_JAVAX
);
}

View File

@@ -114,11 +114,6 @@ public class SpringIndexerJava implements SpringIndexer {
private final SpringIndexerJavaDependencyTracker dependencyTracker = new SpringIndexerJavaDependencyTracker();
private final BiFunction<AtomicReference<TextDocument>, BiConsumer<String, Diagnostic>, IProblemCollector> problemCollectorCreator;
private final Set<String> jakartaAnnnotations = Set.of(
Annotations.RESOURCE_JAKARTA, Annotations.INJECT_JAKARTA, Annotations.NAMED_JAKARTA,
Annotations.RESOURCE_JAVAX, Annotations.INJECT_JAVAX, Annotations.NAMED_JAVAX
);
public SpringIndexerJava(SymbolHandler symbolHandler, AnnotationHierarchyAwareLookup<SymbolProvider> symbolProviders, IndexCache cache,
JavaProjectFinder projectFimder, ProgressService progressService, JdtReconciler jdtReconciler,
@@ -861,7 +856,7 @@ public class SpringIndexerJava implements SpringIndexer {
String qualifiedName = type.getQualifiedName();
if (qualifiedName != null
&& ((qualifiedName.startsWith("org.springframework") && !qualifiedName.startsWith("org.springframework.lang"))
|| isJakartaAnnotationWithDefaultSymbol(qualifiedName))) {
|| Annotations.JAKARTA_ANNOTATIONS.contains(qualifiedName))) {
TextDocument doc = DocumentUtils.getTempTextDocument(context.getDocURI(), context.getDocRef(), context.getContent());
return DefaultSymbolProvider.provideDefaultSymbol(node, doc);
}
@@ -877,10 +872,6 @@ public class SpringIndexerJava implements SpringIndexer {
return null;
}
private boolean isJakartaAnnotationWithDefaultSymbol(String qualifiedName) {
return jakartaAnnnotations.contains(qualifiedName);
}
public static ASTParserCleanupEnabled createParser(IJavaProject project, AnnotationHierarchies annotationHierarchies, boolean ignoreMethodBodies) throws Exception {
String[] classpathEntries = getClasspathEntries(project);
String[] sourceEntries = getSourceEntries(project);