mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:10:43 +07:00
[kotlin] k2 add tests for java interop
- disabled tests are reported as KT-70426, KT-70427, KT-70428 - call line marker messages in BGT, same as in production KT-70404 GitOrigin-RevId: 7b368ad384d13b0a04053a3e666a4e43edf7e37c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
62e6a2484a
commit
fd7607ef38
@@ -21,6 +21,7 @@ import com.intellij.lang.annotation.HighlightSeverity;
|
||||
import com.intellij.lang.injection.InjectedLanguageManager;
|
||||
import com.intellij.lang.java.JavaLanguage;
|
||||
import com.intellij.lang.xml.XMLLanguage;
|
||||
import com.intellij.openapi.actionSystem.ex.ActionUtil;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ex.PathManagerEx;
|
||||
import com.intellij.openapi.command.WriteCommandAction;
|
||||
@@ -248,7 +249,11 @@ public abstract class DaemonAnalyzerTestCase extends JavaCodeInsightTestCase {
|
||||
@NotNull Collection<? extends HighlightInfo> infos,
|
||||
@NotNull String text) {
|
||||
PsiFile file = getFile();
|
||||
data.checkLineMarkers(file, DaemonCodeAnalyzerImpl.getLineMarkers(getDocument(file), getProject()), text);
|
||||
ActionUtil.underModalProgress(myProject, "", () -> {
|
||||
//line marker tooltips are called in BGT in production
|
||||
data.checkLineMarkers(file, DaemonCodeAnalyzerImpl.getLineMarkers(getDocument(file), getProject()), text);
|
||||
return null;
|
||||
});
|
||||
data.checkResult(file, infos, text);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,223 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.jetbrains.kotlin.idea.k2;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode;
|
||||
import org.jetbrains.kotlin.idea.base.test.TestRoot;
|
||||
import org.jetbrains.kotlin.idea.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.idea.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.jetbrains.kotlin.checkers.AbstractJavaAgainstKotlinBinariesCheckerTest;
|
||||
|
||||
/**
|
||||
* This class is generated by {@link org.jetbrains.kotlin.testGenerator.generator.TestGenerator}.
|
||||
* DO NOT MODIFY MANUALLY.
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
@TestRoot("code-insight/kotlin.code-insight.k2")
|
||||
@TestDataPath("$CONTENT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@TestMetadata("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin")
|
||||
public class K2JavaAgainstKotlinBinariesCheckerTestGenerated extends AbstractJavaAgainstKotlinBinariesCheckerTest {
|
||||
@java.lang.Override
|
||||
@org.jetbrains.annotations.NotNull
|
||||
public final KotlinPluginMode getPluginMode() {
|
||||
return KotlinPluginMode.K2;
|
||||
}
|
||||
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("AssignKotlinClassToObjectInJava.kt")
|
||||
public void testAssignKotlinClassToObjectInJava() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/AssignKotlinClassToObjectInJava.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("AssignMappedKotlinType.kt")
|
||||
public void testAssignMappedKotlinType() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/AssignMappedKotlinType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ClassObjects.kt")
|
||||
public void testClassObjects() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/ClassObjects.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("EnumAutoGeneratedMethods.kt")
|
||||
public void testEnumAutoGeneratedMethods() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/EnumAutoGeneratedMethods.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("EnumEntriesInSwitch.kt")
|
||||
public void testEnumEntriesInSwitch() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/EnumEntriesInSwitch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("EnumStaticImportInJava.kt")
|
||||
public void testEnumStaticImportInJava() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/EnumStaticImportInJava.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtendClassWithDefaultImplementationComplex.kt")
|
||||
public void testExtendClassWithDefaultImplementationComplex() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/ExtendClassWithDefaultImplementationComplex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtendClassWithDefaultImplementation_1_6.kt")
|
||||
public void testExtendClassWithDefaultImplementation_1_6() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/ExtendClassWithDefaultImplementation_1_6.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtendClassWithDefaultImplementation_1_8.kt")
|
||||
public void testExtendClassWithDefaultImplementation_1_8() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/ExtendClassWithDefaultImplementation_1_8.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtendInterfaceWithAJvmStaticMethodInCompanion.kt")
|
||||
public void testExtendInterfaceWithAJvmStaticMethodInCompanion() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/ExtendInterfaceWithAJvmStaticMethodInCompanion.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtendInterfaceWithDefaultMethodAndCompatibilityAll.kt")
|
||||
public void testExtendInterfaceWithDefaultMethodAndCompatibilityAll() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/ExtendInterfaceWithDefaultMethodAndCompatibilityAll.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtendInterfaceWithDefaultMethodAndCompatibilityAllCompatibility.kt")
|
||||
public void testExtendInterfaceWithDefaultMethodAndCompatibilityAllCompatibility() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/ExtendInterfaceWithDefaultMethodAndCompatibilityAllCompatibility.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtendInterfaceWithDefaultMethodAndCompatibilityDisabled.kt")
|
||||
public void testExtendInterfaceWithDefaultMethodAndCompatibilityDisabled() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/ExtendInterfaceWithDefaultMethodAndCompatibilityDisabled.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtendingMutableInterfaces.kt")
|
||||
public void testExtendingMutableInterfaces() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/ExtendingMutableInterfaces.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtendingReadOnlyInterfaces.kt")
|
||||
public void testExtendingReadOnlyInterfaces() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/ExtendingReadOnlyInterfaces.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("FlexibleTypes.kt")
|
||||
public void testFlexibleTypes() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/FlexibleTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("FunctionInNestedClassInDataFlowInspection.kt")
|
||||
public void testFunctionInNestedClassInDataFlowInspection() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/FunctionInNestedClassInDataFlowInspection.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ImplementedMethodsFromInterfaces.kt")
|
||||
public void testImplementedMethodsFromInterfaces() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/ImplementedMethodsFromInterfaces.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InferenceReturnType_1_6.kt")
|
||||
public void testInferenceReturnType_1_6() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/InferenceReturnType_1_6.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InferenceReturnType_1_8.kt")
|
||||
public void testInferenceReturnType_1_8() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/InferenceReturnType_1_8.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("Interface.kt")
|
||||
public void testInterface() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/Interface.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InterfaceDefaultImpls.kt")
|
||||
public void testInterfaceDefaultImpls() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/InterfaceDefaultImpls.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InterfaceWithJvmStatic.kt")
|
||||
public void testInterfaceWithJvmStatic() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/InterfaceWithJvmStatic.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("JvmOverloadsFunctions.kt")
|
||||
public void testJvmOverloadsFunctions() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/JvmOverloadsFunctions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("KotlinAnnotations.kt")
|
||||
public void testKotlinAnnotations() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/KotlinAnnotations.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("MyFunctionType.kt")
|
||||
public void testMyFunctionType() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/MyFunctionType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("OverridesAmbiguity.kt")
|
||||
public void testOverridesAmbiguity() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/OverridesAmbiguity.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ReturnInnerClasses.kt")
|
||||
public void testReturnInnerClasses() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/ReturnInnerClasses.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ThrowsOnGenericMethod.kt")
|
||||
public void testThrowsOnGenericMethod() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/ThrowsOnGenericMethod.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("TopLevelFunctionInDataFlowInspection.kt")
|
||||
public void testTopLevelFunctionInDataFlowInspection() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/TopLevelFunctionInDataFlowInspection.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("TopLevelFunctionWithNameSimilarToClassInDataFlowInspection.kt")
|
||||
public void testTopLevelFunctionWithNameSimilarToClassInDataFlowInspection() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/TopLevelFunctionWithNameSimilarToClassInDataFlowInspection.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("TopLevelFunctionWithNameSimilarToPropertyInDataFlowInspection.kt")
|
||||
public void testTopLevelFunctionWithNameSimilarToPropertyInDataFlowInspection() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/TopLevelFunctionWithNameSimilarToPropertyInDataFlowInspection.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("TopLevelOverloadedFunctionInDataFlowInspection.kt")
|
||||
public void testTopLevelOverloadedFunctionInDataFlowInspection() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/TopLevelOverloadedFunctionInDataFlowInspection.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("UseKotlinConstInSwitch.kt")
|
||||
public void testUseKotlinConstInSwitch() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/UseKotlinConstInSwitch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("UseKotlinSubclassesOfMappedTypes.kt")
|
||||
public void testUseKotlinSubclassesOfMappedTypes() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/UseKotlinSubclassesOfMappedTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("UsingKotlinPackageDeclarations.kt")
|
||||
public void testUsingKotlinPackageDeclarations() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/UsingKotlinPackageDeclarations.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("UsingMutableInterfaces.kt")
|
||||
public void testUsingMutableInterfaces() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/UsingMutableInterfaces.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("UsingReadOnlyInterfaces.kt")
|
||||
public void testUsingReadOnlyInterfaces() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/UsingReadOnlyInterfaces.kt");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,260 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package org.jetbrains.kotlin.idea.k2;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.idea.base.plugin.KotlinPluginMode;
|
||||
import org.jetbrains.kotlin.idea.base.test.TestRoot;
|
||||
import org.jetbrains.kotlin.idea.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.idea.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.jetbrains.kotlin.checkers.AbstractJavaAgainstKotlinSourceCheckerTest;
|
||||
|
||||
/**
|
||||
* This class is generated by {@link org.jetbrains.kotlin.testGenerator.generator.TestGenerator}.
|
||||
* DO NOT MODIFY MANUALLY.
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
@TestRoot("code-insight/kotlin.code-insight.k2")
|
||||
@TestDataPath("$CONTENT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public abstract class K2JavaAgainstKotlinSourceCheckerTestGenerated extends AbstractJavaAgainstKotlinSourceCheckerTest {
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@TestMetadata("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin")
|
||||
public static class JavaAgainstKotlin extends AbstractJavaAgainstKotlinSourceCheckerTest {
|
||||
@java.lang.Override
|
||||
@org.jetbrains.annotations.NotNull
|
||||
public final KotlinPluginMode getPluginMode() {
|
||||
return KotlinPluginMode.K2;
|
||||
}
|
||||
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("AssignKotlinClassToObjectInJava.kt")
|
||||
public void testAssignKotlinClassToObjectInJava() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/AssignKotlinClassToObjectInJava.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("AssignMappedKotlinType.kt")
|
||||
public void testAssignMappedKotlinType() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/AssignMappedKotlinType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ClassObjects.kt")
|
||||
public void testClassObjects() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/ClassObjects.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("EnumAutoGeneratedMethods.kt")
|
||||
public void testEnumAutoGeneratedMethods() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/EnumAutoGeneratedMethods.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("EnumEntriesInSwitch.kt")
|
||||
public void testEnumEntriesInSwitch() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/EnumEntriesInSwitch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("EnumStaticImportInJava.kt")
|
||||
public void testEnumStaticImportInJava() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/EnumStaticImportInJava.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtendClassWithDefaultImplementationComplex.kt")
|
||||
public void testExtendClassWithDefaultImplementationComplex() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/ExtendClassWithDefaultImplementationComplex.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtendClassWithDefaultImplementation_1_6.kt")
|
||||
public void testExtendClassWithDefaultImplementation_1_6() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/ExtendClassWithDefaultImplementation_1_6.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtendClassWithDefaultImplementation_1_8.kt")
|
||||
public void testExtendClassWithDefaultImplementation_1_8() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/ExtendClassWithDefaultImplementation_1_8.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtendInterfaceWithAJvmStaticMethodInCompanion.kt")
|
||||
public void testExtendInterfaceWithAJvmStaticMethodInCompanion() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/ExtendInterfaceWithAJvmStaticMethodInCompanion.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtendInterfaceWithDefaultMethodAndCompatibilityAll.kt")
|
||||
public void testExtendInterfaceWithDefaultMethodAndCompatibilityAll() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/ExtendInterfaceWithDefaultMethodAndCompatibilityAll.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtendInterfaceWithDefaultMethodAndCompatibilityAllCompatibility.kt")
|
||||
public void testExtendInterfaceWithDefaultMethodAndCompatibilityAllCompatibility() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/ExtendInterfaceWithDefaultMethodAndCompatibilityAllCompatibility.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtendInterfaceWithDefaultMethodAndCompatibilityDisabled.kt")
|
||||
public void testExtendInterfaceWithDefaultMethodAndCompatibilityDisabled() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/ExtendInterfaceWithDefaultMethodAndCompatibilityDisabled.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtendingMutableInterfaces.kt")
|
||||
public void testExtendingMutableInterfaces() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/ExtendingMutableInterfaces.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ExtendingReadOnlyInterfaces.kt")
|
||||
public void testExtendingReadOnlyInterfaces() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/ExtendingReadOnlyInterfaces.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("FlexibleTypes.kt")
|
||||
public void testFlexibleTypes() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/FlexibleTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("FunctionInNestedClassInDataFlowInspection.kt")
|
||||
public void testFunctionInNestedClassInDataFlowInspection() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/FunctionInNestedClassInDataFlowInspection.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ImplementedMethodsFromInterfaces.kt")
|
||||
public void testImplementedMethodsFromInterfaces() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/ImplementedMethodsFromInterfaces.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InferenceReturnType_1_6.kt")
|
||||
public void testInferenceReturnType_1_6() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/InferenceReturnType_1_6.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InferenceReturnType_1_8.kt")
|
||||
public void testInferenceReturnType_1_8() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/InferenceReturnType_1_8.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("Interface.kt")
|
||||
public void testInterface() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/Interface.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InterfaceDefaultImpls.kt")
|
||||
public void testInterfaceDefaultImpls() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/InterfaceDefaultImpls.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("InterfaceWithJvmStatic.kt")
|
||||
public void testInterfaceWithJvmStatic() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/InterfaceWithJvmStatic.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("JvmOverloadsFunctions.kt")
|
||||
public void testJvmOverloadsFunctions() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/JvmOverloadsFunctions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("KotlinAnnotations.kt")
|
||||
public void testKotlinAnnotations() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/KotlinAnnotations.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("MyFunctionType.kt")
|
||||
public void testMyFunctionType() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/MyFunctionType.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("OverridesAmbiguity.kt")
|
||||
public void testOverridesAmbiguity() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/OverridesAmbiguity.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ReturnInnerClasses.kt")
|
||||
public void testReturnInnerClasses() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/ReturnInnerClasses.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("ThrowsOnGenericMethod.kt")
|
||||
public void testThrowsOnGenericMethod() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/ThrowsOnGenericMethod.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("TopLevelFunctionInDataFlowInspection.kt")
|
||||
public void testTopLevelFunctionInDataFlowInspection() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/TopLevelFunctionInDataFlowInspection.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("TopLevelFunctionWithNameSimilarToClassInDataFlowInspection.kt")
|
||||
public void testTopLevelFunctionWithNameSimilarToClassInDataFlowInspection() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/TopLevelFunctionWithNameSimilarToClassInDataFlowInspection.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("TopLevelFunctionWithNameSimilarToPropertyInDataFlowInspection.kt")
|
||||
public void testTopLevelFunctionWithNameSimilarToPropertyInDataFlowInspection() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/TopLevelFunctionWithNameSimilarToPropertyInDataFlowInspection.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("TopLevelOverloadedFunctionInDataFlowInspection.kt")
|
||||
public void testTopLevelOverloadedFunctionInDataFlowInspection() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/TopLevelOverloadedFunctionInDataFlowInspection.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("UseKotlinConstInSwitch.kt")
|
||||
public void testUseKotlinConstInSwitch() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/UseKotlinConstInSwitch.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("UseKotlinSubclassesOfMappedTypes.kt")
|
||||
public void testUseKotlinSubclassesOfMappedTypes() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/UseKotlinSubclassesOfMappedTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("UsingKotlinPackageDeclarations.kt")
|
||||
public void testUsingKotlinPackageDeclarations() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/UsingKotlinPackageDeclarations.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("UsingMutableInterfaces.kt")
|
||||
public void testUsingMutableInterfaces() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/UsingMutableInterfaces.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("UsingReadOnlyInterfaces.kt")
|
||||
public void testUsingReadOnlyInterfaces() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin/UsingReadOnlyInterfaces.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@TestMetadata("../../idea/tests/testData/kotlinAndJavaChecker/javaWithKotlin")
|
||||
public static class JavaWithKotlin extends AbstractJavaAgainstKotlinSourceCheckerTest {
|
||||
@java.lang.Override
|
||||
@org.jetbrains.annotations.NotNull
|
||||
public final KotlinPluginMode getPluginMode() {
|
||||
return KotlinPluginMode.K2;
|
||||
}
|
||||
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("InnerClassWithoutName.kt")
|
||||
public void testInnerClassWithoutName() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaWithKotlin/InnerClassWithoutName.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("JvmPackageNameFileFacade.kt")
|
||||
public void testJvmPackageNameFileFacade() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaWithKotlin/JvmPackageNameFileFacade.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("NoNotNullOnParameterInOverride.kt")
|
||||
public void testNoNotNullOnParameterInOverride() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaWithKotlin/NoNotNullOnParameterInOverride.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("OverrideInEnumEntry.kt")
|
||||
public void testOverrideInEnumEntry() throws Exception {
|
||||
runTest("../../idea/tests/testData/kotlinAndJavaChecker/javaWithKotlin/OverrideInEnumEntry.kt");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
package org.jetbrains.kotlin.checkers;
|
||||
|
||||
import com.intellij.codeInspection.LocalInspectionTool;
|
||||
import com.intellij.codeInspection.dataFlow.ConstantValueInspection;
|
||||
import com.intellij.codeInspection.dataFlow.DataFlowInspection;
|
||||
import com.intellij.codeInspection.nullable.NullableStuffInspection;
|
||||
import com.intellij.openapi.module.Module;
|
||||
@@ -19,6 +20,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.idea.KotlinDaemonAnalyzerTestCase;
|
||||
import org.jetbrains.kotlin.idea.base.test.InTextDirectivesUtils;
|
||||
import org.jetbrains.kotlin.idea.inspections.ConstantConditionIfInspection;
|
||||
import org.jetbrains.kotlin.idea.test.ConfigLibraryUtil;
|
||||
import org.jetbrains.kotlin.idea.test.TestMetadataUtil;
|
||||
import org.jetbrains.kotlin.utils.ExceptionUtilsKt;
|
||||
@@ -45,6 +47,9 @@ public abstract class AbstractJavaAgainstKotlinCheckerTest extends KotlinDaemonA
|
||||
return new NullableStuffInspection();
|
||||
if ("DataFlowInspection".equals(toolString))
|
||||
return new DataFlowInspection();
|
||||
if ("ConstantValueInspection".equals(toolString)) {
|
||||
return new ConstantValueInspection();
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException("Can't find inspection tool with identifier: " + toolString);
|
||||
}
|
||||
@@ -96,7 +101,7 @@ public abstract class AbstractJavaAgainstKotlinCheckerTest extends KotlinDaemonA
|
||||
protected Module createMainModule() throws IOException {
|
||||
Module module = super.createMainModule();
|
||||
|
||||
ModuleRootModificationUtil.updateModel(module, DefaultLightProjectDescriptor::addJetBrainsAnnotations);
|
||||
ModuleRootModificationUtil.updateModel(module, DefaultLightProjectDescriptor::addJetBrainsAnnotationsWithTypeUse);
|
||||
|
||||
String configFileText = getConfigFileText();
|
||||
if (configFileText == null) {
|
||||
|
||||
@@ -2,14 +2,18 @@
|
||||
|
||||
package org.jetbrains.kotlin.checkers
|
||||
|
||||
import org.jetbrains.kotlin.idea.base.test.IgnoreTests
|
||||
import org.jetbrains.kotlin.idea.test.withCustomCompilerOptions
|
||||
import java.io.File
|
||||
import java.nio.file.Path
|
||||
|
||||
abstract class AbstractJavaAgainstKotlinSourceCheckerTest : AbstractJavaAgainstKotlinCheckerTest() {
|
||||
fun doTest(path: String) {
|
||||
val relativePath = File(path).toRelativeString(File(testDataPath))
|
||||
fun doTest() {
|
||||
doTest(true, true, relativePath.replace(".kt", ".java"), relativePath)
|
||||
IgnoreTests.runTestIfNotDisabledByFileDirective(Path.of(path), IgnoreTests.DIRECTIVES.of(pluginMode), directivePosition = IgnoreTests.DirectivePosition.LAST_LINE_IN_FILE) {
|
||||
doTest(true, true, relativePath.replace(".kt", ".java"), relativePath)
|
||||
}
|
||||
}
|
||||
|
||||
val configFile = configFileText
|
||||
|
||||
@@ -105,6 +105,11 @@ public class JavaAgainstKotlinBinariesCheckerTestGenerated extends AbstractJavaA
|
||||
runTest("testData/kotlinAndJavaChecker/javaAgainstKotlin/ExtendingReadOnlyInterfaces.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("FlexibleTypes.kt")
|
||||
public void testFlexibleTypes() throws Exception {
|
||||
runTest("testData/kotlinAndJavaChecker/javaAgainstKotlin/FlexibleTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("FunctionInNestedClassInDataFlowInspection.kt")
|
||||
public void testFunctionInNestedClassInDataFlowInspection() throws Exception {
|
||||
runTest("testData/kotlinAndJavaChecker/javaAgainstKotlin/FunctionInNestedClassInDataFlowInspection.kt");
|
||||
|
||||
@@ -107,6 +107,11 @@ public abstract class JavaAgainstKotlinSourceCheckerTestGenerated extends Abstra
|
||||
runTest("testData/kotlinAndJavaChecker/javaAgainstKotlin/ExtendingReadOnlyInterfaces.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("FlexibleTypes.kt")
|
||||
public void testFlexibleTypes() throws Exception {
|
||||
runTest("testData/kotlinAndJavaChecker/javaAgainstKotlin/FlexibleTypes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("FunctionInNestedClassInDataFlowInspection.kt")
|
||||
public void testFunctionInNestedClassInDataFlowInspection() throws Exception {
|
||||
runTest("testData/kotlinAndJavaChecker/javaAgainstKotlin/FunctionInNestedClassInDataFlowInspection.kt");
|
||||
|
||||
@@ -23,4 +23,6 @@ interface D {
|
||||
interface S {
|
||||
fun a() = Unit
|
||||
fun b() = Unit
|
||||
}
|
||||
}
|
||||
|
||||
// IGNORE_K2
|
||||
@@ -13,4 +13,5 @@ abstract class KotlinClass : KotlinInterface {
|
||||
override fun f() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// IGNORE_K2
|
||||
@@ -13,4 +13,5 @@ abstract class KotlinClass : KotlinInterface {
|
||||
override fun f() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// IGNORE_K2
|
||||
@@ -3,3 +3,4 @@ package test
|
||||
interface KotlinInterface {
|
||||
fun bar() {}
|
||||
}
|
||||
// IGNORE_K2
|
||||
|
||||
@@ -42,3 +42,4 @@ interface IMutableMapEntry<KElem, VElem> : MutableMap.MutableEntry<KElem, VElem>
|
||||
open class CMutableMapEntry<KElem, VElem> : MutableMap.MutableEntry<KElem, VElem> by mutableMapOf<KElem, VElem>().entries.first()
|
||||
open class SMutableMapEntry<VElem> : MutableMap.MutableEntry<String, VElem> by mutableMapOf<String, VElem>().entries.first()
|
||||
open class ABMutableMapEntry : MutableMap.MutableEntry<A, B> by mutableMapOf<A, B>().entries.first()
|
||||
// IGNORE_K2
|
||||
@@ -42,3 +42,5 @@ interface IMapEntry<KElem, VElem> : Map.Entry<KElem, VElem>
|
||||
open class CMapEntry<KElem, VElem> : Map.Entry<KElem, VElem> by emptyMap<KElem, VElem>().entries.first()
|
||||
open class SMapEntry<VElem> : Map.Entry<String, VElem> by emptyMap<String, VElem>().entries.first()
|
||||
open class ABMapEntry : Map.Entry<A, B> by emptyMap<A, B>().entries.first()
|
||||
|
||||
// IGNORE_K2
|
||||
@@ -0,0 +1,11 @@
|
||||
package test;
|
||||
|
||||
import test.FlexibleTypesKt;
|
||||
|
||||
class Foo {
|
||||
void a() {
|
||||
if (FlexibleTypesKt.getPREVIEW().get(0) != null) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package test
|
||||
|
||||
import java.util.*
|
||||
|
||||
public val PREVIEW: java.util.ArrayList<Any> = java.util.ArrayList<Any>()
|
||||
|
||||
// IGNORE_K2
|
||||
@@ -0,0 +1 @@
|
||||
// TOOL: ConstantValueInspection
|
||||
@@ -1,2 +1,3 @@
|
||||
// kotlin.collections.List
|
||||
abstract class CMutableList<Elem> : MutableList<Elem> by mutableListOf<Elem>()
|
||||
// IGNORE_K2
|
||||
|
||||
@@ -42,3 +42,4 @@ interface IMapEntry<KElem, VElem> : Map.Entry<KElem, VElem>
|
||||
abstract class CMapEntry<KElem, VElem> : Map.Entry<KElem, VElem> by emptyMap<KElem, VElem>().entries.first()
|
||||
abstract class SMapEntry<VElem> : Map.Entry<String, VElem> by emptyMap<String, VElem>().entries.first()
|
||||
abstract class ABMapEntry : Map.Entry<A, B> by emptyMap<A, B>().entries.first()
|
||||
// IGNORE_K2
|
||||
@@ -1,6 +1,8 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.kotlin.fir.testGenerator.codeinsight
|
||||
|
||||
import org.jetbrains.kotlin.checkers.AbstractJavaAgainstKotlinBinariesCheckerTest
|
||||
import org.jetbrains.kotlin.checkers.AbstractJavaAgainstKotlinSourceCheckerTest
|
||||
import org.jetbrains.kotlin.idea.codeInsight.generate.AbstractGenerateHashCodeAndEqualsActionTest
|
||||
import org.jetbrains.kotlin.idea.k2.AbstractK2ExpressionTypeTest
|
||||
import org.jetbrains.kotlin.idea.k2.AbstractKotlinFirBreadcrumbsTest
|
||||
@@ -180,5 +182,14 @@ internal fun MutableTWorkspace.generateK2CodeInsightTests() {
|
||||
isRecursive = true,
|
||||
)
|
||||
}
|
||||
|
||||
testClass<AbstractJavaAgainstKotlinSourceCheckerTest>(generatedClassName = "org.jetbrains.kotlin.idea.k2.K2JavaAgainstKotlinSourceCheckerTestGenerated") {
|
||||
model("../../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin")
|
||||
model("../../../idea/tests/testData/kotlinAndJavaChecker/javaWithKotlin")
|
||||
}
|
||||
|
||||
testClass<AbstractJavaAgainstKotlinBinariesCheckerTest>(generatedClassName = "org.jetbrains.kotlin.idea.k2.K2JavaAgainstKotlinBinariesCheckerTestGenerated") {
|
||||
model("../../../idea/tests/testData/kotlinAndJavaChecker/javaAgainstKotlin")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user