Inner class bean id is equal to bean type
This commit is contained in:
@@ -74,9 +74,8 @@ public class ComponentInjectionsHoverProvider extends AbstractInjectedIntoHoverP
|
||||
String typeName = beanType.getName();
|
||||
|
||||
ITypeBinding declaringClass = beanType.getDeclaringClass();
|
||||
while (declaringClass != null) {
|
||||
typeName = declaringClass.getName() + "." + typeName;
|
||||
declaringClass = declaringClass.getDeclaringClass();
|
||||
if (declaringClass != null) {
|
||||
return getBeanType(beanType).toString();
|
||||
}
|
||||
|
||||
if (StringUtil.hasText(typeName)) {
|
||||
|
||||
@@ -142,7 +142,12 @@ public class LiveHoverUtils {
|
||||
List<LiveBean> relevantBeans = beansModel.getBeansOfName(definedBean.getId());
|
||||
String type = definedBean.getType();
|
||||
if (type != null) {
|
||||
relevantBeans = relevantBeans.stream().filter(bean -> type.equals(bean.getType(true))).collect(Collectors.toList());
|
||||
// TODO: check if we should check for bean type rather than id that we build ourselves based on type
|
||||
// if (relevantBeans.isEmpty()) {
|
||||
// relevantBeans = beansModel.getBeansOfType(type);
|
||||
// } else {
|
||||
relevantBeans = relevantBeans.stream().filter(bean -> type.equals(bean.getType(true))).collect(Collectors.toList());
|
||||
// }
|
||||
}
|
||||
return relevantBeans;
|
||||
}
|
||||
|
||||
@@ -595,7 +595,7 @@ public class ComponentInjectionsHoverProviderTest {
|
||||
public void componentFromInnerClass() throws Exception {
|
||||
LiveBeansModel beans = LiveBeansModel.builder()
|
||||
.add(LiveBean.builder()
|
||||
.id("demoApplication.InnerClass")
|
||||
.id("com.example.DemoApplication$InnerClass")
|
||||
.type("com.example.DemoApplication$InnerClass")
|
||||
.build()
|
||||
)
|
||||
@@ -628,7 +628,7 @@ public class ComponentInjectionsHoverProviderTest {
|
||||
);
|
||||
editor.assertHighlights("@SpringBootApplication");
|
||||
editor.assertHoverContains("@SpringBootApplication",
|
||||
"**Injected `demoApplication.InnerClass` → _not injected anywhere_** \n" +
|
||||
"**Injected `com.example.DemoApplication$InnerClass` → _not injected anywhere_** \n" +
|
||||
"Process [PID=111, name=`the-app`]"
|
||||
);
|
||||
}
|
||||
@@ -637,7 +637,7 @@ public class ComponentInjectionsHoverProviderTest {
|
||||
public void componentFromInnerInnerClass() throws Exception {
|
||||
LiveBeansModel beans = LiveBeansModel.builder()
|
||||
.add(LiveBean.builder()
|
||||
.id("demoApplication.InnerClass.InnerInnerClass")
|
||||
.id("com.example.DemoApplication$InnerClass$InnerInnerClass")
|
||||
.type("com.example.DemoApplication$InnerClass$InnerInnerClass")
|
||||
.build()
|
||||
)
|
||||
@@ -673,7 +673,7 @@ public class ComponentInjectionsHoverProviderTest {
|
||||
);
|
||||
editor.assertHighlights("@SpringBootApplication");
|
||||
editor.assertHoverContains("@SpringBootApplication",
|
||||
"**Injected `demoApplication.InnerClass.InnerInnerClass` → _not injected anywhere_** \n" +
|
||||
"**Injected `com.example.DemoApplication$InnerClass$InnerInnerClass` → _not injected anywhere_** \n" +
|
||||
"Process [PID=111, name=`the-app`]"
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user