Skip to content

Commit 2dfa4d3

Browse files
dimonchik0036Space Team
authored andcommitted
[SLC] SymbolLightMethod: avoid resolve to calculate isOverride
1 parent 6cea761 commit 2dfa4d3

File tree

9 files changed

+28
-16
lines changed

9 files changed

+28
-16
lines changed

analysis/symbol-light-classes/src/org/jetbrains/kotlin/light/classes/symbol/methods/SymbolLightConstructor.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
2+
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
33
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
44
*/
55

@@ -37,6 +37,7 @@ internal class SymbolLightConstructor(
3737
override fun getName(): String = _name ?: ""
3838

3939
override fun isConstructor(): Boolean = true
40+
override fun isOverride(): Boolean = false
4041

4142
override fun hasTypeParameters(): Boolean = false
4243
override fun getTypeParameterList(): PsiTypeParameterList? = null

analysis/symbol-light-classes/src/org/jetbrains/kotlin/light/classes/symbol/methods/SymbolLightMethod.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
2+
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
33
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
44
*/
55

@@ -135,8 +135,6 @@ internal abstract class SymbolLightMethod<FType : KtFunctionLikeSymbol> private
135135

136136
override fun isValid(): Boolean = super.isValid() && functionDeclaration?.isValid ?: functionSymbolPointer.isValid(ktModule)
137137

138-
override fun isOverride(): Boolean = withFunctionSymbol { it.getDirectlyOverriddenSymbols().isNotEmpty() }
139-
140138
override fun equals(other: Any?): Boolean {
141139
if (this === other) return true
142140
if (other !is SymbolLightMethod<*> ||

analysis/symbol-light-classes/src/org/jetbrains/kotlin/light/classes/symbol/methods/SymbolLightSimpleMethod.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,12 @@ internal class SymbolLightSimpleMethod(
167167

168168
override fun isConstructor(): Boolean = false
169169

170+
override fun isOverride(): Boolean = _isOverride
171+
172+
private val _isOverride: Boolean by lazyPub {
173+
withFunctionSymbol { it.isOverride }
174+
}
175+
170176
private val KtType.isVoidType: Boolean get() = isUnit && nullabilityType != NullabilityType.Nullable
171177

172178
private val _returnedType: PsiType by lazyPub {

compiler/testData/asJava/lightClasses/lightClassByFqName/ideRegression/ImplementingCharSequenceAndNumber.fir.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,14 @@ public static final class MyString /* p1.Container.MyString*/ implements java.la
3434
@java.lang.Override()
3535
public char get(int);// get(int)
3636

37-
public MyString();// .ctor()
38-
37+
@java.lang.Override()
3938
public error.NonExistentClass chars();// chars()
4039

40+
@java.lang.Override()
4141
public error.NonExistentClass codePoints();// codePoints()
4242

43+
public MyString();// .ctor()
44+
4345
public int getLength();// getLength()
4446
}
4547
}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
public final class C /* p.C*/ {
2-
public C();// .ctor()
3-
2+
@java.lang.Override()
43
public int af();// af()
54

5+
public C();// .ctor()
6+
67
public int getAp();// getAp()
78
}

compiler/testData/asJava/lightClasses/lightClassByFqName/ideRegression/OverridingInternal.fir.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
public final class C /* p.C*/ {
22
private final int ip = 5 /* initializer type: int */;
33

4-
public C();// .ctor()
5-
4+
@java.lang.Override()
65
public int af();// af()
76

7+
public C();// .ctor()
8+
89
public int getAp();// getAp()
910

1011
public int getIp();// getIp()
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
public final class C /* p.C*/ {
2-
public C();// .ctor()
3-
2+
@java.lang.Override()
43
public int af();// af()
54

5+
public C();// .ctor()
6+
67
public int getAp();// getAp()
78
}

compiler/testData/asJava/lightClasses/lightClassByPsi/implementingKotlinCollections.fir.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ public final class MyList /* MyList*/ implements java.util.List<java.lang.String
1010
}
1111

1212
public abstract class MySet /* MySet*/<T> implements ASet<T> {
13-
public MySet();// .ctor()
14-
13+
@java.lang.Override()
1514
public boolean remove(@org.jetbrains.annotations.NotNull() java.lang.String);// remove(java.lang.String)
15+
16+
public MySet();// .ctor()
1617
}
1718

1819
public abstract class SmartSet /* SmartSet*/<T> extends kotlin.collections.AbstractMutableSet<T> {

compiler/testData/asJava/lightClasses/lightClassByPsi/inlineClasses.fir.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ public enum Foo /* Foo*/ {
99
public final class InlineInheritance /* InlineInheritance*/ {
1010
private final int v;
1111

12+
@java.lang.Override()
13+
public int y();// y()
14+
1215
public final int getV();// getV()
1316

1417
public int getX();// getX()
15-
16-
public int y();// y()
1718
}
1819

1920
public final class InlinedDelegate /* InlinedDelegate*/<T> {

0 commit comments

Comments
 (0)