Skip to content

Commit

Permalink
Handling scenario when list of classpaths is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Strum355 committed Nov 6, 2020
1 parent 7ff2d25 commit cd00ab7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/kotlin/lsifjava/UtilTypes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ inline class Classpath(private val classpaths: Set<String>) {
override fun toString() = classpaths.joinToString(":")
}

fun List<Classpath>.merge() = this.reduce { acc, classpath -> acc + classpath }
fun List<Classpath>.merge() = when(this.isEmpty()) {
false -> this.reduce { acc, classpath -> acc + classpath }
else -> {
println("no classpaths were inferred, symbol resolution for external dependencies may fail.")
Classpath(setOf())
}
}

fun execAndReadStdoutAndStderr(shellCommand: String, directory: Path): Pair<String, String> {
val process = Runtime.getRuntime().exec(shellCommand, null, directory.toFile())
Expand Down

0 comments on commit cd00ab7

Please sign in to comment.