Load special property from Java in cases of J-K-J hierarchy
This commit is contained in:
Vendored
+13
@@ -0,0 +1,13 @@
|
|||||||
|
// FILE: A.java
|
||||||
|
|
||||||
|
abstract public class A<F> extends MyList<F> {
|
||||||
|
int getSize() { return 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: main.kt
|
||||||
|
|
||||||
|
abstract class MyList<G> : Collection<G> {}
|
||||||
|
|
||||||
|
fun main(a: A<String>) {
|
||||||
|
a.size
|
||||||
|
}
|
||||||
Vendored
+27
@@ -0,0 +1,27 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun main(/*0*/ a: A<kotlin.String>): kotlin.Unit
|
||||||
|
|
||||||
|
public abstract class A</*0*/ F : kotlin.Any!> : MyList<F!> {
|
||||||
|
public constructor A</*0*/ F : kotlin.Any!>()
|
||||||
|
public/*package*/ open override /*1*/ val size: kotlin.Int
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun contains(/*0*/ element: F!): kotlin.Boolean
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun containsAll(/*0*/ elements: kotlin.Collection<F!>): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun isEmpty(): kotlin.Boolean
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun iterator(): kotlin.Iterator<F!>
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract class MyList</*0*/ G> : kotlin.Collection<G> {
|
||||||
|
public constructor MyList</*0*/ G>()
|
||||||
|
public abstract override /*1*/ /*fake_override*/ val size: kotlin.Int
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun contains(/*0*/ element: G): kotlin.Boolean
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun containsAll(/*0*/ elements: kotlin.Collection<G>): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun isEmpty(): kotlin.Boolean
|
||||||
|
public abstract override /*1*/ /*fake_override*/ fun iterator(): kotlin.Iterator<G>
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
@@ -9319,6 +9319,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
|||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/collectionOverrides/removeAtInt.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/collectionOverrides/removeAtInt.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("sizeFromKotlinOverriddenInJava.kt")
|
||||||
|
public void testSizeFromKotlinOverriddenInJava() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/collectionOverrides/sizeFromKotlinOverriddenInJava.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/diagnostics/tests/j+k/properties")
|
@TestMetadata("compiler/testData/diagnostics/tests/j+k/properties")
|
||||||
|
|||||||
+6
-2
@@ -151,8 +151,12 @@ public class LazyJavaClassMemberScope(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun PropertyDescriptor.findGetterOverride(): JavaMethodDescriptor? {
|
private fun PropertyDescriptor.findGetterOverride(): JavaMethodDescriptor? {
|
||||||
val specialGetterName = getter?.getOverriddenBuiltinWithDifferentJvmName()?.getBuiltinSpecialPropertyGetterName()
|
val overriddenBuiltinProperty = getter?.getOverriddenBuiltinWithDifferentJvmName()
|
||||||
if (specialGetterName != null) {
|
val specialGetterName = overriddenBuiltinProperty?.getBuiltinSpecialPropertyGetterName()
|
||||||
|
if (specialGetterName != null
|
||||||
|
&& !this@LazyJavaClassMemberScope.getContainingDeclaration().hasRealKotlinSuperClassWithOverrideOf(
|
||||||
|
overriddenBuiltinProperty!!)
|
||||||
|
) {
|
||||||
return findGetterByName(specialGetterName)
|
return findGetterByName(specialGetterName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user