Split AnalysisFlag values to AnalysisFlags and JvmAnalysisFlags
Declare AnalysisFlags in module 'frontend', and JvmAnalysisFlags in module 'frontend.java', to avoid leaking Java-related logic to common compiler code
This commit is contained in:
@@ -27,7 +27,8 @@ import org.jetbrains.annotations.TestOnly;
|
||||
import org.jetbrains.kotlin.backend.common.output.OutputFile;
|
||||
import org.jetbrains.kotlin.backend.common.output.OutputFileCollection;
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState;
|
||||
import org.jetbrains.kotlin.config.AnalysisFlag;
|
||||
import org.jetbrains.kotlin.config.AnalysisFlags;
|
||||
import org.jetbrains.kotlin.config.JvmAnalysisFlags;
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.DescriptorUtilKt;
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor;
|
||||
@@ -113,7 +114,7 @@ public class ClassFileFactory implements OutputFileCollection {
|
||||
part.addTo(builder);
|
||||
}
|
||||
|
||||
List<String> experimental = state.getLanguageVersionSettings().getFlag(AnalysisFlag.getExperimental());
|
||||
List<String> experimental = state.getLanguageVersionSettings().getFlag(AnalysisFlags.getExperimental());
|
||||
if (!experimental.isEmpty()) {
|
||||
writeExperimentalMarkers(state.getModule(), builder, experimental);
|
||||
}
|
||||
@@ -124,7 +125,7 @@ public class ClassFileFactory implements OutputFileCollection {
|
||||
@Override
|
||||
public byte[] asBytes(ClassBuilderFactory factory) {
|
||||
int flags = 0;
|
||||
if (state.getLanguageVersionSettings().getFlag(AnalysisFlag.getStrictMetadataVersionSemantics())) {
|
||||
if (state.getLanguageVersionSettings().getFlag(JvmAnalysisFlags.getStrictMetadataVersionSemantics())) {
|
||||
flags |= ModuleMapping.STRICT_METADATA_VERSION_SEMANTICS_FLAG;
|
||||
}
|
||||
return ModuleMappingKt.serializeToByteArray(moduleProto, state.getMetadataVersion(), flags);
|
||||
|
||||
@@ -245,7 +245,7 @@ class GenerationState private constructor(
|
||||
JVMConstructorCallNormalizationMode.DISABLE
|
||||
}
|
||||
|
||||
val jvmDefaultMode = languageVersionSettings.getFlag(AnalysisFlag.jvmDefaultMode)
|
||||
val jvmDefaultMode = languageVersionSettings.getFlag(JvmAnalysisFlags.jvmDefaultMode)
|
||||
|
||||
val disableOptimization = configuration.get(JVMConfigurationKeys.DISABLE_OPTIMIZATION, false)
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.jetbrains.kotlin.codegen
|
||||
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.config.AnalysisFlag
|
||||
import org.jetbrains.kotlin.config.JvmAnalysisFlags
|
||||
import org.jetbrains.kotlin.load.java.JvmAnnotationNames
|
||||
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
|
||||
import org.jetbrains.kotlin.metadata.jvm.deserialization.JvmBytecodeBinaryVersion
|
||||
@@ -38,7 +38,7 @@ fun writeKotlinMetadata(
|
||||
if (state.languageVersionSettings.isPreRelease()) {
|
||||
flags = flags or JvmAnnotationNames.METADATA_PRE_RELEASE_FLAG
|
||||
}
|
||||
if (state.languageVersionSettings.getFlag(AnalysisFlag.strictMetadataVersionSemantics)) {
|
||||
if (state.languageVersionSettings.getFlag(JvmAnalysisFlags.strictMetadataVersionSemantics)) {
|
||||
flags = flags or JvmAnnotationNames.METADATA_STRICT_VERSION_SEMANTICS_FLAG
|
||||
}
|
||||
if (flags != 0) {
|
||||
|
||||
Reference in New Issue
Block a user