in runner/src/main/kotlin/org/jetbrains/idea/inspections/runners/IdeaRunner.kt [128:165]
override fun run(parameters: IdeaRunnerParameters<T>): Boolean {
logger.info("Class loader: " + this.javaClass.classLoader)
try {
with(parameters) {
application = loadApplication(ideaVersion, ideaHomeDirectory, ideaSystemDirectory, plugins)
// Note: in 2018.2, application?.setSaveAllowed = false would be better.
// However there is no such method in 2017.x. Yet we still want to support these versions,
// and do not want to invent branches for IdeaRunner, so we have to keep doNotSave()
application?.doNotSave()
application?.configureJdk()
val project = openProject(projectDir, projectName, moduleName)
val codeStyleFile = File(ideaHomeDirectory, "config/codestyles/Default.xml")
if (!codeStyleFile.exists()) {
codeStyleFile.parentFile.mkdirs()
val writer = codeStyleFile.bufferedWriter()
writer.write(
"""
<code_scheme name="Default" version="173">
<JetCodeStyleSettings>
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="kotlin">
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</codeStyleSettings>
</code_scheme>
""".trimIndent()
)
writer.close()
}
return analyze(project, parameters.childParameters)
}
} catch (e: Throwable) {
if (e is RunnerException) throw e
throw RunnerException("Exception caught in inspection plugin: $e", e)
}
}