Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
package org.springframework.ide.vscode.boot.java.beans;

import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

Expand Down Expand Up @@ -78,8 +77,7 @@ public static void indexBeanMethod(SpringIndexElement parentNode, Annotation nod

InjectionPoint[] injectionPoints = ASTUtils.findInjectionPoints(method, doc);

Set<String> supertypes = new HashSet<>();
ASTUtils.findSupertypes(beanType, supertypes);
Set<String> supertypes = ASTUtils.findSupertypes(beanType);

Collection<Annotation> annotationsOnMethod = ASTUtils.getAnnotations(method);
AnnotationMetadata[] annotations = ASTUtils.getAnnotationsMetadata(annotationsOnMethod, doc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
package org.springframework.ide.vscode.boot.java.beans;

import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

import org.eclipse.jdt.core.dom.ASTNode;
Expand Down Expand Up @@ -101,8 +100,7 @@ private void indexFunctionBeans(TypeDeclaration typeDeclaration, SpringIndexerJa
context.getGeneratedSymbols().add(new CachedSymbol(context.getDocURI(), context.getLastModified(), symbol));

ITypeBinding concreteBeanType = typeDeclaration.resolveBinding();
Set<String> supertypes = new HashSet<>();
ASTUtils.findSupertypes(concreteBeanType, supertypes);
Set<String> supertypes = ASTUtils.findSupertypes(concreteBeanType);

Collection<Annotation> annotationsOnTypeDeclaration = ASTUtils.getAnnotations(typeDeclaration);
AnnotationMetadata[] annotations = ASTUtils.getAnnotationsMetadata(annotationsOnTypeDeclaration, doc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -45,7 +44,6 @@
import org.springframework.ide.vscode.boot.java.events.EventPublisherIndexElement;
import org.springframework.ide.vscode.boot.java.handlers.SymbolProvider;
import org.springframework.ide.vscode.boot.java.reconcilers.NotRegisteredBeansReconciler;
import org.springframework.ide.vscode.boot.java.reconcilers.ReconcileUtils;
import org.springframework.ide.vscode.boot.java.reconcilers.RequiredCompleteAstException;
import org.springframework.ide.vscode.boot.java.requestmapping.RequestMappingIndexer;
import org.springframework.ide.vscode.boot.java.utils.ASTUtils;
Expand Down Expand Up @@ -114,8 +112,7 @@ private void createSymbol(TypeDeclaration type, Annotation node, ITypeBinding an

InjectionPoint[] injectionPoints = ASTUtils.findInjectionPoints(type, doc);

Set<String> supertypes = new HashSet<>();
ASTUtils.findSupertypes(beanType, supertypes);
Set<String> supertypes = ASTUtils.findSupertypes(beanType);

Collection<Annotation> annotationsOnType = ASTUtils.getAnnotations(type);

Expand Down Expand Up @@ -177,8 +174,7 @@ private void createSymbol(RecordDeclaration record, Annotation node, ITypeBindin

InjectionPoint[] injectionPoints = DefaultValues.EMPTY_INJECTION_POINTS;

Set<String> supertypes = new HashSet<>();
ASTUtils.findSupertypes(beanType, supertypes);
Set<String> supertypes = ASTUtils.findSupertypes(beanType);

Collection<Annotation> annotationsOnType = ASTUtils.getAnnotations(record);

Expand Down Expand Up @@ -322,8 +318,7 @@ public boolean visit(MethodInvocation methodInvocation) {
Location location;
location = new Location(doc.getUri(), nodeRegion.asRange());

Set<String> typesFromhierarchy = new HashSet<>();
ASTUtils.findSupertypes(eventTypeBinding, typesFromhierarchy);
Set<String> typesFromhierarchy = ASTUtils.findSupertypes(eventTypeBinding);

EventPublisherIndexElement eventPublisherIndexElement = new EventPublisherIndexElement(eventTypeBinding.getQualifiedName(), location, typesFromhierarchy);
component.addChild(eventPublisherIndexElement);
Expand Down Expand Up @@ -364,7 +359,7 @@ private void indexAotProcessors(TypeDeclaration typeDeclaration, SpringIndexerJa
ITypeBinding typeBinding = typeDeclaration.resolveBinding();
if (typeBinding == null) return;

if (ReconcileUtils.implementsAnyType(NotRegisteredBeansReconciler.AOT_BEANS, typeBinding)) {
if (ASTUtils.isAnyTypeInHierarchy(typeBinding, NotRegisteredBeansReconciler.AOT_BEANS)) {
String type = typeBinding.getQualifiedName();
String docUri = context.getDocURI();

Expand Down Expand Up @@ -594,8 +589,7 @@ public void createBean(SpringIndexElement parentNode, String beanName, String be
context.getGeneratedSymbols().add(new CachedSymbol(context.getDocURI(), context.getLastModified(), symbol));

InjectionPoint[] injectionPoints = DefaultValues.EMPTY_INJECTION_POINTS;
Set<String> supertypes = new HashSet<>();
ASTUtils.findSupertypes(beanTypeBinding, supertypes);
Set<String> supertypes = ASTUtils.findSupertypes(beanTypeBinding);

AnnotationMetadata[] annotations = DefaultValues.EMPTY_ANNOTATIONS;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
Expand Down Expand Up @@ -96,8 +95,7 @@ protected void createSymbolForType(AbstractTypeDeclaration type, Annotation node

InjectionPoint[] injectionPoints = ASTUtils.findInjectionPoints(type, doc);

Set<String> supertypes = new HashSet<>();
ASTUtils.findSupertypes(typeBinding, supertypes);
Set<String> supertypes = ASTUtils.findSupertypes(typeBinding);

Collection<Annotation> annotationsOnType = ASTUtils.getAnnotations(type);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
Expand Down Expand Up @@ -82,8 +81,7 @@ private Two<WorkspaceSymbol, Bean> createSymbol(Annotation node, ITypeBinding an

InjectionPoint[] injectionPoints = ASTUtils.findInjectionPoints(type, doc);

Set<String> supertypes = new HashSet<>();
ASTUtils.findSupertypes(beanType, supertypes);
Set<String> supertypes = ASTUtils.findSupertypes(beanType);

Collection<Annotation> annotationsOnType = ASTUtils.getAnnotations(type);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

Expand Down Expand Up @@ -81,8 +80,7 @@ public void addSymbols(TypeDeclaration typeDeclaration, SpringIndexerJavaContext

ITypeBinding concreteBeanTypeBindung = typeDeclaration.resolveBinding();

Set<String> supertypes = new HashSet<>();
ASTUtils.findSupertypes(concreteBeanTypeBindung, supertypes);
Set<String> supertypes = ASTUtils.findSupertypes(concreteBeanTypeBindung);

String concreteRepoType = concreteBeanTypeBindung.getQualifiedName();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import java.net.URI;
import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;

import org.eclipse.jdt.core.dom.ASTVisitor;
Expand All @@ -23,6 +24,7 @@
import org.eclipse.jdt.core.dom.ReturnStatement;
import org.eclipse.jdt.core.dom.TypeDeclaration;
import org.springframework.ide.vscode.boot.java.SpringAotJavaProblemType;
import org.springframework.ide.vscode.boot.java.utils.ASTUtils;
import org.springframework.ide.vscode.commons.java.IJavaProject;
import org.springframework.ide.vscode.commons.languageserver.quickfix.QuickfixRegistry;
import org.springframework.ide.vscode.commons.languageserver.reconcile.ProblemType;
Expand Down Expand Up @@ -108,7 +110,7 @@ public boolean visit(ReturnStatement node) {
}

private static boolean isApplicable(ITypeBinding type) {
return ReconcileUtils.implementsType(RUNTIME_BEAN_POST_PROCESSOR, type) && ReconcileUtils.implementsType(COMPILE_BEAN_POST_PROCESSOR, type);
return ASTUtils.areAllTypesInHierarchy(type, Set.of(RUNTIME_BEAN_POST_PROCESSOR, COMPILE_BEAN_POST_PROCESSOR));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.springframework.ide.vscode.boot.index.SpringMetamodelIndex;
import org.springframework.ide.vscode.boot.java.Annotations;
import org.springframework.ide.vscode.boot.java.SpringAotJavaProblemType;
import org.springframework.ide.vscode.boot.java.utils.ASTUtils;
import org.springframework.ide.vscode.commons.java.IClasspathUtil;
import org.springframework.ide.vscode.commons.java.IJavaProject;
import org.springframework.ide.vscode.commons.languageserver.quickfix.QuickfixRegistry;
Expand Down Expand Up @@ -83,7 +84,7 @@ public boolean visit(TypeDeclaration node) {
if (!node.isInterface() && !Modifier.isAbstract(node.getModifiers())) {

ITypeBinding type = node.resolveBinding();
if (type != null && ReconcileUtils.implementsAnyType(AOT_BEANS, type)) {
if (type != null && ASTUtils.isAnyTypeInHierarchy(type, AOT_BEANS)) {

// // reconcile AOT Proceesor itself

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,34 +148,6 @@ public boolean visit(SimpleType node) {
return typeUsed.get();
}

public static boolean implementsType(String fqName, ITypeBinding type) {
if (fqName.equals(type.getQualifiedName())) {
return true;
} else {
for (ITypeBinding t : type.getInterfaces()) {
if (implementsType(fqName, t)) {
return true;
}
}
}
return false;
}

public static boolean implementsAnyType(Collection<String> fqNames, ITypeBinding type) {
if (fqNames.contains(type.getQualifiedName())) {
return true;
} else {
for (ITypeBinding t : type.getInterfaces()) {
if (implementsAnyType(fqNames, t)) {
return true;
}
}
}
return false;
}



public static String getSimpleName(String fqName) {
int idx = fqName.lastIndexOf('.');
if (idx >= 0 && idx < fqName.length() - 1) {
Expand Down
Loading