mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-01 18:58:31 +07:00
[kotlin] ensure that UastCallableReferenceExpression preserves receiver expression
- uast based visitor in unused declaration should analyse receivers which might contain references to variables/functions/etc - Currently simple references in receivers are not processed and thus test has false positive ^ KTIJ-23958 - KotlinJavaApiUsageInspectionTest.`test reference in callable reference` doesn't test actual problem because UastVisitorAdapter is used: meaning that psi hierarchy is traversed and converted to uast one-by-one. GitOrigin-RevId: 01b2c31fe42181c428b2c8767dc18db73bdfd659
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f44c63348e
commit
e2d7214918
@@ -248,6 +248,10 @@ public class RefJavaUtilImpl extends RefJavaUtil {
|
||||
|
||||
@Override
|
||||
public boolean visitCallableReferenceExpression(@NotNull UCallableReferenceExpression methodRef) {
|
||||
UExpression qualifierExpression = methodRef.getQualifierExpression();
|
||||
if (qualifierExpression != null) {
|
||||
qualifierExpression.accept(this);
|
||||
}
|
||||
RefElement refMethod = refManager.getReference(methodRef.getSourcePsi());
|
||||
if (refFrom == refMethod) {
|
||||
visitReferenceExpression(methodRef);
|
||||
@@ -641,18 +645,17 @@ public class RefJavaUtilImpl extends RefJavaUtil {
|
||||
return Integer.compare(getAccessNumber(a1), getAccessNumber(a2));
|
||||
}
|
||||
|
||||
@SuppressWarnings("StringEquality")
|
||||
private static int getAccessNumber(String a) {
|
||||
if (a == PsiModifier.PRIVATE) {
|
||||
if (PsiModifier.PRIVATE.equals(a)) {
|
||||
return 0;
|
||||
}
|
||||
if (a == PsiModifier.PACKAGE_LOCAL) {
|
||||
if (PsiModifier.PACKAGE_LOCAL.equals(a)) {
|
||||
return 1;
|
||||
}
|
||||
if (a == PsiModifier.PROTECTED) {
|
||||
if (PsiModifier.PROTECTED.equals(a)) {
|
||||
return 2;
|
||||
}
|
||||
if (a == PsiModifier.PUBLIC) return 3;
|
||||
if (PsiModifier.PUBLIC.equals(a)) return 3;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user