AllOpen, NoArg: Refactoring, support presets in order to hold special annotations for Spring and JPA in one place

This commit is contained in:
Yan Zhulanow
2017-01-31 19:03:40 +03:00
parent f4690ebff9
commit feb5397f6f
9 changed files with 58 additions and 49 deletions
@@ -28,6 +28,7 @@ import org.jetbrains.kotlin.container.ComponentProvider
import org.jetbrains.kotlin.container.get
import org.jetbrains.kotlin.extensions.StorageComponentContainerContributor
import org.jetbrains.kotlin.load.java.sam.SamWithReceiverResolver
import org.jetbrains.kotlin.samWithReceiver.SamWithReceiverConfigurationKeys.ANNOTATION
object SamWithReceiverConfigurationKeys {
val ANNOTATION: CompilerConfigurationKey<List<String>> =
@@ -46,11 +47,7 @@ class SamWithReceiverCommandLineProcessor : CommandLineProcessor {
override val pluginOptions = listOf(ANNOTATION_OPTION)
override fun processOption(option: CliOption, value: String, configuration: CompilerConfiguration) = when (option) {
ANNOTATION_OPTION -> {
val paths = configuration.getList(SamWithReceiverConfigurationKeys.ANNOTATION).toMutableList()
paths.add(value)
configuration.put(SamWithReceiverConfigurationKeys.ANNOTATION, paths)
}
ANNOTATION_OPTION -> configuration.appendList(ANNOTATION, value)
else -> throw CliOptionProcessingException("Unknown option: ${option.name}")
}
}