Skip to content

Commit 87c311e

Browse files
committed
Add doc comments to CompilerClassPath
1 parent b99b7c6 commit 87c311e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

server/src/main/kotlin/org/javacs/kt/CompilerClassPath.kt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import java.nio.file.FileSystems
77
import java.nio.file.Path
88
import java.util.stream.Collectors
99

10+
/**
11+
* Manages the class path (compiled JARs, etc), the Java source path
12+
* and the compiler. Note that Kotlin sources are stored in SourcePath.
13+
*/
1014
class CompilerClassPath(private val config: CompilerConfiguration) : Closeable {
1115
private val workspaceRoots = mutableSetOf<Path>()
1216
private val javaSourcePath = mutableSetOf<Path>()
@@ -19,6 +23,7 @@ class CompilerClassPath(private val config: CompilerConfiguration) : Closeable {
1923
compiler.updateConfiguration(config)
2024
}
2125

26+
/** Updates and possibly reinstantiates the compiler using new paths. */
2227
private fun refresh(
2328
updateClassPath: Boolean = true,
2429
updateBuildScriptClassPath: Boolean = true,
@@ -31,7 +36,7 @@ class CompilerClassPath(private val config: CompilerConfiguration) : Closeable {
3136
if (updateClassPath) {
3237
val newClassPath = resolver.classpathOrEmpty
3338
if (newClassPath != classPath) {
34-
syncPath(classPath, newClassPath, "class path")
39+
syncPaths(classPath, newClassPath, "class path")
3540
refreshCompiler = true
3641
}
3742
}
@@ -40,7 +45,7 @@ class CompilerClassPath(private val config: CompilerConfiguration) : Closeable {
4045
LOG.info("Update build script path")
4146
val newBuildScriptClassPath = resolver.buildScriptClasspathOrEmpty
4247
if (newBuildScriptClassPath != buildScriptClassPath) {
43-
syncPath(buildScriptClassPath, newBuildScriptClassPath, "class path")
48+
syncPaths(buildScriptClassPath, newBuildScriptClassPath, "class path")
4449
refreshCompiler = true
4550
}
4651
}
@@ -55,7 +60,8 @@ class CompilerClassPath(private val config: CompilerConfiguration) : Closeable {
5560
return refreshCompiler
5661
}
5762

58-
private fun syncPath(dest: MutableSet<Path>, new: Set<Path>, name: String) {
63+
/** Synchronizes the given two path sets and logs the differences. */
64+
private fun syncPaths(dest: MutableSet<Path>, new: Set<Path>, name: String) {
5965
val added = new - dest
6066
val removed = dest - new
6167

0 commit comments

Comments
 (0)