Skip to content

Commit 582f605

Browse files
authored
Merge pull request #505 from fwcd/fix-source-jar-paths
Fix cached source jar paths
2 parents ca09671 + d8f1e57 commit 582f605

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

server/src/main/kotlin/org/javacs/kt/externalsources/ClassContentProvider.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ class ClassContentProvider(
3535
* If the file is inside a source archive, the source code is returned as is.
3636
*/
3737
fun contentOf(uri: KlsURI): Pair<KlsURI, String> {
38+
LOG.info("Resolving {} for contents", uri)
3839
val resolvedUri = sourceArchiveProvider.fetchSourceArchive(uri.archivePath)?.let(uri.withSource(true)::withArchivePath) ?: uri
3940
val key = resolvedUri.toString()
4041
val (contents, extension) = cachedContents[key] ?: run {
41-
LOG.info("Finding contents of {}", describeURI(resolvedUri.fileUri))
42+
LOG.info("Reading contents of {}", describeURI(resolvedUri.fileUri))
4243
tryReadContentOf(resolvedUri)
4344
?: tryReadContentOf(resolvedUri.withFileExtension("class"))
4445
?: tryReadContentOf(resolvedUri.withFileExtension("java"))

shared/src/main/kotlin/org/javacs/kt/classpath/CachedClassPathResolver.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ internal class CachedClassPathResolver(
6060
ClassPathCacheEntryEntity.all().map {
6161
ClassPathEntry(
6262
compiledJar = Paths.get(it.compiledJar),
63-
sourceJar = if (it.sourceJar != null) Paths.get(it.sourceJar) else null
63+
sourceJar = it.sourceJar?.let(Paths::get)
6464
)
6565
}.toSet()
6666
}
@@ -69,7 +69,7 @@ internal class CachedClassPathResolver(
6969
newEntries.map {
7070
ClassPathCacheEntryEntity.new {
7171
compiledJar = it.compiledJar.toString()
72-
sourceJar = it.sourceJar.toString()
72+
sourceJar = it.sourceJar?.toString()
7373
}
7474
}
7575
}

shared/src/main/kotlin/org/javacs/kt/database/DatabaseService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class DatabaseMetadataEntity(id: EntityID<Int>) : IntEntity(id) {
2626
class DatabaseService {
2727

2828
companion object {
29-
const val LATEST_VERSION = 1
29+
const val LATEST_VERSION = 2
3030
const val DB_FILENAME = "kls_database.db"
3131
}
3232

0 commit comments

Comments
 (0)