Fixed the case of public from private class inheritance in Java
This commit is contained in:
+4
-2
@@ -455,7 +455,7 @@ class ExpressionsOfTypeProcessor(
|
||||
is PsiReferenceList -> { // usage in extends/implements list
|
||||
if (parent.role == PsiReferenceList.Role.EXTENDS_LIST || parent.role == PsiReferenceList.Role.IMPLEMENTS_LIST) {
|
||||
val psiClass = parent.parent as PsiClass
|
||||
if (!psiClass.isPrivateOrLocal()) {
|
||||
if (!psiClass.isLocal()) { // we don't filter out private classes because we can inherit public class from private in Java
|
||||
addClassToProcess(psiClass)
|
||||
}
|
||||
}
|
||||
@@ -628,9 +628,11 @@ class ExpressionsOfTypeProcessor(
|
||||
}
|
||||
|
||||
private fun PsiModifierListOwner.isPrivateOrLocal(): Boolean {
|
||||
return hasModifierProperty(PsiModifier.PRIVATE) || parents.any { it is PsiCodeBlock }
|
||||
return hasModifierProperty(PsiModifier.PRIVATE) || isLocal()
|
||||
}
|
||||
|
||||
private fun PsiModifierListOwner.isLocal() = parents.any { it is PsiCodeBlock }
|
||||
|
||||
private fun PsiElement.isOperatorExpensiveToSearch(): Boolean {
|
||||
when (this) {
|
||||
is KtFunction -> {
|
||||
|
||||
@@ -24,4 +24,5 @@ fun listOfA() = listOf<A>(A(1, "", ""))
|
||||
fun test2(p1: JavaClass2, p2: JavaClass3) {
|
||||
val (x1, y1) = p1[0]
|
||||
val (x2, y2) = p2[0]
|
||||
val (x3, y3) = JavaClass4.getNested()[0]
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import pack.A;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class JavaClass4 {
|
||||
private interface NestedPrivate extends List<A> {
|
||||
}
|
||||
|
||||
public interface NestedPublic extends NestedPrivate {
|
||||
}
|
||||
|
||||
public static NestedPublic getNested() {
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ Checked type of x1
|
||||
Checked type of x2
|
||||
Checked type of x2
|
||||
Checked type of x3
|
||||
Checked type of x3
|
||||
Checked type of x4
|
||||
Checked type of x5
|
||||
Checked type of y
|
||||
@@ -17,6 +18,7 @@ Checked type of y1
|
||||
Checked type of y2
|
||||
Checked type of y2
|
||||
Checked type of y3
|
||||
Checked type of y3
|
||||
Checked type of y4
|
||||
Checked type of y5
|
||||
Checked type of z
|
||||
@@ -30,12 +32,16 @@ Resolved (x1, y1)
|
||||
Resolved (x1, y1, z1)
|
||||
Resolved (x2, y2)
|
||||
Resolved (x2, y2, z2)
|
||||
Resolved (x3, y3)
|
||||
Resolved (x3, y3, z3)
|
||||
Resolved (x4, y4, z4)
|
||||
Resolved (x5, y5, z5)
|
||||
Searched references to JavaClass.getA() in Kotlin files
|
||||
Searched references to JavaClass2
|
||||
Searched references to JavaClass3
|
||||
Searched references to JavaClass4.NestedPrivate
|
||||
Searched references to JavaClass4.NestedPublic
|
||||
Searched references to JavaClass4.getNested() in Kotlin files
|
||||
Searched references to a in Kotlin files
|
||||
Searched references to f() in Kotlin files
|
||||
Searched references to g() in Kotlin files
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
[dataClass.1.kt] Value read 15 val (x5, y5, z5) = javaClass.getA()[0]
|
||||
[dataClass.1.kt] Value read 25 val (x1, y1) = p1[0]
|
||||
[dataClass.1.kt] Value read 26 val (x2, y2) = p2[0]
|
||||
[dataClass.1.kt] Value read 27 val (x3, y3) = JavaClass4.getNested()[0]
|
||||
[dataClass.1.kt] Value read 5 a.n
|
||||
[dataClass.1.kt] Value read 8 val (x, y, z) = a
|
||||
[dataClass.1.kt] Value read 9 val (x1, y1, z1) = f()
|
||||
Reference in New Issue
Block a user