Fix unnecessary findType calls and NPEs in Boot LS

This commit is contained in:
BoykoAlex
2019-09-12 19:13:54 -04:00
parent f349518d7c
commit d8bda3812f
2 changed files with 8 additions and 5 deletions

View File

@@ -122,14 +122,15 @@ public class JdtLsIndex implements ClasspathIndex {
sourceTypeCache.put(fqName, type);
} else {
type = Optional.of(toType(data));
if (Classpath.isBinary(data.getClasspathEntry().getCpe())) {
if (data.getClasspathEntry() != null && Classpath.isBinary(data.getClasspathEntry().getCpe())) {
binaryTypeCache.put(fqName, type);
} else {
sourceTypeCache.put(fqName, type);
}
}
} catch (Exception e) {
log.error("{}", e);
log.error("Find type failed for `{}` with {}", fqName, e);
return null;
}
}
return type.orElse(null);