diff --git a/compiler/testData/cli/jvm/jsr305/javax/annotation/ParametersAreNonnullByDefault.java b/compiler/testData/cli/jvm/jsr305/javax/annotation/ParametersAreNonnullByDefault.java
deleted file mode 100644
index a2402b5d98f..00000000000
--- a/compiler/testData/cli/jvm/jsr305/javax/annotation/ParametersAreNonnullByDefault.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package javax.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-import javax.annotation.meta.TypeQualifierDefault;
-
-/**
- * This annotation can be applied to a package, class or method to indicate that
- * the method parameters in that element are nonnull by default unless there is:
- *
- * - An explicit nullness annotation
- *
- The method overrides a method in a superclass (in which case the
- * annotation of the corresponding parameter in the superclass applies)
- *
- There is a default parameter annotation (like {@link ParametersAreNullableByDefault})
- * applied to a more tightly nested element.
- *
- *
- * @see Nonnull
- */
-@Documented
-@Nonnull
-@TypeQualifierDefault(ElementType.PARAMETER)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface ParametersAreNonnullByDefault {
-}
diff --git a/compiler/testData/cli/jvm/jsr305DeprecatedEnable.args b/compiler/testData/cli/jvm/jsr305DeprecatedEnable.args
index 2b15582951a..3bdaf1df819 100644
--- a/compiler/testData/cli/jvm/jsr305DeprecatedEnable.args
+++ b/compiler/testData/cli/jvm/jsr305DeprecatedEnable.args
@@ -1,5 +1,6 @@
-Xjsr305-annotations=enable
$TESTDATA_DIR$/jsr305Usage.kt
$TESTDATA_DIR$/jsr305
+$FOREIGN_ANNOTATIONS_DIR$
-d
$TEMP_DIR$
diff --git a/compiler/testData/cli/jvm/jsr305DeprecatedIgnore.args b/compiler/testData/cli/jvm/jsr305DeprecatedIgnore.args
index b28e65bea4a..14968120f87 100644
--- a/compiler/testData/cli/jvm/jsr305DeprecatedIgnore.args
+++ b/compiler/testData/cli/jvm/jsr305DeprecatedIgnore.args
@@ -1,5 +1,6 @@
-Xjsr305-annotations=ignore
$TESTDATA_DIR$/jsr305Usage.kt
$TESTDATA_DIR$/jsr305
+$FOREIGN_ANNOTATIONS_DIR$
-d
$TEMP_DIR$
diff --git a/compiler/testData/cli/jvm/jsr305DeprecatedWarn.args b/compiler/testData/cli/jvm/jsr305DeprecatedWarn.args
index 534f4c6b8ef..e32ccfe46bd 100644
--- a/compiler/testData/cli/jvm/jsr305DeprecatedWarn.args
+++ b/compiler/testData/cli/jvm/jsr305DeprecatedWarn.args
@@ -1,5 +1,6 @@
-Xjsr305-annotations=warn
$TESTDATA_DIR$/jsr305Usage.kt
$TESTDATA_DIR$/jsr305
+$FOREIGN_ANNOTATIONS_DIR$
-d
$TEMP_DIR$
diff --git a/compiler/testData/cli/jvm/jsr305Ignore.args b/compiler/testData/cli/jvm/jsr305Ignore.args
index fa848bd4cc4..967f733e07b 100644
--- a/compiler/testData/cli/jvm/jsr305Ignore.args
+++ b/compiler/testData/cli/jvm/jsr305Ignore.args
@@ -1,5 +1,6 @@
-Xjsr305=ignore
$TESTDATA_DIR$/jsr305Usage.kt
$TESTDATA_DIR$/jsr305
+$FOREIGN_ANNOTATIONS_DIR$
-d
$TEMP_DIR$
diff --git a/compiler/testData/cli/jvm/jsr305NoFlag.args b/compiler/testData/cli/jvm/jsr305NoFlag.args
index f08788feac5..9c80e2dc59c 100644
--- a/compiler/testData/cli/jvm/jsr305NoFlag.args
+++ b/compiler/testData/cli/jvm/jsr305NoFlag.args
@@ -1,4 +1,5 @@
$TESTDATA_DIR$/jsr305Usage.kt
$TESTDATA_DIR$/jsr305
+$FOREIGN_ANNOTATIONS_DIR$
-d
$TEMP_DIR$
diff --git a/compiler/testData/cli/jvm/jsr305Strict.args b/compiler/testData/cli/jvm/jsr305Strict.args
index 34eda998f64..3961f1f4cfe 100644
--- a/compiler/testData/cli/jvm/jsr305Strict.args
+++ b/compiler/testData/cli/jvm/jsr305Strict.args
@@ -1,5 +1,6 @@
-Xjsr305=strict
$TESTDATA_DIR$/jsr305Usage.kt
$TESTDATA_DIR$/jsr305
+$FOREIGN_ANNOTATIONS_DIR$
-d
$TEMP_DIR$
diff --git a/compiler/testData/cli/jvm/jsr305Warn.args b/compiler/testData/cli/jvm/jsr305Warn.args
index cffba4cad92..bc5461dac12 100644
--- a/compiler/testData/cli/jvm/jsr305Warn.args
+++ b/compiler/testData/cli/jvm/jsr305Warn.args
@@ -1,5 +1,6 @@
-Xjsr305=warn
$TESTDATA_DIR$/jsr305Usage.kt
$TESTDATA_DIR$/jsr305
+$FOREIGN_ANNOTATIONS_DIR$
-d
$TEMP_DIR$
diff --git a/compiler/tests/org/jetbrains/kotlin/cli/AbstractCliTest.java b/compiler/tests/org/jetbrains/kotlin/cli/AbstractCliTest.java
index 1e67cb26812..fd9074cee11 100644
--- a/compiler/tests/org/jetbrains/kotlin/cli/AbstractCliTest.java
+++ b/compiler/tests/org/jetbrains/kotlin/cli/AbstractCliTest.java
@@ -24,6 +24,7 @@ import kotlin.collections.CollectionsKt;
import kotlin.io.FilesKt;
import kotlin.text.Charsets;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.kotlin.checkers.AbstractForeignAnnotationsTestKt;
import org.jetbrains.kotlin.cli.common.CLITool;
import org.jetbrains.kotlin.cli.common.ExitCode;
import org.jetbrains.kotlin.cli.js.K2JSCompiler;
@@ -162,7 +163,11 @@ public abstract class AbstractCliTest extends TestCaseWithTmpdir {
return argsWithColonsReplaced
.replace("$TEMP_DIR$", tempDir)
- .replace("$TESTDATA_DIR$", new File(argsFilePath).getParent());
+ .replace("$TESTDATA_DIR$", new File(argsFilePath).getParent())
+ .replace(
+ "$FOREIGN_ANNOTATIONS_DIR$",
+ new File(AbstractForeignAnnotationsTestKt.getFOREIGN_ANNOTATIONS_SOURCES_PATH()).getPath()
+ );
});
}