Skip to content

Conversation

@theshadowco
Copy link
Member

@theshadowco theshadowco commented Oct 25, 2025

Описание

Оптимизация хранения + некоторые фиксы сонара

Связанные задачи

Closes

Чеклист

Общие

  • Ветка PR обновлена из develop
  • Отладочные, закомментированные и прочие, не имеющие смысла участки кода удалены
  • Изменения покрыты тестами
  • Обязательные действия перед коммитом выполнены (запускал команду gradlew precommit)

Для диагностик

  • Описание диагностики заполнено для обоих языков (присутствуют файлы для обоих языков, для русского заполнено все подробно, перевод на английский можно опустить)

Дополнительно

Summary by CodeRabbit

  • Dependencies

    • mdclasses updated to 0.16.1-rc.1
  • Refactor

    • Internal modernization: many types made immutable, accessor names consolidated, unused imports removed, and serialization metadata added.
  • Diagnostics

    • Several diagnostics and hints adjusted — some checks and messages refined, which may change which issues are reported.
  • Tests

    • Test suite updated to match refactors; one obsolete test removed and assertions improved.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 25, 2025

Warning

Rate limit exceeded

@theshadowco has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 14 minutes and 1 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between af9e845 and 23e3c54.

📒 Files selected for processing (1)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/MethodSymbol.java (5 hunks)

Walkthrough

Bumped mdclasses dependency; migrated many Lombok-backed DTOs to Java records and renamed getter-style methods to fluent accessors; added @serial to serialVersionUID fields; tightened nullability and visibility in a few places; assorted cleanup and corresponding test updates across the codebase.

Changes

