code cleanup: backend-common, cli modules
This commit is contained in:
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.backend.common.bridges
|
||||
import org.jetbrains.kotlin.utils.DFS
|
||||
import java.util.HashSet
|
||||
|
||||
public trait FunctionHandle {
|
||||
public interface FunctionHandle {
|
||||
public val isDeclaration: Boolean
|
||||
public val isAbstract: Boolean
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.backend.common.output
|
||||
|
||||
import java.io.File
|
||||
|
||||
public trait OutputFileCollection {
|
||||
public interface OutputFileCollection {
|
||||
public fun get(relativePath: String): OutputFile?
|
||||
public fun asList(): List<OutputFile>
|
||||
}
|
||||
@@ -28,7 +28,7 @@ public class SimpleOutputFileCollection(private val outputFiles: List<OutputFile
|
||||
override fun asList(): List<OutputFile> = outputFiles
|
||||
}
|
||||
|
||||
public trait OutputFile {
|
||||
public interface OutputFile {
|
||||
public val relativePath: String
|
||||
public val sourceFiles: List<File>
|
||||
public fun asByteArray(): ByteArray
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.jetbrains.kotlin.name.FqName
|
||||
import java.util.ArrayList
|
||||
import java.util.EnumSet
|
||||
import java.util.HashMap
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
public data class JavaRoot(public val file: VirtualFile, public val type: JavaRoot.RootType) {
|
||||
public enum class RootType {
|
||||
@@ -43,7 +42,7 @@ public data class JavaRoot(public val file: VirtualFile, public val type: JavaRo
|
||||
public class JvmDependenciesIndex(_roots: List<JavaRoot>) {
|
||||
|
||||
//these fields are computed based on _roots passed to constructor which are filled in later
|
||||
private val roots: List<JavaRoot> by Delegates.lazy { _roots.toList() }
|
||||
private val roots: List<JavaRoot> by lazy { _roots.toList() }
|
||||
|
||||
private val maxIndex: Int
|
||||
get() = roots.size()
|
||||
@@ -61,7 +60,7 @@ public class JvmDependenciesIndex(_roots: List<JavaRoot>) {
|
||||
}
|
||||
|
||||
// root "Cache" object corresponds to DefaultPackage which exists in every root
|
||||
private val rootCache: Cache by Delegates.lazy {
|
||||
private val rootCache: Cache by lazy {
|
||||
with(Cache()) {
|
||||
roots.indices.forEach {
|
||||
rootIndices.add(it)
|
||||
@@ -236,12 +235,12 @@ public class JvmDependenciesIndex(_roots: List<JavaRoot>) {
|
||||
override val acceptedRootTypes: Set<JavaRoot.RootType>
|
||||
) : SearchRequest
|
||||
|
||||
private trait SearchRequest {
|
||||
private interface SearchRequest {
|
||||
val packageFqName: FqName
|
||||
val acceptedRootTypes: Set<JavaRoot.RootType>
|
||||
}
|
||||
|
||||
private trait SearchResult {
|
||||
private interface SearchResult {
|
||||
class Found(val packageDirectory: VirtualFile, val root: JavaRoot) : SearchResult
|
||||
|
||||
object NotFound : SearchResult
|
||||
|
||||
@@ -69,7 +69,6 @@ import org.jetbrains.kotlin.codegen.extensions.ExpressionCodegenExtension
|
||||
import org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar
|
||||
import org.jetbrains.kotlin.config.CommonConfigurationKeys
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.config.KotlinSourceRoot
|
||||
import org.jetbrains.kotlin.config.kotlinSourceRoots
|
||||
import org.jetbrains.kotlin.extensions.ExternalDeclarationsProvider
|
||||
import org.jetbrains.kotlin.idea.JetFileType
|
||||
@@ -88,7 +87,6 @@ import java.io.File
|
||||
import java.util.ArrayList
|
||||
import java.util.Comparator
|
||||
import kotlin.platform.platformStatic
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
public class KotlinCoreEnvironment private constructor(
|
||||
parentDisposable: Disposable,
|
||||
@@ -161,7 +159,7 @@ public class KotlinCoreEnvironment private constructor(
|
||||
public val project: Project
|
||||
get() = projectEnvironment.getProject()
|
||||
|
||||
public val sourceLinesOfCode: Int by Delegates.lazy { countLinesOfCode(sourceFiles) }
|
||||
public val sourceLinesOfCode: Int by lazy { countLinesOfCode(sourceFiles) }
|
||||
|
||||
public fun countLinesOfCode(sourceFiles: List<JetFile>): Int =
|
||||
sourceFiles.sumBy {
|
||||
|
||||
@@ -25,7 +25,7 @@ public data class JvmClasspathRoot(public override val file: File): JvmContentRo
|
||||
|
||||
public data class JavaSourceRoot(public override val file: File): JvmContentRoot
|
||||
|
||||
public trait JvmContentRoot : ContentRoot {
|
||||
public interface JvmContentRoot : ContentRoot {
|
||||
public val file: File
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user