Do not load common for special properties from Java
I.e. do not treat getName in Java enum as override of Enum.name
This commit is contained in:
@@ -0,0 +1,12 @@
|
|||||||
|
// FILE: MyEnum.java
|
||||||
|
|
||||||
|
public enum MyEnum {
|
||||||
|
A;
|
||||||
|
public int getOrdinal() {return "";}
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: main.kt
|
||||||
|
|
||||||
|
fun foo() {
|
||||||
|
MyEnum.A.getOrdinal()
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
public fun foo(): kotlin.Unit
|
||||||
|
|
||||||
|
public final enum class MyEnum : kotlin.Enum<MyEnum!> {
|
||||||
|
enum entry A
|
||||||
|
|
||||||
|
public constructor MyEnum()
|
||||||
|
public final override /*1*/ /*fake_override*/ val name: kotlin.String
|
||||||
|
public final override /*1*/ /*fake_override*/ val ordinal: kotlin.Int
|
||||||
|
protected final override /*1*/ /*fake_override*/ fun clone(): kotlin.Any
|
||||||
|
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: MyEnum!): kotlin.Int
|
||||||
|
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open fun getOrdinal(): kotlin.Int
|
||||||
|
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
|
||||||
|
// Static members
|
||||||
|
public final /*synthesized*/ val values: kotlin.Array<MyEnum>
|
||||||
|
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): MyEnum
|
||||||
|
@kotlin.Deprecated(message = "Use 'values' property instead", replaceWith = kotlin.ReplaceWith(expression = "this.values", imports = {})) public final /*synthesized*/ fun values(): kotlin.Array<MyEnum>
|
||||||
|
}
|
||||||
@@ -8970,6 +8970,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("enumGetOrdinal.kt")
|
||||||
|
public void testEnumGetOrdinal() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/enumGetOrdinal.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("fieldOverridesField.kt")
|
@TestMetadata("fieldOverridesField.kt")
|
||||||
public void testFieldOverridesField() throws Exception {
|
public void testFieldOverridesField() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/fieldOverridesField.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/fieldOverridesField.kt");
|
||||||
|
|||||||
+5
-4
@@ -148,11 +148,12 @@ public class LazyJavaClassMemberScope(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun PropertyDescriptor.findGetterOverride(): JavaMethodDescriptor? {
|
private fun PropertyDescriptor.findGetterOverride(): JavaMethodDescriptor? {
|
||||||
val commonProperty = findGetterByName(JvmAbi.getterName(name.asString()))
|
val specialGetterName = getter?.getOverriddenBuiltinWithDifferentJvmName()?.getBuiltinSpecialPropertyGetterName()
|
||||||
if (commonProperty != null) return commonProperty
|
if (specialGetterName != null) {
|
||||||
|
return findGetterByName(specialGetterName)
|
||||||
|
}
|
||||||
|
|
||||||
val specialGetterName = getter?.getOverriddenBuiltinWithDifferentJvmName()?.getBuiltinSpecialPropertyGetterName() ?: return null
|
return findGetterByName(JvmAbi.getterName(name.asString()))
|
||||||
return findGetterByName(specialGetterName)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun PropertyDescriptor.findGetterByName(getterName: String): JavaMethodDescriptor? {
|
private fun PropertyDescriptor.findGetterByName(getterName: String): JavaMethodDescriptor? {
|
||||||
|
|||||||
Reference in New Issue
Block a user