No synthetic properties in java class for methods inherited from Kotlin
This commit is contained in:
+3
-2
@@ -109,13 +109,14 @@ class JavaSyntheticExtensionsScope(storageManager: StorageManager) : JetScope by
|
|||||||
val getMethod = possibleGetMethodNames(name)
|
val getMethod = possibleGetMethodNames(name)
|
||||||
.asSequence()
|
.asSequence()
|
||||||
.flatMap { memberScope.getFunctions(it).asSequence() }
|
.flatMap { memberScope.getFunctions(it).asSequence() }
|
||||||
.singleOrNull { isGoodGetMethod(it) } ?: return null
|
.singleOrNull { it.kind != CallableMemberDescriptor.Kind.FAKE_OVERRIDE && isGoodGetMethod(it) } ?: return null
|
||||||
|
|
||||||
// don't accept "uRL" for "getURL" etc
|
// don't accept "uRL" for "getURL" etc
|
||||||
if (SyntheticJavaPropertyDescriptor.propertyNameByGetMethodName(getMethod.name) != name) return null
|
if (SyntheticJavaPropertyDescriptor.propertyNameByGetMethodName(getMethod.name) != name) return null
|
||||||
|
|
||||||
val propertyType = getMethod.getReturnType() ?: return null
|
val propertyType = getMethod.getReturnType() ?: return null
|
||||||
val setMethod = memberScope.getFunctions(setMethodName(getMethod.getName())).singleOrNull { isGoodSetMethod(it, propertyType) }
|
val setMethod = memberScope.getFunctions(setMethodName(getMethod.getName()))
|
||||||
|
.singleOrNull { it.kind != CallableMemberDescriptor.Kind.FAKE_OVERRIDE && isGoodSetMethod(it, propertyType) }
|
||||||
|
|
||||||
return MyPropertyDescriptor(javaClass, getMethod.original, setMethod?.original, name, propertyType)
|
return MyPropertyDescriptor(javaClass, getMethod.original, setMethod?.original, name, propertyType)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
// FILE: KotlinFile.kt
|
// FILE: KotlinFile.kt
|
||||||
open class KotlinClass1 : JavaClass1() {
|
open class KotlinClass1 : JavaClass1() {
|
||||||
fun getSomethingKotlin1(): Int = 1
|
public fun getSomethingKotlin1(): Int = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
class KotlinClass2 : JavaClass2() {
|
class KotlinClass2 : JavaClass2() {
|
||||||
fun getSomethingKotlin2(): Int = 1
|
public fun getSomethingKotlin2(): Int = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo(k: KotlinClass2) {
|
fun foo(k: KotlinClass2) {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public open class JavaClass2 : KotlinClass1 {
|
|||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
public open override /*1*/ /*fake_override*/ fun getSomething1(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun getSomething1(): kotlin.Int
|
||||||
public open fun getSomething2(): kotlin.Int
|
public open fun getSomething2(): kotlin.Int
|
||||||
internal final override /*1*/ /*fake_override*/ fun getSomethingKotlin1(): kotlin.Int
|
public final override /*1*/ /*fake_override*/ fun getSomethingKotlin1(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
}
|
}
|
||||||
@@ -25,7 +25,7 @@ internal open class KotlinClass1 : JavaClass1 {
|
|||||||
public constructor KotlinClass1()
|
public constructor KotlinClass1()
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
public open override /*1*/ /*fake_override*/ fun getSomething1(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun getSomething1(): kotlin.Int
|
||||||
internal final fun getSomethingKotlin1(): kotlin.Int
|
public final fun getSomethingKotlin1(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
}
|
}
|
||||||
@@ -35,8 +35,8 @@ internal final class KotlinClass2 : JavaClass2 {
|
|||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
public open override /*1*/ /*fake_override*/ fun getSomething1(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun getSomething1(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun getSomething2(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun getSomething2(): kotlin.Int
|
||||||
internal final override /*1*/ /*fake_override*/ fun getSomethingKotlin1(): kotlin.Int
|
public final override /*1*/ /*fake_override*/ fun getSomethingKotlin1(): kotlin.Int
|
||||||
internal final fun getSomethingKotlin2(): kotlin.Int
|
public final fun getSomethingKotlin2(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// FILE: KotlinFile.kt
|
// FILE: KotlinFile.kt
|
||||||
class KotlinClass {
|
class KotlinClass {
|
||||||
fun getSomething(): Int = 1
|
public fun getSomething(): Int = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo(javaClass: JavaClass, kotlinClass: KotlinClass) {
|
fun foo(javaClass: JavaClass, kotlinClass: KotlinClass) {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public open class JavaClass {
|
|||||||
internal final class KotlinClass {
|
internal final class KotlinClass {
|
||||||
public constructor KotlinClass()
|
public constructor KotlinClass()
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
internal final fun getSomething(): kotlin.Int
|
public final fun getSomething(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user