diff --git a/compiler/testData/foreignAnnotations/tests/aosp.kt b/compiler/testData/foreignAnnotations/tests/aosp.kt index 285ebbda09c..6abbe23f7f1 100644 --- a/compiler/testData/foreignAnnotations/tests/aosp.kt +++ b/compiler/testData/foreignAnnotations/tests/aosp.kt @@ -21,6 +21,7 @@ public class A { } // FILE: main.kt +// SOURCE_RETENTION_ANNOTATIONS fun main(a: A, a1: A) { a.foo("", null)?.length diff --git a/compiler/tests-common/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt b/compiler/tests-common/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt index 849cf2dee1d..50f6e7b784a 100644 --- a/compiler/tests-common/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt +++ b/compiler/tests-common/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt @@ -357,6 +357,7 @@ abstract class AbstractDiagnosticsTest : BaseDiagnosticsTest() { testFiles: List, modules: Map ) { + if (skipDescriptorsValidation()) return if (testFiles.any { file -> InTextDirectivesUtils.isDirectiveDefined(file.expectedText, "// SKIP_TXT") }) { assertFalse(".txt file should not exist if SKIP_TXT directive is used: $expectedFile", expectedFile.exists()) return @@ -418,6 +419,8 @@ abstract class AbstractDiagnosticsTest : BaseDiagnosticsTest() { KotlinTestUtils.assertEqualsToFile(expectedFile, allPackagesText) } + protected open fun skipDescriptorsValidation(): Boolean = false + private fun createdAffectedPackagesConfiguration( testFiles: List, modules: Collection diff --git a/compiler/tests-common/org/jetbrains/kotlin/checkers/KotlinMultiFileTestWithJava.java b/compiler/tests-common/org/jetbrains/kotlin/checkers/KotlinMultiFileTestWithJava.java index 62c232c365e..36d9877a424 100644 --- a/compiler/tests-common/org/jetbrains/kotlin/checkers/KotlinMultiFileTestWithJava.java +++ b/compiler/tests-common/org/jetbrains/kotlin/checkers/KotlinMultiFileTestWithJava.java @@ -40,7 +40,7 @@ import java.util.List; import java.util.Map; public abstract class KotlinMultiFileTestWithJava extends KtUsefulTestCase { - private File javaFilesDir; + protected File javaFilesDir; private File kotlinSourceRoot; @Override @@ -78,13 +78,28 @@ public abstract class KotlinMultiFileTestWithJava extends KtUsefulTestCase getConfigurationKind(), getTestJdkKind(), CollectionsKt.plus(Collections.singletonList(KotlinTestUtils.getAnnotationsJar()), getExtraClasspath()), - Collections.singletonList(javaFilesDir) + isJavaSourceRootNeeded() ? Collections.singletonList(javaFilesDir) : Collections.emptyList() ); configuration.add(JVMConfigurationKeys.SCRIPT_DEFINITIONS, StandardScriptDefinition.INSTANCE); if (isKotlinSourceRootNeeded()) { ContentRootsKt.addKotlinSourceRoot(configuration, kotlinSourceRoot.getPath()); } - return KotlinCoreEnvironment.createForTests(getTestRootDisposable(), configuration, getEnvironmentConfigFiles()); + + KotlinCoreEnvironment environment = + KotlinCoreEnvironment.createForTests(getTestRootDisposable(), configuration, getEnvironmentConfigFiles()); + performCustomConfiguration( + environment + ); + + return environment; + } + + protected boolean isJavaSourceRootNeeded() { + return true; + } + + protected void performCustomConfiguration(@NotNull KotlinCoreEnvironment environment) { + } @NotNull diff --git a/compiler/tests-common/org/jetbrains/kotlin/codegen/CodegenTestCase.java b/compiler/tests-common/org/jetbrains/kotlin/codegen/CodegenTestCase.java index 9a65b152504..bee076d5e63 100644 --- a/compiler/tests-common/org/jetbrains/kotlin/codegen/CodegenTestCase.java +++ b/compiler/tests-common/org/jetbrains/kotlin/codegen/CodegenTestCase.java @@ -18,7 +18,6 @@ package org.jetbrains.kotlin.codegen; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import com.intellij.ide.highlighter.JavaFileType; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.io.FileUtil; @@ -587,20 +586,6 @@ public abstract class CodegenTestCase extends KtUsefulTestCase { } } - @NotNull - protected static List findJavaSourcesInDirectory(@NotNull File directory) { - List javaFilePaths = new ArrayList<>(1); - - FileUtil.processFilesRecursively(directory, file -> { - if (file.isFile() && FilesKt.getExtension(file).equals(JavaFileType.DEFAULT_EXTENSION)) { - javaFilePaths.add(file.getPath()); - } - return true; - }); - - return javaFilePaths; - } - protected ConfigurationKind extractConfigurationKind(@NotNull List files) { boolean addRuntime = false; diff --git a/compiler/tests-common/org/jetbrains/kotlin/codegen/CodegenTestUtil.java b/compiler/tests-common/org/jetbrains/kotlin/codegen/CodegenTestUtil.java index e97555e0e5f..7bd71bc0893 100644 --- a/compiler/tests-common/org/jetbrains/kotlin/codegen/CodegenTestUtil.java +++ b/compiler/tests-common/org/jetbrains/kotlin/codegen/CodegenTestUtil.java @@ -16,7 +16,10 @@ package org.jetbrains.kotlin.codegen; +import com.intellij.ide.highlighter.JavaFileType; +import com.intellij.openapi.util.io.FileUtil; import kotlin.collections.CollectionsKt; +import kotlin.io.FilesKt; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment; @@ -80,7 +83,22 @@ public class CodegenTestUtil { @NotNull List additionalOptions ) { try { - File javaClassesTempDirectory = KotlinTestUtils.tmpDir("java-classes"); + File directory = KotlinTestUtils.tmpDir("java-classes"); + compileJava(fileNames, additionalClasspath, additionalOptions, directory); + return directory; + } + catch (IOException e) { + throw ExceptionUtilsKt.rethrow(e); + } + } + + public static void compileJava( + @NotNull List fileNames, + @NotNull List additionalClasspath, + @NotNull List additionalOptions, + @NotNull File outDirectory + ) { + try { List classpath = new ArrayList<>(); classpath.add(ForTestCompileRuntime.runtimeJarForTests().getPath()); classpath.add(ForTestCompileRuntime.reflectJarForTests().getPath()); @@ -89,13 +107,11 @@ public class CodegenTestUtil { List options = new ArrayList<>(Arrays.asList( "-classpath", StringsKt.join(classpath, File.pathSeparator), - "-d", javaClassesTempDirectory.getPath() + "-d", outDirectory.getPath() )); options.addAll(additionalOptions); KotlinTestUtils.compileJavaFiles(CollectionsKt.map(fileNames, File::new), options); - - return javaClassesTempDirectory; } catch (IOException e) { throw ExceptionUtilsKt.rethrow(e); @@ -131,4 +147,18 @@ public class CodegenTestUtil { throw ExceptionUtilsKt.rethrow(e); } } + + @NotNull + public static List findJavaSourcesInDirectory(@NotNull File directory) { + List javaFilePaths = new ArrayList<>(1); + + FileUtil.processFilesRecursively(directory, file -> { + if (file.isFile() && FilesKt.getExtension(file).equals(JavaFileType.DEFAULT_EXTENSION)) { + javaFilePaths.add(file.getPath()); + } + return true; + }); + + return javaFilePaths; + } } diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/AbstractForeignAnnotationsNoAnnotationInClasspathTest.kt b/compiler/tests/org/jetbrains/kotlin/checkers/AbstractForeignAnnotationsNoAnnotationInClasspathTest.kt new file mode 100644 index 00000000000..3ae04fec489 --- /dev/null +++ b/compiler/tests/org/jetbrains/kotlin/checkers/AbstractForeignAnnotationsNoAnnotationInClasspathTest.kt @@ -0,0 +1,50 @@ +/* + * Copyright 2010-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.checkers + +import org.jetbrains.kotlin.codegen.CodegenTestUtil +import org.jetbrains.kotlin.test.InTextDirectivesUtils +import org.jetbrains.kotlin.test.KotlinTestUtils +import org.jetbrains.kotlin.test.MockLibraryUtil +import java.io.File + +abstract class AbstractForeignAnnotationsNoAnnotationInClasspathTest : AbstractForeignAnnotationsTest() { + private val compiledJavaPath = KotlinTestUtils.tmpDir("java-compiled-files") + override fun getExtraClasspath(): List { + compileJavaFiles() + return listOf(compiledJavaPath) + } + + override fun analyzeAndCheck(testDataFile: File, files: List) { + if (files.any { file -> InTextDirectivesUtils.isDirectiveDefined(file.expectedText, "// SOURCE_RETENTION_ANNOTATIONS") }) return + super.analyzeAndCheck(testDataFile, files) + } + + override fun isJavaSourceRootNeeded() = false + override fun skipDescriptorsValidation() = true + + private fun createJarWithForeignAnnotations(): List = + listOf(MockLibraryUtil.compileJvmLibraryToJar(annotationsPath, "foreign-annotations")) + + private fun compileJavaFiles() { + CodegenTestUtil.compileJava( + CodegenTestUtil.findJavaSourcesInDirectory(javaFilesDir), + createJarWithForeignAnnotations().map { it.path }, emptyList(), + compiledJavaPath + ) + } +} diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/AbstractForeignAnnotationsNoAnnotationInClasspathWithFastClassReadingTest.kt b/compiler/tests/org/jetbrains/kotlin/checkers/AbstractForeignAnnotationsNoAnnotationInClasspathWithFastClassReadingTest.kt new file mode 100644 index 00000000000..8a5bef70263 --- /dev/null +++ b/compiler/tests/org/jetbrains/kotlin/checkers/AbstractForeignAnnotationsNoAnnotationInClasspathWithFastClassReadingTest.kt @@ -0,0 +1,27 @@ +/* + * Copyright 2010-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.checkers + +import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment +import org.jetbrains.kotlin.config.JVMConfigurationKeys + +abstract class AbstractForeignAnnotationsNoAnnotationInClasspathWithFastClassReadingTest : AbstractForeignAnnotationsNoAnnotationInClasspathTest() { + override fun performCustomConfiguration(environment: KotlinCoreEnvironment) { + super.performCustomConfiguration(environment) + environment.configuration.put(JVMConfigurationKeys.USE_FAST_CLASS_FILES_READING, true) + } +} diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/ForeignAnnotationsNoAnnotationInClasspathTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/ForeignAnnotationsNoAnnotationInClasspathTestGenerated.java new file mode 100644 index 00000000000..c144ccf6a78 --- /dev/null +++ b/compiler/tests/org/jetbrains/kotlin/checkers/ForeignAnnotationsNoAnnotationInClasspathTestGenerated.java @@ -0,0 +1,143 @@ +/* + * Copyright 2010-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.checkers; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TargetBackend; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("compiler/testData/foreignAnnotations/tests") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class ForeignAnnotationsNoAnnotationInClasspathTestGenerated extends AbstractForeignAnnotationsNoAnnotationInClasspathTest { + public void testAllFilesPresentInTests() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/foreignAnnotations/tests"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } + + @TestMetadata("android.kt") + public void testAndroid() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/android.kt"); + doTest(fileName); + } + + @TestMetadata("aosp.kt") + public void testAosp() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/aosp.kt"); + doTest(fileName); + } + + @TestMetadata("eclipse.kt") + public void testEclipse() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/eclipse.kt"); + doTest(fileName); + } + + @TestMetadata("findBugsSimple.kt") + public void testFindBugsSimple() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/findBugsSimple.kt"); + doTest(fileName); + } + + @TestMetadata("jsr305NullabilityNicknames.kt") + public void testJsr305NullabilityNicknames() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/jsr305NullabilityNicknames.kt"); + doTest(fileName); + } + + @TestMetadata("jsr305Simple.kt") + public void testJsr305Simple() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/jsr305Simple.kt"); + doTest(fileName); + } + + @TestMetadata("jsr305Strange.kt") + public void testJsr305Strange() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/jsr305Strange.kt"); + doTest(fileName); + } + + @TestMetadata("lombokSimple.kt") + public void testLombokSimple() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/lombokSimple.kt"); + doTest(fileName); + } + + @TestMetadata("rxjava.kt") + public void testRxjava() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/rxjava.kt"); + doTest(fileName); + } + + @TestMetadata("compiler/testData/foreignAnnotations/tests/typeQualifierDefault") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class TypeQualifierDefault extends AbstractForeignAnnotationsNoAnnotationInClasspathTest { + public void testAllFilesPresentInTypeQualifierDefault() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/typeQualifierDefault"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } + + @TestMetadata("fieldsAreNullable.kt") + public void testFieldsAreNullable() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/typeQualifierDefault/fieldsAreNullable.kt"); + doTest(fileName); + } + + @TestMetadata("nullabilityFromOverridden.kt") + public void testNullabilityFromOverridden() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/typeQualifierDefault/nullabilityFromOverridden.kt"); + doTest(fileName); + } + + @TestMetadata("overridingDefaultQualifier.kt") + public void testOverridingDefaultQualifier() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/typeQualifierDefault/overridingDefaultQualifier.kt"); + doTest(fileName); + } + + @TestMetadata("parametersAreNonnullByDefault.kt") + public void testParametersAreNonnullByDefault() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/typeQualifierDefault/parametersAreNonnullByDefault.kt"); + doTest(fileName); + } + + @TestMetadata("parametersAreNonnullByDefaultPackage.kt") + public void testParametersAreNonnullByDefaultPackage() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/typeQualifierDefault/parametersAreNonnullByDefaultPackage.kt"); + doTest(fileName); + } + + @TestMetadata("springNullable.kt") + public void testSpringNullable() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/typeQualifierDefault/springNullable.kt"); + doTest(fileName); + } + + @TestMetadata("springNullablePackage.kt") + public void testSpringNullablePackage() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/typeQualifierDefault/springNullablePackage.kt"); + doTest(fileName); + } + } +} diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/ForeignAnnotationsNoAnnotationInClasspathWithFastClassReadingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/ForeignAnnotationsNoAnnotationInClasspathWithFastClassReadingTestGenerated.java new file mode 100644 index 00000000000..8318e2ac838 --- /dev/null +++ b/compiler/tests/org/jetbrains/kotlin/checkers/ForeignAnnotationsNoAnnotationInClasspathWithFastClassReadingTestGenerated.java @@ -0,0 +1,143 @@ +/* + * Copyright 2010-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.checkers; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TargetBackend; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("compiler/testData/foreignAnnotations/tests") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class ForeignAnnotationsNoAnnotationInClasspathWithFastClassReadingTestGenerated extends AbstractForeignAnnotationsNoAnnotationInClasspathWithFastClassReadingTest { + public void testAllFilesPresentInTests() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/foreignAnnotations/tests"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } + + @TestMetadata("android.kt") + public void testAndroid() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/android.kt"); + doTest(fileName); + } + + @TestMetadata("aosp.kt") + public void testAosp() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/aosp.kt"); + doTest(fileName); + } + + @TestMetadata("eclipse.kt") + public void testEclipse() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/eclipse.kt"); + doTest(fileName); + } + + @TestMetadata("findBugsSimple.kt") + public void testFindBugsSimple() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/findBugsSimple.kt"); + doTest(fileName); + } + + @TestMetadata("jsr305NullabilityNicknames.kt") + public void testJsr305NullabilityNicknames() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/jsr305NullabilityNicknames.kt"); + doTest(fileName); + } + + @TestMetadata("jsr305Simple.kt") + public void testJsr305Simple() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/jsr305Simple.kt"); + doTest(fileName); + } + + @TestMetadata("jsr305Strange.kt") + public void testJsr305Strange() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/jsr305Strange.kt"); + doTest(fileName); + } + + @TestMetadata("lombokSimple.kt") + public void testLombokSimple() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/lombokSimple.kt"); + doTest(fileName); + } + + @TestMetadata("rxjava.kt") + public void testRxjava() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/rxjava.kt"); + doTest(fileName); + } + + @TestMetadata("compiler/testData/foreignAnnotations/tests/typeQualifierDefault") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class TypeQualifierDefault extends AbstractForeignAnnotationsNoAnnotationInClasspathWithFastClassReadingTest { + public void testAllFilesPresentInTypeQualifierDefault() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/foreignAnnotations/tests/typeQualifierDefault"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } + + @TestMetadata("fieldsAreNullable.kt") + public void testFieldsAreNullable() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/typeQualifierDefault/fieldsAreNullable.kt"); + doTest(fileName); + } + + @TestMetadata("nullabilityFromOverridden.kt") + public void testNullabilityFromOverridden() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/typeQualifierDefault/nullabilityFromOverridden.kt"); + doTest(fileName); + } + + @TestMetadata("overridingDefaultQualifier.kt") + public void testOverridingDefaultQualifier() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/typeQualifierDefault/overridingDefaultQualifier.kt"); + doTest(fileName); + } + + @TestMetadata("parametersAreNonnullByDefault.kt") + public void testParametersAreNonnullByDefault() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/typeQualifierDefault/parametersAreNonnullByDefault.kt"); + doTest(fileName); + } + + @TestMetadata("parametersAreNonnullByDefaultPackage.kt") + public void testParametersAreNonnullByDefaultPackage() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/typeQualifierDefault/parametersAreNonnullByDefaultPackage.kt"); + doTest(fileName); + } + + @TestMetadata("springNullable.kt") + public void testSpringNullable() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/typeQualifierDefault/springNullable.kt"); + doTest(fileName); + } + + @TestMetadata("springNullablePackage.kt") + public void testSpringNullablePackage() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/typeQualifierDefault/springNullablePackage.kt"); + doTest(fileName); + } + } +} diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxAgainstJavaCodegenTest.kt b/compiler/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxAgainstJavaCodegenTest.kt index 6892b73b836..57649a593fb 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxAgainstJavaCodegenTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxAgainstJavaCodegenTest.kt @@ -24,7 +24,7 @@ import java.io.File abstract class AbstractBlackBoxAgainstJavaCodegenTest : AbstractBlackBoxCodegenTest() { override fun doMultiFileTest(wholeFile: File, files: MutableList, javaFilesDir: File?) { javaClassesOutputDirectory = javaFilesDir!!.let { directory -> - CodegenTestUtil.compileJava(findJavaSourcesInDirectory(directory), emptyList(), extractJavacOptions(files)) + CodegenTestUtil.compileJava(CodegenTestUtil.findJavaSourcesInDirectory(directory), emptyList(), extractJavacOptions(files)) } super.doMultiFileTest(wholeFile, files, null) diff --git a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index 411dfa1895d..ddb121d4633 100755 --- a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -232,6 +232,14 @@ fun main(args: Array) { model("foreignAnnotations/tests") } + testClass { + model("foreignAnnotations/tests") + } + + testClass { + model("foreignAnnotations/tests") + } + testClass { model("resolve", extension = "resolve") }