Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,9 @@ public class MissingCommonModuleMethodDiagnostic extends AbstractDiagnostic {
public static final String PRIVATE_METHOD_MESSAGE = "privateMethod";
private final LocationRepository locationRepository;

private static String getMethodNameByLocation(ParserRuleContext node, Range range) {
private static Optional<String> getMethodNameByLocation(ParserRuleContext node, Range range) {
return Trees.findTerminalNodeContainsPosition(node, range.getStart())
.map(ParseTree::getText)
.orElseThrow();
.map(ParseTree::getText);
}

@Override
Expand Down Expand Up @@ -88,9 +87,9 @@ private Optional<CallData> getReferenceToMethodCall(SymbolOccurrence symbolOccur
if (methodSymbol.isEmpty()) {
final var location = symbolOccurrence.location();
// Нельзя использовать symbol.getSymbolName(), т.к. имя в нижнем регистре
return Optional.of(
new CallData(mdObject.get().getName(),
getMethodNameByLocation(documentContext.getAst(), location.getRange()),
return getMethodNameByLocation(documentContext.getAst(), location.getRange())
.map(methodName -> new CallData(mdObject.get().getName(),
methodName,
location.getRange(), false, false));
}
// вызовы приватных методов внутри самого модуля пропускаем
Expand Down