[LC] createField: avoid body resolve in case of psi declaration
This commit is contained in:
committed by
Space Team
parent
5950820787
commit
461682a797
+34
-16
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.light.classes.symbol.classes
|
package org.jetbrains.kotlin.light.classes.symbol.classes
|
||||||
|
|
||||||
|
import com.intellij.psi.PsiElement
|
||||||
import com.intellij.psi.PsiManager
|
import com.intellij.psi.PsiManager
|
||||||
import com.intellij.psi.PsiModifier
|
import com.intellij.psi.PsiModifier
|
||||||
import com.intellij.psi.PsiReferenceList
|
import com.intellij.psi.PsiReferenceList
|
||||||
@@ -19,6 +20,7 @@ import org.jetbrains.kotlin.analysis.api.types.KtTypeMappingMode
|
|||||||
import org.jetbrains.kotlin.analysis.project.structure.KtModule
|
import org.jetbrains.kotlin.analysis.project.structure.KtModule
|
||||||
import org.jetbrains.kotlin.analysis.project.structure.KtSourceModule
|
import org.jetbrains.kotlin.analysis.project.structure.KtSourceModule
|
||||||
import org.jetbrains.kotlin.analysis.project.structure.getKtModuleOfTypeSafe
|
import org.jetbrains.kotlin.analysis.project.structure.getKtModuleOfTypeSafe
|
||||||
|
import org.jetbrains.kotlin.analysis.utils.errors.requireIsInstance
|
||||||
import org.jetbrains.kotlin.asJava.builder.LightMemberOriginForDeclaration
|
import org.jetbrains.kotlin.asJava.builder.LightMemberOriginForDeclaration
|
||||||
import org.jetbrains.kotlin.asJava.classes.*
|
import org.jetbrains.kotlin.asJava.classes.*
|
||||||
import org.jetbrains.kotlin.asJava.elements.KtLightField
|
import org.jetbrains.kotlin.asJava.elements.KtLightField
|
||||||
@@ -349,22 +351,6 @@ internal fun SymbolLightClassBase.createField(
|
|||||||
takePropertyVisibility: Boolean,
|
takePropertyVisibility: Boolean,
|
||||||
result: MutableList<KtLightField>
|
result: MutableList<KtLightField>
|
||||||
) {
|
) {
|
||||||
|
|
||||||
fun hasBackingField(property: KtPropertySymbol): Boolean = when (property) {
|
|
||||||
is KtSyntheticJavaPropertySymbol -> true
|
|
||||||
is KtKotlinPropertySymbol -> when {
|
|
||||||
property.origin == KtSymbolOrigin.SOURCE_MEMBER_GENERATED -> false
|
|
||||||
property.modality == Modality.ABSTRACT -> false
|
|
||||||
property.isHiddenOrSynthetic() -> false
|
|
||||||
property.isLateInit -> true
|
|
||||||
property.isDelegatedProperty -> true
|
|
||||||
property.isFromPrimaryConstructor -> true
|
|
||||||
property.psi.let { it == null || it is KtParameter } -> true
|
|
||||||
property.hasJvmSyntheticAnnotation(AnnotationUseSiteTarget.FIELD) -> false
|
|
||||||
else -> property.hasBackingField
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!hasBackingField(declaration)) return
|
if (!hasBackingField(declaration)) return
|
||||||
|
|
||||||
val isDelegated = (declaration as? KtKotlinPropertySymbol)?.isDelegatedProperty == true
|
val isDelegated = (declaration as? KtKotlinPropertySymbol)?.isDelegatedProperty == true
|
||||||
@@ -386,6 +372,38 @@ internal fun SymbolLightClassBase.createField(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
context(KtAnalysisSession)
|
||||||
|
private fun hasBackingField(property: KtPropertySymbol): Boolean {
|
||||||
|
if (property is KtSyntheticJavaPropertySymbol) return true
|
||||||
|
requireIsInstance<KtKotlinPropertySymbol>(property)
|
||||||
|
|
||||||
|
if (property.origin.cannotHasBackingField() || property.isStatic) return false
|
||||||
|
if (property.isLateInit || property.isDelegatedProperty || property.isFromPrimaryConstructor) return true
|
||||||
|
val hasBackingFieldByPsi: Boolean? = property.psi?.hasBackingField()
|
||||||
|
if (hasBackingFieldByPsi == false) {
|
||||||
|
return hasBackingFieldByPsi
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property.modality == Modality.ABSTRACT ||
|
||||||
|
property.isHiddenOrSynthetic(AnnotationUseSiteTarget.FIELD, strictUseSite = false)
|
||||||
|
) return false
|
||||||
|
|
||||||
|
return hasBackingFieldByPsi ?: property.hasBackingField
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun KtSymbolOrigin.cannotHasBackingField(): Boolean =
|
||||||
|
this == KtSymbolOrigin.SOURCE_MEMBER_GENERATED ||
|
||||||
|
this == KtSymbolOrigin.DELEGATED ||
|
||||||
|
this == KtSymbolOrigin.INTERSECTION_OVERRIDE ||
|
||||||
|
this == KtSymbolOrigin.SUBSTITUTION_OVERRIDE
|
||||||
|
|
||||||
|
private fun PsiElement.hasBackingField(): Boolean {
|
||||||
|
if (this is KtParameter) return true
|
||||||
|
if (this !is KtProperty) return false
|
||||||
|
|
||||||
|
return hasInitializer() || getter?.takeIf { it.hasBody() } == null || setter?.takeIf { it.hasBody() } == null && isVar
|
||||||
|
}
|
||||||
|
|
||||||
context(KtAnalysisSession)
|
context(KtAnalysisSession)
|
||||||
internal fun SymbolLightClassForClassLike<*>.createInheritanceList(
|
internal fun SymbolLightClassForClassLike<*>.createInheritanceList(
|
||||||
forExtendsList: Boolean,
|
forExtendsList: Boolean,
|
||||||
|
|||||||
+6
@@ -78,6 +78,12 @@ public class SymbolLightClassesByFqNameForLibraryTestGenerated extends AbstractS
|
|||||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/AnnotationRepeatable.kt");
|
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/AnnotationRepeatable.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("BackingFields.kt")
|
||||||
|
public void testBackingFields() throws Exception {
|
||||||
|
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/BackingFields.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("CompanionObject.kt")
|
@TestMetadata("CompanionObject.kt")
|
||||||
public void testCompanionObject() throws Exception {
|
public void testCompanionObject() throws Exception {
|
||||||
|
|||||||
+6
@@ -78,6 +78,12 @@ public class SymbolLightClassesParentingForLibraryTestGenerated extends Abstract
|
|||||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/AnnotationRepeatable.kt");
|
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/AnnotationRepeatable.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("BackingFields.kt")
|
||||||
|
public void testBackingFields() throws Exception {
|
||||||
|
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/BackingFields.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("CompanionObject.kt")
|
@TestMetadata("CompanionObject.kt")
|
||||||
public void testCompanionObject() throws Exception {
|
public void testCompanionObject() throws Exception {
|
||||||
|
|||||||
+6
@@ -78,6 +78,12 @@ public class SymbolLightClassesByFqNameForSourceTestGenerated extends AbstractSy
|
|||||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/AnnotationRepeatable.kt");
|
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/AnnotationRepeatable.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("BackingFields.kt")
|
||||||
|
public void testBackingFields() throws Exception {
|
||||||
|
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/BackingFields.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("CompanionObject.kt")
|
@TestMetadata("CompanionObject.kt")
|
||||||
public void testCompanionObject() throws Exception {
|
public void testCompanionObject() throws Exception {
|
||||||
|
|||||||
+6
@@ -78,6 +78,12 @@ public class SymbolLightClassesParentingForSourceTestGenerated extends AbstractS
|
|||||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/AnnotationRepeatable.kt");
|
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/AnnotationRepeatable.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("BackingFields.kt")
|
||||||
|
public void testBackingFields() throws Exception {
|
||||||
|
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/BackingFields.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("CompanionObject.kt")
|
@TestMetadata("CompanionObject.kt")
|
||||||
public void testCompanionObject() throws Exception {
|
public void testCompanionObject() throws Exception {
|
||||||
|
|||||||
+6
-5
@@ -104,12 +104,13 @@ internal class UltraLightMembersCreator(
|
|||||||
private fun hasBackingField(property: KtCallableDeclaration): Boolean {
|
private fun hasBackingField(property: KtCallableDeclaration): Boolean {
|
||||||
if (property.hasModifier(ABSTRACT_KEYWORD)) return false
|
if (property.hasModifier(ABSTRACT_KEYWORD)) return false
|
||||||
if (property.hasModifier(LATEINIT_KEYWORD)) return true
|
if (property.hasModifier(LATEINIT_KEYWORD)) return true
|
||||||
if (property is KtParameter) return true
|
|
||||||
if ((property as? KtProperty)?.accessors?.isEmpty() == true) return true
|
|
||||||
|
|
||||||
val context = LightClassGenerationSupport.getInstance(containingClass.project).analyze(property)
|
if (property is KtParameter) return true
|
||||||
val descriptor = context.get(BindingContext.DECLARATION_TO_DESCRIPTOR, property)
|
if (property !is KtProperty) return false
|
||||||
return descriptor is PropertyDescriptor && context[BindingContext.BACKING_FIELD_REQUIRED, descriptor] == true
|
|
||||||
|
return property.hasInitializer() ||
|
||||||
|
property.getter?.takeIf { it.hasBody() } == null ||
|
||||||
|
property.setter?.takeIf { it.hasBody() } == null && property.isVar
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createMethods(
|
fun createMethods(
|
||||||
|
|||||||
+77
@@ -0,0 +1,77 @@
|
|||||||
|
public final class BackingFields /* one.BackingFields*/ {
|
||||||
|
private final int withBackingFieldProperty = 9 /* initializer type: int */;
|
||||||
|
|
||||||
|
private final int withBackingFieldPropertyWithDummyGetter = 10 /* initializer type: int */;
|
||||||
|
|
||||||
|
private final int withBackingFieldPropertyWithLocalDeclaration = 5 /* initializer type: int */;
|
||||||
|
|
||||||
|
private final int withBackingFieldPropertyWithNestedLocalDeclaration = 7 /* initializer type: int */;
|
||||||
|
|
||||||
|
private int withBackingFieldVariableWithDummyGetter = 12 /* initializer type: int */;
|
||||||
|
|
||||||
|
private int withBackingFieldVariableWithDummyGetterAndSetter = 11 /* initializer type: int */;
|
||||||
|
|
||||||
|
private int withBackingFieldVariableWithDummySetter = 13 /* initializer type: int */;
|
||||||
|
|
||||||
|
public BackingFields();// .ctor()
|
||||||
|
|
||||||
|
public final int getWithBackingFieldProperty();// getWithBackingFieldProperty()
|
||||||
|
|
||||||
|
public final int getWithBackingFieldPropertyWithDummyGetter();// getWithBackingFieldPropertyWithDummyGetter()
|
||||||
|
|
||||||
|
public final int getWithBackingFieldPropertyWithLocalDeclaration();// getWithBackingFieldPropertyWithLocalDeclaration()
|
||||||
|
|
||||||
|
public final int getWithBackingFieldPropertyWithNestedLocalDeclaration();// getWithBackingFieldPropertyWithNestedLocalDeclaration()
|
||||||
|
|
||||||
|
public final int getWithBackingFieldVariableWithDummyGetter();// getWithBackingFieldVariableWithDummyGetter()
|
||||||
|
|
||||||
|
public final int getWithBackingFieldVariableWithDummyGetterAndSetter();// getWithBackingFieldVariableWithDummyGetterAndSetter()
|
||||||
|
|
||||||
|
public final int getWithBackingFieldVariableWithDummySetter();// getWithBackingFieldVariableWithDummySetter()
|
||||||
|
|
||||||
|
public final int getWithoutBackingFieldPropertyWithLocalDeclaration();// getWithoutBackingFieldPropertyWithLocalDeclaration()
|
||||||
|
|
||||||
|
public final int getWithoutBackingFieldPropertyWithNestedLocalDeclaration();// getWithoutBackingFieldPropertyWithNestedLocalDeclaration()
|
||||||
|
|
||||||
|
public final int getWithoutBackingFieldPropertyWithNestedLocalDeclarationAsExpressionBody();// getWithoutBackingFieldPropertyWithNestedLocalDeclarationAsExpressionBody()
|
||||||
|
|
||||||
|
public final int getWithoutBackingFieldPropertyWithOuterLocalDeclaration();// getWithoutBackingFieldPropertyWithOuterLocalDeclaration()
|
||||||
|
|
||||||
|
public final int getWithoutBackingFieldVariableWithLocalDeclarationInsideGetter();// getWithoutBackingFieldVariableWithLocalDeclarationInsideGetter()
|
||||||
|
|
||||||
|
public final int getWithoutBackingFieldVariableWithLocalDeclarationInsideSetter();// getWithoutBackingFieldVariableWithLocalDeclarationInsideSetter()
|
||||||
|
|
||||||
|
public final int getWithoutBackingFieldVariableWithNestedLocalDeclarationInsideGetter();// getWithoutBackingFieldVariableWithNestedLocalDeclarationInsideGetter()
|
||||||
|
|
||||||
|
public final int getWithoutBackingFieldVariableWithNestedLocalDeclarationInsideGetterAsExpressionBody();// getWithoutBackingFieldVariableWithNestedLocalDeclarationInsideGetterAsExpressionBody()
|
||||||
|
|
||||||
|
public final int getWithoutBackingFieldVariableWithNestedLocalDeclarationInsideSetter();// getWithoutBackingFieldVariableWithNestedLocalDeclarationInsideSetter()
|
||||||
|
|
||||||
|
public final int getWithoutBackingFieldVariableWithNestedLocalDeclarationInsideSetterAsExpressionBody();// getWithoutBackingFieldVariableWithNestedLocalDeclarationInsideSetterAsExpressionBody()
|
||||||
|
|
||||||
|
public final int getWithoutBackingFieldVariableWithOuterLocalDeclarationInsideGetter();// getWithoutBackingFieldVariableWithOuterLocalDeclarationInsideGetter()
|
||||||
|
|
||||||
|
public final int getWithoutBackingFieldVariableWithOuterLocalDeclarationInsideSetter();// getWithoutBackingFieldVariableWithOuterLocalDeclarationInsideSetter()
|
||||||
|
|
||||||
|
public final void setWithBackingFieldVariableWithDummyGetter(int);// setWithBackingFieldVariableWithDummyGetter(int)
|
||||||
|
|
||||||
|
public final void setWithBackingFieldVariableWithDummyGetterAndSetter(int);// setWithBackingFieldVariableWithDummyGetterAndSetter(int)
|
||||||
|
|
||||||
|
public final void setWithBackingFieldVariableWithDummySetter(int);// setWithBackingFieldVariableWithDummySetter(int)
|
||||||
|
|
||||||
|
public final void setWithoutBackingFieldVariableWithLocalDeclarationInsideGetter(int);// setWithoutBackingFieldVariableWithLocalDeclarationInsideGetter(int)
|
||||||
|
|
||||||
|
public final void setWithoutBackingFieldVariableWithLocalDeclarationInsideSetter(int);// setWithoutBackingFieldVariableWithLocalDeclarationInsideSetter(int)
|
||||||
|
|
||||||
|
public final void setWithoutBackingFieldVariableWithNestedLocalDeclarationInsideGetter(int);// setWithoutBackingFieldVariableWithNestedLocalDeclarationInsideGetter(int)
|
||||||
|
|
||||||
|
public final void setWithoutBackingFieldVariableWithNestedLocalDeclarationInsideGetterAsExpressionBody(int);// setWithoutBackingFieldVariableWithNestedLocalDeclarationInsideGetterAsExpressionBody(int)
|
||||||
|
|
||||||
|
public final void setWithoutBackingFieldVariableWithNestedLocalDeclarationInsideSetter(int);// setWithoutBackingFieldVariableWithNestedLocalDeclarationInsideSetter(int)
|
||||||
|
|
||||||
|
public final void setWithoutBackingFieldVariableWithNestedLocalDeclarationInsideSetterAsExpressionBody(int);// setWithoutBackingFieldVariableWithNestedLocalDeclarationInsideSetterAsExpressionBody(int)
|
||||||
|
|
||||||
|
public final void setWithoutBackingFieldVariableWithOuterLocalDeclarationInsideGetter(int);// setWithoutBackingFieldVariableWithOuterLocalDeclarationInsideGetter(int)
|
||||||
|
|
||||||
|
public final void setWithoutBackingFieldVariableWithOuterLocalDeclarationInsideSetter(int);// setWithoutBackingFieldVariableWithOuterLocalDeclarationInsideSetter(int)
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
public final class BackingFields /* one.BackingFields*/ {
|
||||||
|
private final int withBackingFieldProperty;
|
||||||
|
|
||||||
|
private final int withBackingFieldPropertyWithDummyGetter;
|
||||||
|
|
||||||
|
private final int withBackingFieldPropertyWithLocalDeclaration;
|
||||||
|
|
||||||
|
private final int withBackingFieldPropertyWithNestedLocalDeclaration;
|
||||||
|
|
||||||
|
private int withBackingFieldVariableWithDummyGetter;
|
||||||
|
|
||||||
|
private int withBackingFieldVariableWithDummyGetterAndSetter;
|
||||||
|
|
||||||
|
private int withBackingFieldVariableWithDummySetter;
|
||||||
|
|
||||||
|
public BackingFields();// .ctor()
|
||||||
|
|
||||||
|
public final int getWithBackingFieldProperty();// getWithBackingFieldProperty()
|
||||||
|
|
||||||
|
public final int getWithBackingFieldPropertyWithDummyGetter();// getWithBackingFieldPropertyWithDummyGetter()
|
||||||
|
|
||||||
|
public final int getWithBackingFieldPropertyWithLocalDeclaration();// getWithBackingFieldPropertyWithLocalDeclaration()
|
||||||
|
|
||||||
|
public final int getWithBackingFieldPropertyWithNestedLocalDeclaration();// getWithBackingFieldPropertyWithNestedLocalDeclaration()
|
||||||
|
|
||||||
|
public final int getWithBackingFieldVariableWithDummyGetter();// getWithBackingFieldVariableWithDummyGetter()
|
||||||
|
|
||||||
|
public final int getWithBackingFieldVariableWithDummyGetterAndSetter();// getWithBackingFieldVariableWithDummyGetterAndSetter()
|
||||||
|
|
||||||
|
public final int getWithBackingFieldVariableWithDummySetter();// getWithBackingFieldVariableWithDummySetter()
|
||||||
|
|
||||||
|
public final int getWithoutBackingFieldPropertyWithLocalDeclaration();// getWithoutBackingFieldPropertyWithLocalDeclaration()
|
||||||
|
|
||||||
|
public final int getWithoutBackingFieldPropertyWithNestedLocalDeclaration();// getWithoutBackingFieldPropertyWithNestedLocalDeclaration()
|
||||||
|
|
||||||
|
public final int getWithoutBackingFieldPropertyWithNestedLocalDeclarationAsExpressionBody();// getWithoutBackingFieldPropertyWithNestedLocalDeclarationAsExpressionBody()
|
||||||
|
|
||||||
|
public final int getWithoutBackingFieldPropertyWithOuterLocalDeclaration();// getWithoutBackingFieldPropertyWithOuterLocalDeclaration()
|
||||||
|
|
||||||
|
public final int getWithoutBackingFieldVariableWithLocalDeclarationInsideGetter();// getWithoutBackingFieldVariableWithLocalDeclarationInsideGetter()
|
||||||
|
|
||||||
|
public final int getWithoutBackingFieldVariableWithLocalDeclarationInsideSetter();// getWithoutBackingFieldVariableWithLocalDeclarationInsideSetter()
|
||||||
|
|
||||||
|
public final int getWithoutBackingFieldVariableWithNestedLocalDeclarationInsideGetter();// getWithoutBackingFieldVariableWithNestedLocalDeclarationInsideGetter()
|
||||||
|
|
||||||
|
public final int getWithoutBackingFieldVariableWithNestedLocalDeclarationInsideGetterAsExpressionBody();// getWithoutBackingFieldVariableWithNestedLocalDeclarationInsideGetterAsExpressionBody()
|
||||||
|
|
||||||
|
public final int getWithoutBackingFieldVariableWithNestedLocalDeclarationInsideSetter();// getWithoutBackingFieldVariableWithNestedLocalDeclarationInsideSetter()
|
||||||
|
|
||||||
|
public final int getWithoutBackingFieldVariableWithNestedLocalDeclarationInsideSetterAsExpressionBody();// getWithoutBackingFieldVariableWithNestedLocalDeclarationInsideSetterAsExpressionBody()
|
||||||
|
|
||||||
|
public final int getWithoutBackingFieldVariableWithOuterLocalDeclarationInsideGetter();// getWithoutBackingFieldVariableWithOuterLocalDeclarationInsideGetter()
|
||||||
|
|
||||||
|
public final int getWithoutBackingFieldVariableWithOuterLocalDeclarationInsideSetter();// getWithoutBackingFieldVariableWithOuterLocalDeclarationInsideSetter()
|
||||||
|
|
||||||
|
public final void setWithBackingFieldVariableWithDummyGetter(int);// setWithBackingFieldVariableWithDummyGetter(int)
|
||||||
|
|
||||||
|
public final void setWithBackingFieldVariableWithDummyGetterAndSetter(int);// setWithBackingFieldVariableWithDummyGetterAndSetter(int)
|
||||||
|
|
||||||
|
public final void setWithBackingFieldVariableWithDummySetter(int);// setWithBackingFieldVariableWithDummySetter(int)
|
||||||
|
|
||||||
|
public final void setWithoutBackingFieldVariableWithLocalDeclarationInsideGetter(int);// setWithoutBackingFieldVariableWithLocalDeclarationInsideGetter(int)
|
||||||
|
|
||||||
|
public final void setWithoutBackingFieldVariableWithLocalDeclarationInsideSetter(int);// setWithoutBackingFieldVariableWithLocalDeclarationInsideSetter(int)
|
||||||
|
|
||||||
|
public final void setWithoutBackingFieldVariableWithNestedLocalDeclarationInsideGetter(int);// setWithoutBackingFieldVariableWithNestedLocalDeclarationInsideGetter(int)
|
||||||
|
|
||||||
|
public final void setWithoutBackingFieldVariableWithNestedLocalDeclarationInsideGetterAsExpressionBody(int);// setWithoutBackingFieldVariableWithNestedLocalDeclarationInsideGetterAsExpressionBody(int)
|
||||||
|
|
||||||
|
public final void setWithoutBackingFieldVariableWithNestedLocalDeclarationInsideSetter(int);// setWithoutBackingFieldVariableWithNestedLocalDeclarationInsideSetter(int)
|
||||||
|
|
||||||
|
public final void setWithoutBackingFieldVariableWithNestedLocalDeclarationInsideSetterAsExpressionBody(int);// setWithoutBackingFieldVariableWithNestedLocalDeclarationInsideSetterAsExpressionBody(int)
|
||||||
|
|
||||||
|
public final void setWithoutBackingFieldVariableWithOuterLocalDeclarationInsideGetter(int);// setWithoutBackingFieldVariableWithOuterLocalDeclarationInsideGetter(int)
|
||||||
|
|
||||||
|
public final void setWithoutBackingFieldVariableWithOuterLocalDeclarationInsideSetter(int);// setWithoutBackingFieldVariableWithOuterLocalDeclarationInsideSetter(int)
|
||||||
|
}
|
||||||
@@ -0,0 +1,139 @@
|
|||||||
|
// one.BackingFields
|
||||||
|
package one;
|
||||||
|
|
||||||
|
class BackingFields {
|
||||||
|
val withoutBackingFieldPropertyWithLocalDeclaration: Int
|
||||||
|
get() {
|
||||||
|
val field = 1
|
||||||
|
return field
|
||||||
|
}
|
||||||
|
|
||||||
|
val withoutBackingFieldPropertyWithNestedLocalDeclaration: Int
|
||||||
|
get() {
|
||||||
|
return run {
|
||||||
|
val field = 2
|
||||||
|
field
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val withoutBackingFieldPropertyWithNestedLocalDeclarationAsExpressionBody: Int
|
||||||
|
get() = run {
|
||||||
|
val field = 3
|
||||||
|
field
|
||||||
|
}
|
||||||
|
|
||||||
|
val withoutBackingFieldPropertyWithOuterLocalDeclaration: Int
|
||||||
|
get() {
|
||||||
|
val field = 4
|
||||||
|
return run {
|
||||||
|
field
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val withBackingFieldPropertyWithLocalDeclaration: Int = 5
|
||||||
|
get() {
|
||||||
|
field
|
||||||
|
val field = 6
|
||||||
|
return field
|
||||||
|
}
|
||||||
|
|
||||||
|
val withBackingFieldPropertyWithNestedLocalDeclaration: Int = 7
|
||||||
|
get() {
|
||||||
|
run {
|
||||||
|
val field = 8
|
||||||
|
field
|
||||||
|
}
|
||||||
|
|
||||||
|
return field
|
||||||
|
}
|
||||||
|
|
||||||
|
val withBackingFieldProperty: Int = 9
|
||||||
|
|
||||||
|
val withBackingFieldPropertyWithDummyGetter: Int = 10
|
||||||
|
get
|
||||||
|
|
||||||
|
var withBackingFieldVariableWithDummyGetterAndSetter: Int = 11
|
||||||
|
get
|
||||||
|
set
|
||||||
|
|
||||||
|
var withBackingFieldVariableWithDummyGetter: Int = 12
|
||||||
|
get
|
||||||
|
|
||||||
|
var withBackingFieldVariableWithDummySetter: Int = 13
|
||||||
|
get
|
||||||
|
|
||||||
|
var withoutBackingFieldVariableWithLocalDeclarationInsideSetter: Int
|
||||||
|
get() = 14
|
||||||
|
set(value) {
|
||||||
|
val field = 15
|
||||||
|
field
|
||||||
|
}
|
||||||
|
|
||||||
|
var withoutBackingFieldVariableWithNestedLocalDeclarationInsideSetter: Int
|
||||||
|
get() = 16
|
||||||
|
set(value) {
|
||||||
|
run {
|
||||||
|
val field = 17
|
||||||
|
field
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var withoutBackingFieldVariableWithNestedLocalDeclarationInsideSetterAsExpressionBody: Int
|
||||||
|
get() = 18
|
||||||
|
set(value) = run {
|
||||||
|
val field = 19
|
||||||
|
field
|
||||||
|
Unit
|
||||||
|
}
|
||||||
|
|
||||||
|
var withoutBackingFieldVariableWithOuterLocalDeclarationInsideSetter: Int
|
||||||
|
get() = 20
|
||||||
|
set(value) {
|
||||||
|
val field = 21
|
||||||
|
run {
|
||||||
|
field
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var withoutBackingFieldVariableWithLocalDeclarationInsideGetter: Int
|
||||||
|
get() {
|
||||||
|
val field = 22
|
||||||
|
field
|
||||||
|
return field
|
||||||
|
}
|
||||||
|
set(value) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var withoutBackingFieldVariableWithNestedLocalDeclarationInsideGetter: Int
|
||||||
|
get() {
|
||||||
|
run {
|
||||||
|
val field = 23
|
||||||
|
field
|
||||||
|
}
|
||||||
|
return 24
|
||||||
|
}
|
||||||
|
set(value) {
|
||||||
|
}
|
||||||
|
|
||||||
|
var withoutBackingFieldVariableWithNestedLocalDeclarationInsideGetterAsExpressionBody: Int
|
||||||
|
get() = run {
|
||||||
|
val field = 25
|
||||||
|
field
|
||||||
|
}
|
||||||
|
set(value) {
|
||||||
|
}
|
||||||
|
|
||||||
|
var withoutBackingFieldVariableWithOuterLocalDeclarationInsideGetter: Int
|
||||||
|
get() {
|
||||||
|
val field = 26
|
||||||
|
run {
|
||||||
|
field
|
||||||
|
}
|
||||||
|
|
||||||
|
return field
|
||||||
|
}
|
||||||
|
set(value) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
-3
@@ -32,9 +32,6 @@ public final class PropertiesKt /* PropertiesKt*/ {
|
|||||||
@org.jetbrains.annotations.Nullable()
|
@org.jetbrains.annotations.Nullable()
|
||||||
private static java.lang.Boolean islowercase;
|
private static java.lang.Boolean islowercase;
|
||||||
|
|
||||||
@org.jetbrains.annotations.Nullable()
|
|
||||||
private static java.lang.Integer counter2;
|
|
||||||
|
|
||||||
@org.jetbrains.annotations.Nullable()
|
@org.jetbrains.annotations.Nullable()
|
||||||
private static java.lang.Integer getInt;
|
private static java.lang.Integer getInt;
|
||||||
|
|
||||||
|
|||||||
+5
@@ -74,6 +74,11 @@ public class CompilerLightClassTestGenerated extends AbstractCompilerLightClassT
|
|||||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/AnnotationRepeatable.kt");
|
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/AnnotationRepeatable.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("BackingFields.kt")
|
||||||
|
public void testBackingFields() throws Exception {
|
||||||
|
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/BackingFields.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("CompanionObject.kt")
|
@TestMetadata("CompanionObject.kt")
|
||||||
public void testCompanionObject() throws Exception {
|
public void testCompanionObject() throws Exception {
|
||||||
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/CompanionObject.kt");
|
runTest("compiler/testData/asJava/lightClasses/lightClassByFqName/CompanionObject.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user