Fix unnecessary findType calls and NPEs in Boot LS
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -600,9 +600,11 @@ public class TypeUtil {
|
||||
|
||||
public boolean isEnum(Type type) {
|
||||
try {
|
||||
IType eclipseType = findType(type.getErasure());
|
||||
if (eclipseType!=null) {
|
||||
return eclipseType.isEnum();
|
||||
if (!isArray(type)) {
|
||||
IType eclipseType = findType(type.getErasure());
|
||||
if (eclipseType!=null) {
|
||||
return eclipseType.isEnum();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("", e);
|
||||
|
||||
Reference in New Issue
Block a user