Specify root type in non-existent location warning
This commit is contained in:
@@ -353,22 +353,25 @@ class KotlinCoreEnvironment private constructor(
|
|||||||
}.orEmpty()
|
}.orEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun contentRootToVirtualFile(root: JvmContentRoot): VirtualFile? {
|
private fun contentRootToVirtualFile(root: JvmContentRoot): VirtualFile? =
|
||||||
return when (root) {
|
when (root) {
|
||||||
is JvmClasspathRoot -> if (root.file.isFile) findJarRoot(root.file) else findLocalFile(root)
|
is JvmClasspathRoot ->
|
||||||
is JvmModulePathRoot -> if (root.file.isFile) findJarRoot(root.file) else findLocalFile(root)
|
if (root.file.isFile) findJarRoot(root.file) else findExistingRoot(root, "Classpath entry")
|
||||||
is JavaSourceRoot -> findLocalFile(root)
|
is JvmModulePathRoot ->
|
||||||
else -> throw IllegalStateException("Unexpected root: $root")
|
if (root.file.isFile) findJarRoot(root.file) else findExistingRoot(root, "Java module root")
|
||||||
|
is JavaSourceRoot ->
|
||||||
|
findExistingRoot(root, "Java source root")
|
||||||
|
else ->
|
||||||
|
throw IllegalStateException("Unexpected root: $root")
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
internal fun findLocalFile(path: String): VirtualFile? =
|
internal fun findLocalFile(path: String): VirtualFile? =
|
||||||
applicationEnvironment.localFileSystem.findFileByPath(path)
|
applicationEnvironment.localFileSystem.findFileByPath(path)
|
||||||
|
|
||||||
private fun findLocalFile(root: JvmContentRoot): VirtualFile? {
|
private fun findExistingRoot(root: JvmContentRoot, rootDescription: String): VirtualFile? {
|
||||||
return findLocalFile(root.file.absolutePath).also {
|
return findLocalFile(root.file.absolutePath).also {
|
||||||
if (it == null) {
|
if (it == null) {
|
||||||
report(STRONG_WARNING, "Classpath entry points to a non-existent location: ${root.file}")
|
report(STRONG_WARNING, "$rootDescription points to a non-existent location: ${root.file}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user