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