File tree Expand file tree Collapse file tree 1 file changed +14
-11
lines changed
server/src/main/kotlin/org/javacs/kt Expand file tree Collapse file tree 1 file changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -20,24 +20,27 @@ class SymbolIndex {
20
20
val started = System .currentTimeMillis()
21
21
LOG .info(" Updating symbol index..." )
22
22
23
- try {
24
- val foundDescriptors = allDescriptors(module)
25
- lock.withLock {
26
- globalDescriptors + = foundDescriptors
27
- }
28
-
29
- val finished = System .currentTimeMillis()
30
- LOG .info(" Updated symbol index in ${finished - started} ms! (${globalDescriptors.size} symbol(s))" )
31
- } catch (e: Exception ) {
32
- LOG .warn(" Could not update symbol index: $e " )
23
+ val foundDescriptors = allDescriptors(module)
24
+ lock.withLock {
25
+ globalDescriptors + = foundDescriptors
33
26
}
27
+
28
+ val finished = System .currentTimeMillis()
29
+ LOG .info(" Updated symbol index in ${finished - started} ms! (${globalDescriptors.size} symbol(s))" )
34
30
}
35
31
36
32
fun <T > withGlobalDescriptors (action : (Set <DeclarationDescriptor >) -> T ): T = lock.withLock { action(globalDescriptors) }
37
33
38
34
private fun allDescriptors (module : ModuleDescriptor ): Collection <DeclarationDescriptor > = allPackages(module)
39
35
.map(module::getPackage)
40
- .flatMap { it.memberScope.getContributedDescriptors(DescriptorKindFilter .ALL , MemberScope .ALL_NAME_FILTER ) }
36
+ .flatMap {
37
+ try {
38
+ it.memberScope.getContributedDescriptors(DescriptorKindFilter .ALL , MemberScope .ALL_NAME_FILTER )
39
+ } catch (e: IllegalStateException ) {
40
+ LOG .warn(" Could not query descriptors in package $it " )
41
+ emptyList()
42
+ }
43
+ }
41
44
42
45
private fun allPackages (module : ModuleDescriptor , pkgName : FqName = FqName .ROOT ): Collection <FqName > = module
43
46
.getSubPackagesOf(pkgName) { it.toString() != " META-INF" }
You can’t perform that action at this time.
0 commit comments