java null argument index: add heuristic to don't process leaves that must not be valid arguments

GitOrigin-RevId: 6e8c3eb1c86cba8a3e4d60b5f983a4e6d77bcec2
This commit is contained in:
Dmitry Batkovich
2019-06-03 19:36:35 +03:00
committed by intellij-monorepo-bot
parent ce39522a4d
commit d730fa522b
2 changed files with 27 additions and 4 deletions

View File

@@ -79,6 +79,26 @@ public class JavaNullMethodArgumentIndex extends ScalarIndexExtension<JavaNullMe
};
}
private static boolean containsStopSymbol(int startIndex, @NotNull CharSequence text, boolean leftDirection) {
int i = startIndex;
while (true) {
if (leftDirection) i--; else i++;
if (leftDirection) {
if (i < 0) return false;
} else {
if (i >= text.length()) return false;
}
char c = text.charAt(i);
if (Lazy.STOP_SYMBOLS.contains(c)) return true;
if (!Lazy.WHITE_SPACE_OR_EOL_SYMBOLS.contains(c) && !Character.isWhitespace(c)) {
return false;
}
}
}
@NotNull
private static Set<LighterASTNode> findCallsWithNulls(@NotNull LighterAST lighterAst,
@NotNull CharSequence text) {