fix index supertype information for spring data repository beans

This commit is contained in:
Martin Lippert
2023-05-24 13:10:10 +02:00
parent 57ec6fd91e
commit 14d2556e71
2 changed files with 8 additions and 3 deletions

View File

@@ -66,10 +66,12 @@ public class DataRepositorySymbolProvider extends AbstractSymbolProvider {
InjectionPoint[] injectionPoints = ASTUtils.findInjectionPoints(typeDeclaration, doc);
Set<String> supertypes = new HashSet<>();
ASTUtils.findSupertypes(beanType, supertypes);
ITypeBinding concreteBeanTypeBindung = typeDeclaration.resolveBinding();
String concreteRepoType = typeDeclaration.resolveBinding().getQualifiedName();
Set<String> supertypes = new HashSet<>();
ASTUtils.findSupertypes(concreteBeanTypeBindung, supertypes);
String concreteRepoType = concreteBeanTypeBindung.getQualifiedName();
Bean beanDefinition = new Bean(beanName, concreteRepoType, location, injectionPoints, (String[]) supertypes.toArray(new String[supertypes.size()]));
context.getGeneratedSymbols().add(new CachedSymbol(context.getDocURI(), context.getLastModified(), enhancedSymbol, beanDefinition));

View File

@@ -210,6 +210,9 @@ public class SpringMetamodelIndexerBeansTest {
assertEquals(1, beans.length);
assertEquals("customerRepository", beans[0].getName());
assertEquals("org.test.springdata.CustomerRepository", beans[0].getType());
assertTrue(beans[0].isTypeCompatibleWith("org.test.springdata.CustomerRepository"));
assertTrue(beans[0].isTypeCompatibleWith("org.springframework.data.repository.CrudRepository"));
InjectionPoint[] injectionPoints = beans[0].getInjectionPoints();
assertEquals(0, injectionPoints.length);