perf(diagnostics): резолв типа конструктора через терминальный путь ReferenceFinder#4256
Merged
nixel2007 merged 2 commits intoJul 10, 2026
Merged
Conversation
…der path MissedRequiredParameterDiagnostic.checkConstructorCall resolved the constructor's type by computing a Position from the typeName identifier and calling ReferenceResolver.findReference(uri, Position), which re-descends the AST from the file root to that position on every Новый expression. Since the typeName IDENTIFIER terminal is already in hand, switch to the terminal-aware overload findReference(uri, TerminalNode), which ascends from the terminal to the enclosing newExpression instead of descending from the root. Drops the now-unused typeNamePosition helper and Position import. Measured on the SSL module УправлениеДоступомСлужебный (~48k lines), same harness, best-of-10: 594.5ms -> 163.2ms (x3.6), diagnostic output identical (parity). The changed path is covered by the existing constructor-call tests. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01BSiRGLm633B4EmvG3vkk4V
Contributor
📝 WalkthroughWalkthroughConstructor-call reference resolution now uses the terminal identifier token directly. The obsolete position-calculation helper and unused import were removed; missed-parameter detection remains otherwise unchanged. ChangesMissed required parameter diagnostics
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
nixel2007
commented
Jul 10, 2026
Extract typeName.IDENTIFIER() into a null-checked local before passing it to findReference. Resolves SonarCloud java:S4449 (the analyzer could not prove the second IDENTIFIER() call was non-null) and drops the redundant comment and the double IDENTIFIER() call. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01BSiRGLm633B4EmvG3vkk4V
|
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Описание
MissedRequiredParameterDiagnostic.checkConstructorCallрезолвил тип конструктора, вычисляяPositionиз идентификатораtypeNameи вызываяReferenceResolver.findReference(uri, Position). Позиционный путь резолвера спускается по AST от корня файла к этой позиции — на каждом выраженииНовый Тип(...).Идентификатор-терминал
typeName.IDENTIFIER()уже под рукой (и проверен наnullвыше), поэтому переключаемся на терминальный оверлоудfindReference(uri, TerminalNode), который поднимается по AST от самого терминала, а не спускается от корня к вычисленной позиции. Удалён ставший ненужным хелперtypeNamePositionи импортPosition; идентификатор вынесен в локальную переменную (снимает повторный вызовIDENTIFIER()и SonarCloudjava:S4449).Замеры
Модуль SSL
УправлениеДоступомСлужебный(~48k строк), один и тот же харнесс, best-of-10 после прогрева:Ускорение ×3.6. Вывод диагностики идентичен (parity, diags=0 на модуле).
Связанные задачи
Продолжение серии перф-оптимизаций движка резолюции типов/ссылок (#4249–#4254, #4255). Использует терминальный оверлоуд
ReferenceFinder, добавленный в #4253.Closes
Чеклист
Общие
checkConstructorCallпокрыт существующими тестами конструкторов:testConstructorCallResolvedToOScriptMethod,…OScriptModule, платформенныйРегулярноеВыражение)Дополнительно
Затронут только один метод; семантика (первое совпадение резолвера, тот же порядок finder'ов) сохранена — терминальный и позиционный пути дают один результат. Прогнан зелёным
MissedRequiredParameterDiagnosticTest(6/6).