FIR IDE: abstract low-level-api from dependency on idea

This commit is contained in:
Ilya Kirillov
2021-06-18 17:02:25 +02:00
parent a483098303
commit 75331b3448
140 changed files with 10894 additions and 6709 deletions
@@ -1,4 +1,3 @@
// FIR_IDE_IGNORE
// FILE: foo/Some.java
package foo;
@@ -0,0 +1,10 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.analyzer
interface ModuleSourceInfoBase: ModuleInfo
interface SdkInfoBase: ModuleInfo
@@ -1,4 +1,3 @@
// FIR_IDE_IGNORE
// FIR_IDENTICAL
// Error: name should present
enum class<!SYNTAX!><!>(val rgb : Int) {
@@ -1,4 +1,3 @@
// FIR_IDENTICAL
// FIR_IDE_IGNORE
enum class<!SYNTAX!><!> {
}
@@ -1,4 +1,3 @@
// FIR_IDE_IGNORE
// SKIP_JAVAC
// FILE: JavaClass.java
public class JavaClass {
@@ -1,4 +1,3 @@
// FIR_IDE_IGNORE
// SKIP_JAVAC
// FILE: A.java
public class A {
@@ -1,4 +1,3 @@
// FIR_IDE_IGNORE
// FIR_IDENTICAL
// FILE: a/b.java
package a;
@@ -1,4 +1,3 @@
// FIR_IDE_IGNORE
// FIR_IDENTICAL
// FILE: foo/a/b.java
package foo.a;
@@ -1,4 +1,3 @@
// FIR_IDE_IGNORE
// FIR_IDENTICAL
// FILE: a/b/c.java
package a.b;
@@ -1,4 +1,3 @@
// FIR_IDE_IGNORE
// FIR_IDENTICAL
// FILE: a/b.java
package a;
@@ -1,4 +1,3 @@
// FIR_IDE_IGNORE
// WITH_RUNTIME
// FULL_JDK
@@ -1,4 +1,3 @@
// FIR_IDE_IGNORE
// WITH_RUNTIME
// FULL_JDK
@@ -1,4 +1,3 @@
// FIR_IDE_IGNORE
// WITH_RUNTIME
// FULL_JDK
@@ -1,4 +1,3 @@
// FIR_IDE_IGNORE
// WITH_RUNTIME
// FULL_JDK
@@ -1,4 +1,3 @@
// FIR_IDE_IGNORE
// WITH_RUNTIME
// FULL_JDK
@@ -1,4 +1,3 @@
// FIR_IDE_IGNORE
// WITH_RUNTIME
// FULL_JDK
@@ -1,4 +1,3 @@
// FIR_IDE_IGNORE
// JAVAC_EXPECTED_FILE
// FILE: KotlinFile.kt
fun foo(javaClass: JavaClass<String>): String {
@@ -1,4 +1,3 @@
// FIR_IDE_IGNORE
// JAVAC_EXPECTED_FILE
// FILE: KotlinFile.kt
fun foo(javaClass: JavaClass): String {
@@ -1,4 +1,3 @@
// FIR_IDE_IGNORE
// JAVAC_EXPECTED_FILE
// FILE: KotlinFile.kt
fun foo(javaClass: JavaClass<Int>) {
@@ -1,4 +1,3 @@
// FIR_IDE_IGNORE
// !JDK_KIND: MODIFIED_MOCK_JDK
abstract class A : Throwable(1.0) {}
@@ -1,4 +1,3 @@
// FIR_IDE_IGNORE
// !API_VERSION: 1.5
// !LANGUAGE: -JvmRecordSupport
// SKIP_TXT
@@ -1,4 +1,3 @@
// FIR_IDE_IGNORE
// !API_VERSION: 1.5
// !LANGUAGE: +JvmRecordSupport
// FILE: MyRecord.java
@@ -106,14 +106,14 @@ class FirFrontendFacade(
return FirOutputArtifactImpl(session, filesMap, firAnalyzerFacade)
}
}
private fun TargetPlatform.getAnalyzerServices(): PlatformDependentAnalyzerServices {
return when {
isJvm() -> JvmPlatformAnalyzerServices
isJs() -> JsPlatformAnalyzerServices
isNative() -> NativePlatformAnalyzerServices
isCommon() -> CommonPlatformAnalyzerServices
else -> error("Unknown target platform: $this")
}
fun TargetPlatform.getAnalyzerServices(): PlatformDependentAnalyzerServices {
return when {
isJvm() -> JvmPlatformAnalyzerServices
isJs() -> JsPlatformAnalyzerServices
isNative() -> NativePlatformAnalyzerServices
isCommon() -> CommonPlatformAnalyzerServices
else -> error("Unknown target platform: $this")
}
}
@@ -49,7 +49,7 @@ abstract class AbstractKotlinCompilerTest {
}
}
private val configuration: TestConfigurationBuilder.() -> Unit = {
protected val configuration: TestConfigurationBuilder.() -> Unit = {
assertions = JUnit5Assertions
defaultConfiguration()
configure(this)
@@ -60,6 +60,7 @@ import java.io.File;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.nio.file.Path;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -272,6 +273,10 @@ public class KotlinTestUtils {
assertEqualsToFile(expectedFile, afterText);
}
public static void assertEqualsToFile(@NotNull Path expectedFile, @NotNull String actual) {
assertEqualsToFile(expectedFile.toFile(), actual);
}
public static void assertEqualsToFile(@NotNull File expectedFile, @NotNull String actual) {
assertEqualsToFile(expectedFile, actual, s -> s);
}
@@ -1,4 +1,3 @@
// FIR_IDE_IGNORE
// SKIP_TXT
// FILE: functions.kt