Fix minor compile warnings
This commit is contained in:
+1
-1
@@ -59,7 +59,7 @@ class LanguageSettingsParser : AbstractInternalArgumentParser<ManualLanguageFeat
|
||||
return null
|
||||
}
|
||||
|
||||
val colon = tail.getOrNull(0) ?: return reportAndReturnNull("Incorrect internal argument syntax, missing colon: $wholeArgument")
|
||||
tail.getOrNull(0) ?: return reportAndReturnNull("Incorrect internal argument syntax, missing colon: $wholeArgument")
|
||||
|
||||
val modificator = tail.getOrNull(1)
|
||||
val languageFeatureState = when (modificator) {
|
||||
|
||||
+6
-5
@@ -86,11 +86,12 @@ open class AggregatedReplStageState<T1, T2>(val state1: IReplStageState<T1>, val
|
||||
override val history: IReplStageHistory<Pair<T1, T2>> = AggregatedReplStateHistory(state1.history, state2.history, lock)
|
||||
|
||||
override fun <StateT : IReplStageState<*>> asState(target: Class<out StateT>): StateT =
|
||||
when {
|
||||
target.isAssignableFrom(state1::class.java) -> state1 as StateT
|
||||
target.isAssignableFrom(state2::class.java) -> state2 as StateT
|
||||
else -> super.asState(target)
|
||||
}
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
when {
|
||||
target.isAssignableFrom(state1::class.java) -> state1 as StateT
|
||||
target.isAssignableFrom(state2::class.java) -> state2 as StateT
|
||||
else -> super.asState(target)
|
||||
}
|
||||
|
||||
override fun getNextLineNo() = state1.getNextLineNo()
|
||||
|
||||
|
||||
@@ -57,9 +57,10 @@ interface IReplStageState<T> {
|
||||
|
||||
fun getNextLineNo(): Int = history.peek()?.id?.no?.let { it + 1 } ?: REPL_CODE_LINE_FIRST_NO // TODO: it should be more robust downstream (e.g. use atomic)
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
fun <StateT : IReplStageState<*>> asState(target: Class<out StateT>): StateT =
|
||||
if (target.isAssignableFrom(this::class.java)) this as StateT
|
||||
else throw IllegalArgumentException("$this is not an expected instance of IReplStageState")
|
||||
if (target.isAssignableFrom(this::class.java)) this as StateT
|
||||
else throw IllegalArgumentException("$this is not an expected instance of IReplStageState")
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ abstract class CLICompiler<A : CommonCompilerArguments> : CLITool<A>() {
|
||||
return exec(errStream, Services.EMPTY, MessageRenderer.PLAIN_FULL_PATHS, args)
|
||||
}
|
||||
|
||||
public override fun execImpl(baseMessageCollector: MessageCollector, services: Services, arguments: A): ExitCode {
|
||||
public override fun execImpl(messageCollector: MessageCollector, services: Services, arguments: A): ExitCode {
|
||||
val performanceManager = performanceManager
|
||||
if (arguments.reportPerf || arguments.dumpPerf != null) {
|
||||
performanceManager.enableCollectingPerformanceStatistics()
|
||||
@@ -61,7 +61,7 @@ abstract class CLICompiler<A : CommonCompilerArguments> : CLITool<A>() {
|
||||
|
||||
val configuration = CompilerConfiguration()
|
||||
|
||||
val messageCollector = GroupingMessageCollector(baseMessageCollector, arguments.allWarningsAsErrors).also {
|
||||
val collector = GroupingMessageCollector(messageCollector, arguments.allWarningsAsErrors).also {
|
||||
configuration.put(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, it)
|
||||
}
|
||||
|
||||
@@ -69,8 +69,8 @@ abstract class CLICompiler<A : CommonCompilerArguments> : CLITool<A>() {
|
||||
try {
|
||||
setupCommonArguments(configuration, arguments)
|
||||
setupPlatformSpecificArgumentsAndServices(configuration, arguments, services)
|
||||
val paths = computeKotlinPaths(messageCollector, arguments)
|
||||
if (messageCollector.hasErrors()) {
|
||||
val paths = computeKotlinPaths(collector, arguments)
|
||||
if (collector.hasErrors()) {
|
||||
return ExitCode.COMPILATION_ERROR
|
||||
}
|
||||
|
||||
@@ -93,14 +93,14 @@ abstract class CLICompiler<A : CommonCompilerArguments> : CLITool<A>() {
|
||||
performanceManager.dumpPerformanceReport(File(arguments.dumpPerf!!))
|
||||
}
|
||||
|
||||
return if (messageCollector.hasErrors()) COMPILATION_ERROR else code
|
||||
return if (collector.hasErrors()) COMPILATION_ERROR else code
|
||||
} catch (e: CompilationCanceledException) {
|
||||
messageCollector.report(INFO, "Compilation was canceled", null)
|
||||
collector.report(INFO, "Compilation was canceled", null)
|
||||
return ExitCode.OK
|
||||
} catch (e: RuntimeException) {
|
||||
val cause = e.cause
|
||||
if (cause is CompilationCanceledException) {
|
||||
messageCollector.report(INFO, "Compilation was canceled", null)
|
||||
collector.report(INFO, "Compilation was canceled", null)
|
||||
return ExitCode.OK
|
||||
} else {
|
||||
throw e
|
||||
@@ -111,10 +111,10 @@ abstract class CLICompiler<A : CommonCompilerArguments> : CLITool<A>() {
|
||||
} catch (e: AnalysisResult.CompilationErrorException) {
|
||||
return COMPILATION_ERROR
|
||||
} catch (t: Throwable) {
|
||||
MessageCollectorUtil.reportException(messageCollector, t)
|
||||
MessageCollectorUtil.reportException(collector, t)
|
||||
return INTERNAL_ERROR
|
||||
} finally {
|
||||
messageCollector.flush()
|
||||
collector.flush()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user