Introduced Identifier.withNoPrototype()

This commit is contained in:
Valentin Kipyatkov
2016-08-19 18:07:24 +03:00
parent 0554e1702c
commit 87294207f9
14 changed files with 52 additions and 46 deletions
@@ -86,7 +86,7 @@ class AnnotationConverter(private val converter: Converter) {
private fun convertModifiersToAnnotations(owner: PsiModifierListOwner): Annotations {
val list = MODIFIER_TO_ANNOTATION
.filter { owner.hasModifierProperty(it.first) }
.map { Annotation(Identifier(it.second).assignNoPrototype(), listOf(), newLineAfter = false).assignNoPrototype() }
.map { Annotation(Identifier.withNoPrototype(it.second), listOf(), newLineAfter = false).assignNoPrototype() }
return Annotations(list).assignNoPrototype()
}
@@ -110,7 +110,7 @@ class AnnotationConverter(private val converter: Converter) {
val qualifiedName = annotation.qualifiedName
if (qualifiedName == CommonClassNames.JAVA_LANG_DEPRECATED && annotation.parameterList.attributes.isEmpty()) {
val deferredExpression = converter.deferredElement<Expression> { LiteralExpression("\"\"").assignNoPrototype() }
return Identifier("Deprecated").assignNoPrototype() to listOf(null to deferredExpression) //TODO: insert comment
return Identifier.withNoPrototype("Deprecated") to listOf(null to deferredExpression) //TODO: insert comment
}
if (qualifiedName == CommonClassNames.JAVA_LANG_ANNOTATION_TARGET) {
val attributes = annotation.parameterList.attributes
@@ -131,11 +131,11 @@ class AnnotationConverter(private val converter: Converter) {
val deferredExpressionList = arguments.map {
val name = it.name
null to converter.deferredElement<Expression> {
QualifiedExpression(Identifier("AnnotationTarget", false).assignNoPrototype(),
Identifier(name, false).assignNoPrototype())
QualifiedExpression(Identifier.withNoPrototype("AnnotationTarget", isNullable = false),
Identifier.withNoPrototype(name, isNullable = false))
}
}
return Identifier("Target").assignNoPrototype() to deferredExpressionList
return Identifier.withNoPrototype("Target") to deferredExpressionList
}
val nameRef = annotation.nameReferenceElement
@@ -146,7 +146,7 @@ class AnnotationConverter(private val converter: Converter) {
val method = annotationClass?.findMethodsByName(parameterName, false)?.firstOrNull()
val expectedType = method?.returnType
val attrName = it.name?.let { Identifier(it).assignNoPrototype() }
val attrName = it.name?.let { Identifier.withNoPrototype(it) }
val value = it.value
val isVarArg = parameterName == "value" /* converted to vararg in Kotlin */
@@ -34,6 +34,7 @@ import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.psiUtil.parentsWithSelf
import org.jetbrains.kotlin.types.expressions.OperatorConventions.*
import org.jetbrains.kotlin.utils.addToStdlib.singletonOrEmptyList
import java.lang.IllegalArgumentException
import java.util.*
class Converter private constructor(
@@ -386,7 +387,7 @@ class Converter private constructor(
else if (propertyInfo.modifiers.contains(Modifier.OVERRIDE) && !(propertyInfo.superInfo?.isAbstract() ?: false)) {
val superExpression = SuperExpression(Identifier.Empty).assignNoPrototype()
val superAccess = QualifiedExpression(superExpression, propertyInfo.identifier).assignNoPrototype()
val valueIdentifier = Identifier("value", false).assignNoPrototype()
val valueIdentifier = Identifier.withNoPrototype("value", isNullable = false)
val assignment = AssignmentExpression(superAccess, valueIdentifier, Operator.EQ).assignNoPrototype()
val body = Block.of(assignment).assignNoPrototype()
val parameter = FunctionParameter(valueIdentifier, propertyType, FunctionParameter.VarValModifier.None, Annotations.Empty, Modifiers.Empty).assignNoPrototype()
@@ -553,14 +554,14 @@ class Converter private constructor(
if (PsiMethodUtil.isMainMethod(method)) {
function.annotations += Annotations(
listOf(Annotation(Identifier("JvmStatic").assignNoPrototype(),
listOf(Annotation(Identifier.withNoPrototype("JvmStatic"),
listOf(),
newLineAfter = false).assignNoPrototype())).assignNoPrototype()
}
if (function.parameterList!!.parameters.any { it is FunctionParameter && it.defaultValue != null } && !function.modifiers.isPrivate) {
function.annotations += Annotations(
listOf(Annotation(Identifier("JvmOverloads").assignNoPrototype(),
listOf(Annotation(Identifier.withNoPrototype("JvmOverloads"),
listOf(),
newLineAfter = false).assignNoPrototype())).assignNoPrototype()
}
@@ -633,7 +634,7 @@ class Converter private constructor(
result = Identifier.toKotlin(codeRefElement.referenceName!!) + "." + result
qualifier = codeRefElement.qualifier
}
return ReferenceElement(Identifier(result).assignNoPrototype(), typeArgs).assignPrototype(element)
return ReferenceElement(Identifier.withNoPrototype(result), typeArgs).assignPrototype(element)
}
else {
if (!hasExternalQualifier) {
@@ -646,7 +647,7 @@ class Converter private constructor(
}
}
return ReferenceElement(Identifier(element.referenceName!!).assignNoPrototype(), typeArgs).assignPrototype(element)
return ReferenceElement(Identifier.withNoPrototype(element.referenceName!!), typeArgs).assignPrototype(element)
}
}
@@ -656,7 +657,7 @@ class Converter private constructor(
&& !PsiTreeUtil.isAncestor(outerClass, context, true)
&& !psiClass.isImported(context.containingFile as PsiJavaFile)) {
val qualifier = constructNestedClassReferenceIdentifier(outerClass, context)?.name ?: outerClass.name!!
return Identifier(Identifier.toKotlin(qualifier) + "." + Identifier.toKotlin(psiClass.name!!)).assignNoPrototype()
return Identifier.withNoPrototype(Identifier.toKotlin(qualifier) + "." + Identifier.toKotlin(psiClass.name!!))
}
return null
}
@@ -782,7 +783,7 @@ class Converter private constructor(
val convertedType = typeConverter.convertType(types[index], Nullability.NotNull)
null to deferredElement<Expression> { ClassLiteralExpression(convertedType.assignPrototype(refElements[index])) }
}
val annotation = Annotation(Identifier("Throws").assignNoPrototype(), arguments, newLineAfter = true)
val annotation = Annotation(Identifier.withNoPrototype("Throws"), arguments, newLineAfter = true)
return Annotations(listOf(annotation.assignPrototype(throwsList))).assignPrototype(throwsList)
}
@@ -37,6 +37,7 @@ import org.jetbrains.kotlin.psi.psiUtil.getParentOfType
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
import org.jetbrains.kotlin.psi.psiUtil.isExtensionDeclaration
import org.jetbrains.kotlin.resolve.jvm.JvmPrimitiveType
import java.lang.AssertionError
interface ExpressionConverter {
fun convertExpression(expression: PsiExpression, codeConverter: CodeConverter): Expression
@@ -241,7 +242,7 @@ class DefaultExpressionConverter : JavaElementVisitor(), ExpressionConverter {
}
else {
val type = converter.convertTypeElement(operand, Nullability.NotNull)
result = QualifiedExpression(ClassLiteralExpression(type).assignNoPrototype(), Identifier("java").assignNoPrototype())
result = QualifiedExpression(ClassLiteralExpression(type).assignNoPrototype(), Identifier.withNoPrototype("java"))
return
}
@@ -252,7 +253,7 @@ class DefaultExpressionConverter : JavaElementVisitor(), ExpressionConverter {
else
wrapperTypeName.shortName().asString()
result = QualifiedExpression(Identifier(classNameToUse, false).assignPrototype(operand),
Identifier("TYPE", false).assignNoPrototype())
Identifier.withNoPrototype("TYPE", isNullable = false))
}
override fun visitConditionalExpression(expression: PsiConditionalExpression) {
@@ -335,7 +336,7 @@ class DefaultExpressionConverter : JavaElementVisitor(), ExpressionConverter {
origin as KtNamedDeclaration
val parameterCount = target.parameterList.parameters.size
if (parameterCount == arguments.size) {
val propertyName = Identifier(property.name!!, isNullable).assignNoPrototype()
val propertyName = Identifier.withNoPrototype(property.name!!, isNullable)
val isExtension = property.isExtensionDeclaration()
val propertyAccess = if (isTopLevel) {
if (isExtension)
@@ -536,9 +537,9 @@ class DefaultExpressionConverter : JavaElementVisitor(), ExpressionConverter {
val qualifier = expression.qualifierExpression
var identifier = Identifier(referenceName, isNullable).assignNoPrototype()
var identifier = Identifier.withNoPrototype(referenceName, isNullable)
if (qualifier != null && qualifier.type is PsiArrayType && referenceName == "length") {
identifier = Identifier("size", isNullable).assignNoPrototype()
identifier = Identifier.withNoPrototype("size", isNullable)
}
else if (qualifier != null) {
if (target is KtLightField && target.kotlinOrigin is KtObjectDeclaration) {
@@ -549,7 +550,7 @@ class DefaultExpressionConverter : JavaElementVisitor(), ExpressionConverter {
else {
if (target is PsiClass) {
if (PrimitiveType.values().any { it.typeName.asString() == target.name }) {
result = Identifier(target.qualifiedName!!, false)
result = Identifier.withNoPrototype(target.qualifiedName!!, isNullable = false)
return
}
}
@@ -568,7 +569,7 @@ class DefaultExpressionConverter : JavaElementVisitor(), ExpressionConverter {
code = Identifier.toKotlin(containingClass.name!!) + "." + code
member = containingClass
}
result = Identifier(code, false, false)
result = Identifier.withNoPrototype(code, isNullable = false, quotingNeeded = false)
return
}
}
@@ -689,7 +690,7 @@ class DefaultExpressionConverter : JavaElementVisitor(), ExpressionConverter {
override fun visitLambdaExpression(expression: PsiLambdaExpression) {
val parameters = expression.parameterList
val convertedParameters = ParameterList(parameters.parameters.map {
val paramName = Identifier(it.name!!).assignNoPrototype()
val paramName = Identifier.withNoPrototype(it.name!!)
val paramType = if (it.typeElement != null) converter.typeConverter.convertType(it.type) else null
LambdaParameter(paramName, paramType).assignPrototype(it)
}, lPar = null, rPar = null).assignPrototype(parameters)
@@ -718,7 +719,7 @@ class DefaultExpressionConverter : JavaElementVisitor(), ExpressionConverter {
val callExpression = expression.getParentOfType<PsiMethodCallExpression>(false)
if (callExpression != null) {
return ReturnStatement(expressionForReturn, Identifier(callExpression.methodExpression.text).assignNoPrototype())
return ReturnStatement(expressionForReturn, Identifier.withNoPrototype(callExpression.methodExpression.text))
}
return ReturnStatement(expressionForReturn)
@@ -852,23 +853,23 @@ class DefaultExpressionConverter : JavaElementVisitor(), ExpressionConverter {
val containingClassName = thisClass.qualifiedName ?: containingClass!!.name
if (containingClassName != null) {
val fqName = FqName(containingClassName)
val identifier = Identifier(fqName.shortName().identifier, imports = listOf(fqName)).assignNoPrototype()
val identifier = Identifier.withNoPrototype(fqName.shortName().identifier, imports = listOf(fqName))
thisClassType = ClassType(
ReferenceElement(identifier, converter.convertTypeParameterList(thisClass.typeParameterList).parameters).assignNoPrototype(),
Nullability.NotNull,
converter.settings).assignNoPrototype()
}
}
if (needThis) newParameters.add(Identifier("obj", false).assignNoPrototype() to thisClassType)
if (needThis) newParameters.add(Identifier.withNoPrototype("obj", isNullable = false) to thisClassType)
parameterList.parameters.forEach {
val parameterType = if (isKotlinFunctionType) converter.typeConverter.convertType(it.type, Nullability.NotNull) else null
newParameters.add(Identifier(it.name ?: "p", false).assignNoPrototype() to parameterType)
newParameters.add(Identifier.withNoPrototype(it.name ?: "p", isNullable = false) to parameterType)
}
if (newParameters.size == 1 && !isKotlinFunctionType) {
newParameters.clear()
newParameters.add(Identifier("it", false).assignNoPrototype() to null)
newParameters.add(Identifier.withNoPrototype("it", isNullable = false) to null)
}
return newParameters
@@ -178,7 +178,7 @@ class ForConverter(
val range = forIterationRange(start, right, reversed, inclusive).assignNoPrototype()
val explicitType = if (settings.specifyLocalVariableTypeByDefault)
PrimitiveType(Identifier("Int").assignNoPrototype()).assignNoPrototype()
PrimitiveType(Identifier.withNoPrototype("Int")).assignNoPrototype()
else
null
return ForeachStatement(loopVar.declarationIdentifier(), explicitType, range, codeConverter.convertStatementOrBlock(body), statement.isInSingleLine())
@@ -239,7 +239,7 @@ class ForConverter(
val collectionType = PsiElementFactory.SERVICE.getInstance(project).createTypeByFQClassName(CommonClassNames.JAVA_UTIL_COLLECTION)
val qualifierType = qualifier.type
if (qualifierType != null && collectionType.isAssignableFrom(qualifierType)) {
indices = QualifiedExpression(codeConverter.convertExpression(qualifier), Identifier("indices", false).assignNoPrototype())
indices = QualifiedExpression(codeConverter.convertExpression(qualifier), Identifier.withNoPrototype("indices", isNullable = false))
}
}
}
@@ -249,7 +249,7 @@ class ForConverter(
&& collectionSize.referenceName == "length") {
val qualifier = collectionSize.qualifierExpression
if (qualifier is PsiReferenceExpression && qualifier.type is PsiArrayType) {
indices = QualifiedExpression(codeConverter.convertExpression(qualifier), Identifier("indices", false).assignNoPrototype())
indices = QualifiedExpression(codeConverter.convertExpression(qualifier), Identifier.withNoPrototype("indices", isNullable = false))
}
}
@@ -196,7 +196,7 @@ enum class SpecialMethod(val qualifiedClassName: String?, val methodName: String
OBJECT_GET_CLASS(JAVA_LANG_OBJECT, "getClass", 0) {
override fun convertCall(qualifier: PsiExpression?, arguments: Array<PsiExpression>, typeArgumentsConverted: List<Type>, codeConverter: CodeConverter): Expression {
val identifier = Identifier("javaClass", false).assignNoPrototype()
val identifier = Identifier.withNoPrototype("javaClass", isNullable = false)
return if (qualifier != null) QualifiedExpression(codeConverter.convertExpression(qualifier), identifier) else identifier
}
},
@@ -233,7 +233,7 @@ enum class SpecialMethod(val qualifiedClassName: String?, val methodName: String
STRING_TRIM(JAVA_LANG_STRING, "trim", 0) {
override fun convertCall(qualifier: PsiExpression?, arguments: Array<PsiExpression>, typeArgumentsConverted: List<Type>, codeConverter: CodeConverter): Expression? {
val comparison = BinaryExpression(Identifier("it", isNullable = false).assignNoPrototype(), LiteralExpression("' '").assignNoPrototype(), Operator(JavaTokenType.LE).assignNoPrototype()).assignNoPrototype()
val comparison = BinaryExpression(Identifier.withNoPrototype("it", isNullable = false), LiteralExpression("' '").assignNoPrototype(), Operator(JavaTokenType.LE).assignNoPrototype()).assignNoPrototype()
return MethodCallExpression.buildNotNull(
codeConverter.convertExpression(qualifier), "trim",
listOf(LambdaExpression(null, Block.of(comparison).assignNoPrototype())), emptyList())
@@ -266,7 +266,7 @@ enum class SpecialMethod(val qualifiedClassName: String?, val methodName: String
STRING_SPLIT(JAVA_LANG_STRING, "split", 1) {
override fun convertCall(qualifier: PsiExpression?, arguments: Array<PsiExpression>, typeArgumentsConverted: List<Type>, codeConverter: CodeConverter): Expression? {
val splitCall = MethodCallExpression.buildNotNull(codeConverter.convertExpression(qualifier), "split", listOf(codeConverter.convertToRegex(arguments.single())), emptyList()).assignNoPrototype()
val isEmptyCall = MethodCallExpression.buildNotNull(Identifier("it", isNullable = false).assignNoPrototype(), "isEmpty", emptyList(), emptyList()).assignNoPrototype()
val isEmptyCall = MethodCallExpression.buildNotNull(Identifier.withNoPrototype("it", isNullable = false), "isEmpty", emptyList(), emptyList()).assignNoPrototype()
val isEmptyCallBlock = Block.of(isEmptyCall).assignNoPrototype()
val dropLastCall = MethodCallExpression.buildNotNull(splitCall, "dropLastWhile", listOf(LambdaExpression(null, isEmptyCallBlock).assignNoPrototype())).assignNoPrototype()
return MethodCallExpression.buildNotNull(dropLastCall, "toTypedArray", emptyList(), emptyList())
@@ -419,7 +419,7 @@ enum class SpecialMethod(val qualifiedClassName: String?, val methodName: String
abstract fun convertCall(qualifier: PsiExpression?, arguments: Array<PsiExpression>, typeArgumentsConverted: List<Type>, codeConverter: CodeConverter): Expression?
protected fun convertMethodCallToPropertyUse(codeConverter: CodeConverter, qualifier: PsiExpression?, propertyName: String = methodName): Expression {
val identifier = Identifier(propertyName, false).assignNoPrototype()
val identifier = Identifier.withNoPrototype(propertyName, isNullable = false)
return if (qualifier != null) QualifiedExpression(codeConverter.convertExpression(qualifier), identifier) else identifier
}
@@ -441,7 +441,7 @@ enum class SpecialMethod(val qualifiedClassName: String?, val methodName: String
val convertedQualifier = codeConverter.convertExpression(qualifier)
val qualifierType = codeConverter.typeConverter.convertType(qualifier.type)
val typeArgs = if (qualifierType is ClassType) qualifierType.referenceElement.typeArgs else emptyList()
val referenceElement = ReferenceElement(Identifier(type).assignNoPrototype(), typeArgs).assignNoPrototype()
val referenceElement = ReferenceElement(Identifier.withNoPrototype(type), typeArgs).assignNoPrototype()
val newType = ClassType(referenceElement, Nullability.Default, codeConverter.settings).assignNoPrototype()
return TypeCastExpression(newType, convertedQualifier).assignNoPrototype()
}
@@ -485,7 +485,7 @@ private fun addIgnoreCaseArgument(
ignoreCaseArgument: PsiExpression? = null
): Expression {
val ignoreCaseExpression = ignoreCaseArgument?.let { codeConverter.convertExpression(it) } ?: LiteralExpression("true").assignNoPrototype()
val ignoreCaseArgumentExpression = AssignmentExpression(Identifier("ignoreCase").assignNoPrototype(), ignoreCaseExpression, Operator.EQ).assignNoPrototype()
val ignoreCaseArgumentExpression = AssignmentExpression(Identifier.withNoPrototype("ignoreCase"), ignoreCaseExpression, Operator.EQ).assignNoPrototype()
return MethodCallExpression.build(codeConverter.convertExpression(qualifier), methodName,
arguments.map { codeConverter.convertExpression(it, null, Nullability.NotNull) } + ignoreCaseArgumentExpression,
typeArgumentsConverted, false)
@@ -215,7 +215,7 @@ class DefaultStatementConverter : JavaElementVisitor(), StatementConverter {
var block = converterForBody.convertBlock(tryBlock)
var expression: Expression = Expression.Empty
for (variable in resourceVariables.asReversed()) {
val parameter = LambdaParameter(Identifier(variable.name!!).assignNoPrototype(), null).assignNoPrototype()
val parameter = LambdaParameter(Identifier.withNoPrototype(variable.name!!), null).assignNoPrototype()
val parameterList = ParameterList(listOf(parameter), lPar = null, rPar = null).assignNoPrototype()
val lambda = LambdaExpression(parameterList, block)
expression = MethodCallExpression.build(codeConverter.convertExpression(variable.initializer), "use", listOf(lambda), listOf(), false)
@@ -58,7 +58,7 @@ class TypeConverter(val converter: Converter) {
fun convertVariableType(variable: PsiVariable): Type {
val result = if (variable.isMainMethodParameter()) {
ArrayType(ClassType(ReferenceElement(Identifier("String").assignNoPrototype(), listOf()).assignNoPrototype(), Nullability.NotNull, converter.settings).assignNoPrototype(),
ArrayType(ClassType(ReferenceElement(Identifier.withNoPrototype("String"), listOf()).assignNoPrototype(), Nullability.NotNull, converter.settings).assignNoPrototype(),
Nullability.NotNull,
converter.settings).assignNoPrototype()
}
@@ -44,13 +44,13 @@ class TypeVisitor(
UnitType()
}
else if (PRIMITIVE_TYPES_NAMES.contains(name)) {
PrimitiveType(Identifier(StringUtil.capitalize(name)).assignNoPrototype())
PrimitiveType(Identifier.withNoPrototype(StringUtil.capitalize(name)))
}
else if (name == "null") {
NullType()
}
else {
PrimitiveType(Identifier(name).assignNoPrototype())
PrimitiveType(Identifier.withNoPrototype(name))
}
}
@@ -76,7 +76,7 @@ class TypeVisitor(
if (inAnnotationType && javaClassName == "java.lang.Class") {
val fqName = FqName("kotlin.reflect.KClass")
val identifier = Identifier(fqName.shortName().identifier, imports = listOf(fqName)).assignNoPrototype()
val identifier = Identifier.withNoPrototype(fqName.shortName().identifier, imports = listOf(fqName))
return ReferenceElement(identifier, typeArgs).assignNoPrototype()
}
}
@@ -85,7 +85,7 @@ class TypeVisitor(
return converter.convertCodeReferenceElement(classType.reference, hasExternalQualifier = false, typeArgsConverted = typeArgs)
}
return ReferenceElement(Identifier(classType.className ?: "").assignNoPrototype(), typeArgs).assignNoPrototype()
return ReferenceElement(Identifier.withNoPrototype(classType.className ?: ""), typeArgs).assignNoPrototype()
}
private fun convertTypeArgs(classType: PsiClassType): List<Type> {
+1 -1
View File
@@ -139,7 +139,7 @@ fun Converter.convertToKotlinAnalog(classQualifiedName: String?, mutability: Mut
fun Converter.convertToKotlinAnalogIdentifier(classQualifiedName: String?, mutability: Mutability): Identifier? {
val kotlinClassName = convertToKotlinAnalog(classQualifiedName, mutability) ?: return null
return Identifier(kotlinClassName.substringAfterLast('.')).assignNoPrototype()
return Identifier.withNoPrototype(kotlinClassName.substringAfterLast('.'))
}
private val toKotlinTypesMap: Map<String, String> = mapOf(
@@ -61,5 +61,9 @@ class Identifier(
private val KEYWORDS = KtTokens.KEYWORDS.types.map { (it as KtKeywordToken).value }.toSet()
fun toKotlin(name: String): String = Identifier(name).toKotlin()
fun withNoPrototype(name: String, isNullable: Boolean = true, quotingNeeded: Boolean = true, imports: Collection<FqName> = emptyList()): Identifier {
return Identifier(name, isNullable, quotingNeeded, imports).assignNoPrototype()
}
}
}
@@ -49,7 +49,7 @@ class MethodCallExpression(
arguments: List<Expression>,
typeArguments: List<Type>,
isNullable: Boolean): MethodCallExpression {
val identifier = Identifier(methodName, false).assignNoPrototype()
val identifier = Identifier.withNoPrototype(methodName, isNullable = false)
return MethodCallExpression(if (receiver != null) QualifiedExpression(receiver, identifier).assignNoPrototype() else identifier,
arguments,
typeArguments,
@@ -219,7 +219,7 @@ private class PropertyDetector(
propertyAccess
val specialSetterAccess = setterAccess?.check { it != propertyAccess }
val propertyInfo = PropertyInfo(Identifier(propertyName).assignNoPrototype(),
val propertyInfo = PropertyInfo(Identifier.withNoPrototype(propertyName),
isVar,
type,
field,
@@ -33,7 +33,7 @@ class AccessorToPropertyProcessing(val accessorMethod: PsiMethod, val accessorKi
val methodExpr = methodCall.methodExpression
val arguments = methodCall.argumentList.expressions
val propertyName = Identifier(propertyName, isNullable).assignNoPrototype()
val propertyName = Identifier.withNoPrototype(propertyName, isNullable)
val propertyAccess = QualifiedExpression(codeConverter.convertExpression(methodExpr.qualifierExpression), propertyName).assignNoPrototype()
if (accessorKind == AccessorKind.GETTER) {
@@ -56,7 +56,7 @@ class FieldToPropertyProcessing(
|| replaceWriteWithFieldReference && PsiUtil.isAccessedForWriting(expression)
//TODO: what if local "field" is declared? Should be rare case though
val identifier = Identifier(if (useFieldReference) "field" else propertyName, isNullable).assignNoPrototype()
val identifier = Identifier.withNoPrototype(if (useFieldReference) "field" else propertyName, isNullable)
val qualifier = expression.qualifierExpression
if (qualifier != null && !useFieldReference) {