Set method should not accept vararg
This commit is contained in:
+3
-1
@@ -74,7 +74,9 @@ class SyntheticExtensionsScope(storageManager: StorageManager) : JetScope by Jet
|
||||
}
|
||||
|
||||
private fun isGoodSetMethod(descriptor: FunctionDescriptor, propertyType: JetType): Boolean {
|
||||
return descriptor.getValueParameters().singleOrNull()?.getType() == propertyType
|
||||
val parameter = descriptor.getValueParameters().singleOrNull() ?: return false
|
||||
return parameter.getType() == propertyType
|
||||
&& parameter.getVarargElementType() == null
|
||||
&& descriptor.getTypeParameters().isEmpty()
|
||||
&& descriptor.getReturnType()?.let { KotlinBuiltIns.isUnit(it) } ?: false
|
||||
&& descriptor.getVisibility() == Visibilities.PUBLIC
|
||||
|
||||
@@ -5,6 +5,7 @@ fun foo(javaClass: JavaClass) {
|
||||
<!VAL_REASSIGNMENT!>javaClass.something3<!>++
|
||||
<!VAL_REASSIGNMENT!>javaClass.something4<!>++
|
||||
<!VAL_REASSIGNMENT!>javaClass.something5<!>++
|
||||
<!VAL_REASSIGNMENT!>javaClass.something6<!> = null
|
||||
}
|
||||
|
||||
// FILE: JavaClass.java
|
||||
@@ -23,4 +24,7 @@ public class JavaClass {
|
||||
|
||||
public int getSomething5() { return 1; }
|
||||
public static void setSomething5(int value) { }
|
||||
|
||||
public int[] getSomething6() { return null; }
|
||||
public void setSomething6(int... value) { }
|
||||
}
|
||||
@@ -10,11 +10,13 @@ public open class JavaClass {
|
||||
public open fun getSomething3(): kotlin.Int
|
||||
public open fun getSomething4(): kotlin.Int
|
||||
public open fun getSomething5(): kotlin.Int
|
||||
public open fun getSomething6(): kotlin.IntArray!
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun setSomething1(/*0*/ value: kotlin.Int, /*1*/ c: kotlin.Char): kotlin.Unit
|
||||
public open fun setSomething2(/*0*/ value: kotlin.String!): kotlin.Unit
|
||||
public open fun setSomething3(/*0*/ value: kotlin.Int): kotlin.Int
|
||||
public open fun </*0*/ T> setSomething4(/*0*/ value: kotlin.Int): kotlin.Unit
|
||||
public open fun setSomething6(/*0*/ vararg value: kotlin.Int /*kotlin.IntArray!*/): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
// Static members
|
||||
|
||||
Reference in New Issue
Block a user