Support foreign nullability annotations

#KT-10418 Fixed
 #KT-10594 Fixed
This commit is contained in:
Denis Zharkov
2016-01-11 22:04:31 +03:00
parent fd8a718797
commit f4613b8db1
41 changed files with 1236 additions and 8 deletions
@@ -0,0 +1,41 @@
/*
* Copyright 2010-2015 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.config.CompilerConfiguration
import org.jetbrains.kotlin.test.ConfigurationKind
import org.jetbrains.kotlin.test.KotlinTestUtils
import org.jetbrains.kotlin.test.MockLibraryUtil
import org.jetbrains.kotlin.test.TestJdkKind
import java.io.File
abstract class AbstractForeignAnnotationsTest : AbstractDiagnosticsTest() {
lateinit var annotationsFile: File
override fun createCompilerConfiguration(javaFilesDir: File?): CompilerConfiguration {
val annotationsFile = MockLibraryUtil.compileLibraryToJar(
"compiler/testData/foreignAnnotations/annotations",
"foreign-annotations", /* addSources = */false)
return KotlinTestUtils.compilerConfigurationForTests(
ConfigurationKind.JDK_ONLY,
TestJdkKind.MOCK_JDK,
listOf(KotlinTestUtils.getAnnotationsJar(), annotationsFile),
listOf(javaFilesDir))
}
}
@@ -0,0 +1,79 @@
/*
* Copyright 2010-2015 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.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 ForeignAnnotationsTestGenerated extends AbstractForeignAnnotationsTest {
public void testAllFilesPresentInTests() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/foreignAnnotations/tests"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("android.kt")
public void testAndroid() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/android.kt");
doTest(fileName);
}
@TestMetadata("checkerFramework.kt")
public void testCheckerFramework() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/foreignAnnotations/tests/checkerFramework.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("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);
}
}