Extract building JSR-305 settings to separate function

This commit is contained in:
Victor Petukhov
2021-06-02 17:19:05 +03:00
parent f92ab691f8
commit 61c2f1b203
3 changed files with 15 additions and 10 deletions
@@ -46,8 +46,9 @@ open class JvmForeignAnnotationsConfigurator(testServices: TestServices) : Envir
get() = listOf(ForeignAnnotationsDirectives)
override fun provideAdditionalAnalysisFlags(directives: RegisteredDirectives): Map<AnalysisFlag<*>, Any?> {
val globalState = directives.singleOrZeroValue(JSR305_GLOBAL_REPORT) ?: ReportLevel.WARN
val migrationState = directives.singleOrZeroValue(JSR305_MIGRATION_REPORT)
val defaultJsr305Settings = Jsr305Settings.DEFAULT
val globalState = directives.singleOrZeroValue(JSR305_GLOBAL_REPORT) ?: defaultJsr305Settings.globalLevel
val migrationState = directives.singleOrZeroValue(JSR305_MIGRATION_REPORT) ?: defaultJsr305Settings.migrationLevel
val userAnnotationsState = directives[JSR305_SPECIAL_REPORT].mapNotNull {
val (name, stateDescription) = it.split(":").takeIf { it.size == 2 } ?: return@mapNotNull null
val state = ReportLevel.findByDescription(stateDescription) ?: return@mapNotNull null