From 312e9315828fcd0127fdbc8decaf4092254bff2b Mon Sep 17 00:00:00 2001 From: Ilya Chernikov Date: Wed, 25 Nov 2015 14:30:24 +0100 Subject: [PATCH] Code cleanup - removing public modifier, obsolete constants, fixing typos, etc. --- .../CompilerCallbackServicesFacadeServer.kt | 2 +- .../rmi/kotlinr/KotlinCompilerClient.kt | 28 ++--- .../jetbrains/kotlin/rmi/CompileService.kt | 34 +++--- .../rmi/CompilerCallbackServicesFacade.kt | 24 ++-- .../org/jetbrains/kotlin/rmi/DaemonParams.kt | 107 +++++++++--------- .../jetbrains/kotlin/rmi/FileSystemUtils.kt | 4 +- .../org/jetbrains/kotlin/rmi/NetworkUtils.kt | 14 ++- .../kotlin/rmi/RemoteOperationsTracer.kt | 6 +- .../kotlin/rmi/RemoteOutputStream.kt | 8 +- compiler/rmi/rmi-server/rmi-server.iml | 5 +- .../kotlin/rmi/service/CompileDaemon.kt | 6 +- .../kotlin/rmi/service/CompileServiceImpl.kt | 2 +- .../rmi/service/LazyClasspathWatcher.kt | 10 +- .../service/RemoteIncrementalCacheClient.kt | 2 +- .../rmi/service/RemoteOutputStreamClient.kt | 2 +- 15 files changed, 127 insertions(+), 127 deletions(-) diff --git a/compiler/rmi/kotlinr/src/org/jetbrains/kotlin/rmi/kotlinr/CompilerCallbackServicesFacadeServer.kt b/compiler/rmi/kotlinr/src/org/jetbrains/kotlin/rmi/kotlinr/CompilerCallbackServicesFacadeServer.kt index a872da2bed1..7bca1b82aff 100644 --- a/compiler/rmi/kotlinr/src/org/jetbrains/kotlin/rmi/kotlinr/CompilerCallbackServicesFacadeServer.kt +++ b/compiler/rmi/kotlinr/src/org/jetbrains/kotlin/rmi/kotlinr/CompilerCallbackServicesFacadeServer.kt @@ -27,7 +27,7 @@ import org.jetbrains.kotlin.rmi.LoopbackNetworkInterface import org.jetbrains.kotlin.rmi.SOCKET_ANY_FREE_PORT -public class CompilerCallbackServicesFacadeServer( +class CompilerCallbackServicesFacadeServer( val incrementalCompilationComponents: IncrementalCompilationComponents? = null, val compilationCancelledStatus: CompilationCanceledStatus? = null, port: Int = SOCKET_ANY_FREE_PORT diff --git a/compiler/rmi/kotlinr/src/org/jetbrains/kotlin/rmi/kotlinr/KotlinCompilerClient.kt b/compiler/rmi/kotlinr/src/org/jetbrains/kotlin/rmi/kotlinr/KotlinCompilerClient.kt index 2322a16d2a3..c6b40da7761 100644 --- a/compiler/rmi/kotlinr/src/org/jetbrains/kotlin/rmi/kotlinr/KotlinCompilerClient.kt +++ b/compiler/rmi/kotlinr/src/org/jetbrains/kotlin/rmi/kotlinr/KotlinCompilerClient.kt @@ -29,13 +29,13 @@ import java.util.concurrent.TimeUnit import kotlin.concurrent.thread -public class CompilationServices( +class CompilationServices( val incrementalCompilationComponents: IncrementalCompilationComponents? = null, val compilationCanceledStatus: CompilationCanceledStatus? = null ) -public object KotlinCompilerClient { +object KotlinCompilerClient { val DAEMON_DEFAULT_STARTUP_TIMEOUT_MS = 10000L val DAEMON_CONNECT_CYCLE_ATTEMPTS = 3 @@ -43,7 +43,7 @@ public object KotlinCompilerClient { val verboseReporting = System.getProperty(COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY) != null - public fun connectToCompileService(compilerId: CompilerId, + fun connectToCompileService(compilerId: CompilerId, daemonJVMOptions: DaemonJVMOptions, daemonOptions: DaemonOptions, reportingTargets: DaemonReportingTargets, @@ -65,7 +65,7 @@ public object KotlinCompilerClient { return connectToCompileService(compilerId, flagFile, daemonJVMOptions, daemonOptions, reportingTargets, autostart) } - public fun connectToCompileService(compilerId: CompilerId, + fun connectToCompileService(compilerId: CompilerId, clientAliveFlagFile: File, daemonJVMOptions: DaemonJVMOptions, daemonOptions: DaemonOptions, @@ -97,18 +97,18 @@ public object KotlinCompilerClient { } - public fun shutdownCompileService(compilerId: CompilerId, daemonOptions: DaemonOptions): Unit { + fun shutdownCompileService(compilerId: CompilerId, daemonOptions: DaemonOptions): Unit { KotlinCompilerClient.connectToCompileService(compilerId, DaemonJVMOptions(), daemonOptions, DaemonReportingTargets(out = System.out), autostart = false, checkId = false) ?.shutdown() } - public fun shutdownCompileService(compilerId: CompilerId): Unit { + fun shutdownCompileService(compilerId: CompilerId): Unit { shutdownCompileService(compilerId, DaemonOptions()) } - public fun compile(compilerService: CompileService, + fun compile(compilerService: CompileService, sessionId: Int, targetPlatform: CompileService.TargetPlatform, args: Array, @@ -121,7 +121,7 @@ public object KotlinCompilerClient { } - public fun incrementalCompile(compileService: CompileService, + fun incrementalCompile(compileService: CompileService, sessionId: Int, targetPlatform: CompileService.TargetPlatform, args: Array, @@ -145,9 +145,9 @@ public object KotlinCompilerClient { operationsTracer).get() } - public val COMPILE_DAEMON_CLIENT_OPTIONS_PROPERTY: String = "kotlin.daemon.client.options" + val COMPILE_DAEMON_CLIENT_OPTIONS_PROPERTY: String = "kotlin.daemon.client.options" data class ClientOptions( - public var stop: Boolean = false + var stop: Boolean = false ) : OptionsGroup { override val mappers: List> get() = listOf(BoolPropMapper(this, ClientOptions::stop)) @@ -168,7 +168,7 @@ public object KotlinCompilerClient { @JvmStatic - public fun main(vararg args: String) { + fun main(vararg args: String) { val compilerId = CompilerId() val daemonOptions = configureDaemonOptions() val daemonLaunchingOptions = configureDaemonJVMOptions(inheritMemoryLimits = true, inheritAdditionalProperties = true) @@ -231,7 +231,7 @@ public object KotlinCompilerClient { } } - public fun detectCompilerClasspath(): List? = + fun detectCompilerClasspath(): List? = System.getProperty("java.class.path") ?.split(File.pathSeparator) ?.map { File(it).parentFile } @@ -339,9 +339,9 @@ public object KotlinCompilerClient { } -public data class DaemonReportMessage(public val category: DaemonReportCategory, public val message: String) +data class DaemonReportMessage(public val category: DaemonReportCategory, public val message: String) -public class DaemonReportingTargets(public val out: PrintStream? = null, public val messages: MutableCollection? = null) +class DaemonReportingTargets(public val out: PrintStream? = null, public val messages: MutableCollection? = null) internal fun isProcessAlive(process: Process) = diff --git a/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/CompileService.kt b/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/CompileService.kt index 4056b9b22f4..ad2bb0c00c1 100644 --- a/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/CompileService.kt +++ b/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/CompileService.kt @@ -20,23 +20,23 @@ import java.io.Serializable import java.rmi.Remote import java.rmi.RemoteException -public interface CompileService : Remote { +interface CompileService : Remote { - public enum class OutputFormat : Serializable { + enum class OutputFormat : Serializable { PLAIN, XML } - public enum class TargetPlatform : Serializable { + enum class TargetPlatform : Serializable { JVM, JS } companion object { - public val NO_SESSION: Int = 0 + val NO_SESSION: Int = 0 } - public sealed class CallResult : Serializable { + sealed class CallResult : Serializable { class Good(val result: R) : CallResult() { override fun get(): R = result @@ -66,41 +66,41 @@ public interface CompileService : Remote { // TODO: remove! @Throws(RemoteException::class) - public fun checkCompilerId(expectedCompilerId: CompilerId): Boolean + fun checkCompilerId(expectedCompilerId: CompilerId): Boolean @Throws(RemoteException::class) - public fun getUsedMemory(): CallResult + fun getUsedMemory(): CallResult @Throws(RemoteException::class) - public fun getDaemonOptions(): CallResult + fun getDaemonOptions(): CallResult @Throws(RemoteException::class) - public fun getDaemonJVMOptions(): CallResult + fun getDaemonJVMOptions(): CallResult @Throws(RemoteException::class) - public fun registerClient(aliveFlagPath: String?): CallResult + fun registerClient(aliveFlagPath: String?): CallResult // TODO: consider adding another client alive checking mechanism, e.g. socket/port @Throws(RemoteException::class) - public fun getClients(): CallResult> + fun getClients(): CallResult> @Throws(RemoteException::class) - public fun leaseCompileSession(aliveFlagPath: String?): CallResult + fun leaseCompileSession(aliveFlagPath: String?): CallResult @Throws(RemoteException::class) - public fun releaseCompileSession(sessionId: Int): CallResult + fun releaseCompileSession(sessionId: Int): CallResult @Throws(RemoteException::class) - public fun shutdown(): CallResult + fun shutdown(): CallResult @Throws(RemoteException::class) - public fun scheduleShutdown(graceful: Boolean): CallResult + fun scheduleShutdown(graceful: Boolean): CallResult // TODO: consider adding async version of shutdown and release @Throws(RemoteException::class) - public fun remoteCompile( + fun remoteCompile( sessionId: Int, targetPlatform: TargetPlatform, args: Array, @@ -112,7 +112,7 @@ public interface CompileService : Remote { ): CallResult @Throws(RemoteException::class) - public fun remoteIncrementalCompile( + fun remoteIncrementalCompile( sessionId: Int, targetPlatform: TargetPlatform, args: Array, diff --git a/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/CompilerCallbackServicesFacade.kt b/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/CompilerCallbackServicesFacade.kt index a38641cb830..5558220fc3f 100644 --- a/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/CompilerCallbackServicesFacade.kt +++ b/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/CompilerCallbackServicesFacade.kt @@ -28,45 +28,45 @@ import java.rmi.RemoteException * the reason for having common facade is attempt to reduce number of connections between client and daemon * Note: non-standard naming convention used to denote combining several entities in one facade - prefix _ is used for every function belonging to the entity */ -public interface CompilerCallbackServicesFacade : Remote { +interface CompilerCallbackServicesFacade : Remote { @Throws(RemoteException::class) - public fun hasIncrementalCaches(): Boolean + fun hasIncrementalCaches(): Boolean @Throws(RemoteException::class) - public fun hasLookupTracker(): Boolean + fun hasLookupTracker(): Boolean @Throws(RemoteException::class) - public fun hasCompilationCanceledStatus(): Boolean + fun hasCompilationCanceledStatus(): Boolean // ---------------------------------------------------- // IncrementalCache @Throws(RemoteException::class) - public fun incrementalCache_getObsoletePackageParts(target: TargetId): Collection + fun incrementalCache_getObsoletePackageParts(target: TargetId): Collection @Throws(RemoteException::class) - public fun incrementalCache_getObsoleteMultifileClassFacades(target: TargetId): Collection + fun incrementalCache_getObsoleteMultifileClassFacades(target: TargetId): Collection @Throws(RemoteException::class) - public fun incrementalCache_getMultifileFacade(target: TargetId, partInternalName: String): String? + fun incrementalCache_getMultifileFacade(target: TargetId, partInternalName: String): String? @Throws(RemoteException::class) - public fun incrementalCache_getPackagePartData(target: TargetId, fqName: String): JvmPackagePartProto? + fun incrementalCache_getPackagePartData(target: TargetId, fqName: String): JvmPackagePartProto? @Throws(RemoteException::class) - public fun incrementalCache_getModuleMappingData(target: TargetId): ByteArray? + fun incrementalCache_getModuleMappingData(target: TargetId): ByteArray? @Throws(RemoteException::class) - public fun incrementalCache_registerInline(target: TargetId, fromPath: String, jvmSignature: String, toPath: String) + fun incrementalCache_registerInline(target: TargetId, fromPath: String, jvmSignature: String, toPath: String) @Throws(RemoteException::class) fun incrementalCache_getClassFilePath(target: TargetId, internalClassName: String): String @Throws(RemoteException::class) - public fun incrementalCache_close(target: TargetId) + fun incrementalCache_close(target: TargetId) @Throws(RemoteException::class) - public fun incrementalCache_getMultifileFacadeParts(target: TargetId, internalName: String): Collection? + fun incrementalCache_getMultifileFacadeParts(target: TargetId, internalName: String): Collection? // ---------------------------------------------------- // LookupTracker diff --git a/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/DaemonParams.kt b/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/DaemonParams.kt index e91a1a76687..b954c0fca13 100644 --- a/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/DaemonParams.kt +++ b/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/DaemonParams.kt @@ -23,36 +23,33 @@ import java.lang.management.ManagementFactory import java.security.MessageDigest import java.util.* import kotlin.reflect.KMutableProperty1 -import kotlin.text.RegexOption -public val COMPILER_JAR_NAME: String = "kotlin-compiler.jar" -public val COMPILER_SERVICE_RMI_NAME: String = "KotlinJvmCompilerService" -public val COMPILER_DAEMON_CLASS_FQN: String = "org.jetbrains.kotlin.rmi.service.CompileDaemon" -public val COMPILE_DAEMON_FIND_PORT_ATTEMPTS: Int = 10 -public val COMPILE_DAEMON_PORTS_RANGE_START: Int = 17001 -public val COMPILE_DAEMON_PORTS_RANGE_END: Int = 18000 -public val COMPILE_DAEMON_STARTUP_LOCK_TIMEOUT_MS: Long = 10000L -public val COMPILE_DAEMON_STARTUP_LOCK_TIMEOUT_CHECK_MS: Long = 100L -public val COMPILE_DAEMON_ENABLED_PROPERTY: String = "kotlin.daemon.enabled" -public val COMPILE_DAEMON_JVM_OPTIONS_PROPERTY: String = "kotlin.daemon.jvm.options" -public val COMPILE_DAEMON_OPTIONS_PROPERTY: String = "kotlin.daemon.options" -public val COMPILE_DAEMON_CLIENT_ALIVE_PATH_PROPERTY: String = "kotlin.daemon.client.alive.path" -public val COMPILE_DAEMON_LOG_PATH_PROPERTY: String = "kotlin.daemon.log.path" -public val COMPILE_DAEMON_REPORT_PERF_PROPERTY: String = "kotlin.daemon.perf" -public val COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY: String = "kotlin.daemon.verbose" -public val COMPILE_DAEMON_CMDLINE_OPTIONS_PREFIX: String = "--daemon-" -public val COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY: String = "kotlin.daemon.startup.timeout" -public val COMPILE_DAEMON_DEFAULT_FILES_PREFIX: String = "kotlin-daemon" -public val COMPILE_DAEMON_TIMEOUT_INFINITE_S: Int = 0 -public val COMPILE_DAEMON_DEFAULT_IDLE_TIMEOUT_S: Int = 7200 // 2 hours -public val COMPILE_DAEMON_DEFAULT_UNUSED_TIMEOUT_S: Int = 60 -public val COMPILE_DAEMON_DEFAULT_SHUTDOWN_DELAY_MS: Long = 1000L // 1 sec -public val COMPILE_DAEMON_MEMORY_THRESHOLD_INFINITE: Long = 0L -public val COMPILE_DAEMON_FORCE_SHUTDOWN_DEFAULT_TIMEOUT_MS: Long = 10000L // 10 secs -public val COMPILE_DAEMON_TIMEOUT_INFINITE_MS: Long = 0L +val COMPILER_JAR_NAME: String = "kotlin-compiler.jar" +val COMPILER_SERVICE_RMI_NAME: String = "KotlinJvmCompilerService" +val COMPILER_DAEMON_CLASS_FQN: String = "org.jetbrains.kotlin.rmi.service.CompileDaemon" +val COMPILE_DAEMON_FIND_PORT_ATTEMPTS: Int = 10 +val COMPILE_DAEMON_PORTS_RANGE_START: Int = 17001 +val COMPILE_DAEMON_PORTS_RANGE_END: Int = 18000 +val COMPILE_DAEMON_ENABLED_PROPERTY: String = "kotlin.daemon.enabled" +val COMPILE_DAEMON_JVM_OPTIONS_PROPERTY: String = "kotlin.daemon.jvm.options" +val COMPILE_DAEMON_OPTIONS_PROPERTY: String = "kotlin.daemon.options" +val COMPILE_DAEMON_CLIENT_ALIVE_PATH_PROPERTY: String = "kotlin.daemon.client.alive.path" +val COMPILE_DAEMON_LOG_PATH_PROPERTY: String = "kotlin.daemon.log.path" +val COMPILE_DAEMON_REPORT_PERF_PROPERTY: String = "kotlin.daemon.perf" +val COMPILE_DAEMON_VERBOSE_REPORT_PROPERTY: String = "kotlin.daemon.verbose" +val COMPILE_DAEMON_CMDLINE_OPTIONS_PREFIX: String = "--daemon-" +val COMPILE_DAEMON_STARTUP_TIMEOUT_PROPERTY: String = "kotlin.daemon.startup.timeout" +val COMPILE_DAEMON_DEFAULT_FILES_PREFIX: String = "kotlin-daemon" +val COMPILE_DAEMON_TIMEOUT_INFINITE_S: Int = 0 +val COMPILE_DAEMON_DEFAULT_IDLE_TIMEOUT_S: Int = 7200 // 2 hours +val COMPILE_DAEMON_DEFAULT_UNUSED_TIMEOUT_S: Int = 60 +val COMPILE_DAEMON_DEFAULT_SHUTDOWN_DELAY_MS: Long = 1000L // 1 sec +val COMPILE_DAEMON_MEMORY_THRESHOLD_INFINITE: Long = 0L +val COMPILE_DAEMON_FORCE_SHUTDOWN_DEFAULT_TIMEOUT_MS: Long = 10000L // 10 secs +val COMPILE_DAEMON_TIMEOUT_INFINITE_MS: Long = 0L -public val COMPILE_DAEMON_DEFAULT_RUN_DIR_PATH: String get() = +val COMPILE_DAEMON_DEFAULT_RUN_DIR_PATH: String get() = FileSystem.getRuntimeStateFilesPath("kotlin", "daemon") val CLASSPATH_ID_DIGEST = "MD5" @@ -173,22 +170,22 @@ fun Iterable.filterExtractProps(propMappers: List>, } -public fun String.trimQuotes() = trim('"','\'') +fun String.trimQuotes() = trim('"','\'') -public interface OptionsGroup : Serializable { - public val mappers: List> +interface OptionsGroup : Serializable { + val mappers: List> } -public fun Iterable.filterExtractProps(vararg groups: OptionsGroup, prefix: String): Iterable = +fun Iterable.filterExtractProps(vararg groups: OptionsGroup, prefix: String): Iterable = filterExtractProps(groups.flatMap { it.mappers }, prefix) -public data class DaemonJVMOptions( - public var maxMemory: String = "", - public var maxPermSize: String = "", - public var reservedCodeCacheSize: String = "", - public var jvmParams: MutableCollection = arrayListOf() +data class DaemonJVMOptions( + var maxMemory: String = "", + var maxPermSize: String = "", + var reservedCodeCacheSize: String = "", + var jvmParams: MutableCollection = arrayListOf() ) : OptionsGroup { override val mappers: List> @@ -202,15 +199,15 @@ public data class DaemonJVMOptions( } -public data class DaemonOptions( - public var runFilesPath: String = COMPILE_DAEMON_DEFAULT_RUN_DIR_PATH, - public var autoshutdownMemoryThreshold: Long = COMPILE_DAEMON_MEMORY_THRESHOLD_INFINITE, - public var autoshutdownIdleSeconds: Int = COMPILE_DAEMON_DEFAULT_IDLE_TIMEOUT_S, - public var autoshutdownUnusedSeconds: Int = COMPILE_DAEMON_DEFAULT_UNUSED_TIMEOUT_S, - public var shutdownDelayMilliseconds: Long = COMPILE_DAEMON_DEFAULT_SHUTDOWN_DELAY_MS, - public var forceShutdownTimeoutMilliseconds: Long = COMPILE_DAEMON_FORCE_SHUTDOWN_DEFAULT_TIMEOUT_MS, - public var verbose: Boolean = false, - public var reportPerf: Boolean = false +data class DaemonOptions( + var runFilesPath: String = COMPILE_DAEMON_DEFAULT_RUN_DIR_PATH, + var autoshutdownMemoryThreshold: Long = COMPILE_DAEMON_MEMORY_THRESHOLD_INFINITE, + var autoshutdownIdleSeconds: Int = COMPILE_DAEMON_DEFAULT_IDLE_TIMEOUT_S, + var autoshutdownUnusedSeconds: Int = COMPILE_DAEMON_DEFAULT_UNUSED_TIMEOUT_S, + var shutdownDelayMilliseconds: Long = COMPILE_DAEMON_DEFAULT_SHUTDOWN_DELAY_MS, + var forceShutdownTimeoutMilliseconds: Long = COMPILE_DAEMON_FORCE_SHUTDOWN_DEFAULT_TIMEOUT_MS, + var verbose: Boolean = false, + var reportPerf: Boolean = false ) : OptionsGroup { override val mappers: List> @@ -237,9 +234,9 @@ fun Iterable.distinctStringsDigest(): ByteArray = fun ByteArray.toHexString(): String = joinToString("", transform = { "%02x".format(it) }) -public data class CompilerId( - public var compilerClasspath: List = listOf(), - public var compilerVersion: String = "" +data class CompilerId( + var compilerClasspath: List = listOf(), + var compilerVersion: String = "" ) : OptionsGroup { override val mappers: List> @@ -248,19 +245,19 @@ public data class CompilerId( companion object { @JvmStatic - public fun makeCompilerId(vararg paths: File): CompilerId = makeCompilerId(paths.asIterable()) + fun makeCompilerId(vararg paths: File): CompilerId = makeCompilerId(paths.asIterable()) @JvmStatic - public fun makeCompilerId(paths: Iterable): CompilerId = + fun makeCompilerId(paths: Iterable): CompilerId = CompilerId(compilerClasspath = paths.map { it.absolutePath }) } } -public fun isDaemonEnabled(): Boolean = System.getProperty(COMPILE_DAEMON_ENABLED_PROPERTY) != null +fun isDaemonEnabled(): Boolean = System.getProperty(COMPILE_DAEMON_ENABLED_PROPERTY) != null -public fun configureDaemonJVMOptions(opts: DaemonJVMOptions, +fun configureDaemonJVMOptions(opts: DaemonJVMOptions, vararg additionalParams: String, inheritMemoryLimits: Boolean, inheritAdditionalProperties: Boolean @@ -286,7 +283,7 @@ public fun configureDaemonJVMOptions(opts: DaemonJVMOptions, } -public fun configureDaemonJVMOptions(vararg additionalParams: String, +fun configureDaemonJVMOptions(vararg additionalParams: String, inheritMemoryLimits: Boolean, inheritAdditionalProperties: Boolean ): DaemonJVMOptions = @@ -296,7 +293,7 @@ public fun configureDaemonJVMOptions(vararg additionalParams: String, inheritAdditionalProperties = inheritAdditionalProperties) -public fun configureDaemonOptions(opts: DaemonOptions): DaemonOptions { +fun configureDaemonOptions(opts: DaemonOptions): DaemonOptions { System.getProperty(COMPILE_DAEMON_OPTIONS_PROPERTY)?.let { val unrecognized = it.trimQuotes().split(",").filterExtractProps(opts.mappers, "") if (unrecognized.any()) @@ -310,7 +307,7 @@ public fun configureDaemonOptions(opts: DaemonOptions): DaemonOptions { } -public fun configureDaemonOptions(): DaemonOptions = configureDaemonOptions(DaemonOptions()) +fun configureDaemonOptions(): DaemonOptions = configureDaemonOptions(DaemonOptions()) private val humanizedMemorySizeRegex = "(\\d+)([kmg]?)".toRegex() diff --git a/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/FileSystemUtils.kt b/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/FileSystemUtils.kt index 8efb56485d6..3af527ff73e 100644 --- a/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/FileSystemUtils.kt +++ b/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/FileSystemUtils.kt @@ -18,7 +18,7 @@ package org.jetbrains.kotlin.rmi import java.io.File -public enum class OSKind { +enum class OSKind { Windows, OSX, Unix, @@ -54,7 +54,7 @@ private fun String?.orDefault(v: String): String = // unix (freedesktop): http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html // OS X: https://developer.apple.com/library/mac/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/AccessingFilesandDirectories/AccessingFilesandDirectories.html -public object FileSystem { +object FileSystem { val userHomePath: String get() = System.getProperty("user.home") val tempPath: String get() = System.getProperty("java.io.tmpdir") diff --git a/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/NetworkUtils.kt b/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/NetworkUtils.kt index b5e7ea388b7..d13974211ce 100644 --- a/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/NetworkUtils.kt +++ b/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/NetworkUtils.kt @@ -29,9 +29,9 @@ import java.rmi.server.RMIServerSocketFactory import java.util.* -public val SOCKET_ANY_FREE_PORT = 0 +val SOCKET_ANY_FREE_PORT = 0 -public object LoopbackNetworkInterface { +object LoopbackNetworkInterface { val IPV4_LOOPBACK_INET_ADDRESS = "127.0.0.1" val IPV6_LOOPBACK_INET_ADDRESS = "::1" @@ -39,11 +39,11 @@ public object LoopbackNetworkInterface { val SERVER_SOCKET_BACKLOG_SIZE = 10 // size of the requests queue for daemon services, so far seems that we don't need any big numbers here // but if we'll start getting "connection refused" errors, that could be the first place to try to fix it - public val serverLoopbackSocketFactory by lazy { ServerLoopbackSocketFactory() } - public val clientLoopbackSocketFactory by lazy { ClientLoopbackSocketFactory() } + val serverLoopbackSocketFactory by lazy { ServerLoopbackSocketFactory() } + val clientLoopbackSocketFactory by lazy { ClientLoopbackSocketFactory() } // TODO switch to InetAddress.getLoopbackAddress on java 7+ - public val loopbackInetAddressName by lazy { + val loopbackInetAddressName by lazy { try { if (java.net.InetAddress.getLocalHost() is java.net.Inet6Address) IPV6_LOOPBACK_INET_ADDRESS else IPV4_LOOPBACK_INET_ADDRESS } @@ -59,6 +59,7 @@ public object LoopbackNetworkInterface { class ServerLoopbackSocketFactory : RMIServerSocketFactory, Serializable { override fun equals(other: Any?): Boolean = other === this || super.equals(other) + override fun hashCode(): Int = super.hashCode() @Throws(IOException::class) override fun createServerSocket(port: Int): ServerSocket = ServerSocket(port, SERVER_SOCKET_BACKLOG_SIZE, InetAddress.getByName(loopbackInetAddressName)) @@ -67,6 +68,7 @@ public object LoopbackNetworkInterface { class ClientLoopbackSocketFactory : RMIClientSocketFactory, Serializable { override fun equals(other: Any?): Boolean = other === this || super.equals(other) + override fun hashCode(): Int = super.hashCode() @Throws(IOException::class) override fun createSocket(host: String, port: Int): Socket = Socket(InetAddress.getByName(loopbackInetAddressName), port) @@ -76,7 +78,7 @@ public object LoopbackNetworkInterface { private val portSelectionRng = Random() -public fun findPortAndCreateRegistry(attempts: Int, portRangeStart: Int, portRangeEnd: Int) : Pair { +fun findPortAndCreateRegistry(attempts: Int, portRangeStart: Int, portRangeEnd: Int) : Pair { var i = 0 var lastException: RemoteException? = null diff --git a/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/RemoteOperationsTracer.kt b/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/RemoteOperationsTracer.kt index 1494cc88b2b..3d21da9c4d9 100644 --- a/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/RemoteOperationsTracer.kt +++ b/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/RemoteOperationsTracer.kt @@ -19,11 +19,11 @@ package org.jetbrains.kotlin.rmi import java.rmi.Remote import java.rmi.RemoteException -public interface RemoteOperationsTracer : Remote { +interface RemoteOperationsTracer : Remote { @Throws(RemoteException::class) - public fun before(id: String) + fun before(id: String) @Throws(RemoteException::class) - public fun after(id: String) + fun after(id: String) } diff --git a/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/RemoteOutputStream.kt b/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/RemoteOutputStream.kt index 848bb7591a9..127f8560271 100644 --- a/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/RemoteOutputStream.kt +++ b/compiler/rmi/rmi-interface/src/org/jetbrains/kotlin/rmi/RemoteOutputStream.kt @@ -19,14 +19,14 @@ package org.jetbrains.kotlin.rmi import java.rmi.Remote import java.rmi.RemoteException -public interface RemoteOutputStream : Remote { +interface RemoteOutputStream : Remote { @Throws(RemoteException::class) - public fun close() + fun close() @Throws(RemoteException::class) - public fun write(data: ByteArray, offset: Int, length: Int) + fun write(data: ByteArray, offset: Int, length: Int) @Throws(RemoteException::class) - public fun write(dataByte: Int) + fun write(dataByte: Int) } diff --git a/compiler/rmi/rmi-server/rmi-server.iml b/compiler/rmi/rmi-server/rmi-server.iml index 1083739c346..8eda3cd81de 100644 --- a/compiler/rmi/rmi-server/rmi-server.iml +++ b/compiler/rmi/rmi-server/rmi-server.iml @@ -8,9 +8,10 @@ - - + + + \ No newline at end of file diff --git a/compiler/rmi/rmi-server/src/org/jetbrains/kotlin/rmi/service/CompileDaemon.kt b/compiler/rmi/rmi-server/src/org/jetbrains/kotlin/rmi/service/CompileDaemon.kt index 3108995bfdd..5f1e149d528 100644 --- a/compiler/rmi/rmi-server/src/org/jetbrains/kotlin/rmi/service/CompileDaemon.kt +++ b/compiler/rmi/rmi-server/src/org/jetbrains/kotlin/rmi/service/CompileDaemon.kt @@ -55,7 +55,7 @@ class LogStream(name: String) : OutputStream() { } -public object CompileDaemon { +object CompileDaemon { init { val logTime: String = SimpleDateFormat("yyyy-MM-dd.HH-mm-ss-SSS").format(Date()) @@ -90,7 +90,7 @@ public object CompileDaemon { } @JvmStatic - public fun main(args: Array) { + fun main(args: Array) { log.info("Kotlin compiler daemon version " + (loadVersionFromResource() ?: "")) log.info("daemon JVM args: " + ManagementFactory.getRuntimeMXBean().inputArguments.joinToString(" ")) @@ -165,7 +165,7 @@ public object CompileDaemon { System.setOut(PrintStream(LogStream("stdout"))) } catch (e: Exception) { - System.err.println("Exception: " + e.getMessage()) + System.err.println("Exception: " + e.message) e.printStackTrace(System.err) // repeating it to log for the cases when stderr is not redirected yet log.log(Level.INFO, "Exception: ", e) diff --git a/compiler/rmi/rmi-server/src/org/jetbrains/kotlin/rmi/service/CompileServiceImpl.kt b/compiler/rmi/rmi-server/src/org/jetbrains/kotlin/rmi/service/CompileServiceImpl.kt index a048e369592..c67b1509785 100644 --- a/compiler/rmi/rmi-server/src/org/jetbrains/kotlin/rmi/service/CompileServiceImpl.kt +++ b/compiler/rmi/rmi-server/src/org/jetbrains/kotlin/rmi/service/CompileServiceImpl.kt @@ -104,7 +104,7 @@ class CompileServiceImpl( } @Volatile private var _lastUsedSeconds = nowSeconds() - public val lastUsedSeconds: Long get() = if (rwlock.isWriteLocked || rwlock.readLockCount - rwlock.readHoldCount > 0) nowSeconds() else _lastUsedSeconds + val lastUsedSeconds: Long get() = if (rwlock.isWriteLocked || rwlock.readLockCount - rwlock.readHoldCount > 0) nowSeconds() else _lastUsedSeconds private val log by lazy { Logger.getLogger("compiler") } diff --git a/compiler/rmi/rmi-server/src/org/jetbrains/kotlin/rmi/service/LazyClasspathWatcher.kt b/compiler/rmi/rmi-server/src/org/jetbrains/kotlin/rmi/service/LazyClasspathWatcher.kt index 2adad29e6ab..1c3e0be74e1 100644 --- a/compiler/rmi/rmi-server/src/org/jetbrains/kotlin/rmi/service/LazyClasspathWatcher.kt +++ b/compiler/rmi/rmi-server/src/org/jetbrains/kotlin/rmi/service/LazyClasspathWatcher.kt @@ -40,9 +40,9 @@ val DEFAULT_CLASSPATH_DIGEST_WATCH_PERIOD_MS = 300000L // 5 min * poor-man watcher in the absence of NIO * TODO: replace with NIO watching when switching to java 7+ */ -public class LazyClasspathWatcher(classpath: Iterable, - val chackPeriod: Long = DEFAULT_CLASSPATH_WATCH_PERIOD_MS, - val digestCheckPeriod: Long = DEFAULT_CLASSPATH_DIGEST_WATCH_PERIOD_MS) { +class LazyClasspathWatcher(classpath: Iterable, + val checkPeriod: Long = DEFAULT_CLASSPATH_WATCH_PERIOD_MS, + val digestCheckPeriod: Long = DEFAULT_CLASSPATH_DIGEST_WATCH_PERIOD_MS) { private data class FileId(val file: File, val lastModified: Long, val digest: ByteArray) @@ -78,10 +78,10 @@ public class LazyClasspathWatcher(classpath: Iterable, } } - public val isChanged: Boolean get() { + val isChanged: Boolean get() { if (lastChangedStatus.get()) return true val nowMs = TimeUnit.MILLISECONDS.toMillis(System.nanoTime()) - if (nowMs - lastUpdate.get() < chackPeriod) return false + if (nowMs - lastUpdate.get() < checkPeriod) return false val checkDigest = nowMs - lastDigestUpdate.get() > digestCheckPeriod // making sure that fieldIds are initialized diff --git a/compiler/rmi/rmi-server/src/org/jetbrains/kotlin/rmi/service/RemoteIncrementalCacheClient.kt b/compiler/rmi/rmi-server/src/org/jetbrains/kotlin/rmi/service/RemoteIncrementalCacheClient.kt index bd2e749c76f..d23cb2d11ad 100644 --- a/compiler/rmi/rmi-server/src/org/jetbrains/kotlin/rmi/service/RemoteIncrementalCacheClient.kt +++ b/compiler/rmi/rmi-server/src/org/jetbrains/kotlin/rmi/service/RemoteIncrementalCacheClient.kt @@ -23,7 +23,7 @@ import org.jetbrains.kotlin.rmi.CompilerCallbackServicesFacade import org.jetbrains.kotlin.rmi.DummyProfiler import org.jetbrains.kotlin.rmi.Profiler -public class RemoteIncrementalCacheClient(val facade: CompilerCallbackServicesFacade, val target: TargetId, val profiler: Profiler = DummyProfiler()): IncrementalCache { +class RemoteIncrementalCacheClient(val facade: CompilerCallbackServicesFacade, val target: TargetId, val profiler: Profiler = DummyProfiler()): IncrementalCache { override fun getObsoletePackageParts(): Collection = profiler.withMeasure(this) { facade.incrementalCache_getObsoletePackageParts(target) } diff --git a/compiler/rmi/rmi-server/src/org/jetbrains/kotlin/rmi/service/RemoteOutputStreamClient.kt b/compiler/rmi/rmi-server/src/org/jetbrains/kotlin/rmi/service/RemoteOutputStreamClient.kt index cc2faae41d0..061be42c16a 100644 --- a/compiler/rmi/rmi-server/src/org/jetbrains/kotlin/rmi/service/RemoteOutputStreamClient.kt +++ b/compiler/rmi/rmi-server/src/org/jetbrains/kotlin/rmi/service/RemoteOutputStreamClient.kt @@ -23,7 +23,7 @@ import java.io.OutputStream class RemoteOutputStreamClient(val remote: RemoteOutputStream, val profiler: Profiler = DummyProfiler()): OutputStream() { override fun write(data: ByteArray) { - profiler.withMeasure(this) { remote.write(data, 0, data.size()) } + profiler.withMeasure(this) { remote.write(data, 0, data.size) } } override fun write(data: ByteArray, offset: Int, length: Int) {