Run psi check on light classes from compiled Kotlin
This commit is contained in:
@@ -9,7 +9,4 @@ public interface Generic <N, NN> {
|
||||
|
||||
@org.jetbrains.annotations.Nullable
|
||||
NN b1(@org.jetbrains.annotations.Nullable NN nn);
|
||||
|
||||
final class DefaultImpls {
|
||||
}
|
||||
}
|
||||
+1
-4
@@ -1,5 +1,5 @@
|
||||
public interface Primitives {
|
||||
int $$int /* Real name is 'int' */(int x);
|
||||
int $$int /* Real name is 'int' */(int i);
|
||||
|
||||
@org.jetbrains.annotations.Nullable
|
||||
java.lang.Boolean getNullableBool();
|
||||
@@ -40,7 +40,4 @@ public interface Primitives {
|
||||
float getFloat();
|
||||
|
||||
double getDouble();
|
||||
|
||||
final class DefaultImpls {
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// Primitives
|
||||
|
||||
interface Primitives {
|
||||
fun int(x: Int): Int
|
||||
fun int(i: Int): Int
|
||||
|
||||
val nullableBool: Boolean?
|
||||
val nullableByte: Byte?
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// PrivateInClass
|
||||
|
||||
class PrivateInClass private (g: String?) {
|
||||
class PrivateInClass private constructor (g: String?) {
|
||||
private var nn: String
|
||||
get() = ""
|
||||
set(value) {}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
public interface Trait {
|
||||
@org.jetbrains.annotations.NotNull
|
||||
java.lang.String notNull(@org.jetbrains.annotations.NotNull java.lang.String a);
|
||||
java.lang.String notNull(@org.jetbrains.annotations.NotNull java.lang.String p);
|
||||
|
||||
@org.jetbrains.annotations.Nullable
|
||||
java.lang.String nullable(@org.jetbrains.annotations.Nullable java.lang.String a);
|
||||
java.lang.String nullable(@org.jetbrains.annotations.Nullable java.lang.String p);
|
||||
|
||||
@org.jetbrains.annotations.NotNull
|
||||
java.lang.String notNullWithNN();
|
||||
@@ -34,7 +34,4 @@ public interface Trait {
|
||||
java.lang.String getNotNullVar();
|
||||
|
||||
void setNotNullVar(@org.jetbrains.annotations.NotNull java.lang.String p);
|
||||
|
||||
final class DefaultImpls {
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,8 @@ import org.jetbrains.annotations.NotNull
|
||||
import org.jetbrains.annotations.Nullable
|
||||
|
||||
interface Trait {
|
||||
fun notNull(a: String): String
|
||||
fun nullable(a: String?): String?
|
||||
fun notNull(p: String): String
|
||||
fun nullable(p: String?): String?
|
||||
|
||||
@NotNull fun notNullWithNN(): String
|
||||
@Nullable fun notNullWithN(): String
|
||||
|
||||
-3
@@ -22,7 +22,4 @@ public interface TraitClassObjectField {
|
||||
|
||||
private Companion() { /* compiled code */ }
|
||||
}
|
||||
|
||||
final class DefaultImpls {
|
||||
}
|
||||
}
|
||||
@@ -72,6 +72,11 @@ public abstract class AbstractCompilerLightClassTest extends KotlinMultiFileTest
|
||||
throw ExceptionUtilsKt.rethrow(e);
|
||||
}
|
||||
}
|
||||
}, new Function1<String, String>() {
|
||||
@Override
|
||||
public String invoke(String s) {
|
||||
return LightClassTestCommon.INSTANCE.removeEmptyDefaultImpls(s);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -35,9 +35,9 @@ public class CompilerLightClassTestGenerated extends AbstractCompilerLightClassT
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("annotationClass.kt")
|
||||
@TestMetadata("AnnotationClass.kt")
|
||||
public void testAnnotationClass() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/annotationClass.kt");
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/AnnotationClass.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@@ -61,9 +61,9 @@ public class CompilerLightClassTestGenerated extends AbstractCompilerLightClassT
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("WithPlatformTypes.kt")
|
||||
public void testWithPlatformTypes() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/delegation/WithPlatformTypes.kt");
|
||||
@TestMetadata("WithPlatformTypes.NoCompile.kt")
|
||||
public void testWithPlatformTypes_NoCompile() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/delegation/WithPlatformTypes.NoCompile.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
@@ -76,9 +76,9 @@ public class CompilerLightClassTestGenerated extends AbstractCompilerLightClassT
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/asJava/lightClasses/facades"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("EmptyFile.kt")
|
||||
public void testEmptyFile() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/facades/EmptyFile.kt");
|
||||
@TestMetadata("EmptyFile.NoCompile.kt")
|
||||
public void testEmptyFile_NoCompile() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/facades/EmptyFile.NoCompile.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@@ -181,9 +181,9 @@ public class CompilerLightClassTestGenerated extends AbstractCompilerLightClassT
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("PrivateInTrait.kt")
|
||||
public void testPrivateInTrait() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations/PrivateInTrait.kt");
|
||||
@TestMetadata("PrivateInTrait.NoCompile.kt")
|
||||
public void testPrivateInTrait_NoCompile() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations/PrivateInTrait.NoCompile.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@@ -199,9 +199,9 @@ public class CompilerLightClassTestGenerated extends AbstractCompilerLightClassT
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("TraitClassObjectField.kt")
|
||||
public void testTraitClassObjectField() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations/TraitClassObjectField.kt");
|
||||
@TestMetadata("TraitClassObjectField.NoCompile.kt")
|
||||
public void testTraitClassObjectField_NoCompile() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/asJava/lightClasses/nullabilityAnnotations/TraitClassObjectField.NoCompile.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,4 +58,9 @@ object LightClassTestCommon {
|
||||
val actual = normalizeText(buffer.toString())
|
||||
return actual
|
||||
}
|
||||
|
||||
// Actual text for light class is generated with ClsElementImpl.appendMirrorText() that can find empty DefaultImpl inner class in stubs
|
||||
// for all interfaces. This inner class can't be used in Java as it generally is not seen from light classes built from Kotlin sources.
|
||||
// It is also omitted during classes generation in backend so it also absent in light classes built from compiled code.
|
||||
public fun removeEmptyDefaultImpls(text: String) : String = text.replace("\n final class DefaultImpls {\n }\n", "")
|
||||
}
|
||||
Reference in New Issue
Block a user