[JPS] Track changes of PurelyImplements annotation in Kotlin JPS incremental rules

#KT-75460 Fixed

GitOrigin-RevId: a1d7fb49ba94db1493d8a3604711d95a1c8c0be5
This commit is contained in:
Aleksei.Cherepanov
2025-04-23 13:46:17 +00:00
committed by intellij-monorepo-bot
parent fec1040ce4
commit f5f079e49a
6 changed files with 85 additions and 0 deletions
@@ -71,6 +71,16 @@ public final class KotlinJvmDifferentiateStrategy extends JvmDifferentiateStrate
new TypeRepr.ClassType("kotlin/Deprecated"),
new TypeRepr.ClassType("kotlin/DeprecatedSinceKotlin")
)
),
AnnotationGroup.of(
"Kotlin JVM specific annotations",
EnumSet.of(AnnotationGroup.AnnTarget.type),
EnumSet.of(AnnotationGroup.AffectionKind.added, AnnotationGroup.AffectionKind.changed),
EnumSet.of(AnnotationGroup.AffectionScope.usages),
Set.of(
new TypeRepr.ClassType("kotlin/jvm/PurelyImplements")
)
)
);
@@ -0,0 +1,22 @@
import java.util.AbstractList;
import kotlin.jvm.PurelyImplements;
//@PurelyImplements("kotlin.collections.MutableList")
public class SmartList<E> extends AbstractList<E> {
@Override
public boolean add(E e) {
return true;
}
@Override
public E get(int index) {
return null;
}
@Override
public int size() {
return 0;
}
}
@@ -0,0 +1,22 @@
import java.util.AbstractList;
import kotlin.jvm.PurelyImplements;
@PurelyImplements("kotlin.collections.MutableList")
public class SmartList<E> extends AbstractList<E> {
@Override
public boolean add(E e) {
return true;
}
@Override
public E get(int index) {
return null;
}
@Override
public int size() {
return 0;
}
}
@@ -0,0 +1,5 @@
fun main() {
val result = SmartList<String>()
result.add(null)
}
@@ -0,0 +1,21 @@
================ Step #1 =================
Cleaning output files:
out/production/module/SmartList.class
End of files
Exit code: NOTHING_DONE
------------------------------------------
Compiling files:
src/SmartList.java
End of files
Cleaning output files:
out/production/module/META-INF/module.kotlin_module
out/production/module/TestClassKt.class
End of files
Compiling files:
src/TestClass.kt
End of files
Exit code: ABORT
------------------------------------------
COMPILATION FAILED
Null cannot be a value of a non-null type 'kotlin.String'.
@@ -1452,6 +1452,11 @@ public class IncrementalK2JvmJpsTestGenerated extends AbstractIncrementalK2JvmJp
runTest("withJava/javaUsedInKotlin/addNullableAnnotation/");
}
@TestMetadata("addPurelyImplementsAnnotation")
public void testAddPurelyImplementsAnnotation() throws Exception {
runTest("withJava/javaUsedInKotlin/addPurelyImplementsAnnotation/");
}
public void testAllFilesPresentInJavaUsedInKotlin() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("withJava/javaUsedInKotlin"), Pattern.compile("^([^\\.]+)$"), null, TargetBackend.JVM_IR, true);
}