Minor, make Services#get return type nullable
This commit is contained in:
@@ -222,7 +222,6 @@ class K2JVMCompiler : CLICompiler<K2JVMCompilerArguments>() {
|
||||
) {
|
||||
if (IncrementalCompilation.isEnabled()) {
|
||||
val components = services.get(IncrementalCompilationComponents::class.java)
|
||||
@Suppress("SENSELESS_COMPARISON")
|
||||
if (components != null) {
|
||||
configuration.put(JVMConfigurationKeys.INCREMENTAL_COMPILATION_COMPONENTS, components)
|
||||
}
|
||||
|
||||
@@ -16,20 +16,20 @@
|
||||
|
||||
package org.jetbrains.kotlin.config
|
||||
|
||||
import java.util.HashMap
|
||||
import java.util.*
|
||||
|
||||
class Services private constructor(private val map: Map<Class<*>, Any>) {
|
||||
companion object {
|
||||
@JvmField val EMPTY: Services = Builder().build()
|
||||
@JvmField
|
||||
val EMPTY: Services = Builder().build()
|
||||
}
|
||||
|
||||
fun <T> get(interfaceClass: Class<T>): T {
|
||||
fun <T> get(interfaceClass: Class<T>): T? {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return map.get(interfaceClass) as T
|
||||
return map[interfaceClass] as T?
|
||||
}
|
||||
|
||||
class Builder {
|
||||
|
||||
private val map = HashMap<Class<*>, Any>()
|
||||
|
||||
fun <T : Any> register(interfaceClass: Class<T>, implementation: T): Builder {
|
||||
|
||||
Reference in New Issue
Block a user