Remove the compiler option "Xmultifile-facades-open"
This commit is contained in:
@@ -4,6 +4,9 @@
|
|||||||
|
|
||||||
## 1.0.2
|
## 1.0.2
|
||||||
|
|
||||||
|
### JVM
|
||||||
|
- Remove the compiler option "Xmultifile-facades-open"
|
||||||
|
|
||||||
### JS
|
### JS
|
||||||
- Safe calls (`x?.let { it }`) are now inlined
|
- Safe calls (`x?.let { it }`) are now inlined
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2015 JetBrains s.r.o.
|
* Copyright 2010-2016 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -30,7 +30,6 @@ import org.jetbrains.kotlin.descriptors.Visibilities
|
|||||||
import org.jetbrains.kotlin.diagnostics.DiagnosticUtils
|
import org.jetbrains.kotlin.diagnostics.DiagnosticUtils
|
||||||
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil
|
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil
|
||||||
import org.jetbrains.kotlin.load.java.JvmAnnotationNames
|
import org.jetbrains.kotlin.load.java.JvmAnnotationNames
|
||||||
import org.jetbrains.kotlin.load.kotlin.PackageParts
|
|
||||||
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
|
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
|
||||||
import org.jetbrains.kotlin.load.kotlin.incremental.IncrementalPackageFragmentProvider
|
import org.jetbrains.kotlin.load.kotlin.incremental.IncrementalPackageFragmentProvider
|
||||||
import org.jetbrains.kotlin.name.FqName
|
import org.jetbrains.kotlin.name.FqName
|
||||||
@@ -39,7 +38,6 @@ import org.jetbrains.kotlin.psi.*
|
|||||||
import org.jetbrains.kotlin.resolve.BindingContext
|
import org.jetbrains.kotlin.resolve.BindingContext
|
||||||
import org.jetbrains.kotlin.resolve.MemberComparator
|
import org.jetbrains.kotlin.resolve.MemberComparator
|
||||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
|
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
|
||||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin
|
|
||||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.MultifileClass
|
import org.jetbrains.kotlin.resolve.jvm.diagnostics.MultifileClass
|
||||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.MultifileClassPart
|
import org.jetbrains.kotlin.resolve.jvm.diagnostics.MultifileClassPart
|
||||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.OtherOrigin
|
import org.jetbrains.kotlin.resolve.jvm.diagnostics.OtherOrigin
|
||||||
@@ -52,7 +50,6 @@ import org.jetbrains.kotlin.serialization.deserialization.descriptors.Deserializ
|
|||||||
import org.jetbrains.org.objectweb.asm.MethodVisitor
|
import org.jetbrains.org.objectweb.asm.MethodVisitor
|
||||||
import org.jetbrains.org.objectweb.asm.Opcodes
|
import org.jetbrains.org.objectweb.asm.Opcodes
|
||||||
import org.jetbrains.org.objectweb.asm.Type
|
import org.jetbrains.org.objectweb.asm.Type
|
||||||
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class MultifileClassCodegen(
|
class MultifileClassCodegen(
|
||||||
@@ -89,17 +86,13 @@ class MultifileClassCodegen(
|
|||||||
val singleSourceFile = if (previouslyCompiledCallables.isNotEmpty()) null else filesWithCallables.singleOrNull()
|
val singleSourceFile = if (previouslyCompiledCallables.isNotEmpty()) null else filesWithCallables.singleOrNull()
|
||||||
|
|
||||||
classBuilder.defineClass(singleSourceFile, Opcodes.V1_6,
|
classBuilder.defineClass(singleSourceFile, Opcodes.V1_6,
|
||||||
if (state.generateOpenMultifileClasses) OPEN_FACADE_CLASS_ATTRIBUTES else FACADE_CLASS_ATTRIBUTES,
|
FACADE_CLASS_ATTRIBUTES,
|
||||||
facadeClassType.internalName,
|
facadeClassType.internalName,
|
||||||
null, "java/lang/Object", ArrayUtil.EMPTY_STRING_ARRAY)
|
null, "java/lang/Object", ArrayUtil.EMPTY_STRING_ARRAY)
|
||||||
if (singleSourceFile != null) {
|
if (singleSourceFile != null) {
|
||||||
classBuilder.visitSource(singleSourceFile.name, null)
|
classBuilder.visitSource(singleSourceFile.name, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.generateOpenMultifileClasses) {
|
|
||||||
generateMultifileFacadeClassConstructor(classBuilder, originFile)
|
|
||||||
}
|
|
||||||
|
|
||||||
classBuilder
|
classBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -159,16 +152,6 @@ class MultifileClassCodegen(
|
|||||||
MemberCodegen.genClassOrObject(packagePartContext, classOrObject, state, null)
|
MemberCodegen.genClassOrObject(packagePartContext, classOrObject, state, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun generateMultifileFacadeClassConstructor(classBuilder: ClassBuilder, originFile: KtFile?) {
|
|
||||||
val mv = classBuilder.newMethod(JvmDeclarationOrigin.NO_ORIGIN, Opcodes.ACC_PUBLIC, "<init>", "()V", null, null)
|
|
||||||
val v = InstructionAdapter(mv)
|
|
||||||
v.load(0, facadeClassType)
|
|
||||||
v.invokespecial("java/lang/Object", "<init>", "()V", false)
|
|
||||||
v.visitInsn(Opcodes.RETURN)
|
|
||||||
FunctionCodegen.endVisit(v, "multifile class constructor", originFile)
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun generatePart(
|
private fun generatePart(
|
||||||
file: KtFile,
|
file: KtFile,
|
||||||
generateCallableMemberTasks: MutableMap<CallableMemberDescriptor, () -> Unit>,
|
generateCallableMemberTasks: MutableMap<CallableMemberDescriptor, () -> Unit>,
|
||||||
@@ -300,7 +283,6 @@ class MultifileClassCodegen(
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val FACADE_CLASS_ATTRIBUTES = Opcodes.ACC_PUBLIC or Opcodes.ACC_FINAL or Opcodes.ACC_SUPER
|
private val FACADE_CLASS_ATTRIBUTES = Opcodes.ACC_PUBLIC or Opcodes.ACC_FINAL or Opcodes.ACC_SUPER
|
||||||
private val OPEN_FACADE_CLASS_ATTRIBUTES = Opcodes.ACC_PUBLIC or Opcodes.ACC_SUPER
|
|
||||||
|
|
||||||
private fun getOnlyPackageFragment(packageFqName: FqName, files: Collection<KtFile>, bindingContext: BindingContext): PackageFragmentDescriptor? {
|
private fun getOnlyPackageFragment(packageFqName: FqName, files: Collection<KtFile>, bindingContext: BindingContext): PackageFragmentDescriptor? {
|
||||||
val fragments = SmartList<PackageFragmentDescriptor>()
|
val fragments = SmartList<PackageFragmentDescriptor>()
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2015 JetBrains s.r.o.
|
* Copyright 2010-2016 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -66,7 +66,6 @@ class GenerationState @JvmOverloads constructor(
|
|||||||
// TODO: get rid of it with the proper module infrastructure
|
// TODO: get rid of it with the proper module infrastructure
|
||||||
val outDirectory: File? = null,
|
val outDirectory: File? = null,
|
||||||
val incrementalCompilationComponents: IncrementalCompilationComponents? = null,
|
val incrementalCompilationComponents: IncrementalCompilationComponents? = null,
|
||||||
val generateOpenMultifileClasses: Boolean = false,
|
|
||||||
val progress: Progress = Progress.DEAF,
|
val progress: Progress = Progress.DEAF,
|
||||||
private val onIndependentPartCompilationEnd: GenerationStateEventCallback = GenerationStateEventCallback.DO_NOTHING
|
private val onIndependentPartCompilationEnd: GenerationStateEventCallback = GenerationStateEventCallback.DO_NOTHING
|
||||||
) {
|
) {
|
||||||
|
|||||||
+1
-4
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2015 JetBrains s.r.o.
|
* Copyright 2010-2016 JetBrains s.r.o.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -64,9 +64,6 @@ public class K2JVMCompilerArguments extends CommonCompilerArguments {
|
|||||||
@Argument(value = "Xreport-perf", description = "Report detailed performance statistics")
|
@Argument(value = "Xreport-perf", description = "Report detailed performance statistics")
|
||||||
public boolean reportPerf;
|
public boolean reportPerf;
|
||||||
|
|
||||||
@Argument(value = "Xmultifile-facades-open", description = "Compile multifile facade classes as open")
|
|
||||||
public boolean multifileFacadesOpen;
|
|
||||||
|
|
||||||
@Argument(value = "Xallow-kotlin-package", description = "Allow compiling code in package 'kotlin'")
|
@Argument(value = "Xallow-kotlin-package", description = "Allow compiling code in package 'kotlin'")
|
||||||
public boolean allowKotlinPackage;
|
public boolean allowKotlinPackage;
|
||||||
|
|
||||||
|
|||||||
@@ -279,7 +279,6 @@ open class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
|||||||
configuration.put(JVMConfigurationKeys.DISABLE_PARAM_ASSERTIONS, arguments.noParamAssertions)
|
configuration.put(JVMConfigurationKeys.DISABLE_PARAM_ASSERTIONS, arguments.noParamAssertions)
|
||||||
configuration.put(JVMConfigurationKeys.DISABLE_INLINE, arguments.noInline)
|
configuration.put(JVMConfigurationKeys.DISABLE_INLINE, arguments.noInline)
|
||||||
configuration.put(JVMConfigurationKeys.DISABLE_OPTIMIZATION, arguments.noOptimize)
|
configuration.put(JVMConfigurationKeys.DISABLE_OPTIMIZATION, arguments.noOptimize)
|
||||||
configuration.put(JVMConfigurationKeys.MULTIFILE_FACADES_OPEN, arguments.multifileFacadesOpen);
|
|
||||||
configuration.put(CLIConfigurationKeys.ALLOW_KOTLIN_PACKAGE, arguments.allowKotlinPackage);
|
configuration.put(CLIConfigurationKeys.ALLOW_KOTLIN_PACKAGE, arguments.allowKotlinPackage);
|
||||||
configuration.put(CLIConfigurationKeys.REPORT_PERF, arguments.reportPerf);
|
configuration.put(CLIConfigurationKeys.REPORT_PERF, arguments.reportPerf);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -398,7 +398,6 @@ object KotlinToJVMBytecodeCompiler {
|
|||||||
moduleName,
|
moduleName,
|
||||||
outputDirectory,
|
outputDirectory,
|
||||||
incrementalCompilationComponents,
|
incrementalCompilationComponents,
|
||||||
configuration.get(JVMConfigurationKeys.MULTIFILE_FACADES_OPEN, false),
|
|
||||||
onIndependentPartCompilationEnd = onIndependentPartCompilationEnd)
|
onIndependentPartCompilationEnd = onIndependentPartCompilationEnd)
|
||||||
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
|
ProgressIndicatorAndCompilationCanceledStatus.checkCanceled()
|
||||||
|
|
||||||
|
|||||||
@@ -35,8 +35,6 @@ public class JVMConfigurationKeys {
|
|||||||
CompilerConfigurationKey.create("disable inline");
|
CompilerConfigurationKey.create("disable inline");
|
||||||
public static final CompilerConfigurationKey<Boolean> DISABLE_OPTIMIZATION =
|
public static final CompilerConfigurationKey<Boolean> DISABLE_OPTIMIZATION =
|
||||||
CompilerConfigurationKey.create("disable optimization");
|
CompilerConfigurationKey.create("disable optimization");
|
||||||
public static final CompilerConfigurationKey<Boolean> MULTIFILE_FACADES_OPEN =
|
|
||||||
CompilerConfigurationKey.create("compile multifile facade classes as open");
|
|
||||||
|
|
||||||
public static final CompilerConfigurationKey<IncrementalCompilationComponents> INCREMENTAL_COMPILATION_COMPONENTS =
|
public static final CompilerConfigurationKey<IncrementalCompilationComponents> INCREMENTAL_COMPILATION_COMPONENTS =
|
||||||
CompilerConfigurationKey.create("incremental cache provider");
|
CompilerConfigurationKey.create("incremental cache provider");
|
||||||
|
|||||||
-1
@@ -4,7 +4,6 @@ where advanced options include:
|
|||||||
-Xno-param-assertions Don't generate not-null assertions on parameters of methods accessible from Java
|
-Xno-param-assertions Don't generate not-null assertions on parameters of methods accessible from Java
|
||||||
-Xno-optimize Disable optimizations
|
-Xno-optimize Disable optimizations
|
||||||
-Xreport-perf Report detailed performance statistics
|
-Xreport-perf Report detailed performance statistics
|
||||||
-Xmultifile-facades-open Compile multifile facade classes as open
|
|
||||||
-Xallow-kotlin-package Allow compiling code in package 'kotlin'
|
-Xallow-kotlin-package Allow compiling code in package 'kotlin'
|
||||||
-Xskip-metadata-version-check Try loading binary incompatible classes, may cause crashes
|
-Xskip-metadata-version-check Try loading binary incompatible classes, may cause crashes
|
||||||
-Xno-inline Disable method inlining
|
-Xno-inline Disable method inlining
|
||||||
|
|||||||
Reference in New Issue
Block a user