Cohort / File(s) Summary
Dependency
\build.gradle.kts``
Bumped io.github.1c-syntax:mdclasses from 0.16.00.16.1-rc.1.
Core records & complexity
\src/main/java/.../context/computer/ComplexityData.java`, `src/main/java/.../context/computer/ComplexitySecondaryLocation.java``
Replaced Lombok POJOs with Java records; updated accessors (e.g., fileComplexity()), Javadoc and removed Lombok.
Symbol & reference models
\src/main/java/.../references/model/Symbol.java`, `src/main/java/.../references/model/SymbolOccurrence.java`, `src/main/java/.../references/model/Location.java`, `src/main/java/.../references/model/LocationRepository.java``
Converted symbol types to records, adjusted interning and compareTo, switched usages to record accessors (symbol(), location()), and small formatting tweaks.
Descriptions & parameters
\src/main/java/.../context/symbol/description/ParameterDescription.java`, `src/main/java/.../context/symbol/description/TypeDescription.java`, `src/main/java/.../context/symbol/annotations/AnnotationParameterDefinition.java``
Converted description/parameter classes to records; updated call sites to use fluent component accessors (name(), types(), description(), link(), etc.).
Diagnostics & private holders
\src/main/java/.../diagnostics/*.java``
Replaced many private/Lombok holders with private records, updated diagnostics to new accessors, adjusted some stream collectors (toList() vs Collectors.toList()), and minor logic tweaks in predicates.
Accessor renames across codebase
\src/main/java/.../diagnostics/.java`, `src/main/java/.../hover/DescriptionFormatter.java`, `src/main/java/.../inlayhints/.java`, `src/main/java/.../references/*.java``
Replaced getX() usages with fluent x() accessors (range(), message(), symbol(), location(), etc.) and updated dependent code and tests.
Serialization annotations
\src/main/java/.../configuration/events/LanguageServerConfigurationChangedEvent.java`, `src/main/java/.../context/events/DocumentContextContentChangedEvent.java`, `src/main/java/.../context/events/ServerContextPopulatedEvent.java`, `src/main/java/.../events/LanguageServerInitializeRequestReceivedEvent.java``
Added import java.io.Serial; and annotated serialVersionUID fields with @Serial.
API/annotation & visibility tweaks
\src/main/java/.../aop/sentry/PermissionFilterBeforeSendCallback.java`, `src/main/java/.../context/symbol/annotations/CompilerDirectiveKind.java`, `src/main/java/.../utils/expressiontree/TernaryOperatorNode.java``
Added Lombok @NonNull to sentry callback params, used Lombok @Getter on enum field, and narrowed TernaryOperatorNode constructor visibility to private.
Refactors, cleanups & minor logic changes
\src/main/java/.../BSLLSPLauncher.java`, `src/main/java/.../codelenses/AbstractRunTestsCodeLensSupplier.java`, `src/main/java/.../aop/sentry/SentryScopeConfigurer.java`, `src/main/java/.../hover/AnnotationParamSymbolMarkupContentBuilder.java`, `src/main/java/.../utils/Trees.java`, `src/main/java/.../reporters/data/FileInfo.java`, `src/main/java/.../diagnostics/TimeoutsInExternalResourcesDiagnostic.java`, `src/main/java/.../diagnostics/SetPermissionsForNewObjectsDiagnostic.java`, `src/main/java/.../diagnostics/WrongDataPathForFormElementsDiagnostic.java``
Removed unused imports, simplified predicates/conditions, centralized MDO ref extraction, adjusted null-guard/predicate logic in a few diagnostics, and minor stream/collection changes.
References & index logic
\src/main/java/.../references/ReferenceIndex.java`, `src/main/java/.../references/model/SymbolOccurrenceRepository.java``
Switched to record accessors (location(), symbol()), updated filters and lookups, and added an accessibility check in reference building.
Tests
\src/test/java/.../*.java` (many)`
Updated tests to new accessors/records, removed several throws declarations, replaced some assertions with idiomatic checks, adjusted type assertions, and deleted one obsolete test file.

Sequence Diagram(s)

(Skipped — changes are API/type renames and refactors without primary control-flow feature additions that benefit from a sequence diagram.)

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Areas to inspect closely:

  • All call sites for converted record types (ComplexityData, TypeDescription, ParameterDescription, Symbol, SymbolOccurrence) for missed getter/constructor usages.
  • compareTo implementations in Symbol, SymbolOccurrence, and MethodSymbol for null-handling and ordering correctness.
  • @serial additions for serialization compatibility with previous serialized forms.
  • @nonnull on PermissionFilterBeforeSendCallback.execute(...) — confirm no callers pass null.
  • Diagnostics where null-guards or predicate semantics were changed (e.g., TimeoutsInExternalResourcesDiagnostic, WrongDataPathForFormElementsDiagnostic, SetPermissionsForNewObjectsDiagnostic).

Possibly related PRs

Suggested reviewers

  • nixel2007

Poem

🐇
I hopped through getters, left them behind,
wrapped data in records — tidy and kind.
Serials tucked in, dependency bumped with a cheer,
tests pruned and imports cleared — the forest feels near.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 13.01% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "Оптимизация хранения + некоторые фиксы сонара" (Storage optimization + some SonarQube fixes) is fully related to the changeset. The dominant patterns in the changes are: (1) converting multiple Lombok-annotated classes to Java records (ComplexityData, ParameterDescription, TypeDescription, Symbol, SymbolOccurrence, etc.), which aligns with "storage optimization"; and (2) numerous code quality improvements including renaming methods to more idiomatic names, removing unused imports, adding @nonnull and @serial annotations, and simplifying logic, which corresponds to "SonarQube fixes." The title clearly identifies both main themes without being vague or misleading.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Nitpick comments (11)
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ScheduledJobHandlerDiagnostic.java (1)

89-89: Avoid using peek() for side effects; prefer map() or explicit iteration.

Using .peek() to mutate stream elements (sorting in-place) is discouraged because peek() is primarily intended for debugging. This makes the side effect less obvious and could be fragile.

Apply this diff to use map() instead:

-      .peek(mdScheduledJobs -> mdScheduledJobs.sort(Comparator.comparing(ScheduledJob::getName)))
+      .map(mdScheduledJobs -> {
+        mdScheduledJobs.sort(Comparator.comparing(ScheduledJob::getName));
+        return mdScheduledJobs;
+      })

Alternatively, if clarity is preferred over streaming style, consider:

-    scheduledJobHandlers.values().stream()
-      .filter(mdScheduledJobs -> mdScheduledJobs.size() > 1)
-      .peek(mdScheduledJobs -> mdScheduledJobs.sort(Comparator.comparing(ScheduledJob::getName)))
-      .forEach(this::fireIssueForDoubles);
+    for (var mdScheduledJobs : scheduledJobHandlers.values()) {
+      if (mdScheduledJobs.size() > 1) {
+        mdScheduledJobs.sort(Comparator.comparing(ScheduledJob::getName));
+        fireIssueForDoubles(mdScheduledJobs);
+      }
+    }
src/test/java/com/github/_1c_syntax/bsl/languageserver/BSLTextDocumentServiceTest.java (2)

144-152: Consider enhancing test coverage for rename functionality.

The test validates that rename() returns a non-null result but doesn't verify the actual rename behavior or result structure. Additionally, testing with an unknown file (without calling didOpen() first) may not provide meaningful validation.

Consider following the pattern from testDiagnosticsKnownFile by opening a document first and asserting on the result's content or structure.

Example enhancement:

 @Test
-void testRename() {
+void testRename() throws IOException {
+  // given
+  var textDocumentItem = getTextDocumentItem();
+  var didOpenParams = new DidOpenTextDocumentParams(textDocumentItem);
+  textDocumentService.didOpen(didOpenParams);
+
+  // when
   var params = new RenameParams();
   params.setTextDocument(getTextDocumentIdentifier());
   params.setPosition(new Position(0, 16));
+  params.setNewName("newName");
 
   var result = textDocumentService.rename(params);
 
+  // then
   assertThat(result).isNotNull();
+  assertThat(result.getChanges()).isNotEmpty();
 }

155-163: Consider enhancing test coverage for prepareRename functionality.

Similar to testRename(), this test only validates non-null results without verifying the actual functionality or result structure. Testing with an unknown file may not exercise the intended behavior.

Consider opening a document first and asserting on the result's range or placeholder content.

Example enhancement:

 @Test
-void testRenamePrepare() {
+void testRenamePrepare() throws IOException {
+  // given
+  var textDocumentItem = getTextDocumentItem();
+  var didOpenParams = new DidOpenTextDocumentParams(textDocumentItem);
+  textDocumentService.didOpen(didOpenParams);
+
+  // when
   var params = new PrepareRenameParams();
   params.setTextDocument(getTextDocumentIdentifier());
   params.setPosition(new Position(0, 16));
 
   var result = textDocumentService.prepareRename(params);
 
+  // then
   assertThat(result).isNotNull();
+  // Verify the result contains a valid range or placeholder
+  assertThat(result.getLeft()).isNotNull(); // or getRight() depending on return type
 }
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/annotations/CompilerDirectiveKind.java (1)

25-25: Question the necessity of adding Lombok for a single getter.

The overall PR appears to be converting Lombok-annotated POJOs to Java records, but this file adds Lombok's @Getter instead. For an enum with a single field, a manual getter is typically simpler and more explicit than introducing Lombok.

Consider keeping the manual getTokenType() method for clarity, or verify if there's a specific reason for adding Lombok here when the PR removes it elsewhere.

Also applies to: 41-42

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RewriteMethodParameterDiagnostic.java (1)

141-143: Consider using .get() for clarity.

Since refContextInsideDefAssign is guaranteed to be non-empty at this point (due to the guard on line 138), using .orElseThrow() is redundant. The .get() method would more clearly express that we know the value is present.

Apply this diff for improved clarity:

-var isSelfAssign = refContextInsideDefAssign
-  .map(RewriteMethodParameterDiagnostic::isVarNameOnlyIntoExpression)
-  .orElseThrow();
+var isSelfAssign = isVarNameOnlyIntoExpression(refContextInsideDefAssign.get());

Alternatively, if you prefer to keep the mapping style:

-var isSelfAssign = refContextInsideDefAssign
-  .map(RewriteMethodParameterDiagnostic::isVarNameOnlyIntoExpression)
-  .orElseThrow();
+var isSelfAssign = refContextInsideDefAssign
+  .map(RewriteMethodParameterDiagnostic::isVarNameOnlyIntoExpression)
+  .get();
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/variable/VariableDescription.java (1)

106-107: Уточните null‑контракт для param.link()

Если link() может быть null, проверьте, что downstream‑код готов к null в поле String link. Иначе нормализуйте (напр., пустая строка) или используйте Optional.

-  String link;
+  // Может быть null, если ссылка отсутствует (уточнить контракт).
+  String link;
src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/AbstractComplexityInlayHintSupplier.java (1)

98-102: Переход на range()/message(): корректно

Маппинг в InlayHint не меняет семантику.

Можно заменить Collectors.toList() на Stream.toList() в методе getInlayHints при целевом JDK ≥ 16 для лаконичности.

src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/LocationRepository.java (1)

59-60: Guard against null and reuse local URI

Defensively null-check location and avoid double dereference; keeps Sonar happy and improves readability.

-    locations.computeIfAbsent(symbolOccurrence.location().getUri(), uri -> ConcurrentHashMap.newKeySet())
+    var uri = java.util.Objects.requireNonNull(symbolOccurrence.location(), "location").getUri();
+    locations.computeIfAbsent(uri, u -> ConcurrentHashMap.newKeySet())
       .add(symbolOccurrence);
src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/SymbolOccurrence.java (1)

44-64: Refactor compareTo to a clear, accessor-based Comparator chain

Cleaner, consistent with equals, and avoids direct field access of the peer instance.

-  public int compareTo(@Nullable SymbolOccurrence symbolOccurrence) {
-    if (symbolOccurrence == null) {
-      return 1;
-    }
-    if (this.equals(symbolOccurrence)) {
-      return 0;
-    }
-    final var uriCompare = location.getUri().compareTo(symbolOccurrence.location.getUri());
-    if (uriCompare != 0) {
-      return uriCompare;
-    }
-    final var rangesCompare = Ranges.compare(location.getRange(), symbolOccurrence.location.getRange());
-    if (rangesCompare != 0) {
-      return rangesCompare;
-    }
-    final var occurrenceCompare = occurrenceType.compareTo(symbolOccurrence.occurrenceType);
-    if (occurrenceCompare != 0) {
-      return occurrenceCompare;
-    }
-    return symbol.compareTo(symbolOccurrence.symbol);
-  }
+  public int compareTo(@Nullable SymbolOccurrence other) {
+    if (other == null) {
+      return 1;
+    }
+    var cmp = java.util.Comparator
+      .comparing(SymbolOccurrence::location, java.util.Comparator
+        .comparing(Location::getUri)
+        .thenComparing((l1, l2) -> Ranges.compare(l1.getRange(), l2.getRange())))
+      .thenComparing(SymbolOccurrence::occurrenceType)
+      .thenComparing(SymbolOccurrence::symbol)
+      .compare(this, other);
+    return cmp;
+  }

Please confirm that Location.equals/hashCode are based on (URI, Range). If Location has additional fields affecting equals, compareTo must incorporate them to stay consistent with equals for use in ConcurrentSkipListSet.

src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/Symbol.java (2)

51-51: Make interner field final

Immutable static improves thread-safety semantics.

-  private static GenericInterner<Symbol> interner = new GenericInterner<>();
+  private static final GenericInterner<Symbol> interner = new GenericInterner<>();

58-89: Simplify compareTo with Comparator chain

Removes boilerplate, keeps ordering over all record components explicit.

-  public int compareTo(@Nullable Symbol symbol) {
-    if (symbol == null) {
-      return 1;
-    }
-
-    if (this.equals(symbol)) {
-      return 0;
-    }
-
-    int compareResult = mdoRef.compareTo(symbol.mdoRef);
-    if (compareResult != 0) {
-      return compareResult;
-    }
-
-    compareResult = moduleType.compareTo(symbol.moduleType);
-    if (compareResult != 0) {
-      return compareResult;
-    }
-
-    compareResult = scopeName.compareTo(symbol.scopeName);
-    if (compareResult != 0) {
-      return compareResult;
-    }
-
-    compareResult = symbolKind.compareTo(symbol.symbolKind);
-    if (compareResult != 0) {
-      return compareResult;
-    }
-
-    compareResult = symbolName.compareTo(symbol.symbolName);
-    return compareResult;
-  }
+  public int compareTo(@Nullable Symbol other) {
+    if (other == null) {
+      return 1;
+    }
+    return java.util.Comparator
+      .comparing(Symbol::mdoRef)
+      .thenComparing(Symbol::moduleType)
+      .thenComparing(Symbol::scopeName)
+      .thenComparing(Symbol::symbolKind)
+      .thenComparing(Symbol::symbolName)
+      .compare(this, other);
+  }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5893366 and a994d6b.

📒 Files selected for processing (74)
  • build.gradle.kts (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLLSPLauncher.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/PermissionFilterBeforeSendCallback.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/SentryScopeConfigurer.java (0 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/AbstractRunTestsCodeLensSupplier.java (0 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplier.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplier.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/databind/ParametersDeserializer.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/events/LanguageServerConfigurationChangedEvent.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/DocumentContext.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/ComplexityData.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/ComplexitySecondaryLocation.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputer.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/events/DocumentContextContentChangedEvent.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/events/ServerContextPopulatedEvent.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/annotations/AnnotationParameterDefinition.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/annotations/CompilerDirectiveKind.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/DescriptionReader.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/ParameterDescription.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/TypeDescription.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/variable/VariableDescription.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CognitiveComplexityDiagnostic.java (4 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CyclomaticComplexityDiagnostic.java (4 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DuplicatedInsertionIntoCollectionDiagnostic.java (6 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/LineLengthDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingCommonModuleMethodDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingParameterDescriptionDiagnostic.java (4 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingReturnedValueDescriptionDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RefOveruseDiagnostic.java (0 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RewriteMethodParameterDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ScheduledJobHandlerDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/SetPermissionsForNewObjectsDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TimeoutsInExternalResourcesDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TransferringParametersBetweenClientAndServerDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UnreachableCodeDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/WrongDataPathForFormElementsDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/events/LanguageServerInitializeRequestReceivedEvent.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/AnnotationParamSymbolMarkupContentBuilder.java (0 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/DescriptionFormatter.java (4 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/AbstractComplexityInlayHintSupplier.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/CognitiveComplexityInlayHintSupplier.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/CyclomaticComplexityInlayHintSupplier.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/SourceDefinedMethodCallInlayHintSupplier.java (0 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/AnnotationReferenceFinder.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/ReferenceIndex.java (5 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/Location.java (0 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/LocationRepository.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/Symbol.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/SymbolOccurrence.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/SymbolOccurrenceRepository.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/reporters/data/FileInfo.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/Trees.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/TernaryOperatorNode.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/BSLLSPLauncherTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/BSLTextDocumentServiceTest.java (2 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/aop/measures/MeasureCollectorTest.java (2 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplierTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplierTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/context/DocumentContextTest.java (2 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/CognitiveComplexityComputerTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/CyclomaticComplexityComputerTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputerTest.java (3 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/VariableSymbolTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/MethodDescriptionTest.java (6 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DiagnosticInfosTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/EmptyStatementDiagnosticTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/SmokyTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ThisObjectAssignDiagnosticTest.java (0 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/hover/DescriptionFormatterTest.java (0 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/util/assertions/ColorInformationsAssert.java (3 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/util/assertions/ColorPresentationsAssert.java (2 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/util/assertions/FoldingRangesAssert.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitorTest.java (1 hunks)
💤 Files with no reviewable changes (8)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/AbstractRunTestsCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/SentryScopeConfigurer.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/SourceDefinedMethodCallInlayHintSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/Location.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/AnnotationParamSymbolMarkupContentBuilder.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/hover/DescriptionFormatterTest.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ThisObjectAssignDiagnosticTest.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RefOveruseDiagnostic.java
🧰 Additional context used
🧬 Code graph analysis (1)
src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/Symbol.java (1)
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/AbstractVariableSymbol.java (1)
  • Builder (121-207)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
  • GitHub Check: Benchmark
  • GitHub Check: build (21, windows-latest)
  • GitHub Check: build (23, macOS-latest)
  • GitHub Check: build (23, windows-latest)
  • GitHub Check: build (23, ubuntu-latest)
  • GitHub Check: build (21, ubuntu-latest)
  • GitHub Check: build (21, macOS-latest)
  • GitHub Check: build (17, macOS-latest)
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build (17, windows-latest)
  • GitHub Check: build
🔇 Additional comments (68)
src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/EmptyStatementDiagnosticTest.java (1)

72-72: Good refactoring to use isEmpty().

Using isEmpty() instead of equals("") is more idiomatic and clearly expresses the intent. This aligns with Sonar best practices (rule S1155).

src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLLSPLauncher.java (1)

127-129: LGTM! Clean modernization to Java 16+ Stream API.

The migration from Collectors.toList() to Stream.toList() is appropriate here. The resulting unmodifiable list is safe since unmatchedArgs is only used for read operations (isEmpty check and iteration).

src/test/java/com/github/_1c_syntax/bsl/languageserver/aop/measures/MeasureCollectorTest.java (1)

25-25: LGTM! Modern AssertJ API usage.

The migration from .asList() to .asInstanceOf(InstanceOfAssertFactories.LIST) follows current AssertJ best practices and improves type safety. This modernization aligns well with the PR's SonarQube fixes objective.

Also applies to: 74-74

src/test/java/com/github/_1c_syntax/bsl/languageserver/BSLLSPLauncherTest.java (1)

69-69: LGTM! Clean removal of unnecessary exception declaration.

The throws Exception clause was correctly removed since no checked exceptions are actually thrown by this test method. The RuntimeException is caught by assertThatThrownBy, making this a proper cleanup that improves code clarity.

src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java (1)

178-182: LGTM—cleaner dispatch logic.

The refactoring from switch-default to if-else is appropriate for a single-case check and maintains identical behavior.

src/test/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitorTest.java (1)

103-103: LGTM—cosmetic whitespace change.

The whitespace modification in the string literal has no impact on test behavior.

src/test/java/com/github/_1c_syntax/bsl/languageserver/util/assertions/FoldingRangesAssert.java (1)

49-49: LGTM - Minor documentation cleanup.

The removal of parentheses around "см." in the Javadoc is a harmless stylistic improvement that maintains correct Javadoc syntax.

src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/databind/ParametersDeserializer.java (1)

79-80: LGTM!

The reformatted TypeReference instantiation is a stylistic improvement with no behavioral change. This aligns with the PR's Sonar fix objectives.

src/test/java/com/github/_1c_syntax/bsl/languageserver/util/assertions/ColorInformationsAssert.java (1)

43-72: LGTM! Documentation formatting improved.

The Javadoc formatting has been cleaned up by removing parentheses around the "см." references, making the parameter documentation more concise and consistent across all three methods.

src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/Trees.java (1)

361-373: LGTM! Clean refactor using pattern matching.

The change properly leverages the pattern variable parserRuleContext introduced by the instanceof check on line 364, eliminating the redundant cast. This is idiomatic Java 16+ code that improves readability without changing behavior.

src/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/VariableSymbolTest.java (1)

97-97: Good refactoring to more idiomatic Java.

The change from a string equality check to isEmpty() is clearer and follows Java best practices for empty string validation.

src/test/java/com/github/_1c_syntax/bsl/languageserver/context/DocumentContextTest.java (1)

114-114: Good cleanup removing unnecessary exception declaration.

The method body doesn't throw IOException, so removing it from the signature is appropriate and improves code clarity.

src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/TernaryOperatorNode.java (1)

40-40: Constructor visibility change is correct and safe.

Verification confirms no subclasses of TernaryOperatorNode exist in the codebase. All instantiation already uses the Lombok-generated factory method TernaryOperatorNode.create() (ExpressionTreeBuildingVisitor.java:411). The private constructor properly enforces the factory pattern and aligns with immutability best practices for @Value classes.

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/LineLengthDiagnostic.java (1)

136-140: LGTM! Logic simplification is correct.

The collapsed boolean expression correctly implements the filtering logic described in the comment. The short-circuit evaluation efficiently handles both cases: including all comments when trailing comments aren't excluded, or filtering based on whether the comment shares a line with code.

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/annotations/CompilerDirectiveKind.java (1)

48-52: LGTM: The of() method will work correctly with the Lombok-generated getter.

The call to getTokenType() at line 50 will use the Lombok-generated method, maintaining the same functionality as before.

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RewriteMethodParameterDiagnostic.java (1)

164-164: LGTM! Unnecessary cast removed.

The cast to RuleNode was redundant since TerminalNode.getParent() already returns a RuleNode. Good cleanup.

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DuplicatedInsertionIntoCollectionDiagnostic.java (4)

93-96: Clean migration to Java record.

The conversion from Lombok @Value to a Java record is well-executed. Records provide the same immutability guarantees while using modern Java syntax, and all seven components are appropriately preserved.


180-186: Record accessor method references correctly updated.

All groupingBy key extractors properly reference the record component accessors (collectionName, methodName, firstParamName) instead of the old Lombok-style getters.


305-305: Record accessor correctly applied.

The mapping to extract callStatement properly uses the record accessor syntax.


319-337: Cleaner collection creation with .toList().

The replacement of Collectors.toUnmodifiableList() with .toList() is appropriate. Both return unmodifiable lists, and the newer syntax (Java 16+) is more concise. The cached lists are used read-only throughout, so immutability is maintained.

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/SetPermissionsForNewObjectsDiagnostic.java (1)

71-71: Change verified and approved.

The method rename from isSetForNewObjects() to setForNewObjects() correctly adapts to the mdclasses library upgrade. Integration tests in SetPermissionsForNewObjectsDiagnosticTest.java (three test methods covering different configurations) exercise this code path by loading metadata and verifying diagnostic output. The tests verify the diagnostic correctly identifies roles, which indirectly confirms the filter logic works as expected. No test changes were needed since the tests operate at the diagnostic output level rather than mocking the underlying API.

src/main/java/com/github/_1c_syntax/bsl/languageserver/references/AnnotationReferenceFinder.java (1)

220-222: Accessor method change verified and correct.

The conversion from getValue() to value() is confirmed complete and consistent. AnnotationParameterDefinition is a Java record with a value field that auto-generates the value() accessor (not a getter-style method). Existing tests already validate this accessor pattern, and no incomplete conversions remain in the codebase.

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingCommonModuleMethodDiagnostic.java (4)

65-67: LGTM!

The configuration source check is correctly implemented and serves as an appropriate guard clause.


69-71: LGTM!

The conversion from getter-style to record-style accessors is correctly implemented with proper method call syntax.


78-104: LGTM!

The accessor method updates in this method are correctly implemented. All record-style accessor calls properly include parentheses, maintaining type safety and compilation correctness.


117-119: LGTM!

The record definition is well-structured with appropriate component types and access modifier. The conversion from Lombok to a Java record maintains immutability and reduces boilerplate.

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/WrongDataPathForFormElementsDiagnostic.java (1)

65-67: Semantic change from segments().startsWith() to direct startsWith() is verified and correct.

The modification has been confirmed via git history: the change removes the .segments() call as part of an external dependency API refactoring (records migration). The existing test suite—WrongDataPathForFormElementsDiagnosticTest.java with three test cases—validates that the new implementation correctly identifies form elements with data paths starting with "~" in both FormModule and non-FormModule scenarios. No behavioral regression detected.

src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DiagnosticInfosTest.java (1)

78-79: LGTM! Cleaner assertion syntax.

The refactor from a multiline lambda to allSatisfy with key-value parameters is more concise and idiomatic.

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UnreachableCodeDiagnostic.java (1)

145-145: Good use of Stream.toList().

Using the built-in .toList() (Java 16+) is cleaner than Collectors.toList().

src/test/java/com/github/_1c_syntax/bsl/languageserver/util/assertions/ColorPresentationsAssert.java (1)

56-56: LGTM! Minor Javadoc formatting improvement.

The Javadoc updates improve consistency by removing unnecessary parentheses.

Also applies to: 71-71

src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/SmokyTest.java (1)

75-75: LGTM! Simplified test signature.

Removing the throws Exception declaration improves readability and indicates the test no longer throws checked exceptions.

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/annotations/AnnotationParameterDefinition.java (1)

28-28: LGTM! Modern Java record migration.

Converting from Lombok @Value to a Java record is a good modernization. Records provide immutability, conciseness, and built-in equals/hashCode/toString implementations. This aligns with the broader refactoring across the codebase.

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/ComplexitySecondaryLocation.java (1)

26-26: LGTM! Clean record migration.

The conversion from Lombok @Value to a Java record improves code clarity and leverages modern Java features. The immutable data carrier pattern is well-suited for records.

build.gradle.kts (1)

91-91: I need to gather more information about the mdclasses library and the 0.16.1-rc.1 release status.

Prefer stable 0.16.0 over release candidate 0.16.1-rc.1.

A stable version 0.16.0 is available in Maven Central. Using the 0.16.1-rc.1 release candidate introduces unnecessary risk when a stable release exists. Consider updating to 0.16.0 to avoid potential regressions in a non-final version.

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TimeoutsInExternalResourcesDiagnostic.java (1)

239-240: No null-safety issues found.

The removal of the null-check is safe. The diagnosticCompatibility variable is assigned from getCompatibilityMode() (line 209-213), which uses Optional.map().orElseGet() to guarantee a non-null DiagnosticCompatibilityMode return value. Both arguments passed to CompatibilityMode.compareTo() at lines 239-240 are provably non-null: the first from the Optional chain and the second from the enum method call DiagnosticCompatibilityMode.UNDEFINED.getCompatibilityMode(). The existing test suite confirms this code path is correct.

src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/CognitiveComplexityInlayHintSupplier.java (1)

47-50: Accessor rename to methodsComplexitySecondaryLocations() verified and complete

All six call sites across the codebase consistently use the new record-style accessor method. No legacy getMethodsComplexitySecondaryLocations() references remain.

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/events/ServerContextPopulatedEvent.java (1)

27-32: @serial annotation is fully compatible with Java 17 target.

The project is configured to use Java 17 (sourceCompatibility and targetCompatibility are set to JavaVersion.VERSION_17 in build.gradle.kts, lines 153-154). The @Serial annotation, introduced in Java 14 and finalized in Java 16, compiles without issues on Java 17. No verification needed.

src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplier.java (1)

47-48: methodsComplexity() refactoring verified

Tests already cover the new method: CognitiveComplexityCodeLensSupplierTest and CyclomaticComplexityCodeLensSupplierTest both validate the new methodsComplexity() delegation pattern. The old wrapper methods remain functional as safe delegates. No incomplete transitions or stale code detected.

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/DocumentContext.java (1)

422-423: LGTM: Accessor rename aligns with record refactoring.

The migration from getFileComplexity() to fileComplexity() is consistent with the broader conversion of ComplexityData from Lombok POJOs to Java records. The change is purely mechanical and maintains identical behavior.

src/main/java/com/github/_1c_syntax/bsl/languageserver/events/LanguageServerInitializeRequestReceivedEvent.java (1)

29-30: LGTM: Modern Java serialization best practice.

Adding the @Serial annotation to serialVersionUID follows modern Java conventions and improves compile-time validation of serialization-related fields. This is a good housekeeping improvement.

Also applies to: 38-39

src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/CyclomaticComplexityInlayHintSupplier.java (1)

49-49: LGTM: Consistent accessor refactoring.

The update to methodsComplexitySecondaryLocations() aligns with the record-based API surface. No logic changes, purely a mechanical rename.

src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplier.java (1)

47-47: LGTM: Record accessor update.

The change to methodsComplexity() is consistent with the broader refactoring to Java records. Behavior remains unchanged.

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/DescriptionReader.java (1)

129-129: LGTM: Record accessor migration.

The update from getTypes() to types() reflects the conversion of ParameterDescription to a Java record. This is a straightforward mechanical change with no behavioral impact.

src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplierTest.java (1)

70-70: LGTM: Test updated for new API.

The test correctly uses methodsComplexity() to match the refactored API surface. Proper maintenance of test consistency with production code changes.

src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplierTest.java (1)

70-70: LGTM: Test API alignment.

The test properly uses methodsComplexity() consistent with the record-based refactoring. Good parallel update to the cognitive complexity test.

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputer.java (1)

321-321: LGTM: Record accessor in filter predicate.

The change from getName() to name() is consistent with ParameterDescription's conversion to a record. The filtering logic remains identical.

src/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/CognitiveComplexityComputerTest.java (1)

51-51: LGTM! Test correctly updated for record accessor.

The test properly uses the new record accessor methodsComplexity() instead of the previous Lombok-generated getter. The change maintains test correctness while aligning with the ComplexityData record conversion.

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingReturnedValueDescriptionDiagnostic.java (1)

104-105: LGTM! Diagnostic correctly updated for record accessors.

The code properly uses the new TypeDescription record accessors (description(), parameters(), name()) instead of the previous Lombok-generated getters. The diagnostic logic remains unchanged and continues to correctly identify types without descriptions.

src/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/CyclomaticComplexityComputerTest.java (1)

52-52: LGTM! Test correctly updated for record accessor.

The test properly uses the new record accessor methodsComplexity() instead of the previous Lombok-generated getter, consistent with the ComplexityData record conversion.

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/events/DocumentContextContentChangedEvent.java (1)

27-32: LGTM! Proper serialization annotation added.

The @Serial annotation correctly marks the serialVersionUID field, following Java best practices and addressing Sonar recommendations. This improves code clarity and enables compile-time validation of serialization-related members.

src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/events/LanguageServerConfigurationChangedEvent.java (1)

27-37: LGTM! Proper serialization annotation added.

The @Serial annotation correctly marks the serialVersionUID field, consistent with Java best practices and Sonar recommendations. This change aligns with other serialization improvements across the codebase.

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/ComplexityData.java (1)

29-36: LGTM! Excellent conversion to Java record.

The conversion from Lombok POJO to a Java record is well-executed. Records are ideal for this immutable data carrier, providing:

  • Automatic canonical constructor, accessors, equals(), hashCode(), and toString()
  • More compact memory representation
  • Clearer intent as an immutable data structure
  • Reduced dependency on Lombok

The five components comprehensively capture file-level and method-level complexity metrics with associated secondary locations.

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/TypeDescription.java (1)

29-46: LGTM! Well-documented record conversion.

The conversion to a Java record is excellent, with comprehensive Javadoc documentation for each component. The record appropriately models immutable type description metadata. The preserved TODO comment at lines 32-36 indicates awareness of the temporary link design, which is good for future maintainability.

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/ParameterDescription.java (1)

28-37: LGTM! Clean record conversion with documentation.

The conversion to a Java record is well-executed with proper Javadoc documentation. The compact single-line record declaration is clean and readable while modeling immutable parameter description metadata. The preserved TODO comment maintains visibility of the temporary link design decision.

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TransferringParametersBetweenClientAndServerDiagnostic.java (2)

171-173: LGTM! Clean conversion to Java record.

The conversion from Lombok to a Java record is appropriate for this immutable data carrier. Records provide better compile-time guarantees and are more idiomatic in modern Java.


73-76: LGTM! Accessor usage updated correctly.

The method calls have been properly updated to use record-style accessors (parameterDefinitions(), methodSymbol(), references()) instead of Lombok-generated getters. The logic remains unchanged.

src/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputerTest.java (2)

274-274: LGTM! Exception declaration removed.

The throws IOException clause has been removed from the test method signature. This suggests the underlying implementation no longer throws this checked exception, likely due to the dependency upgrade mentioned in the PR.


162-172: LGTM! Test assertions updated to new API.

All test assertions have been consistently updated to use record-style accessors (name(), optional(), value()) instead of getter methods. The test logic and expectations remain unchanged.

Also applies to: 179-179, 186-186, 193-193, 245-246

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CyclomaticComplexityDiagnostic.java (1)

74-74: LGTM! Complexity data accessor calls updated consistently.

All accessor calls for complexity data structures have been properly updated to record-style naming (methodsComplexity(), methodsComplexitySecondaryLocations(), fileCodeBlockComplexity(), fileBlockComplexitySecondaryLocations(), range(), message()). The diagnostic logic remains unchanged.

Also applies to: 80-81, 93-93, 126-126, 139-139, 145-146

src/test/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/MethodDescriptionTest.java (1)

87-143: LGTM! Comprehensive test updates to new API.

All test assertions throughout this file have been systematically updated to use record-style accessors (name(), types(), description(), parameters(), link()). The test coverage remains thorough, including complex nested type structures. The test expectations are unchanged, confirming the API migration is purely structural.

Also applies to: 158-162, 266-427

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CognitiveComplexityDiagnostic.java (1)

81-81: LGTM! Cognitive complexity accessor calls updated consistently.

All accessor calls for cognitive complexity data have been updated to record-style naming, mirroring the changes in CyclomaticComplexityDiagnostic. The diagnostic logic remains unchanged.

Also applies to: 87-88, 100-100, 133-133, 146-146, 152-153

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingParameterDescriptionDiagnostic.java (1)

108-108: LGTM! ParameterDescription accessor calls updated correctly.

All accessor calls on ParameterDescription have been updated to use record-style naming (name(), types()). The diagnostic logic for validating parameter descriptions remains unchanged.

Also applies to: 123-123, 142-142, 158-158

src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/DescriptionFormatter.java (1)

242-242: LGTM! Description formatter accessor calls updated comprehensively.

All accessor calls for ParameterDescription and TypeDescription throughout the formatter have been updated to record-style naming. The complex formatting logic, including nested structures and hyperlink handling, has been preserved correctly.

Also applies to: 283-283, 291-291, 296-296, 299-299, 326-328, 351-351, 356-356, 361-361

src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/SymbolOccurrenceRepository.java (1)

49-50: LGTM: accessor migration

Using symbolOccurrence.symbol() aligns with record accessors.

src/main/java/com/github/_1c_syntax/bsl/languageserver/references/ReferenceIndex.java (4)

106-106: LGTM: accessor update

Uses location() accessor correctly in filter.


134-137: LGTM: kind filter via record accessor

Records migration applied consistently.


241-251: Rely on non-null invariants for SymbolOccurrence components

buildReference assumes non-null location, occurrenceType, and symbol. Ensure the record enforces this (canonical constructor with requireNonNull), else this will NPE under malformed inputs.

Would you like me to add a compact constructor to SymbolOccurrence to enforce non-null?


273-275: LGTM: localizing URI/position

Local vars reduce repeated derefs and improve readability.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (2)
src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/SymbolOccurrence.java (1)

36-40: Enforce non-null invariants for record components

Add a compact constructor with requireNonNull to fail fast and avoid latent NPEs downstream. This also tightens Comparable logic guarantees.

 public record SymbolOccurrence(
   OccurrenceType occurrenceType,
   Symbol symbol,
   Location location
 ) implements Comparable<SymbolOccurrence> {
+  public SymbolOccurrence {
+    java.util.Objects.requireNonNull(occurrenceType, "occurrenceType");
+    java.util.Objects.requireNonNull(symbol, "symbol");
+    java.util.Objects.requireNonNull(location, "location");
+  }
src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/Symbol.java (1)

42-48: Add compact constructor to enforce non-null components

Guarantees immutability invariants and avoids NPEs in compareTo/callers. Uses clear parameter names.

 public record Symbol(
   String mdoRef,
   ModuleType moduleType,
   String scopeName,
   SymbolKind symbolKind,
   String symbolName
 ) implements Comparable<Symbol> {
+  public Symbol {
+    java.util.Objects.requireNonNull(mdoRef, "mdoRef");
+    java.util.Objects.requireNonNull(moduleType, "moduleType");
+    java.util.Objects.requireNonNull(scopeName, "scopeName");
+    java.util.Objects.requireNonNull(symbolKind, "symbolKind");
+    java.util.Objects.requireNonNull(symbolName, "symbolName");
+  }
🧹 Nitpick comments (2)
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/TypeDescription.java (2)

28-36: Tidy Javadoc: replace TODO with tracked issue and clarify link/hyperlink.

Move the TODO to a tracked issue reference to satisfy Sonar and keep Javadoc user‑facing. Minor wording tweak below.

Proposed edit:

- * @param link        Если описание параметров содержит только ссылку, то здесь будет ее значение
- *                    <p>
- *                    TODO Временное решение, надо будет продумать в следующем релизе
+ * @param link        Значение гиперссылки, если описание параметров содержит только ссылку.
+ *                    <p>
+ *                    См. задачу #<ISSUE_ID> для пересмотра подхода в следующем релизе.
- * @param isHyperlink Признак того, что параметр является гиперссылкой
+ * @param isHyperlink Признак того, что описание представлено гиперссылкой

Please replace <ISSUE_ID> with the actual tracker ID.


37-43: Apply defensive copy pattern to parameters field for true immutability.

The verification found no existing mutations of parameters() in the codebase. However, since List is mutable, callers could mutate the returned list (e.g., .parameters().add(...)), creating a defensive coding concern. Add a compact constructor with List.copyOf() to guarantee immutability and null-safety:

 public record TypeDescription(
   String name,
   String description,
   List<ParameterDescription> parameters,
   String link,
   boolean isHyperlink
 ) {
+  public TypeDescription {
+    parameters = (parameters == null) ? List.of() : List.copyOf(parameters);
+  }
 }

No legacy getter pattern usage or active mutations detected during verification.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a994d6b and 03d8037.

📒 Files selected for processing (8)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/TypeDescription.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingCommonModuleMethodDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesDiagnostic.java (0 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RewriteMethodParameterDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/Symbol.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/SymbolOccurrence.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/reporters/data/FileInfo.java (2 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputerTest.java (3 hunks)
💤 Files with no reviewable changes (1)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesDiagnostic.java
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingCommonModuleMethodDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RewriteMethodParameterDiagnostic.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputerTest.java
🧰 Additional context used
🧬 Code graph analysis (1)
src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/Symbol.java (1)
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/AbstractVariableSymbol.java (1)
  • Builder (121-207)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (21)
  • GitHub Check: build (21, macOS-latest)
  • GitHub Check: build (23, windows-latest)
  • GitHub Check: build (21, windows-latest)
  • GitHub Check: build (21, ubuntu-latest)
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build (17, windows-latest)
  • GitHub Check: build (17, macOS-latest)
  • GitHub Check: build
  • GitHub Check: build (23, windows-latest)
  • GitHub Check: build (23, ubuntu-latest)
  • GitHub Check: build (21, ubuntu-latest)
  • GitHub Check: build (21, windows-latest)
  • GitHub Check: build (23, macOS-latest)
  • GitHub Check: build (17, macOS-latest)
  • GitHub Check: build (21, macOS-latest)
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build (17, windows-latest)
  • GitHub Check: Analyse
  • GitHub Check: build
  • GitHub Check: Benchmark
  • GitHub Check: Analyze the repo with CodeSee
🔇 Additional comments (5)
src/main/java/com/github/_1c_syntax/bsl/languageserver/reporters/data/FileInfo.java (1)

51-51: Refactoring is correct; centralizes MDO reference extraction with proper null-safety.

The MdoRefBuilder.getMdoRef() method properly handles null cases through Optional chaining and an explicit fallback to documentContext.getUri().toString(), ensuring the method always returns a non-null String. This centralization eliminates duplicate inline logic and is consistent with the PR's optimization goals.

src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/SymbolOccurrence.java (2)

25-25: Do not remove the Nullable import—@nullable is still in use

The @Nullable annotation is still present on the compareTo method parameter at line 43, making the import necessary. The suggested removal is not applicable.

Likely an incorrect or invalid review comment.


35-40: No action required — Lombok version is compatible

The project uses the FreeFair Gradle plugin v9.0.0, which defaults to Lombok 1.18.38. Lombok supports @builder for records since v1.18.20, so the codebase already meets the compatibility requirement for @Builder on records.

src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/Symbol.java (2)

27-27: Let me verify if there are any other uses of @Nullable in the entire Symbol.java file to confirm the import is actually needed:Based on the verification results, the review comment's assumption is incorrect. The execution of the shell script confirmed that @Nullable is still actively used on line 57 of the Symbol.java file in the compareTo method parameter. Since the annotation is still in use, the import at line 27 is not unused and should NOT be removed.

Keep the Nullable import—@nullable is still used in the compareTo method

The suggestion to drop this import is based on an incorrect premise. The verification shows @Nullable remains on line 57 in the compareTo method signature, so the import is still required.

Likely an incorrect or invalid review comment.


50-54: Verify GenericInterner characteristics before adding Javadoc

The GenericInterner class is imported from com.github._1c_syntax.utils and is not present in this repository. Unable to inspect its implementation to confirm reference type (weak/strong), thread-safety model, or locking strategy. Verify that:

  • GenericInterner documentation/source is accessible in the external _1c_syntax.utils module
  • Its characteristics (weak refs, thread-safety) should be documented based on actual implementation
  • Adding Javadoc to the INTERNER field is appropriate once implementation details are confirmed

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RewriteMethodParameterDiagnostic.java (1)

140-146: Consider more idiomatic Optional handling.

While calling .get() is safe here (we're in the else block after checking isEmpty()), a more idiomatic approach would avoid explicit .get() calls:

 } else {
-  boolean isSelfAssign = refContextInsideDefAssign
-    .map(RewriteMethodParameterDiagnostic::isVarNameOnlyIntoExpression)
-    .get();
+  boolean isSelfAssign = refContextInsideDefAssign
+    .map(RewriteMethodParameterDiagnostic::isVarNameOnlyIntoExpression)
+    .orElse(false);
   if (isSelfAssign && references.size() > COUNT_OF_PAIR_FOR_SELF_ASSIGN) {
     return isOverwrited(references.subList(COUNT_OF_PAIR_FOR_SELF_ASSIGN, references.size()));
   }
 }

Note: Since we're in the else block, .orElse(false) would never actually return false, but this pattern is more consistent with Optional best practices and avoids the code smell of calling .get().

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 03d8037 and 38cc7ba.

📒 Files selected for processing (1)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RewriteMethodParameterDiagnostic.java (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (21)
  • GitHub Check: build (23, macOS-latest)
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build (23, ubuntu-latest)
  • GitHub Check: build (21, windows-latest)
  • GitHub Check: build (21, ubuntu-latest)
  • GitHub Check: build (17, macOS-latest)
  • GitHub Check: build (17, windows-latest)
  • GitHub Check: Analyse
  • GitHub Check: build
  • GitHub Check: build (23, ubuntu-latest)
  • GitHub Check: build (23, macOS-latest)
  • GitHub Check: build (21, windows-latest)
  • GitHub Check: build (23, windows-latest)
  • GitHub Check: build (17, macOS-latest)
  • GitHub Check: build (21, macOS-latest)
  • GitHub Check: build (17, windows-latest)
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build (21, ubuntu-latest)
  • GitHub Check: build
  • GitHub Check: Benchmark
  • GitHub Check: Analyze the repo with CodeSee
🔇 Additional comments (1)
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RewriteMethodParameterDiagnostic.java (1)

153-166: ---

No action required—review comment is based on incorrect assumptions.

The compilation verification confirms the code is type-safe. The gradle build completed with --warning-mode=all and found no errors, warnings, or unchecked cast warnings. This contradicts the assumption that removing the explicit RuleNode.class::cast would cause a type mismatch. The ANTLR4 API ensures that TerminalNode.getParent() returns a type compatible with Optional<RuleNode>, making the cast unnecessary and the current implementation correct.

Likely an incorrect or invalid review comment.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/MethodSymbol.java (1)

29-29: Avoid @nullable on Comparable#compareTo; drop null acceptance.

Comparable’s contract assumes non‑null argument. Remove @nullable and the null branch; callers should not pass null.

-import edu.umd.cs.findbugs.annotations.Nullable;
@@
-  public int compareTo(@Nullable MethodSymbol other) {
-    if (other == null) {
-      return 1;
-    }
+  public int compareTo(MethodSymbol other) {

Also applies to: 126-130

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 38cc7ba and 989f08d.

📒 Files selected for processing (1)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/MethodSymbol.java (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: build
  • GitHub Check: build (23, windows-latest)
  • GitHub Check: build (23, ubuntu-latest)
  • GitHub Check: build (21, macOS-latest)
  • GitHub Check: build (21, ubuntu-latest)
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build (17, macOS-latest)
  • GitHub Check: Analyse
  • GitHub Check: build
  • GitHub Check: build (23, windows-latest)
  • GitHub Check: build (23, ubuntu-latest)
  • GitHub Check: build (23, macOS-latest)
  • GitHub Check: build (21, macOS-latest)
  • GitHub Check: build (21, ubuntu-latest)
  • GitHub Check: build (17, macOS-latest)
  • GitHub Check: build (17, windows-latest)
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build (21, windows-latest)
  • GitHub Check: Benchmark
  • GitHub Check: Analyze the repo with CodeSee
🔇 Additional comments (3)
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/MethodSymbol.java (3)

50-50: Good call making MethodSymbol Comparable. Ensure natural order matches equals.

Comparable is appropriate here; just align compareTo with equals (see next comment).


60-67: No breaking changes detected — private getter restriction is safe.

Verification found no external usages of MethodSymbol's getters. All calls to getStartLine(), getStartCharacter(), getEndLine(), getEndCharacter(), and sub-name accessors occur within MethodSymbol.java itself (lines 134–140 in the compareTo method), where private access is appropriate. Other files use identically-named getters on different classes (FoldingRange, PhysicalLocation), not MethodSymbol.


125-142: Based on verification, the review comment contains both valid and invalid concerns:

Valid:

  • compareTo includes fields (startLine, startCharacter, endLine, endCharacter) not included in equals/hashCode, which violates Comparable contract consistency
  • symbolKind comparison is redundant (always SymbolKind.Method per @Builder.Default)

Invalid/Problematic:

  • The concern about DocumentContext requiring Comparable is incorrect—DocumentContext implements Comparable (verified line 86), so thenComparing(MethodSymbol::getOwner) compiles without issue
  • The suggested fix removes null safety by dropping the null check, but the parameter is annotated @nullable—this would introduce a potential NullPointerException
  • The concern about TreeSet/TreeMap undefined behavior is theoretical—no TreeSet or TreeMap with MethodSymbol as key exists in the codebase; all such usages found are for String types
  • The suggested diff contradicts the @nullable annotation on the parameter

Critical issue with suggested fix: Removing the null check while keeping @nullable parameter violates Nullable contract and contradicts DocumentContext's own null-handling pattern (it uses @nonnull and no null check).


Ensure compareTo/equals consistency by comparing only declared @EqualsAndHashCode.Include fields.

The inconsistency is valid: compareTo includes startLine, startCharacter, endLine, endCharacter which are not in equals/hashCode. Also, symbolKind comparison is redundant (always Method).

Fix:

  @Override
  public int compareTo(@Nullable MethodSymbol other) {
    if (other == null) {
      return 1;
    }

    return java.util.Comparator.comparing(MethodSymbol::getName)
      .thenComparing(MethodSymbol::getOwner)
      .thenComparingInt(MethodSymbol::getSubNameLine)
      .thenComparingInt(MethodSymbol::getSubNameStartCharacter)
      .thenComparingInt(MethodSymbol::getSubNameEndCharacter)
      .compare(this, other);
  }

Remove symbolKind and full range (startLine/Character/endLine/endCharacter) comparisons. Keep null check since parameter is @nullable. Use thenComparingInt for primitive int comparisons (subName fields).

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (6)
src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/PermissionFilterBeforeSendCallback.java (1)

34-35: Reconsider @nonnull on Hint

hint isn’t used; enforcing non-null adds risk if SDK passes null. Keep @NonNull on event, drop it on hint unless the SDK guarantees non-null hints across all call paths.

If keeping it, please confirm the exact Sentry Java SDK version and its BeforeSendCallback contract.

Quick tweak:

-  public SentryEvent execute(@NonNull SentryEvent event, @NonNull Hint hint) {
+  public SentryEvent execute(@NonNull SentryEvent event, Hint hint) {

Also applies to: 74-80

src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/SymbolOccurrenceRepository.java (1)

69-71: Fix NPE and remove empty sets when deleting occurrences

occurrencesToSymbols.get(...).remove(...) will NPE if no set exists for the key, and empty sets remain in the map after removals. Use computeIfPresent and drop empty sets.

Apply minimal safe fix:

-  public void deleteAll(Set<SymbolOccurrence> symbolOccurrences) {
-    symbolOccurrences.forEach(symbolOccurrence ->
-      occurrencesToSymbols.get(symbolOccurrence.symbol()).remove(symbolOccurrence)
-    );
-  }
+  public void deleteAll(Set<SymbolOccurrence> symbolOccurrences) {
+    symbolOccurrences.forEach(symbolOccurrence ->
+      occurrencesToSymbols.computeIfPresent(symbolOccurrence.symbol(), (s, set) -> {
+        set.remove(symbolOccurrence);
+        return set.isEmpty() ? null : set; // null => remove mapping
+      })
+    );
+  }

Optional optimization: reduce map lookups by grouping by symbol.

+  public void deleteAll(Set<SymbolOccurrence> symbolOccurrences) {
+    var bySymbol = new java.util.HashMap<Symbol, java.util.Set<SymbolOccurrence>>();
+    for (var occ : symbolOccurrences) {
+      bySymbol.computeIfAbsent(occ.symbol(), k -> new java.util.HashSet<>()).add(occ);
+    }
+    bySymbol.forEach((symbol, toRemove) ->
+      occurrencesToSymbols.computeIfPresent(symbol, (s, set) -> {
+        set.removeAll(toRemove);
+        return set.isEmpty() ? null : set;
+      })
+    );
+  }
src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/SymbolOccurrence.java (2)

36-40: Add compact constructor to enforce non-null invariants.

The record components can be null, which may cause NPEs in compareTo and other downstream code. Add validation in a compact constructor.

Apply this diff to add non-null validation:

 ) implements Comparable<SymbolOccurrence> {
+  public SymbolOccurrence {
+    java.util.Objects.requireNonNull(occurrenceType, "occurrenceType");
+    java.util.Objects.requireNonNull(symbol, "symbol");
+    java.util.Objects.requireNonNull(location, "location");
+  }

Based on past review comments.


43-54: Comparable contract: reject null arguments.

The compareTo method should not accept null per the Comparable contract. Remove @Nullable and let it throw NullPointerException for null arguments.

Apply this diff:

-  public int compareTo(@Nullable SymbolOccurrence other) {
-    if (other == null) {
-      return 1;
-    }
+  public int compareTo(SymbolOccurrence other) {
+    java.util.Objects.requireNonNull(other, "other");

Based on past review comments.

src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/Symbol.java (2)

42-48: Add compact constructor to enforce non-null invariants.

The record components may be null, which can cause NPEs in compareTo and other code. Add validation in a compact constructor.

Apply this diff to add non-null validation:

 ) implements Comparable<Symbol> {
+  public Symbol {
+    java.util.Objects.requireNonNull(mdoRef, "mdoRef");
+    java.util.Objects.requireNonNull(moduleType, "moduleType");
+    java.util.Objects.requireNonNull(scopeName, "scopeName");
+    java.util.Objects.requireNonNull(symbolKind, "symbolKind");
+    java.util.Objects.requireNonNull(symbolName, "symbolName");
+  }

Based on past review comments.


57-68: Comparable contract: reject null arguments.

The compareTo method should not accept null per the Comparable contract. Remove @Nullable and let it throw NullPointerException for null arguments.

Apply this diff:

-  public int compareTo(@Nullable Symbol other) {
-    if (other == null) {
-      return 1;
-    }
+  public int compareTo(Symbol other) {
+    java.util.Objects.requireNonNull(other, "other");

Based on past review comments.

🧹 Nitpick comments (8)
src/test/java/com/github/_1c_syntax/bsl/languageserver/BSLTextDocumentServiceTest.java (2)

144-152: Consider adding document setup and verifying rename functionality.

The test operates on a potentially unopened document and only asserts non-null, unlike testDiagnosticsKnownFile (line 117) which calls didOpen() first. Consider:

  • Opening the document with doOpen() before testing rename
  • Verifying the actual rename result (e.g., checking WorkspaceEdit contains expected changes)

Apply this diff to improve the test:

 @Test
-void testRename() {
+void testRename() throws IOException {
+  doOpen();
+
   var params = new RenameParams();
   params.setTextDocument(getTextDocumentIdentifier());
   params.setPosition(new Position(0, 16));
+  params.setNewName("newName");

   var result = textDocumentService.rename(params);

   assertThat(result).isNotNull();
+  assertThat(result.getChanges()).isNotEmpty();
 }

155-163: Consider adding document setup and verifying prepareRename functionality.

Similar to testRename, this test operates without opening the document first and only checks for non-null. Consider:

  • Opening the document with doOpen() before testing prepareRename
  • Verifying the result contains the expected range or placeholder

Apply this diff to improve the test:

 @Test
-void testRenamePrepare() {
+void testRenamePrepare() throws IOException {
+  doOpen();
+
   var params = new PrepareRenameParams();
   params.setTextDocument(getTextDocumentIdentifier());
   params.setPosition(new Position(0, 16));

   var result = textDocumentService.prepareRename(params);

   assertThat(result).isNotNull();
+  // Verify the result is an Either with left (Range) or right (PrepareRenameResult)
+  assertThat(result.isLeft() || result.isRight()).isTrue();
 }
src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/databind/ParametersDeserializer.java (1)

79-82: Simplify deserialization; avoid extra TypeFactory dance

Use convertValue with TypeReference (or use the parser’s codec) for clarity and to honor mapper modules.

-      JavaType type = mapper.getTypeFactory().constructType(new TypeReference<Map<String, Object>>() {
-      });
-      parameterConfiguration = mapper.readValue(mapper.treeAsTokens(parameterConfig), type);
+      parameterConfiguration = mapper.convertValue(
+        parameterConfig,
+        new TypeReference<Map<String, Object>>() {}
+      );

Or, prefer the parser’s codec to keep configuration consistent:

-    var mapper = new ObjectMapper();
+    var mapper = (ObjectMapper) p.getCodec();
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/TypeDescription.java (1)

27-44: Make record components defensively safe

Consider validating non-null components and copying the list to enforce immutability.

-public record TypeDescription(
-  String name,
-  String description,
-  List<ParameterDescription> parameters,
-  String link,
-  boolean isHyperlink
-) {
+public record TypeDescription(
+  String name,
+  String description,
+  List<ParameterDescription> parameters,
+  String link,
+  boolean isHyperlink
+) {
+  public TypeDescription {
+    // null-safety
+    if (name == null) throw new NullPointerException("name");
+    if (parameters == null) parameters = List.of();
+    // defensive copy
+    parameters = List.copyOf(parameters);
+  }
 }
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/ParameterDescription.java (2)

36-36: Harden record invariants: null-safety + defensive copies

Ensure name is non-null and types is immutable to callers.

Apply:

@@
 package com.github._1c_syntax.bsl.languageserver.context.symbol.description;
 
 import java.util.List;
+import java.util.Objects;
 
@@
-public record ParameterDescription(String name, List<TypeDescription> types, String link, boolean isHyperlink) {
+public record ParameterDescription(String name, List<TypeDescription> types, String link, boolean isHyperlink) {
+  public ParameterDescription {
+    Objects.requireNonNull(name, "name");
+    types = (types == null) ? List.of() : List.copyOf(types);
+  }
 }

26-35: Javadoc formatting nit

The TODO line alignment is off; consider reflowing or moving to an implNote to keep API docs tidy.

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/ComplexitySecondaryLocation.java (1)

35-35: Guard against nulls in value object

Range/message should never be null; make it explicit.

Apply:

@@
 package com.github._1c_syntax.bsl.languageserver.context.computer;
 
 import org.eclipse.lsp4j.Range;
+import java.util.Objects;
@@
-public record ComplexitySecondaryLocation(Range range, String message) {
+public record ComplexitySecondaryLocation(Range range, String message) {
+  public ComplexitySecondaryLocation {
+    Objects.requireNonNull(range, "range");
+    Objects.requireNonNull(message, "message");
+  }
 }
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/ComplexityData.java (1)

41-47: Make ComplexityData truly immutable and null-safe

Copy incoming collections and default nulls to empty; wrap nested lists.

Apply:

@@
 package com.github._1c_syntax.bsl.languageserver.context.computer;
 
 import com.github._1c_syntax.bsl.languageserver.context.symbol.MethodSymbol;
 
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
@@
 public record ComplexityData(
   int fileComplexity,
   int fileCodeBlockComplexity,
   List<ComplexitySecondaryLocation> fileBlockComplexitySecondaryLocations,
   Map<MethodSymbol, Integer> methodsComplexity,
   Map<MethodSymbol, List<ComplexitySecondaryLocation>> methodsComplexitySecondaryLocations
 ) {
+  public ComplexityData {
+    fileBlockComplexitySecondaryLocations =
+      fileBlockComplexitySecondaryLocations == null ? List.of() : List.copyOf(fileBlockComplexitySecondaryLocations);
+
+    methodsComplexity = methodsComplexity == null ? Map.of() : Map.copyOf(methodsComplexity);
+
+    methodsComplexitySecondaryLocations =
+      methodsComplexitySecondaryLocations == null
+        ? Map.of()
+        : methodsComplexitySecondaryLocations.entrySet().stream()
+          .collect(Collectors.toUnmodifiableMap(
+            Map.Entry::getKey,
+            e -> {
+              var v = e.getValue();
+              return v == null ? List.of() : List.copyOf(v);
+            }
+          ));
+  }
 }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 989f08d and 1950f9f.

📒 Files selected for processing (75)
  • build.gradle.kts (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLLSPLauncher.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/PermissionFilterBeforeSendCallback.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/SentryScopeConfigurer.java (0 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/AbstractRunTestsCodeLensSupplier.java (0 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplier.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplier.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/databind/ParametersDeserializer.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/events/LanguageServerConfigurationChangedEvent.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/DocumentContext.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/ComplexityData.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/ComplexitySecondaryLocation.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputer.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/events/DocumentContextContentChangedEvent.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/events/ServerContextPopulatedEvent.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/MethodSymbol.java (4 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/annotations/AnnotationParameterDefinition.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/annotations/CompilerDirectiveKind.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/DescriptionReader.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/ParameterDescription.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/TypeDescription.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/variable/VariableDescription.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CognitiveComplexityDiagnostic.java (4 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CyclomaticComplexityDiagnostic.java (4 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DuplicatedInsertionIntoCollectionDiagnostic.java (6 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/LineLengthDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingCommonModuleMethodDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingParameterDescriptionDiagnostic.java (4 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingReturnedValueDescriptionDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RefOveruseDiagnostic.java (0 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesDiagnostic.java (0 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RewriteMethodParameterDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/SetPermissionsForNewObjectsDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TimeoutsInExternalResourcesDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TransferringParametersBetweenClientAndServerDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UnreachableCodeDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/WrongDataPathForFormElementsDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/events/LanguageServerInitializeRequestReceivedEvent.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/AnnotationParamSymbolMarkupContentBuilder.java (0 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/DescriptionFormatter.java (4 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/AbstractComplexityInlayHintSupplier.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/CognitiveComplexityInlayHintSupplier.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/CyclomaticComplexityInlayHintSupplier.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/SourceDefinedMethodCallInlayHintSupplier.java (0 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/AnnotationReferenceFinder.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/ReferenceIndex.java (5 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/Location.java (0 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/LocationRepository.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/Symbol.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/SymbolOccurrence.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/SymbolOccurrenceRepository.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/reporters/data/FileInfo.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/Trees.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/TernaryOperatorNode.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/BSLLSPLauncherTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/BSLTextDocumentServiceTest.java (2 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/aop/measures/MeasureCollectorTest.java (2 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplierTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplierTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/context/DocumentContextTest.java (2 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/CognitiveComplexityComputerTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/CyclomaticComplexityComputerTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputerTest.java (3 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/VariableSymbolTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/MethodDescriptionTest.java (6 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DiagnosticInfosTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/EmptyStatementDiagnosticTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/SmokyTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ThisObjectAssignDiagnosticTest.java (0 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/hover/DescriptionFormatterTest.java (0 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/util/assertions/ColorInformationsAssert.java (3 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/util/assertions/ColorPresentationsAssert.java (2 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/util/assertions/FoldingRangesAssert.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitorTest.java (1 hunks)
💤 Files with no reviewable changes (9)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RefOveruseDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/Location.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/AbstractRunTestsCodeLensSupplier.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/hover/DescriptionFormatterTest.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/SentryScopeConfigurer.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ThisObjectAssignDiagnosticTest.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/SourceDefinedMethodCallInlayHintSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/AnnotationParamSymbolMarkupContentBuilder.java
✅ Files skipped from review due to trivial changes (1)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DiagnosticInfosTest.java
🚧 Files skipped from review as they are similar to previous changes (32)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/EmptyStatementDiagnosticTest.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TransferringParametersBetweenClientAndServerDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/Trees.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/events/LanguageServerConfigurationChangedEvent.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/util/assertions/ColorPresentationsAssert.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/reporters/data/FileInfo.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/CyclomaticComplexityInlayHintSupplier.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitorTest.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CognitiveComplexityDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/LocationRepository.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingReturnedValueDescriptionDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/AnnotationReferenceFinder.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/SmokyTest.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/variable/VariableDescription.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/CognitiveComplexityComputerTest.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputer.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/WrongDataPathForFormElementsDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplier.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplierTest.java
  • build.gradle.kts
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/annotations/AnnotationParameterDefinition.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/MethodSymbol.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/events/DocumentContextContentChangedEvent.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UnreachableCodeDiagnostic.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplierTest.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/util/assertions/FoldingRangesAssert.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/events/LanguageServerInitializeRequestReceivedEvent.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/AbstractComplexityInlayHintSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLLSPLauncher.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingCommonModuleMethodDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TimeoutsInExternalResourcesDiagnostic.java
🧰 Additional context used
🧬 Code graph analysis (2)
src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/Symbol.java (1)
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/AbstractVariableSymbol.java (1)
  • Builder (121-207)
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CyclomaticComplexityDiagnostic.java (1)
src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/RelatedInformation.java (1)
  • RelatedInformation (36-54)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: build
  • GitHub Check: Analyse
  • GitHub Check: build (21, windows-latest)
  • GitHub Check: build (23, ubuntu-latest)
  • GitHub Check: build (23, windows-latest)
  • GitHub Check: build (21, macOS-latest)
  • GitHub Check: build (21, ubuntu-latest)
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build (23, macOS-latest)
  • GitHub Check: build (17, windows-latest)
  • GitHub Check: build (23, windows-latest)
  • GitHub Check: build (21, windows-latest)
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build (17, windows-latest)
  • GitHub Check: build (23, ubuntu-latest)
  • GitHub Check: build (23, macOS-latest)
  • GitHub Check: build (17, macOS-latest)
  • GitHub Check: build (21, ubuntu-latest)
  • GitHub Check: build (21, macOS-latest)
  • GitHub Check: Benchmark
🔇 Additional comments (26)
src/test/java/com/github/_1c_syntax/bsl/languageserver/BSLLSPLauncherTest.java (1)

69-69: Good cleanup removing unnecessary exception declaration.

The throws Exception clause was unnecessary since no checked exceptions are thrown outside the assertThatThrownBy lambda. This aligns with the PR's Sonar fixes objective.

src/test/java/com/github/_1c_syntax/bsl/languageserver/util/assertions/ColorInformationsAssert.java (1)

43-79: LGTM! Documentation formatting improvements.

The Javadoc changes consistently remove parentheses around "см." across all three methods, resulting in cleaner parameter documentation. The changes align well with the PR's cleanup objectives.

src/test/java/com/github/_1c_syntax/bsl/languageserver/aop/measures/MeasureCollectorTest.java (1)

25-25: LGTM! Modern AssertJ assertion pattern.

The migration from .asList() to .asInstanceOf(InstanceOfAssertFactories.LIST) improves type safety and follows current AssertJ best practices. The necessary import has been correctly added.

Also applies to: 74-74

src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/TernaryOperatorNode.java (1)

42-47: Good practice: enforcing factory method usage.

Making the constructor private when using Lombok's staticConstructor is a best practice that ensures all instantiation goes through the create() factory method. Verification confirms no breaking changes—the codebase already uses the factory pattern correctly, with no direct constructor calls or subclasses.

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/annotations/CompilerDirectiveKind.java (2)

25-25: Clean refactoring to Lombok-generated getter.

The addition of the @Getter annotation and corresponding import correctly replaces the manual getter method, reducing boilerplate while maintaining the same functionality.

Also applies to: 41-42


48-52: Correct usage of Lombok-generated getter.

The of() method correctly calls getTokenType(), which will be generated by Lombok at compile time. No changes needed here.

src/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/VariableSymbolTest.java (1)

97-97: Good improvement using .isEmpty() instead of .equals("").

This aligns with SonarQube best practices (rule S1155) and is more idiomatic Java.

The VariableDescription class uses Lombok's @Value annotation, which generates traditional getters (getDescription(), etc.), not fluent accessors. The test file correctly uses getDescription() throughout and requires no changes.

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/events/ServerContextPopulatedEvent.java (1)

27-38: Good modernization: @serial on serialVersionUID

Correct usage; aligns with JDK 14+ best practices and other event classes. No behavior change.

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/LineLengthDiagnostic.java (1)

136-140: Predicate simplification looks correct

Logic matches the comment and prior behavior; cleaner and equivalent.

src/test/java/com/github/_1c_syntax/bsl/languageserver/context/DocumentContextTest.java (2)

114-121: LGTM: no longer declaring IOException

Method doesn’t throw; signature cleanup is appropriate.


152-158: LGTM: style-only tweak

Indent/format change inside lambda; no behavior change.

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/SetPermissionsForNewObjectsDiagnostic.java (1)

70-76: No critical issues found—accessor is confirmed working correctly

The code at line 71 uses setForNewObjects() in a filter context, which requires a boolean return value. The fact that this code compiles and executes proves the method is correctly functioning as a boolean accessor, despite the unconventional set* naming convention from mdclasses.

The optional refactor to trim/normalize role names in getSetFromString() is a nice-to-have for robustness but not required.

src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplier.java (1)

45-48: LGTM: uses record accessor methodsComplexity()

Matches ComplexityData record API; no functional change.

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/DescriptionReader.java (1)

129-130: LGTM: switch to types() accessor

Consistent with ParameterDescription as a record; result type unchanged.

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/DocumentContext.java (1)

429-431: Verification complete: accessor switch to record API is correct and complete

No legacy getFileComplexity() calls remain in the codebase. The getMethodsComplexity() usages in code lens suppliers are legitimate accessor calls for the record component—not leftover legacy methods. The migration from traditional getters to record accessors is consistent and properly applied.

src/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/CyclomaticComplexityComputerTest.java (1)

52-53: No issues found—test correctly uses methodsComplexity() accessor

The test has been properly updated to call the accessor on the ComplexityData record, which is automatically generated for the methodsComplexity field. This matches the production API, which already uses this accessor in four locations across the codebase. Assertions remain intact.

src/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputerTest.java (2)

179-179: Consistent accessor updates across annotation parameter checks — OK

value() usage is consistent with the refactor.

Also applies to: 186-186, 193-193


272-275: Removing checked exception from testOwner is appropriate

No IO here; cleaner signature.

As PR checklist items for tests/precommit aren’t checked, please run them locally.

src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/CognitiveComplexityInlayHintSupplier.java (1)

47-50: Accessor rename verified—no stale usages found

Grep confirmed the old getMethodsComplexitySecondaryLocations() method has no remaining references in the codebase. The new methodsComplexitySecondaryLocations() accessor is properly defined and consistently used across all four call sites (InlayHintSupplier and Diagnostic classes).

src/main/java/com/github/_1c_syntax/bsl/languageserver/references/ReferenceIndex.java (1)

112-114: LGTM! Accessor migration is consistent.

The migration from Lombok-generated getters to record component accessors (location(), symbol(), occurrenceType(), mdoRef(), moduleType(), symbolName(), etc.) is correctly applied throughout the file. The logic remains unchanged.

Also applies to: 140-143, 247-256, 260-275, 279-293

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DuplicatedInsertionIntoCollectionDiagnostic.java (2)

93-96: LGTM! Lombok @value class correctly converted to record.

The GroupingData nested class has been successfully migrated from a Lombok-annotated class to a private record with all components properly declared.


319-319: LGTM! Simplified collector usage.

The change from Collectors.toUnmodifiableList() to .toList() is appropriate, as .toList() (Java 16+) returns an unmodifiable list by default.

Also applies to: 328-328, 337-337

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CyclomaticComplexityDiagnostic.java (1)

74-87: LGTM! Accessor migration is consistent.

All method calls have been correctly updated to use the new fluent accessors from the ComplexityData and ComplexitySecondaryLocation records (methodsComplexity(), methodsComplexitySecondaryLocations(), fileCodeBlockComplexity(), range(), message()).

Also applies to: 93-104, 126-157

src/test/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/MethodDescriptionTest.java (1)

87-143: LGTM! Test assertions updated consistently.

All test assertions have been correctly updated to use the new fluent accessors (name(), types(), description(), parameters(), link()) instead of the previous getter-style methods. The test logic and coverage remain unchanged.

Also applies to: 157-162, 265-427

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingParameterDescriptionDiagnostic.java (1)

108-112: LGTM! Accessor migration is consistent.

All usages of ParameterDescription have been correctly updated to use the new fluent accessors (name(), types()) instead of the previous getter methods.

Also applies to: 123-125, 142-142, 158-158

src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/DescriptionFormatter.java (1)

242-244: LGTM! Accessor migration is consistent.

All method calls have been correctly updated to use the new fluent accessors from ParameterDescription and TypeDescription records (types(), name(), description(), parameters(), link()).

Also applies to: 283-287, 289-303, 319-334, 349-364

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (2)
src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/PermissionFilterBeforeSendCallback.java (1)

74-74: Remove @NonNull from the hint parameter to avoid unnecessary overhead and potential NPE.

This concern was already raised in a previous review: the hint parameter is marked @NonNull but is never used in the method body (lines 75-79), creating unnecessary null-check overhead. Additionally, depending on the Sentry Java SDK version and call scenarios, the hint may be passed as null, which would cause a Lombok-enforced NullPointerException.

Consider removing @NonNull from the hint parameter while keeping it on event (which is actually used):

-  public SentryEvent execute(@NonNull SentryEvent event, @NonNull Hint hint) {
+  public SentryEvent execute(@NonNull SentryEvent event, Hint hint) {
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingCommonModuleMethodDiagnostic.java (1)

107-115: Critical: Fix record accessor syntax on line 109.

Line 109 uses direct field access callData.exists instead of the record accessor method callData.exists(). This will cause a compilation error since Java records only expose accessor methods, not public fields.

Apply this diff:

   private void fireIssue(CallData callData) {
     final String message;
-    if (!callData.exists) {
+    if (!callData.exists()) {
       message = info.getMessage(callData.methodName(), callData.moduleName());
     } else {
       message = info.getResourceString(PRIVATE_METHOD_MESSAGE, callData.methodName(), callData.moduleName());
     }
     diagnosticStorage.addDiagnostic(callData.moduleMethodRange(), message);
   }
🧹 Nitpick comments (8)
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/annotations/CompilerDirectiveKind.java (1)

41-42: LGTM! Lombok-generated getter replaces manual implementation.

The @Getter annotation will generate the same public int getTokenType() method that was previously implemented manually, maintaining the existing API. The usage at line 50 remains compatible.

Optional consideration: While functionally correct, using Lombok on enum fields is less common since enums are typically simple and self-contained. However, this is a valid choice that reduces boilerplate and is consistent if Lombok is already used throughout the codebase.

src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DiagnosticInfosTest.java (2)

78-79: Consider applying this pattern consistently across all similar tests.

The refactored allSatisfy approach is cleaner and more idiomatic than the previous assertThatCode().doesNotThrowAnyException() pattern. However, other similar tests in this file (testAddDiagnosticsHaveDiagnosticName at lines 64-66, testAllDiagnosticsHaveDiagnosticMessage at lines 71-73, and testAllDiagnosticsHaveTags at lines 84-89) still use the older pattern, creating inconsistency.

Consider either:

  • Reverting this change to match the existing pattern, OR
  • Applying the allSatisfy pattern to the other similar tests for consistency

If you'd like to standardize on allSatisfy, here's an example for testAddDiagnosticsHaveDiagnosticName:

-    assertThatCode(() -> diagnosticInfos.values().forEach(diagnosticInfo
-      -> assertThat(diagnosticInfo.getName()).isNotEmpty()))
-      .doesNotThrowAnyException();
+    assertThat(diagnosticInfos)
+      .allSatisfy((key, diagnosticInfo) -> assertThat(diagnosticInfo.getName()).isNotEmpty());

79-79: Unused parameter key.

The key parameter in the lambda is declared but never used. Consider using an underscore to indicate it's intentionally unused, if your Java version supports it (Java 22+), or simply acknowledge that it's required by the BiConsumer signature.

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RewriteMethodParameterDiagnostic.java (2)

139-141: Simplify Optional flow; avoid map(...).get() on Optional.

You already checked presence above. Call the predicate directly on the unwrapped RuleNode for clarity and to keep static analyzers calm.

-          boolean isSelfAssign = refContextInsideDefAssign
-            .map(RewriteMethodParameterDiagnostic::isVarNameOnlyIntoExpression)
-            .get();
+          boolean isSelfAssign = isVarNameOnlyIntoExpression(refContextInsideDefAssign.get());

130-149: Minor naming nit: “isOverwrited” → “isOverwritten”.

Private method, so safe to rename for readability when convenient.

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/MethodSymbol.java (2)

66-80: Avoid generating private getters; use field lambdas in comparator

These getters exist only for the comparator method refs. Switching to field lambdas (thenComparingInt(m -> m.subNameLine), etc.) removes the need to generate extra methods.

Apply this diff to suppress getter generation for internal fields:

-  @Getter(AccessLevel.PRIVATE)
+  @Getter(AccessLevel.NONE)
   int startLine;
-  @Getter(AccessLevel.PRIVATE)
+  @Getter(AccessLevel.NONE)
   int startCharacter;
-  @Getter(AccessLevel.PRIVATE)
+  @Getter(AccessLevel.NONE)
   int endLine;
-  @Getter(AccessLevel.PRIVATE)
+  @Getter(AccessLevel.NONE)
   int endCharacter;
-  @Getter(AccessLevel.PRIVATE)
+  @Getter(AccessLevel.NONE)
   int subNameLine;
-  @Getter(AccessLevel.PRIVATE)
+  @Getter(AccessLevel.NONE)
   int subNameStartCharacter;
-  @Getter(AccessLevel.PRIVATE)
+  @Getter(AccessLevel.NONE)
   int subNameEndCharacter;

29-29: Consider NonNull for compareTo parameter

Accepting null in compareTo is unconventional; typical practice is to disallow and let callers use null-friendly Comparators when needed.

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/variable/VariableDescription.java (1)

99-109: Add a null guard for ParameterDescription in ctor

Defensive check avoids surprising NPEs at call sites and matches style used elsewhere (requireNonNull).

Apply:

-  public VariableDescription(ParameterDescription param) {
+  public VariableDescription(ParameterDescription param) {
 
-    description = "";
+    requireNonNull(param, "param");
+    description = "";
     deprecationInfo = "";
     deprecated = false;
     purposeDescription = "";
     range = Ranges.create();
-    link = param.link();
+    link = param.link();
     trailingDescription = Optional.empty();
 
   }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 90c05da and d4eade6.

📒 Files selected for processing (75)
  • build.gradle.kts (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLLSPLauncher.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/PermissionFilterBeforeSendCallback.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/SentryScopeConfigurer.java (0 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/AbstractRunTestsCodeLensSupplier.java (0 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplier.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplier.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/databind/ParametersDeserializer.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/events/LanguageServerConfigurationChangedEvent.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/DocumentContext.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/ComplexityData.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/ComplexitySecondaryLocation.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputer.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/events/DocumentContextContentChangedEvent.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/events/ServerContextPopulatedEvent.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/MethodSymbol.java (4 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/annotations/AnnotationParameterDefinition.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/annotations/CompilerDirectiveKind.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/DescriptionReader.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/ParameterDescription.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/TypeDescription.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/variable/VariableDescription.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CognitiveComplexityDiagnostic.java (4 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CyclomaticComplexityDiagnostic.java (4 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DuplicatedInsertionIntoCollectionDiagnostic.java (6 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/LineLengthDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingCommonModuleMethodDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingParameterDescriptionDiagnostic.java (4 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingReturnedValueDescriptionDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RefOveruseDiagnostic.java (0 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesDiagnostic.java (0 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RewriteMethodParameterDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/SetPermissionsForNewObjectsDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TimeoutsInExternalResourcesDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TransferringParametersBetweenClientAndServerDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UnreachableCodeDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/WrongDataPathForFormElementsDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/events/LanguageServerInitializeRequestReceivedEvent.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/AnnotationParamSymbolMarkupContentBuilder.java (0 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/DescriptionFormatter.java (4 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/AbstractComplexityInlayHintSupplier.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/CognitiveComplexityInlayHintSupplier.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/CyclomaticComplexityInlayHintSupplier.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/SourceDefinedMethodCallInlayHintSupplier.java (0 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/AnnotationReferenceFinder.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/ReferenceIndex.java (5 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/Location.java (0 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/LocationRepository.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/Symbol.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/SymbolOccurrence.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/SymbolOccurrenceRepository.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/reporters/data/FileInfo.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/Trees.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/TernaryOperatorNode.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/BSLLSPLauncherTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/BSLTextDocumentServiceTest.java (2 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/aop/measures/MeasureCollectorTest.java (2 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplierTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplierTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/context/DocumentContextTest.java (2 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/CognitiveComplexityComputerTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/CyclomaticComplexityComputerTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputerTest.java (3 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/VariableSymbolTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/MethodDescriptionTest.java (6 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DiagnosticInfosTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/EmptyStatementDiagnosticTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/SmokyTest.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ThisObjectAssignDiagnosticTest.java (0 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/hover/DescriptionFormatterTest.java (0 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/util/assertions/ColorInformationsAssert.java (3 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/util/assertions/ColorPresentationsAssert.java (2 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/util/assertions/FoldingRangesAssert.java (1 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitorTest.java (1 hunks)
💤 Files with no reviewable changes (9)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/Location.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/AbstractRunTestsCodeLensSupplier.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ThisObjectAssignDiagnosticTest.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/SourceDefinedMethodCallInlayHintSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RefOveruseDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/SentryScopeConfigurer.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ReservedParameterNamesDiagnostic.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/hover/DescriptionFormatterTest.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/AnnotationParamSymbolMarkupContentBuilder.java
✅ Files skipped from review due to trivial changes (1)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/util/assertions/ColorPresentationsAssert.java
🚧 Files skipped from review as they are similar to previous changes (27)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplierTest.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingReturnedValueDescriptionDiagnostic.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/EmptyStatementDiagnosticTest.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/BSLTextDocumentServiceTest.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/SymbolOccurrenceRepository.java
  • build.gradle.kts
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/BSLLSPLauncherTest.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/aop/measures/MeasureCollectorTest.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/CyclomaticComplexityInlayHintSupplier.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/util/assertions/FoldingRangesAssert.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/LocationRepository.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputerTest.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/reporters/data/FileInfo.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/LineLengthDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/AnnotationReferenceFinder.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitorTest.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/databind/ParametersDeserializer.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/CognitiveComplexityComputerTest.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/AbstractComplexityInlayHintSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UnreachableCodeDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CognitiveComplexityDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TimeoutsInExternalResourcesDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/ReferenceIndex.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/context/DocumentContextTest.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/events/DocumentContextContentChangedEvent.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CyclomaticComplexityDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-10-27T08:05:10.053Z
Learnt from: theshadowco
PR: 1c-syntax/bsl-language-server#3555
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RewriteMethodParameterDiagnostic.java:163-166
Timestamp: 2025-10-27T08:05:10.053Z
Learning: В проекте bsl-language-server используется собственная версия ANTLR4, в которой интерфейс TerminalNode переопределяет метод getParent() с возвращаемым типом RuleNode вместо ParseTree (как в стандартной версии ANTLR4).

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RewriteMethodParameterDiagnostic.java
📚 Learning: 2025-04-18T22:42:30.042Z
Learnt from: nixel2007
PR: 1c-syntax/bsl-language-server#3449
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java:88-97
Timestamp: 2025-04-18T22:42:30.042Z
Learning: В реализации ANTLR, если метод `getChildCount()` возвращает значение больше 0, то поле `children` гарантированно не равно null.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RewriteMethodParameterDiagnostic.java
🧬 Code graph analysis (1)
src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/Symbol.java (1)
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/AbstractVariableSymbol.java (1)
  • Builder (121-207)
🔇 Additional comments (41)
src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLLSPLauncher.java (1)

134-136: LGTM! Clean migration to modern Java Stream API.

The replacement of .collect(Collectors.toList()) with .toList() is a good simplification. Since unmatchedArgs is only read after creation (checked for emptiness and iterated), the unmodifiable nature of the returned list is appropriate and enhances safety.

src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/SmokyTest.java (1)

75-75: LGTM! Unnecessary exception declaration removed.

The throws Exception clause was unnecessary since the method body doesn't throw any checked exceptions directly—assertThatThrownBy() handles exception catching internally. This cleanup improves code quality and aligns with best practices.

src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/Trees.java (1)

393-405: Good refactor using pattern matching.

Using the parserRuleContext pattern variable directly eliminates the redundant cast and makes the code cleaner. This is idiomatic modern Java.

src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/events/LanguageServerConfigurationChangedEvent.java (1)

27-28: LGTM! Proper use of @serial annotation.

The addition of the @Serial annotation on serialVersionUID follows Java serialization best practices and likely addresses SonarQube recommendations mentioned in the PR title.

Also applies to: 36-37

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/events/ServerContextPopulatedEvent.java (1)

27-28: LGTM! Consistent with serialization best practices.

The @Serial annotation is correctly applied, maintaining consistency with other event classes in this PR.

Also applies to: 37-38

src/main/java/com/github/_1c_syntax/bsl/languageserver/events/LanguageServerInitializeRequestReceivedEvent.java (1)

29-30: LGTM! Proper serialization metadata annotation.

The @Serial annotation is correctly applied to serialVersionUID, consistent with the other event classes reviewed in this PR.

Also applies to: 38-39

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/annotations/CompilerDirectiveKind.java (1)

25-25: LGTM!

The Lombok import is correctly added to support the @Getter annotation.

src/test/java/com/github/_1c_syntax/bsl/languageserver/util/assertions/ColorInformationsAssert.java (1)

43-43: LGTM! Minor documentation formatting cleanup.

The removal of parentheses around "см." in the Javadoc @param tags improves readability and consistency. This is a minor but appropriate cleanup that aligns with the PR's objective of addressing sonar fixes.

Also applies to: 57-57, 71-72

src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/PermissionFilterBeforeSendCallback.java (1)

34-34: Import addition is appropriate.

The lombok.NonNull import is necessary for the parameter annotations added on line 74.

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DuplicatedInsertionIntoCollectionDiagnostic.java (2)

93-96: Excellent modernization from Lombok to Java records!

The migration from Lombok's @Value annotation to a Java record is well-executed. Records provide the same immutability guarantees while offering more concise syntax. All accessor method references have been correctly updated from getter-style (getCollectionName(), getMethodName(), getFirstParamName(), getCallStatement()) to fluent record accessors (collectionName(), methodName(), firstParamName(), callStatement()).

Also applies to: 180-180, 183-183, 186-186, 305-305


319-319: Clean simplification with Stream.toList()!

Replacing Collectors.toUnmodifiableList() with .toList() is a good modernization. Both return unmodifiable lists, but .toList() is more concise and idiomatic in Java 16+. The usage patterns confirm these collections are never modified after creation.

Also applies to: 328-328, 337-337

src/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/VariableSymbolTest.java (1)

97-97: LGTM! Improved idiomatic check.

Using isEmpty() instead of comparing to an empty string is more idiomatic and clearer in intent.

src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/TernaryOperatorNode.java (1)

42-42: Good encapsulation improvement aligning with Lombok best practices.

Changing the constructor from protected to private correctly enforces the use of the create() static factory method and prevents unintended subclassing, which aligns with the immutable value object pattern of @Value. Verification confirms no code depends on the protected constructor—no subclasses exist, no direct constructor calls exist, and the factory method is the intended access pattern.

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RewriteMethodParameterDiagnostic.java (2)

131-134: Good early-exit guard.

Prevents false positives when the first reference isn’t a definition. LGTM.


161-164: TerminalNode::getParent returning RuleNode is correct here.

With your custom ANTLR, this yields Optional<RuleNode> without extra casts. All good. Based on learnings.

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingCommonModuleMethodDiagnostic.java (3)

65-75: LGTM! Configuration check and fluent accessor usage are correct.

The early return for EMPTY configuration source is appropriate, and the stream pipeline correctly uses the new fluent accessors (occurrenceType(), symbol(), symbolKind(), moduleType()).


77-105: Accessor migrations look good overall.

The migration to fluent accessors is correctly applied throughout: symbol(), mdoRef(), moduleType(), symbolName(), location(), and getRange(). The logic for checking method existence and export status is preserved.

However, verify line 109 in the next code segment for proper record accessor syntax.


117-119: LGTM! CallData record definition is correct.

The record components are well-named and appropriately typed. The boolean flags (nonExport, exists) clearly distinguish between missing methods and private method access violations.

src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/Symbol.java (2)

42-54: Record migration looks good; consider past review suggestions for null-safety.

The migration from Lombok to a Java record is clean, and the interning mechanism is correctly updated to use the dedicated INTERNER instance.

Past reviews suggested adding a compact constructor to enforce non-null invariants on all components. While not critical for immediate merge, this would improve robustness and align with defensive programming practices.


57-68: compareTo implementation functional; stricter contract suggested in past reviews.

The current null-handling in compareTo (returning 1 for null) works but diverges from the typical Comparable contract, which expects non-null arguments. Past reviews recommended rejecting null with Objects.requireNonNull(other) and removing @Nullable.

This refactor can be deferred but would improve consistency with Java conventions.

src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/SymbolOccurrence.java (3)

25-25: LGTM! Nullable annotation updated to project standard.

The migration from javax.annotation.Nullable to edu.umd.cs.findbugs.annotations.Nullable aligns with the explicit spotbugs-annotations dependency and addresses the past review concern.


36-40: Record migration is correct; compact constructor suggested in past reviews.

The record definition is clean and well-documented. Past reviews recommended adding a compact constructor to validate non-null components, which would prevent latent NPEs. This is a recommended improvement but not blocking.


43-54: compareTo works; stricter contract recommended in past reviews.

The comparator chain correctly orders by location, occurrence type, and symbol. As with Symbol.java, past reviews suggested removing @Nullable and rejecting null arguments to align with the Comparable contract. This refactor can be deferred.

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/SetPermissionsForNewObjectsDiagnostic.java (1)

71-71: Method change verified as part of mdclasses API modernization.

The change from isSetForNewObjects() to setForNewObjects() is an intentional API modernization in the mdclasses dependency (version 0.16.1-rc.1). The method correctly returns a boolean and is used appropriately in the filter predicate at line 71. No other files require updates, and the behavior remains unchanged.

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/WrongDataPathForFormElementsDiagnostic.java (1)

65-67: The review comment is based on false premises and should be disregarded.

The AI summary incorrectly claimed the code changed from getDataPath().segments().startsWith("~") to getDataPath().startsWith("~"). Verification shows:

  1. No segments() method exists – Zero results in the entire codebase; this method never existed.
  2. DataPath is a String – Confirmed by external API documentation and web sources; it returns String type.
  3. No uncommitted changes – Git diff HEAD is empty; the file contains no pending modifications.
  4. Current code is correctformItem.getDataPath().startsWith("~") is the proper and only valid implementation for checking if a String path begins with "~".
  5. Test coverage confirms correctness – Existing tests validate that paths with "~" prefix are correctly flagged.

There is no behavioral change to verify; the current implementation is correct as-is.

Likely an incorrect or invalid review comment.

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/DocumentContext.java (1)

429-431: Accessor rename LGTM

Switch to fileComplexity() aligns with ComplexityData record API; no behavior change.

src/main/java/com/github/_1c_syntax/bsl/languageserver/inlayhints/CognitiveComplexityInlayHintSupplier.java (1)

47-50: API rename LGTM

Updated to methodsComplexitySecondaryLocations(); consistent with ComplexityData changes.

src/test/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplierTest.java (1)

69-71: Test update LGTM

methodsComplexity() accessor matches new public API.

src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CognitiveComplexityCodeLensSupplier.java (1)

47-47: LGTM! Accessor renamed to match record convention.

The change from getMethodsComplexity() to methodsComplexity() correctly aligns with Java record accessor naming.

src/test/java/com/github/_1c_syntax/bsl/languageserver/context/computer/CyclomaticComplexityComputerTest.java (1)

52-52: LGTM! Test updated for new record accessor.

The test correctly uses methodsComplexity() instead of the old getMethodsComplexity().

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputer.java (1)

327-327: LGTM! Updated to use record accessor.

The change from getName() to name() correctly reflects the ParameterDescription migration to a record.

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/DescriptionReader.java (1)

129-129: LGTM! Record accessor update.

The change from getTypes() to types() aligns with the ParameterDescription record conversion.

src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/CyclomaticComplexityCodeLensSupplier.java (1)

47-47: LGTM! Accessor renamed to match record convention.

The change from getMethodsComplexity() to methodsComplexity() correctly aligns with Java record accessor naming, consistent with the CognitiveComplexityCodeLensSupplier.

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/ParameterDescription.java (1)

27-36: LGTM! Clean migration to Java record.

The conversion from a Lombok-backed class to a Java record is correct. The Javadoc properly documents all record components, and the immutable semantics are appropriate for this value object.

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/ComplexitySecondaryLocation.java (1)

26-35: LGTM! Proper record conversion.

The migration to a Java record is correctly implemented with appropriate Javadoc. The two-component record with Range and String is well-suited for this immutable value object.

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/TypeDescription.java (1)

27-44: LGTM! Well-structured record conversion.

The migration to a Java record is correctly implemented. All five components are properly documented in the Javadoc, and the circular reference between TypeDescription and ParameterDescription is valid and appropriate for modeling nested type structures.

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/ComplexityData.java (1)

29-47: LGTM! Clean migration to Java record.

The conversion from Lombok-based POJO to Java record is well-executed. The record components are properly typed, and the Javadoc correctly documents all components using @param tags, which is the standard convention for records. This change should improve memory efficiency and reduce boilerplate.

src/test/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/MethodDescriptionTest.java (1)

86-427: LGTM! Comprehensive test updates aligned with new fluent accessors.

All test assertions have been systematically updated to use the new fluent accessor pattern (e.g., name(), types(), description(), parameters(), link() instead of their getter equivalents). The nested accessor chains are properly updated throughout, and the test logic remains unchanged—only the accessor names have been refactored to match the new record-based API.

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TransferringParametersBetweenClientAndServerDiagnostic.java (1)

171-173: LGTM! Well-structured internal record.

The migration of the ParamReference inner class from Lombok to a Java record is clean and appropriate. The record serves as a simple data carrier with three well-typed components, and all usage sites (lines 73-76) have been correctly updated to use the fluent component accessors.

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingParameterDescriptionDiagnostic.java (1)

108-158: LGTM! Consistent accessor updates throughout the diagnostic.

All references to ParameterDescription accessors have been correctly updated to use the new fluent API (name() and types() instead of getName() and getTypes()). The changes include both direct method calls and method references, maintaining consistency across the diagnostic logic.

src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/DescriptionFormatter.java (1)

242-361: LGTM! Thorough migration to fluent accessors across hover formatting.

The file has been comprehensively updated to use the new record-based fluent accessors for both ParameterDescription (name(), types()) and TypeDescription (name(), description(), parameters(), link()). All usage patterns—including method references, direct calls, and nested accessor chains—have been consistently updated while preserving the original formatting logic.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/MethodSymbol.java (1)

131-144: Remove getSymbolKind() from compareTo to be consistent with equals.

The compareTo method includes getSymbolKind() (line 138), which is not part of equals/hashCode. Only name, owner, and getSubNameRange() are included in equality (see @EqualsAndHashCode.Include annotations). This violates the Comparable contract and can break sorted collections like TreeSet.

Apply this diff to remove the inconsistent field:

   @Override
   public int compareTo(@Nullable MethodSymbol other) {
     if (other == null) {
       return 1;
     }

     return java.util.Comparator.comparing(MethodSymbol::getName)
-      .thenComparing(MethodSymbol::getSymbolKind)
       .thenComparing(MethodSymbol::getOwner)
       .thenComparingInt(m -> m.subNameLine)
       .thenComparingInt(m -> m.subNameStartCharacter)
       .thenComparingInt(m -> m.subNameEndCharacter)
       .compare(this, other);
   }
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d4eade6 and 5800db4.

📒 Files selected for processing (4)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/MethodSymbol.java (3 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/variable/VariableDescription.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RewriteMethodParameterDiagnostic.java (2 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DiagnosticInfosTest.java (2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-10-27T08:05:10.053Z
Learnt from: theshadowco
PR: 1c-syntax/bsl-language-server#3555
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RewriteMethodParameterDiagnostic.java:163-166
Timestamp: 2025-10-27T08:05:10.053Z
Learning: В проекте bsl-language-server используется собственная версия ANTLR4, в которой интерфейс TerminalNode переопределяет метод getParent() с возвращаемым типом RuleNode вместо ParseTree (как в стандартной версии ANTLR4).

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RewriteMethodParameterDiagnostic.java
📚 Learning: 2025-04-18T22:42:30.042Z
Learnt from: nixel2007
PR: 1c-syntax/bsl-language-server#3449
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java:88-97
Timestamp: 2025-04-18T22:42:30.042Z
Learning: В реализации ANTLR, если метод `getChildCount()` возвращает значение больше 0, то поле `children` гарантированно не равно null.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RewriteMethodParameterDiagnostic.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (21)
  • GitHub Check: Analyse
  • GitHub Check: build (23, ubuntu-latest)
  • GitHub Check: build (21, windows-latest)
  • GitHub Check: build (23, windows-latest)
  • GitHub Check: build (21, ubuntu-latest)
  • GitHub Check: build (21, macOS-latest)
  • GitHub Check: build (17, macOS-latest)
  • GitHub Check: build (17, windows-latest)
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build
  • GitHub Check: build (23, windows-latest)
  • GitHub Check: build (21, ubuntu-latest)
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build (23, macOS-latest)
  • GitHub Check: build (21, windows-latest)
  • GitHub Check: build (21, macOS-latest)
  • GitHub Check: build (23, ubuntu-latest)
  • GitHub Check: build (17, macOS-latest)
  • GitHub Check: build (17, windows-latest)
  • GitHub Check: Benchmark
  • GitHub Check: Analyze the repo with CodeSee
🔇 Additional comments (9)
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/MethodSymbol.java (2)

29-29: LGTM!

The @Nullable import is appropriate for documenting that the compareTo parameter can be null.


56-56: LGTM!

Adding Comparable<MethodSymbol> enables natural ordering for method symbols, which is useful for sorted collections and ordering operations.

src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RewriteMethodParameterDiagnostic.java (2)

129-146: Well-structured refactoring with clear early exits.

The refactored logic improves readability by handling edge cases upfront and clearly separating the single-reference and multi-reference scenarios. The early exit pattern for empty references and non-DEFINITION types is a solid defensive programming practice.


160-160: Correct removal of unnecessary cast.

The cast to RuleNode is no longer needed since the project's custom ANTLR4 implementation has TerminalNode.getParent() returning RuleNode directly.

Based on learnings

src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DiagnosticInfosTest.java (3)

64-65: Good refactoring to AssertJ's allSatisfy pattern.

The migration from forEach iteration to allSatisfy improves readability and follows AssertJ best practices for map assertions.


70-71: LGTM - consistent refactoring.


76-77: LGTM - consistent refactoring.

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/variable/VariableDescription.java (2)

29-29: Good addition for null-safety.

The @NonNull import is properly used in the constructor below, enhancing compile-time null-safety.


100-108: Constructor changes are correct and consistent with codebase migration.

The @NonNull annotation appropriately prevents null-safety issues, and the transition from param.getLink() to param.link() correctly follows Java record accessor conventions. Verification confirms no old-style getters remain in the codebase for ParameterDescription, and the record accessor pattern is applied consistently across all usages.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/ShortBasedVariableSymbol.java (1)

56-63: Same equality semantics concern as IntBasedVariableSymbol.

The same position-based equality concern raised for IntBasedVariableSymbol applies here. The changes are consistent across both implementations, which is good, but the verification requested in the previous file should cover both classes.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5800db4 and af9e845.

📒 Files selected for processing (6)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/AbstractVariableSymbol.java (0 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/IntBasedVariableSymbol.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/MethodSymbol.java (5 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/ShortBasedVariableSymbol.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/VariableSymbol.java (0 hunks)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DiagnosticInfosTest.java (1 hunks)
💤 Files with no reviewable changes (2)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/VariableSymbol.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/AbstractVariableSymbol.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DiagnosticInfosTest.java
🧰 Additional context used
🧬 Code graph analysis (1)
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/ShortBasedVariableSymbol.java (1)
src/main/java/com/github/_1c_syntax/bsl/languageserver/cfg/ConditionalVertex.java (1)
  • EqualsAndHashCode (30-66)
🔇 Additional comments (5)
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/MethodSymbol.java (4)

29-29: LGTM!

The new imports support the @nullable annotation for null-safe compareTo parameter handling and the @default annotation that replaces @Builder.Default throughout the file.

Also applies to: 32-32


61-61: LGTM!

The migration from @Builder.Default to @Default aligns with Lombok best practices and the broader refactoring theme across the codebase.

Also applies to: 88-88, 92-92, 101-101, 104-106


77-77: LGTM!

Including the sub-name range fields in equals/hashCode correctly distinguishes methods with identical names and owners but different source positions.

Also applies to: 80-80, 83-83


57-57: Comparable interface addition enables natural ordering.

The class declaration correctly extends the API to support Comparable, though the implementation requires correction (see separate comment on lines 134-147).

src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/IntBasedVariableSymbol.java (1)

56-63: Position-based equality is intentional and supported by test design.

The test suite explicitly uses position ranges to differentiate and verify variable symbols. The change to include variableNameLine, variableNameStartCharacter, and variableNameEndCharacter in equals/hashCode is semantically correct—it distinguishes declarations of identically-named variables at different source locations within the same scope.

No issues identified:

  • Position fields are immutable (set in constructor only, no setters exist)
  • VariableSymbol is never used as a Map key, only as a value
  • HashSet<VariableSymbol> operations work correctly with immutable position-based equality
  • Test fixture confirms multiple distinct variables can coexist with position as the key differentiator

@nixel2007 nixel2007 self-requested a review October 28, 2025 06:21
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants