Minor corrections on code review

This commit is contained in:
Valentin Kipyatkov
2015-09-25 13:02:11 +03:00
parent db0578c187
commit c8a244cc40
4 changed files with 8 additions and 10 deletions
@@ -70,7 +70,7 @@ class ClassBodyConverter(private val psiClass: PsiClass,
converter.referenceSearcher)
val constructorConverter = if (psiClass.getName() != null && !classKind.isObject())
ConstructorConverter(psiClass, converter, { memberToPropertyInfo[it] }, overloadReducer, classKind)
ConstructorConverter(psiClass, converter, { field -> memberToPropertyInfo[field]!! }, overloadReducer)
else
null
@@ -24,9 +24,8 @@ import java.util.*
class ConstructorConverter(
private val psiClass: PsiClass,
private val converter: Converter,
private val fieldToPropertyInfo: (PsiField) -> PropertyInfo?,
private val overloadReducer: OverloadReducer,
private val classKind: ClassKind
private val fieldToPropertyInfo: (PsiField) -> PropertyInfo,
private val overloadReducer: OverloadReducer
) {
private val constructors = psiClass.getConstructors().asList()
@@ -145,13 +144,13 @@ class ConstructorConverter(
}
val propertyInfo = fieldToPropertyInfo(field)
if (propertyInfo != null && (propertyInfo.needExplicitGetter || propertyInfo.needExplicitSetter)) continue
if (propertyInfo.needExplicitGetter || propertyInfo.needExplicitSetter) continue
parameterToField.put(parameter, field to type)
statementsToRemove.add(initializationStatement)
fieldsToDrop.add(field)
val fieldName = propertyInfo?.name ?: field.getName()!!
val fieldName = propertyInfo.name
if (fieldName != parameter.getName()) {
parameterUsageReplacementMap.put(parameter.getName()!!, fieldName)
}
@@ -200,7 +199,7 @@ class ConstructorConverter(
}
else {
val (field, type) = parameterToField[parameter]!!
val propertyInfo = fieldToPropertyInfo(field)!!
val propertyInfo = fieldToPropertyInfo(field)
FunctionParameter(propertyInfo.identifier,
type,
if (propertyInfo.isVar) FunctionParameter.VarValModifier.Var else FunctionParameter.VarValModifier.Val,
@@ -206,7 +206,7 @@ private class PropertyDetector(
private fun detectGetters(
methodsToCheck: List<Pair<PsiMethod, SuperInfo.Property?>>,
prohibitedPropertyNames: MutableSet<String?>,
propertyNamesWithConflict: HashSet<String>
propertyNamesWithConflict: MutableSet<String>
): Map<String, AccessorInfo> {
val propertyNameToGetterInfo = LinkedHashMap<String, AccessorInfo>()
for ((method, superInfo) in methodsToCheck) {
@@ -228,7 +228,7 @@ private class PropertyDetector(
methodsToCheck: List<Pair<PsiMethod, SuperInfo.Property?>>,
prohibitedPropertyNames: MutableSet<String?>,
propertyNamesFromGetters: Set<String>,
propertyNamesWithConflict: HashSet<String>
propertyNamesWithConflict: MutableSet<String>
): Map<String, AccessorInfo> {
val propertyNameToSetterInfo = LinkedHashMap<String, AccessorInfo>()
for ((method, superInfo) in methodsToCheck) {
-1
View File
@@ -2,7 +2,6 @@ package javaApi;
import org.jetbrains.annotations.Nullable;
import java.lang.String;
import java.util.Set;
import kotlinApi.KotlinClassWithProperties;