Minor correction
This commit is contained in:
@@ -81,7 +81,7 @@ class PropertyInfo(
|
|||||||
class PropertyDetectionCache(private val converter: Converter) {
|
class PropertyDetectionCache(private val converter: Converter) {
|
||||||
private val cache = HashMap<PsiClass, Map<PsiMember, PropertyInfo>>()
|
private val cache = HashMap<PsiClass, Map<PsiMember, PropertyInfo>>()
|
||||||
|
|
||||||
fun get(psiClass: PsiClass): Map<PsiMember, PropertyInfo> {
|
operator fun get(psiClass: PsiClass): Map<PsiMember, PropertyInfo> {
|
||||||
cache[psiClass]?.let { return it }
|
cache[psiClass]?.let { return it }
|
||||||
|
|
||||||
assert(converter.inConversionScope(psiClass))
|
assert(converter.inConversionScope(psiClass))
|
||||||
@@ -149,7 +149,7 @@ private class PropertyDetector(
|
|||||||
else
|
else
|
||||||
field != null && field.isVar(converter.referenceSearcher)
|
field != null && field.isVar(converter.referenceSearcher)
|
||||||
|
|
||||||
val type = field?.type ?: getterInfo?.method?.returnType ?: setterInfo!!.method.parameterList.parameters.single()?.type!!
|
val type = getterInfo?.method?.returnType ?: setterInfo!!.method.parameterList.parameters.single()?.type!!
|
||||||
|
|
||||||
val isOverride = getterInfo?.superProperty != null || setterInfo?.superProperty != null
|
val isOverride = getterInfo?.superProperty != null || setterInfo?.superProperty != null
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
class A {
|
||||||
|
private ArrayList<String> list1 = new ArrayList<String>();
|
||||||
|
private List<String> list2 = new ArrayList<String>();
|
||||||
|
private List<String> myList3 = new ArrayList<String>();
|
||||||
|
|
||||||
|
public List<String> getList1() {
|
||||||
|
return list1;
|
||||||
|
}
|
||||||
|
public List<String> getList2() {
|
||||||
|
return list2;
|
||||||
|
}
|
||||||
|
public List<String> getList3() {
|
||||||
|
return myList3;
|
||||||
|
}
|
||||||
|
|
||||||
|
void foo() {
|
||||||
|
list1.add("a");
|
||||||
|
list2.add("a");
|
||||||
|
myList3.add("a");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import java.util.ArrayList
|
||||||
|
|
||||||
|
internal class A {
|
||||||
|
private val list1 = ArrayList<String>()
|
||||||
|
private val list2 = ArrayList<String>()
|
||||||
|
private val myList3 = ArrayList<String>()
|
||||||
|
|
||||||
|
fun getList1(): List<String> {
|
||||||
|
return list1
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getList2(): List<String> {
|
||||||
|
return list2
|
||||||
|
}
|
||||||
|
|
||||||
|
val list3: List<String>
|
||||||
|
get() = myList3
|
||||||
|
|
||||||
|
fun foo() {
|
||||||
|
list1.add("a")
|
||||||
|
list2.add("a")
|
||||||
|
myList3.add("a")
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1549,6 +1549,12 @@ public class JavaToKotlinConverterForWebDemoTestGenerated extends AbstractJavaTo
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("PropertyType.java")
|
||||||
|
public void testPropertyType() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("j2k/testData/fileOrElement/detectProperties/PropertyType.java");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("SetterTypeNotMatch.java")
|
@TestMetadata("SetterTypeNotMatch.java")
|
||||||
public void testSetterTypeNotMatch() throws Exception {
|
public void testSetterTypeNotMatch() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("j2k/testData/fileOrElement/detectProperties/SetterTypeNotMatch.java");
|
String fileName = JetTestUtils.navigationMetadata("j2k/testData/fileOrElement/detectProperties/SetterTypeNotMatch.java");
|
||||||
|
|||||||
@@ -1549,6 +1549,12 @@ public class JavaToKotlinConverterSingleFileTestGenerated extends AbstractJavaTo
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("PropertyType.java")
|
||||||
|
public void testPropertyType() throws Exception {
|
||||||
|
String fileName = JetTestUtils.navigationMetadata("j2k/testData/fileOrElement/detectProperties/PropertyType.java");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("SetterTypeNotMatch.java")
|
@TestMetadata("SetterTypeNotMatch.java")
|
||||||
public void testSetterTypeNotMatch() throws Exception {
|
public void testSetterTypeNotMatch() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("j2k/testData/fileOrElement/detectProperties/SetterTypeNotMatch.java");
|
String fileName = JetTestUtils.navigationMetadata("j2k/testData/fileOrElement/detectProperties/SetterTypeNotMatch.java");
|
||||||
|
|||||||
Reference in New Issue
Block a user