diff --git a/build-common/src/org/jetbrains/kotlin/incremental/IncrementalJvmCache.kt b/build-common/src/org/jetbrains/kotlin/incremental/IncrementalJvmCache.kt index 78b7c4297bf..d1bcaac7036 100644 --- a/build-common/src/org/jetbrains/kotlin/incremental/IncrementalJvmCache.kt +++ b/build-common/src/org/jetbrains/kotlin/incremental/IncrementalJvmCache.kt @@ -652,7 +652,7 @@ class KotlinClassInfo constructor( return KotlinClassInfo( classId, classHeader.kind, - classHeader.data ?: emptyArray(), + classHeader.data ?: classHeader.incompatibleData ?: emptyArray(), classHeader.strings ?: emptyArray(), classHeader.multifileClassName, constantsMap = constantsAndInlineFunctions.first, diff --git a/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTestIncremental.kt b/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTestIncremental.kt index 997b7e30cb1..89e1c526025 100644 --- a/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTestIncremental.kt +++ b/jps/jps-plugin/jps-tests/test/org/jetbrains/kotlin/jps/build/KotlinJpsBuildTestIncremental.kt @@ -148,6 +148,27 @@ class KotlinJpsBuildTestIncremental : KotlinJpsBuildTest() { languageOrApiVersionChanged(CommonCompilerArguments::apiVersion) } + @WorkingDir("LanguageOrApiVersionChanged") + fun testLanguageVersionExperimental() { + initProject(LibraryDependency.JVM_MOCK_RUNTIME) + val module = myProject.modules.first() + val args = module.kotlinCompilerArguments + + // Try to set Language version to Stable+2 (there is no promises that metadata will be supported) + val experimentalLevelVersion: LanguageVersion + try { + experimentalLevelVersion = LanguageVersion.values()[LanguageVersion.LATEST_STABLE.ordinal+2] + } catch (e: ArrayIndexOutOfBoundsException) { + // there is no Stable+2 version for now, skiping test + return + } + CommonCompilerArguments::languageVersion.set(args, experimentalLevelVersion.versionString) + myProject.kotlinCommonCompilerArguments = args + + buildAllModules().assertSuccessful() + assertCompiled(KotlinBuilder.KOTLIN_BUILDER_NAME, "src/Bar.kt", "src/Foo.kt") + } + private fun languageOrApiVersionChanged(versionProperty: KMutableProperty1) { initProject(LibraryDependency.JVM_MOCK_RUNTIME)