Don't search twice for the same declaration
This commit is contained in:
@@ -276,8 +276,10 @@ class UnusedSymbolInspection : AbstractKotlinInspection() {
|
||||
|
||||
if (declaration is KtCallableDeclaration) {
|
||||
val lightMethods = declaration.toLightMethods()
|
||||
for (method in lightMethods) {
|
||||
if (!MethodReferencesSearch.search(method).forEach(::checkReference)) return true
|
||||
if (lightMethods.isNotEmpty()) {
|
||||
return lightMethods.any { method ->
|
||||
!MethodReferencesSearch.search(method).forEach(::checkReference)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package companionObjectUsedInJava
|
||||
|
||||
class A {
|
||||
companion object {
|
||||
val CONST = 42
|
||||
@JvmField val CONST = 42
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ class B {
|
||||
|
||||
class C {
|
||||
companion object Named {
|
||||
val CONST = 42
|
||||
@JvmField val CONST = 42
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -5,6 +5,6 @@ class Foo {
|
||||
@JvmStatic fun foo() {
|
||||
}
|
||||
|
||||
val CONST = 111
|
||||
@JvmField val CONST = 111
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,6 @@ class usedInJava {
|
||||
public static void main(String[] args) {
|
||||
UsedInJavaKt.getUsedByGetter();
|
||||
UsedInJavaKt.setUsedBySetter(":|");
|
||||
System.out.println(Obj.CONST);
|
||||
System.out.println(Obj.getCONST());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user