No synthetic property for false get-method like "issue()"
This commit is contained in:
+5
-4
@@ -24,6 +24,7 @@ import org.jetbrains.kotlin.descriptors.impl.PropertyGetterDescriptorImpl
|
||||
import org.jetbrains.kotlin.descriptors.impl.PropertySetterDescriptorImpl
|
||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.scopes.DescriptorKindFilter
|
||||
@@ -39,9 +40,7 @@ import org.jetbrains.kotlin.util.capitalizeDecapitalize.capitalizeFirstWord
|
||||
import org.jetbrains.kotlin.util.capitalizeDecapitalize.decapitalizeSmart
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
import org.jetbrains.kotlin.utils.addIfNotNull
|
||||
import java.util.ArrayList
|
||||
import java.util.HashMap
|
||||
import java.util.HashSet
|
||||
import java.util.*
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
interface SyntheticJavaPropertyDescriptor : PropertyDescriptor {
|
||||
@@ -73,6 +72,8 @@ interface SyntheticJavaPropertyDescriptor : PropertyDescriptor {
|
||||
if (methodName.isSpecial()) return null
|
||||
val identifier = methodName.getIdentifier()
|
||||
if (!identifier.startsWith(prefix)) return null
|
||||
if (identifier.length() == prefix.length()) return null
|
||||
if (identifier[prefix.length()] in 'a'..'z') return null
|
||||
|
||||
if (addPrefix != null) {
|
||||
assert(removePrefix)
|
||||
@@ -218,7 +219,7 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager) : JetScopeImp
|
||||
val result = ArrayList<Name>(3)
|
||||
val identifier = propertyName.identifier
|
||||
|
||||
if (identifier.startsWith("is")) {
|
||||
if (JvmAbi.startsWithIsPrefix(identifier)) {
|
||||
result.add(propertyName)
|
||||
}
|
||||
|
||||
|
||||
+7
@@ -6,6 +6,9 @@ fun foo(javaClass: JavaClass) {
|
||||
javaClass.<!UNRESOLVED_REFERENCE!>something<!>
|
||||
javaClass.<!FUNCTION_CALL_EXPECTED!>isSomethingWrong<!>
|
||||
javaClass.<!UNRESOLVED_REFERENCE!>somethingWrong<!>
|
||||
|
||||
javaClass.<!FUNCTION_CALL_EXPECTED!>issueFlag<!>
|
||||
javaClass.<!UNRESOLVED_REFERENCE!>isSueFlag<!>
|
||||
}
|
||||
|
||||
// FILE: JavaClass.java
|
||||
@@ -27,4 +30,8 @@ public class JavaClass {
|
||||
public int isSomethingWrong() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public boolean issueFlag() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+1
@@ -9,6 +9,7 @@ public open class JavaClass {
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open fun isSomething(): kotlin.Boolean
|
||||
public open fun isSomethingWrong(): kotlin.Int
|
||||
public open fun issueFlag(): kotlin.Boolean
|
||||
public open fun setIsSomething2(/*0*/ value: kotlin.Boolean): kotlin.Unit
|
||||
public open fun setSomething(/*0*/ value: kotlin.Boolean): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
@@ -90,7 +90,7 @@ public final class JvmAbi {
|
||||
: SET_PREFIX + CapitalizeDecapitalizeKt.capitalizeAsciiOnly(propertyName);
|
||||
}
|
||||
|
||||
private static boolean startsWithIsPrefix(String name) {
|
||||
public static boolean startsWithIsPrefix(String name) {
|
||||
if (!name.startsWith(IS_PREFIX)) return false;
|
||||
if (name.length() == IS_PREFIX.length()) return false;
|
||||
char c = name.charAt(IS_PREFIX.length());
|
||||
|
||||
@@ -5,4 +5,6 @@ public class AAA {
|
||||
public int getX() {
|
||||
return other.x;
|
||||
}
|
||||
|
||||
public boolean issue() { return true; }
|
||||
}
|
||||
|
||||
@@ -5,4 +5,8 @@ class AAA {
|
||||
fun getX(): Int {
|
||||
return other.x
|
||||
}
|
||||
|
||||
fun issue(): Boolean {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user