[SLC] Ignore callables with invalid or absent names (KTIJ-23584)

This commit is contained in:
Yan Zhulanow
2022-11-10 17:23:38 +09:00
committed by teamcity
parent 6fe989b4b4
commit e21226d02a
11 changed files with 68 additions and 85 deletions
@@ -193,9 +193,8 @@ internal fun SymbolLightClassBase.createMethods(
when (declaration) {
is KtFunctionSymbol -> {
// TODO: check if it has expect modifier
if (declaration.hasReifiedParameters ||
declaration.isHiddenOrSynthetic()
) return
if (declaration.hasReifiedParameters || declaration.isHiddenOrSynthetic()) return
if (declaration.name.isSpecial) return
result.add(
SymbolLightSimpleMethod(
@@ -272,6 +271,7 @@ internal fun SymbolLightClassBase.createPropertyAccessors(
) {
if (declaration is KtKotlinPropertySymbol && declaration.isConst) return
if (declaration.origin == KtSymbolOrigin.SOURCE_MEMBER_GENERATED) return
if (declaration.name.isSpecial) return
if (declaration.visibility.isPrivateOrPrivateToThis() &&
declaration.getter?.hasBody == false &&
@@ -285,6 +285,12 @@ public class SymbolLightClassesForSourceTestGenerated extends AbstractSymbolLigh
runTest("compiler/testData/asJava/lightClasses/compilationErrors/ExpectedNestedClassInObject.kt");
}
@Test
@TestMetadata("FunctionWithoutName.kt")
public void testFunctionWithoutName() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/FunctionWithoutName.kt");
}
@Test
@TestMetadata("JvmPackageName.kt")
public void testJvmPackageName() throws Exception {
@@ -303,6 +309,12 @@ public class SymbolLightClassesForSourceTestGenerated extends AbstractSymbolLigh
runTest("compiler/testData/asJava/lightClasses/compilationErrors/PrivateInTrait.kt");
}
@Test
@TestMetadata("PropertyWithoutName.kt")
public void testPropertyWithoutName() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/PropertyWithoutName.kt");
}
@Test
@TestMetadata("RepetableAnnotations.kt")
public void testRepetableAnnotations() throws Exception {
@@ -285,6 +285,12 @@ public class SymbolLightClassesParentingForSourceTestGenerated extends AbstractS
runTest("compiler/testData/asJava/lightClasses/compilationErrors/ExpectedNestedClassInObject.kt");
}
@Test
@TestMetadata("FunctionWithoutName.kt")
public void testFunctionWithoutName() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/FunctionWithoutName.kt");
}
@Test
@TestMetadata("JvmPackageName.kt")
public void testJvmPackageName() throws Exception {
@@ -303,6 +309,12 @@ public class SymbolLightClassesParentingForSourceTestGenerated extends AbstractS
runTest("compiler/testData/asJava/lightClasses/compilationErrors/PrivateInTrait.kt");
}
@Test
@TestMetadata("PropertyWithoutName.kt")
public void testPropertyWithoutName() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/PropertyWithoutName.kt");
}
@Test
@TestMetadata("RepetableAnnotations.kt")
public void testRepetableAnnotations() throws Exception {
@@ -0,0 +1,5 @@
public abstract interface Foo /* test.Foo*/ {
@org.jetbrains.annotations.NotNull()
public abstract java.lang.String foo();// foo()
}
@@ -0,0 +1,7 @@
public abstract interface Foo /* test.Foo*/ {
@org.jetbrains.annotations.NotNull()
public abstract java.lang.String foo();// foo()
public abstract int <no name provided>();// <no name provided>()
}
@@ -0,0 +1,7 @@
// test.Foo
package test
interface Foo {
fun foo(): String
fun (): Int
}
@@ -0,0 +1,5 @@
public abstract interface Foo /* test.Foo*/ {
@org.jetbrains.annotations.NotNull()
public abstract java.lang.String getFoo();// getFoo()
}
@@ -0,0 +1,7 @@
// test.Foo
package test
interface Foo {
val foo: String
val
}
@@ -3,8 +3,6 @@ public final class C /* p.C*/ {
public C();// .ctor()
public int <no name provided>();// <no name provided>()
public int af();// af()
public int getAp();// getAp()
@@ -1,80 +0,0 @@
public final class FileFacadeKt /* FileFacadeKt*/ {
@org.jetbrains.annotations.NotNull()
private static final java.lang.String notNullVal;
@org.jetbrains.annotations.NotNull()
private static final java.lang.String privateNn;
@org.jetbrains.annotations.NotNull()
private static java.lang.String notNullVar;
@org.jetbrains.annotations.Nullable()
private static final java.lang.String nullableVal;
@org.jetbrains.annotations.Nullable()
private static final java.lang.String privateN;
@org.jetbrains.annotations.Nullable()
private static java.lang.String nullableVar;
@org.jetbrains.annotations.NotNull()
@org.jetbrains.annotations.Nullable()
public static final java.lang.String getNotNullValWithGet();// getNotNullValWithGet()
@org.jetbrains.annotations.NotNull()
@org.jetbrains.annotations.Nullable()
public static final java.lang.String getNotNullVarWithGetSet();// getNotNullVarWithGetSet()
@org.jetbrains.annotations.NotNull()
@org.jetbrains.annotations.Nullable()
public static final java.lang.String getNullableValWithGet();// getNullableValWithGet()
@org.jetbrains.annotations.NotNull()
@org.jetbrains.annotations.Nullable()
public static final java.lang.String getNullableVarWithGetSet();// getNullableVarWithGetSet()
@org.jetbrains.annotations.NotNull()
@org.jetbrains.annotations.Nullable()
public static final java.lang.String notNullWithN();// notNullWithN()
@org.jetbrains.annotations.NotNull()
@org.jetbrains.annotations.Nullable()
public static final java.lang.String nullableWithNN();// nullableWithNN()
@org.jetbrains.annotations.NotNull()
public static final java.lang.String getNotNullVal();// getNotNullVal()
@org.jetbrains.annotations.NotNull()
public static final java.lang.String getNotNullVar();// getNotNullVar()
@org.jetbrains.annotations.NotNull()
public static final java.lang.String notNull(@org.jetbrains.annotations.NotNull() java.lang.String);// notNull(java.lang.String)
@org.jetbrains.annotations.NotNull()
public static final java.lang.String notNullWithNN();// notNullWithNN()
@org.jetbrains.annotations.NotNull()
public static final void setNullableVarWithGetSet(@org.jetbrains.annotations.Nullable() java.lang.String);// setNullableVarWithGetSet(java.lang.String)
@org.jetbrains.annotations.Nullable()
public static final java.lang.String getNullableVal();// getNullableVal()
@org.jetbrains.annotations.Nullable()
public static final java.lang.String getNullableVar();// getNullableVar()
@org.jetbrains.annotations.Nullable()
public static final java.lang.String nullable(@org.jetbrains.annotations.Nullable() java.lang.String);// nullable(java.lang.String)
@org.jetbrains.annotations.Nullable()
public static final java.lang.String nullableWithN();// nullableWithN()
@org.jetbrains.annotations.Nullable()
public static final void setNotNullVarWithGetSet(@org.jetbrains.annotations.NotNull() java.lang.String);// setNotNullVarWithGetSet(java.lang.String)
private static final java.lang.String privateFun(java.lang.String, java.lang.String);// privateFun(java.lang.String, java.lang.String)
public static final void setNotNullVar(@org.jetbrains.annotations.NotNull() java.lang.String);// setNotNullVar(java.lang.String)
public static final void setNullableVar(@org.jetbrains.annotations.Nullable() java.lang.String);// setNullableVar(java.lang.String)
}
@@ -251,6 +251,11 @@ public class CompilerLightClassTestGenerated extends AbstractCompilerLightClassT
runTest("compiler/testData/asJava/lightClasses/compilationErrors/ExpectedNestedClassInObject.kt");
}
@TestMetadata("FunctionWithoutName.kt")
public void testFunctionWithoutName() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/FunctionWithoutName.kt");
}
@TestMetadata("JvmPackageName.kt")
public void testJvmPackageName() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/JvmPackageName.kt");
@@ -266,6 +271,11 @@ public class CompilerLightClassTestGenerated extends AbstractCompilerLightClassT
runTest("compiler/testData/asJava/lightClasses/compilationErrors/PrivateInTrait.kt");
}
@TestMetadata("PropertyWithoutName.kt")
public void testPropertyWithoutName() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/PropertyWithoutName.kt");
}
@TestMetadata("RepetableAnnotations.kt")
public void testRepetableAnnotations() throws Exception {
runTest("compiler/testData/asJava/lightClasses/compilationErrors/RepetableAnnotations.kt");