mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
accept @Nullable scope EA-58099 - NPE: RefManagerImpl.findAllDeclarations
This commit is contained in:
+2
-2
@@ -194,7 +194,7 @@ public class GlobalJavaInspectionContextImpl extends GlobalJavaInspectionContext
|
||||
final SearchScope searchScope = new GlobalSearchScope(refManager.getProject()) {
|
||||
@Override
|
||||
public boolean contains(@NotNull VirtualFile file) {
|
||||
return !scope.contains(file) || file.getFileType() != StdFileTypes.JAVA;
|
||||
return scope != null && !scope.contains(file) || file.getFileType() != StdFileTypes.JAVA;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -394,7 +394,7 @@ public class GlobalJavaInspectionContextImpl extends GlobalJavaInspectionContext
|
||||
@Override
|
||||
public boolean execute(PsiReference reference) {
|
||||
AnalysisScope scope = context.getRefManager().getScope();
|
||||
if (scope.contains(reference.getElement()) && reference.getElement().getLanguage() == StdLanguages.JAVA ||
|
||||
if (scope != null && scope.contains(reference.getElement()) && reference.getElement().getLanguage() == StdLanguages.JAVA ||
|
||||
PsiTreeUtil.getParentOfType(reference.getElement(), PsiDocComment.class) != null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -132,7 +132,7 @@ public class UnusedParametersInspection extends GlobalJavaBatchInspectionTool {
|
||||
int idx = refParameter.getIndex();
|
||||
final boolean[] found = {false};
|
||||
for (int i = 0; i < derived.length && !found[0]; i++) {
|
||||
if (!scope.contains(derived[i])) {
|
||||
if (scope == null || !scope.contains(derived[i])) {
|
||||
final PsiParameter[] parameters = derived[i].getParameterList().getParameters();
|
||||
if (parameters.length >= idx) continue;
|
||||
PsiParameter psiParameter = parameters[idx];
|
||||
|
||||
@@ -47,6 +47,7 @@ public abstract class RefManager {
|
||||
*
|
||||
* @return the analysis scope.
|
||||
*/
|
||||
@Nullable
|
||||
public abstract AnalysisScope getScope();
|
||||
|
||||
/**
|
||||
|
||||
+4
-1
@@ -149,6 +149,7 @@ public class RefManagerImpl extends RefManager {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public AnalysisScope getScope() {
|
||||
return myScope;
|
||||
@@ -304,7 +305,9 @@ public class RefManagerImpl extends RefManager {
|
||||
if (!myDeclarationsFound) {
|
||||
long before = System.currentTimeMillis();
|
||||
final AnalysisScope scope = getScope();
|
||||
scope.accept(myProjectIterator);
|
||||
if (scope != null) {
|
||||
scope.accept(myProjectIterator);
|
||||
}
|
||||
myDeclarationsFound = true;
|
||||
|
||||
LOG.info("Total duration of processing project usages:" + (System.currentTimeMillis() - before));
|
||||
|
||||
Reference in New Issue
Block a user