Minor corrections on code review
This commit is contained in:
@@ -70,7 +70,7 @@ class ClassBodyConverter(private val psiClass: PsiClass,
|
|||||||
converter.referenceSearcher)
|
converter.referenceSearcher)
|
||||||
|
|
||||||
val constructorConverter = if (psiClass.getName() != null && !classKind.isObject())
|
val constructorConverter = if (psiClass.getName() != null && !classKind.isObject())
|
||||||
ConstructorConverter(psiClass, converter, { memberToPropertyInfo[it] }, overloadReducer, classKind)
|
ConstructorConverter(psiClass, converter, { field -> memberToPropertyInfo[field]!! }, overloadReducer)
|
||||||
else
|
else
|
||||||
null
|
null
|
||||||
|
|
||||||
|
|||||||
@@ -24,9 +24,8 @@ import java.util.*
|
|||||||
class ConstructorConverter(
|
class ConstructorConverter(
|
||||||
private val psiClass: PsiClass,
|
private val psiClass: PsiClass,
|
||||||
private val converter: Converter,
|
private val converter: Converter,
|
||||||
private val fieldToPropertyInfo: (PsiField) -> PropertyInfo?,
|
private val fieldToPropertyInfo: (PsiField) -> PropertyInfo,
|
||||||
private val overloadReducer: OverloadReducer,
|
private val overloadReducer: OverloadReducer
|
||||||
private val classKind: ClassKind
|
|
||||||
) {
|
) {
|
||||||
private val constructors = psiClass.getConstructors().asList()
|
private val constructors = psiClass.getConstructors().asList()
|
||||||
|
|
||||||
@@ -145,13 +144,13 @@ class ConstructorConverter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val propertyInfo = fieldToPropertyInfo(field)
|
val propertyInfo = fieldToPropertyInfo(field)
|
||||||
if (propertyInfo != null && (propertyInfo.needExplicitGetter || propertyInfo.needExplicitSetter)) continue
|
if (propertyInfo.needExplicitGetter || propertyInfo.needExplicitSetter) continue
|
||||||
|
|
||||||
parameterToField.put(parameter, field to type)
|
parameterToField.put(parameter, field to type)
|
||||||
statementsToRemove.add(initializationStatement)
|
statementsToRemove.add(initializationStatement)
|
||||||
fieldsToDrop.add(field)
|
fieldsToDrop.add(field)
|
||||||
|
|
||||||
val fieldName = propertyInfo?.name ?: field.getName()!!
|
val fieldName = propertyInfo.name
|
||||||
if (fieldName != parameter.getName()) {
|
if (fieldName != parameter.getName()) {
|
||||||
parameterUsageReplacementMap.put(parameter.getName()!!, fieldName)
|
parameterUsageReplacementMap.put(parameter.getName()!!, fieldName)
|
||||||
}
|
}
|
||||||
@@ -200,7 +199,7 @@ class ConstructorConverter(
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
val (field, type) = parameterToField[parameter]!!
|
val (field, type) = parameterToField[parameter]!!
|
||||||
val propertyInfo = fieldToPropertyInfo(field)!!
|
val propertyInfo = fieldToPropertyInfo(field)
|
||||||
FunctionParameter(propertyInfo.identifier,
|
FunctionParameter(propertyInfo.identifier,
|
||||||
type,
|
type,
|
||||||
if (propertyInfo.isVar) FunctionParameter.VarValModifier.Var else FunctionParameter.VarValModifier.Val,
|
if (propertyInfo.isVar) FunctionParameter.VarValModifier.Var else FunctionParameter.VarValModifier.Val,
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ private class PropertyDetector(
|
|||||||
private fun detectGetters(
|
private fun detectGetters(
|
||||||
methodsToCheck: List<Pair<PsiMethod, SuperInfo.Property?>>,
|
methodsToCheck: List<Pair<PsiMethod, SuperInfo.Property?>>,
|
||||||
prohibitedPropertyNames: MutableSet<String?>,
|
prohibitedPropertyNames: MutableSet<String?>,
|
||||||
propertyNamesWithConflict: HashSet<String>
|
propertyNamesWithConflict: MutableSet<String>
|
||||||
): Map<String, AccessorInfo> {
|
): Map<String, AccessorInfo> {
|
||||||
val propertyNameToGetterInfo = LinkedHashMap<String, AccessorInfo>()
|
val propertyNameToGetterInfo = LinkedHashMap<String, AccessorInfo>()
|
||||||
for ((method, superInfo) in methodsToCheck) {
|
for ((method, superInfo) in methodsToCheck) {
|
||||||
@@ -228,7 +228,7 @@ private class PropertyDetector(
|
|||||||
methodsToCheck: List<Pair<PsiMethod, SuperInfo.Property?>>,
|
methodsToCheck: List<Pair<PsiMethod, SuperInfo.Property?>>,
|
||||||
prohibitedPropertyNames: MutableSet<String?>,
|
prohibitedPropertyNames: MutableSet<String?>,
|
||||||
propertyNamesFromGetters: Set<String>,
|
propertyNamesFromGetters: Set<String>,
|
||||||
propertyNamesWithConflict: HashSet<String>
|
propertyNamesWithConflict: MutableSet<String>
|
||||||
): Map<String, AccessorInfo> {
|
): Map<String, AccessorInfo> {
|
||||||
val propertyNameToSetterInfo = LinkedHashMap<String, AccessorInfo>()
|
val propertyNameToSetterInfo = LinkedHashMap<String, AccessorInfo>()
|
||||||
for ((method, superInfo) in methodsToCheck) {
|
for ((method, superInfo) in methodsToCheck) {
|
||||||
|
|||||||
Vendored
-1
@@ -2,7 +2,6 @@ package javaApi;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.lang.String;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import kotlinApi.KotlinClassWithProperties;
|
import kotlinApi.KotlinClassWithProperties;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user