Skip to content

Conversation

@theshadowco
Copy link
Member

@theshadowco theshadowco commented Dec 11, 2025

Описание

Исправление замечаний к коду, рефакторинг

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

Closes

Чеклист

Общие

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

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

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

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

Summary by CodeRabbit

  • Chores
    • Widespread nullability, annotation and formatting updates across the server for clearer code and safer handling.
  • Bug Fixes
    • Numerous diagnostics and helpers hardened for null-safety and simplified logic to reduce false positives and NPE risks.
  • New Features
    • CI workflow enhanced to always archive test results and added a dedicated job to publish test results for clearer build feedback.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 11, 2025

Walkthrough

Applied a widespread nullability sweep and minor refactors: added @Nullable annotations, adjusted method/field signatures and local type inference (var), reordered imports, extracted small helpers, and updated CI to always publish test results. A few public APIs now allow or return null; most changes are metadata/defensive.

Changes

Cohort / File(s) Summary
Build & CI
\build.gradle.kts`, `.github/workflows/gradle.yml``
Add description and group metadata to the updateLicenses Gradle task; update GitHub Actions to always archive test results and add publish-test-results job that downloads artifacts and publishes JUnit results.
Server bootstrap & textual services
\src/main/java/.../BSLLanguageServer.java`, `src/main/java/.../BSLTextDocumentService.java`, `src/main/java/.../LanguageClientHolder.java`, `src/main/java/.../cli/FileAwarePrintWriter.java``
Import reorderings, added local var usage and nullable annotations in initialization and lambdas; no high‑level control‑flow changes.
Nullability sweep (APIs & fields)
\src/main/java/.../ClientCapabilitiesHolder.java`, `.../EventPublisherAspect.java`, `.../MeasuresAspect.java`, `.../CommandProvider.java`, `.../EhCacheAdapter.java`, `.../DiagnosticHelper.java`, `.../CachePathProvider.java`, `.../Ranges.java`, `.../Trees.java`, `.../UTF8Control.java`, `.../MdoRefBuilder.java`, `.../MultilingualStringAnalyser.java`, `.../BslExpression.java`, `.../ErrorExpressionNode.java`, `.../ExpressionTreeBuildingVisitor.java`, `.../RenameProvider.java`, `.../DiagnosticParams.java``
Add or adjust @Nullable to many fields/parameters/returns (some public), update callers/guards accordingly, and introduce minor local refactors (type inference). A few public method signatures changed to accept/return nullable.
Expression tree & visitor
\src/main/java/.../utils/expressiontree/ExpressionTreeBuildingVisitor.java`, `.../BslExpression.java`, `.../ErrorExpressionNode.java``
Mark expression-related fields and getters nullable, change constructor/visitor parameter nullability, adopt pattern-matching instanceof bindings and adjust call sites — affects expression tree construction nullability surface.
Diagnostics (broad set)
\src/main/java/.../diagnostics/*`(examples:AbstractMagicValueDiagnostic.java, MagicNumberDiagnostic.java, MagicDateDiagnostic.java, BeginTransactionBeforeTryCatchDiagnostic.java, CommitTransactionOutsideTryCatchDiagnostic.java, MissingTemporaryFileDeletionDiagnostic.java, UnusedParametersDiagnostic.java, FieldsFromJoinsWithoutIsNullDiagnostic.java, UsingExternalCodeToolsDiagnostic.java, QueryToMissingMetadataDiagnostic.java`)
Extensive nullable and Optional refactors, small control‑flow tweaks (added explicit else/no‑op paths), some removals of prior null‑filtering (possible NPE risk), and small new/altered diagnostic emission (e.g., cube-dimension handling in QueryToMissingMetadataDiagnostic).
Sentry & AOP
\src/main/java/.../aop/sentry/PermissionFilterBeforeSendCallback.java`, `.../aop/SentryAspect.java`, `.../aop/EventPublisherAspect.java``
Relax parameter/field nullability, change execute() to return nullable SentryEvent, annotate publishers/collectors as nullable, and add null checks/guards in publish/log paths.
Symbols, models & Lombok tweaks
\src/main/java/.../context/symbol/ModuleSymbol.java`, `.../variable/VariableDescription.java`, `.../context/symbol/MethodSymbol.java`, `.../references/model/Symbol.java`, `.../references/model/SymbolOccurrence.java``
Adjust Lombok annotations (@Include, @Default), remove @NonNull on a constructor param, and reorder imports — affects equals/hashCode/defaulting behavior via Lombok annotations.
Hover & markup
\src/main/java/.../hover/DescriptionFormatter.java`, `.../hover/ModuleSymbolMarkupContentBuilder.java``
Refactor Optional handling to functional style; extract getModuleFlags(CommonModule) helper and render flags/reuse blocks conditionally.
Providers & features
\src/main/java/.../providers/*`(e.g.,SemanticTokensProvider.java, RenameProvider.java, DiagnosticProvider.java, SelectionRangeProvider.java`)
Centralize helper for ampersand ranges, add null checks, make prepare-rename return nullable Range, and minor lambda typing/import tweaks.
CFG & control-flow utilities
\src/main/java/.../cfg/*`(e.g.,ControlFlowGraph.java, ControlFlowGraphWalker.java, CfgBuildingParseTreeVisitor.java`)
Add @SuppressWarnings("NullAway.Init") to entryPoint, enforce non-null entryPoint in walker with Objects.requireNonNull, and small import rearrangements.
Infrastructure: cache & paths
\src/main/java/.../infrastructure/*`(e.g.,EhCacheAdapter.java, CacheConfiguration.java, CachePathProvider.java, LanguageClientAwareAppender.java`)
Allow nullable cache values (annotation only), relocate cache constant, allow nullable fullPath for cache path and make helper static; import reorders.
Misc: formatting/package-info/import tidy
many \package-info.java`` and assorted files
Import reorderings, trailing newline fixes, Javadoc whitespace adjustments, and small non‑functional refactors across many files.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Areas needing extra attention:

  • src/main/java/.../diagnostics/FieldsFromJoinsWithoutIsNullDiagnostic.java — removal of null-filtering may introduce NPEs when casting downstream.
  • src/main/java/.../diagnostics/UnusedParametersDiagnostic.java — nonNull filter removed before iterating token nodes; confirm tokens cannot be null.
  • src/main/java/.../utils/expressiontree/ExpressionTreeBuildingVisitor.java — nullable result/parent changes and pattern-matching visitor logic; validate tree consistency and callers.
  • src/main/java/.../aop/sentry/PermissionFilterBeforeSendCallback.java — changed return to nullable; ensure Sentry pipeline tolerates nulls.
  • src/main/java/.../diagnostics/QueryToMissingMetadataDiagnostic.java — added cube-dimension diagnostic emission; verify correctness and duplication behavior.

Possibly related PRs

Suggested reviewers

  • nixel2007

"I hop through code with tiny paws and cheer,
Nulls get labeled and Optionals appear,
I nibble imports, tidy every line,
With whiskered joy I mark annotations fine,
My hop makes the codebase cozy and clear." 🐇

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.46% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The PR title 'Исправление замечаний к коду, рефакторинг' (Code review fixes, refactoring) is a generic description that broadly covers the changeset but lacks specificity about the primary focus of the changes. Consider using a more specific title that highlights the main technical focus, such as 'Add nullability annotations and refactor Optional chains' or 'Migrate to jspecify nullability annotations', to better convey the primary intent of the 100+ file changeset.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/SQFixes251111

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: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/variable/VariableDescription.java (1)

100-108: Missing null safety after removing @NonNull annotation.

The removal of @NonNull from the param parameter (line 100) eliminates compile-time null safety, yet line 106 dereferences param with param.link() without any null check. If param is null, this will throw a NullPointerException.

Choose one of the following solutions:

Solution 1: Add explicit null check (if param can be null):

 public VariableDescription(ParameterDescription param) {
+  if (param == null) {
+    throw new IllegalArgumentException("param cannot be null");
+  }
   description = "";

Solution 2: Use Objects.requireNonNull (if param must not be null):

+import static java.util.Objects.requireNonNull;
+
 public VariableDescription(ParameterDescription param) {
+  requireNonNull(param, "param cannot be null");
   description = "";

Solution 3: If migrating to JSpecify, add the appropriate annotation:

+import org.jspecify.annotations.NonNull;
+
-public VariableDescription(ParameterDescription param) {
+public VariableDescription(@NonNull ParameterDescription param) {

Note: The unused lombok.NonNull import on line 29 should also be removed if no longer needed.

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

102-107: Update JavaDoc to document null return case.

The @Nullable annotation correctly reflects that this method can return null (line 106), improving null-safety metadata. However, the JavaDoc (lines 95-101) currently states @return Range without documenting when null is returned, which should be clarified for API consumers.

Update the JavaDoc to:

  /**
   * {@link Range}
   *
   * @param documentContext Контекст документа.
   * @param params          Параметры вызова.
-  * @return Range
+  * @return Range для переименования или null, если позиция не указывает на переименовываемый символ
   */
src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/EhCacheAdapter.java (1)

80-88: Комментарий в get(...) противоречит условию

Сейчас условие if (value != null) возвращает значение из кэша, но комментарий говорит «если нет в кеше, загружаем из valueLoader». Это вводит в заблуждение.

Предлагаю либо поправить комментарий, либо перенести его к ветке, где действительно вызывается valueLoader:

-    if (value != null) { // если нет в кеше, загружаем из valueLoader
-      return (T) value;
-    }
+    if (value != null) { // значение найдено в кэше — возвращаем его
+      return (T) value;
+    }
🧹 Nitpick comments (15)
src/main/java/com/github/_1c_syntax/bsl/languageserver/references/AnnotationReferenceFinder.java (1)

150-153: Minor indentation inconsistency.

The second parameter BSLParser.RULE_annotationParamValue is aligned to the start of the line rather than to the opening parenthesis or the first parameter. Consider aligning consistently.

     var annotationParamValueContext = parentContext instanceof BSLParser.AnnotationParamValueContext apv
       ? apv
       : Trees.<BSLParser.AnnotationParamValueContext>getAncestorByRuleIndex(
-      parentContext, BSLParser.RULE_annotationParamValue);
+        parentContext, BSLParser.RULE_annotationParamValue);
src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/ModuleSymbolMarkupContentBuilder.java (1)

114-139: Good extraction! Consider returning interface type.

The helper method successfully consolidates flag checks, improving modularity and testability. However, returning ArrayList<String> is more specific than necessary.

Apply this diff to return the interface type:

-  private ArrayList<String> getModuleFlags(CommonModule commonModule) {
+  private List<String> getModuleFlags(CommonModule commonModule) {
     var flags = new ArrayList<String>();

Add this import at the top:

import java.util.List;
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MagicNumberDiagnostic.java (1)

116-134: Refactoring improves readability.

The consolidation of logic under a single expression.isPresent() guard is cleaner and preserves the original behavior correctly.

Minor simplification opportunity: Lines 129-131 use expression.filter(...).isPresent() within an already-confirmed expression.isPresent() block. This could be simplified to directly evaluate the predicate: !isNumericExpression(expression.get()) || insideCallParam(expression.get()), but the current approach is also acceptable.

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

104-116: instanceof pattern matching & Preprocessor handling look good; consider clarifying the fallback exception

The switch to instanceof pattern matching for OperationContext / MemberContext and explicit skipping of PreprocessorContext makes the dispatch clearer and removes spurious failures for valid preprocessor nodes. The remaining else that throws new IllegalStateException() is fine as a safety net, but you might want to include the unexpected node’s class in the message to ease debugging (e.g. "Unexpected child in ExpressionContext: " + child.getClass()).

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

59-81: The @Nullable annotation accurately reflects the method behavior.

The method can return null (line 69: .orElse(null)), making the annotation correct and beneficial for null-safety. However, verify that all callers properly handle the null return value.

Run the following script to identify callers and verify null handling:

#!/bin/bash
# Description: Find all callers of executeCommand method and verify null handling

# Search for calls to executeCommand in the codebase
rg -n -P --type=java -C5 'executeCommand\s*\(' | rg -v 'public.*executeCommand'

Optional: Update JavaDoc to document null return.

Consider updating the JavaDoc (lines 52-58) to explicitly mention that this method may return null.

src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/SemanticTokensProvider.java (2)

311-333: Excellent refactoring: consolidated logic and improved null safety.

The extraction of addAmpersandRange eliminates duplicate code for handling compiler directives and annotations. The explicit null check for annotationParams at line 322 is good defensive programming that prevents potential NPE when annotations lack parameters.


423-432: Well-designed helper method with proper null handling.

The method correctly consolidates the ampersand range logic for both annotations and compiler directives. The @Nullable annotation on the name parameter is appropriate, and the null handling is explicit and correct.

Consider adding a brief JavaDoc comment to describe the method's purpose, even though it's private:

+  /**
+   * Adds a decorator range starting from ampersand through the optional name token.
+   * Used for both compiler directives and annotations.
+   *
+   * @param entries token entries list
+   * @param node ampersand terminal node
+   * @param name optional name context (compiler directive symbol or annotation name)
+   */
   // общий для аннотаций и директив компиляции способ добавления
   private void addAmpersandRange(List<TokenEntry> entries, TerminalNode node, @Nullable ParserRuleContext name) {
src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/PermissionFilterBeforeSendCallback.java (1)

72-79: Nullability annotation on execute correctly reflects existing behavior

Annotating the return type as @Nullable matches the current logic (returning null to drop the event) without changing runtime behavior and keeps the override compatible with Sentry’s BeforeSendCallback. Dropping Lombok @NonNull on parameters is also consistent with moving nullness handling to jspecify-level defaults while still using Lombok only for boilerplate-reduction annotations.

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

73-88: Clarify cube vs dimension table diagnostics and tighten null‑filtering

The new branch correctly adds a diagnostic for missing cube dimension tables, but with the current logic you’ll emit two diagnostics when the cube itself is missing:

  • nonCubeExists(eds) is true → diagnostic on eds.cubeName.
  • For the same eds, getCubeDimTable(eds) also returns empty (no cube → no dimension tables) → nonCubeDimTableExists(eds) is true → second diagnostic on eds.tableName.

If that double signal is not desired, consider checking the dimension table only when the cube exists, and pushing the eds.tableName != null guard into the stream filters to keep null‑checks in one place and avoid the extra local variable:

   ctx.dataSource().stream()
     .map(SDBLParser.DataSourceContext::externalDataSourceTable)
     .filter(Objects::nonNull)
     .filter(eds -> eds.cubeName != null)
     .filter(eds -> eds.mdo() != null && eds.mdo().tableName != null)
+    .filter(eds -> eds.tableName != null)
-    .forEach((SDBLParser.ExternalDataSourceTableContext eds) -> {
-      if (nonCubeExists(eds)) {
-        diagnosticStorage.addDiagnostic(eds.cubeName, info.getMessage(eds.cubeName.getText()));
-      }
-
-      var cubeDimTable = eds.tableName;
-
-      if (cubeDimTable != null && nonCubeDimTableExists(eds)) {
-        diagnosticStorage.addDiagnostic(cubeDimTable, info.getMessage(eds.tableName.getText()));
-      }
-    });
+    .forEach((SDBLParser.ExternalDataSourceTableContext eds) -> {
+      var cubeMissing = nonCubeExists(eds);
+      if (cubeMissing) {
+        diagnosticStorage.addDiagnostic(eds.cubeName, info.getMessage(eds.cubeName.getText()));
+      }
+
+      if (!cubeMissing && nonCubeDimTableExists(eds)) {
+        diagnosticStorage.addDiagnostic(eds.tableName, info.getMessage(eds.tableName.getText()));
+      }
+    });

This keeps diagnostics 1:1 with the actual missing metadata element (cube vs dimension table) and keeps the pipeline’s null assumptions explicit.

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

50-51: LGTM! Type inference usage is clear and idiomatic.

The use of var for local variables is appropriate and follows modern Java conventions. The inferred types are clear from the right-hand side expressions.

For consistency, consider also using var for the stream variable on line 53:

-    InputStream stream = null;
+    var stream = (InputStream) null;

However, keeping it as an explicit type is also reasonable since it's assigned in multiple branches.

Also applies to: 55-55, 57-57, 68-68

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

123-129: Explicit lambda parameter type is fine; optional style alignment

Switching to an explicitly typed lambda parameter here is clear and type-safe. Note that publishDiagnostics below still uses type inference in its lambda; if your style guide prefers consistency, you might consider aligning both call sites (either both explicit or both inferred), but functionally this is OK as-is.

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

84-101: Simplify null handling and comparison in the async logging block

The async refactor looks good, but the inner block can be tightened up:

  • Objects.requireNonNull(languageClientHolder) is redundant after an explicit null check.
  • Using a local variable avoids a check‑then‑use pattern.
  • SentryId.EMPTY_ID.equals(sentryId) is a bit safer if captureException ever returns null.

A minimal refactor could look like:

-    CompletableFuture.runAsync(() -> {
-        var sentryId = Sentry.captureException(ex);
-        if (sentryId.equals(SentryId.EMPTY_ID)) {
-          return;
-        }
-        if (languageClientHolder == null) {
-          return;
-        }
+    CompletableFuture.runAsync(() -> {
+        var sentryId = Sentry.captureException(ex);
+        if (SentryId.EMPTY_ID.equals(sentryId)) {
+          return;
+        }
+        var clientHolder = languageClientHolder;
+        if (clientHolder == null) {
+          return;
+        }
         var messageType = MessageType.Info;
         var message = resources.getResourceString(getClass(), "logMessage", sentryId);
         var messageParams = new MessageParams(messageType, message);
-
-        Objects.requireNonNull(languageClientHolder)
-          .execIfConnected(languageClient -> languageClient.showMessage(messageParams));
+        clientHolder.execIfConnected(
+          languageClient -> languageClient.showMessage(messageParams)
+        );
       },
       executorService);

After this change, the java.util.Objects import becomes unused and can be removed.

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

122-136: Optional-based variable type resolution is sound; only minor readability nits

The refactors to use Optional.flatMap and filter(...).isPresent() in isSecondParameterOfStructureInsert, getVariableTypeFromCallParamList, getVariableTypeFromCallStatement, and getVariableTypeFromAST correctly propagate the Optional<Boolean> semantics and avoid unsafe get() calls. If you want to squeeze a bit more readability, you could avoid the filter(...).isPresent() idiom and express it directly as a boolean, e.g.:

return getVariableTypeFromCallParamList(callParamList)
  .map(typeIsCorrespondence -> !typeIsCorrespondence)
  .orElse(false);

But the current version is logically correct.

Also applies to: 217-224, 253-256, 310-312


489-492: Consider reducing repeated Optional.get calls in structure-constructor helpers

In checkInsideStructureConstructor, callParamContextOpt.get() is used multiple times, and typeNameOpt.filter(...).isPresent() is used only to return a boolean. For clarity and to avoid repeated get() usage, you could cache the context and collapse the chain, e.g.:

var callParamContext = callParamContextOpt.get();
var typeNameOpt = getStructureTypeName(callParamContext);
return typeNameOpt
  .map(typeName -> isValidStructureConstructorParameter(callParamContext, typeName))
  .orElse(false);

This keeps behavior identical while making data-flow a bit easier to follow.

Also applies to: 547-572

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

151-175: checkMetadataObject refactor is behavior‑preserving; consider inlining returns

Changing var result = false; to boolean result; with explicit assignments in each branch keeps the method’s behavior identical and is perfectly fine. If you want to further simplify, you could remove the local variable entirely and return directly from the type branches, e.g.:

if (mdoType == MDOType.CATALOG) {
  return isUnsafeCatalogUsage((Catalog) mdo);
} else if (mdoType == MDOType.CHART_OF_CHARACTERISTIC_TYPES) {
  return isUnsafeChartOfCharacteristicTypesUsage((ChartOfCharacteristicTypes) mdo);
} else if (mdoType == MDOType.CHART_OF_ACCOUNTS) {
  return isUnsafeChartOfAccountsUsage((ChartOfAccounts) mdo);
}
return false;

Purely optional; current code is correct.

📜 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 8f73f30 and 5db62f2.

📒 Files selected for processing (40)
  • build.gradle.kts (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLLanguageServer.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/ClientCapabilitiesHolder.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/EventPublisherAspect.java (3 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/MeasuresAspect.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/SentryAspect.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/PermissionFilterBeforeSendCallback.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/LanguageServerConfiguration.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/CognitiveComplexityComputer.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/CyclomaticComplexityComputer.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/computer/ModuleSymbolComputer.java (0 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/ModuleSymbol.java (0 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/AbstractMagicValueDiagnostic.java (17 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/BeginTransactionBeforeTryCatchDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CommitTransactionOutsideTryCatchDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MagicNumberDiagnostic.java (3 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingTemporaryFileDeletionDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/QueryToMissingMetadataDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RefOveruseDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ServerCallsInFormEventsDiagnostic.java (5 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UnsafeFindByCodeDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UselessTernaryOperatorDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/DescriptionFormatter.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/ModuleSymbolMarkupContentBuilder.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/EhCacheAdapter.java (3 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/CommandProvider.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/DiagnosticProvider.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/RenameProvider.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/SemanticTokensProvider.java (6 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/AnnotationReferenceFinder.java (5 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/ReferenceIndexFiller.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/MdoRefBuilder.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/MultilingualStringAnalyser.java (3 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/Ranges.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/Trees.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/UTF8Control.java (3 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/BslExpression.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java (1 hunks)
💤 Files with no reviewable changes (2)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/ModuleSymbolComputer.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/ModuleSymbol.java
🧰 Additional context used
📓 Path-based instructions (3)
**/*.java

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.java: Follow the Style Guide provided in docs/en/contributing/StyleGuide.md
Use Lombok annotations to reduce boilerplate code and enable annotation processing in your IDE
Optimize imports before committing but do NOT optimize imports across the entire project unless specifically working on that task
Follow Java naming conventions with meaningful, descriptive names; keep class and method names concise but clear
Write JavaDoc for public APIs and include comments for complex logic
Use Target Java 17 as the language version

Files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/ReferenceIndexFiller.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/Trees.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/EventPublisherAspect.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UnsafeFindByCodeDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/UTF8Control.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/ModuleSymbolMarkupContentBuilder.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/Ranges.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/LanguageServerConfiguration.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MagicNumberDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ServerCallsInFormEventsDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputer.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/ClientCapabilitiesHolder.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/MeasuresAspect.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RefOveruseDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/SemanticTokensProvider.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/EhCacheAdapter.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingTemporaryFileDeletionDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/variable/VariableDescription.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/SentryAspect.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/BeginTransactionBeforeTryCatchDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/RenameProvider.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/CognitiveComplexityComputer.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLLanguageServer.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/MultilingualStringAnalyser.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/DiagnosticProvider.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/DescriptionFormatter.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/PermissionFilterBeforeSendCallback.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/CyclomaticComplexityComputer.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/CommandProvider.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UselessTernaryOperatorDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/BslExpression.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/AnnotationReferenceFinder.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/QueryToMissingMetadataDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/MdoRefBuilder.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/AbstractMagicValueDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CommitTransactionOutsideTryCatchDiagnostic.java
**/diagnostics/*.java

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Each diagnostic should have a Java implementation class, resource bundle for localized messages, unit tests, and documentation

Files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UnsafeFindByCodeDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MagicNumberDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ServerCallsInFormEventsDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RefOveruseDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingTemporaryFileDeletionDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/BeginTransactionBeforeTryCatchDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UselessTernaryOperatorDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/QueryToMissingMetadataDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/AbstractMagicValueDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CommitTransactionOutsideTryCatchDiagnostic.java
build.gradle.kts

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

build.gradle.kts: Use Gradle with Kotlin DSL for build configuration
Be cautious with external dependencies and review security alerts from CodeQL and Dependabot

Files:

  • build.gradle.kts
🧠 Learnings (11)
📓 Common learnings
Learnt from: CR
Repo: 1c-syntax/bsl-language-server PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T07:17:33.726Z
Learning: Applies to **/*.java : Use Lombok annotations to reduce boilerplate code and enable annotation processing in your IDE
📚 Learning: 2025-11-19T09:02:03.154Z
Learnt from: theshadowco
Repo: 1c-syntax/bsl-language-server PR: 3610
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/folding/QueryPackageFoldingRangeSupplier.java:26-26
Timestamp: 2025-11-19T09:02:03.154Z
Learning: В проекте bsl-language-server используется кастомная версия ANTLR4 от 1c-syntax (io.github.1c-syntax:antlr4), которая включает базовый класс org.antlr.v4.runtime.Tokenizer с методами getAst() и getTokens(). SDBLTokenizer и BSLTokenizer наследуются от этого базового класса.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/Trees.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MagicNumberDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputer.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/SemanticTokensProvider.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingTemporaryFileDeletionDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/MultilingualStringAnalyser.java
📚 Learning: 2025-04-18T22:46:43.245Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3449
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java:192-203
Timestamp: 2025-04-18T22:46:43.245Z
Learning: В проекте bsl-language-server класс BSLParser.ExpressionContext наследуется от BSLParserRuleContext, а не напрямую от ParserRuleContext. При работе с ним нужно учитывать специфичные методы BSLParserRuleContext.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/Trees.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MagicNumberDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputer.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/SemanticTokensProvider.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingTemporaryFileDeletionDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/MultilingualStringAnalyser.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/BslExpression.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/AbstractMagicValueDiagnostic.java
📚 Learning: 2025-02-10T17:13:41.452Z
Learnt from: theshadowco
Repo: 1c-syntax/bsl-language-server PR: 3408
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ProtectedModuleDiagnostic.java:54-58
Timestamp: 2025-02-10T17:13:41.452Z
Learning: In ProtectedModuleDiagnostic.java, the usage of `Range` field as a diagnostic target is accepted as is, despite being marked as a temporary solution in the comments.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UnsafeFindByCodeDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RefOveruseDiagnostic.java
📚 Learning: 2025-11-27T07:17:33.726Z
Learnt from: CR
Repo: 1c-syntax/bsl-language-server PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T07:17:33.726Z
Learning: Applies to docs/*/diagnostics/**/*.md : Update diagnostic documentation in both Russian and English with examples of problematic code and fixes

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UnsafeFindByCodeDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ServerCallsInFormEventsDiagnostic.java
📚 Learning: 2025-04-18T22:42:30.042Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 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/utils/expressiontree/ExpressionTreeBuildingVisitor.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/BslExpression.java
📚 Learning: 2025-02-10T17:12:56.150Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3408
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ProtectedModuleDiagnostic.java:63-66
Timestamp: 2025-02-10T17:12:56.150Z
Learning: In BSL Language Server, `documentContext.getServerContext().getConfiguration()` is guaranteed to return a non-null value, making null checks unnecessary.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/LanguageServerConfiguration.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLLanguageServer.java
📚 Learning: 2025-11-27T07:17:33.726Z
Learnt from: CR
Repo: 1c-syntax/bsl-language-server PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T07:17:33.726Z
Learning: Applies to **/diagnostics/*.java : Each diagnostic should have a Java implementation class, resource bundle for localized messages, unit tests, and documentation

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MagicNumberDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ServerCallsInFormEventsDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/QueryToMissingMetadataDiagnostic.java
📚 Learning: 2025-01-20T19:33:59.692Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3388
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunAllTestsCodeLensSupplier.java:55-59
Timestamp: 2025-01-20T19:33:59.692Z
Learning: In Spring, self-injection pattern (using Autowired Lazy on a self-reference field) is required to enable caching through Cacheable when methods are called from within the same class, as Spring's proxy-based AOP doesn't work with direct 'this' references.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/EhCacheAdapter.java
📚 Learning: 2025-01-19T20:47:40.061Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3388
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/codelens/TestRunnerAdapterOptions.java:46-46
Timestamp: 2025-01-19T20:47:40.061Z
Learning: Configuration classes in the BSL Language Server project use mutable collections (HashMap, ArrayList) and Data annotation from Lombok, allowing for modification of configuration properties after initialization.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/EhCacheAdapter.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingTemporaryFileDeletionDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/SentryAspect.java
📚 Learning: 2024-12-27T17:03:11.817Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3364
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/references/AnnotationReferenceFinder.java:125-127
Timestamp: 2024-12-27T17:03:11.817Z
Learning: В методе `findAnnotation` класса `AnnotationReferenceFinder` уже проверяется, что у аннотации ровно один параметр, поэтому в `getAnnotationName` не требуется отдельная проверка на пустой список.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/AnnotationReferenceFinder.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). (17)
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build (17, windows-latest)
  • GitHub Check: build (21, macOS-latest)
  • GitHub Check: build (25, windows-latest)
  • GitHub Check: Analyse
  • GitHub Check: build
  • 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 (25, macOS-latest)
  • GitHub Check: build (25, ubuntu-latest)
  • GitHub Check: build (21, macOS-latest)
  • GitHub Check: build (21, windows-latest)
  • GitHub Check: build (25, windows-latest)
  • GitHub Check: build
  • GitHub Check: Sentry
🔇 Additional comments (45)
src/main/java/com/github/_1c_syntax/bsl/languageserver/references/ReferenceIndexFiller.java (1)

250-257: LGTM!

Clean refactoring from block lambda to expression lambda. The logic remains unchanged, and the single-expression form is more concise and idiomatic for this use case.

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

65-76: Explicit else branch improves readability without changing behavior

The added else with a clarifying comment makes it explicit that all remaining ternary patterns are intentionally treated as non-errors, while preserving existing behavior of the diagnostic. This is a good readability/refactoring-only change.

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

324-331: LGTM! Excellent refactoring to functional style.

The refactoring from explicit null-check to Optional.map/orElseGet improves readability and follows Java best practices for Optional handling. The logic is preserved while making the code more concise and functional.

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

95-98: LGTM!

Comment reformatting improves readability by wrapping long lines appropriately.


111-114: LGTM!

Reformatting the chained method calls and lambda improves readability without changing behavior.


159-161: LGTM!

Method signature reformatting with aligned parameters follows good Java style conventions.


172-183: LGTM!

Method reformatting improves readability of the fluent API chain.


185-195: LGTM!

Consistent reformatting with the sibling overloaded method.


228-229: LGTM!

Lambda reformatting improves readability and is consistent with other changes in this file.

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

247-249: Explicit else branch clarifies intent.

The addition of an explicit else branch with a no-op comment makes it clear that other Tree types are intentionally not processed, rather than accidentally overlooked.

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

324-326: Explicit else branch clarifies intent.

This change mirrors the adjustment in CyclomaticComplexityComputer.java, maintaining consistency between the two complexity computation implementations. The explicit no-op documents that other Tree types are intentionally not processed.

build.gradle.kts (1)

451-455: LGTM! Task metadata enhances discoverability.

Adding description and group properties to the task improves documentation and makes it easier to discover via gradle tasks.

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

30-50: Nullable import and field annotation are consistent with Optional-based API

Using org.jspecify.annotations.Nullable on capabilities together with Optional.ofNullable(capabilities) keeps the external contract null-safe while documenting the internal field correctly. Lombok’s @Setter will align the setter parameter’s nullability with the field type, which matches the intended semantics. As per coding guidelines, continued use of Lombok for boilerplate here is appropriate.

Please just confirm this compiles cleanly with your configured JSpecify and Lombok versions in your IDE/CI.

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

33-33: LGTM! Proper null-safety annotation added.

The @Nullable annotation on the identifier parameter correctly documents the existing null-handling logic (lines 105-107). This improves the API contract clarity without changing behavior.

Also applies to: 102-102

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

35-35: LGTM! Proper null-safety annotation added.

The @Nullable annotation on the endToken parameter correctly documents the existing null-handling logic (line 122). The implementation gracefully falls back to startToken when endToken is null.

Also applies to: 119-122

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

33-33: LGTM! Proper null-safety annotation added.

The @Nullable return type annotation correctly documents that getVariableName can return null (lines 176, 181). The caller at line 97 already handles this case appropriately.

Also applies to: 171-171

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

27-27: LGTM! Proper null-safety annotations and modern Java syntax.

The changes correctly improve null-safety:

  • The @Nullable annotations on the variableName field (line 68) and getVariableName return type (line 110) document the existing null-handling contract.
  • The use of var for local variable inference (line 114) is appropriate for Java 17 and improves readability.
  • The caller at line 203 already handles null properly: if (variableName == null).

Also applies to: 68-68, 110-120

src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/ModuleSymbolMarkupContentBuilder.java (2)

90-96: LGTM! Clean refactoring of flag rendering.

The extraction of flag collection to a helper method improves modularity. The conditional rendering based on non-empty flags list is correct, and using String.join for comma separation is idiomatic.


98-109: LGTM! Effective use of switch expression.

The switch expression appropriately leverages Java 17 features to map return-value-reuse modes to resource keys. The handling of DONT_USE and UNKNOWN cases with an empty string, followed by conditional rendering, cleanly avoids unnecessary output.

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

32-37: LGTM!

Import reorganization is appropriate for focused refactoring work on this file.

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

37-44: Javadoc formatting changes with <br/> are consistent and safe

The added <br/> lines uniformly separate the short summary from the detailed description in all affected Javadocs (class and methods), improving readability without changing behavior or tool interaction. No further changes needed here.

Also applies to: 90-97, 111-118, 124-131, 143-151

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

314-314: Good refactoring for consistency.

Using var here aligns with the existing type inference pattern used throughout this method (lines 298, 299, 305, 309), improving code consistency.

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

30-30: LGTM! JSpecify annotation import added.

The addition of org.jspecify.annotations.Nullable aligns with the PR's goal of improving null-safety through standardized annotations.

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

37-37: Nullability annotation and cleanup are consistent with existing usage

Marking measureCollector as @Nullable and adding the corresponding import accurately reflect its actual usage pattern (explicit null checks in all advices and @PreDestroy clearing it via the setter). No functional or style issues detected here; the change improves null-safety metadata while preserving behavior.
Based on learnings, Lombok usage here continues to follow the project’s preference for reducing boilerplate.

Also applies to: 53-59

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

37-37: LGTM: Appropriate nullability annotation import.

The addition of org.jspecify.annotations.Nullable import supports the null-safety annotation added to the getPrepareRename method, improving API documentation and enabling better static analysis.

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

70-70: @Nullable import is appropriate and consistent

The new org.jspecify.annotations.Nullable import is necessary for the added annotation and keeps import ordering consistent with the existing style.


167-172: Nullability annotation on throwable matches whenComplete contract

Typing the first parameter as Void and marking Throwable as @Nullable correctly reflects CompletableFuture<Void>.whenComplete semantics and aligns with the explicit null-check inside the handler. No behavior change, only clearer null-safety metadata.

src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/SemanticTokensProvider.java (2)

64-64: LGTM: Nullability annotation support added.

The import is necessary for the new @Nullable annotation on the helper method parameter and aligns with the PR's null-safety improvements.


171-171: LGTM: Formatting improvements for readability.

Minor formatting adjustments with no functional impact.

Also applies to: 341-343, 563-564

src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/EventPublisherAspect.java (2)

40-40: LGTM! Nullability annotation correctly documents field lifecycle.

The @Nullable annotation accurately reflects that applicationEventPublisher can be null (explicitly set to null in destroy() on line 66), improving null-safety documentation for the codebase.

Also applies to: 61-61


104-104: LGTM! Defensive null check improves safety.

The added null check guards against NPE and aligns with the @Nullable annotation on the field. While theoretically redundant if active is properly managed, this defensive check protects against unexpected states.

src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/BslExpression.java (2)

31-31: Import for nullability annotation is correct and necessary

The new import cleanly matches the @Nullable usage on parent below; no issues here.


46-48: Nullability of parent now explicitly documented

Marking parent as @Nullable accurately reflects that root expressions have no parent and will surface this to consumers via Lombok-generated accessors. Please ensure existing callers of getParent() either null-check or are updated to respect the new nullability contract.

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

24-24: @nullable annotation correctly documents the return contract.

The @Nullable annotation appropriately indicates that this method can return null (as seen on lines 52 and 75). The import and annotation align with the PR's objective of adding nullability metadata across the codebase.

The code follows Java 17 conventions with appropriate use of var for type inference, and jspecify 1.0.0 is properly configured as a project dependency. Adding @Nullable to this overridden method is fully compatible with the JDK base implementation and poses no compilation concerns.

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

38-38: New LanguageClient import is correct and used

The added org.eclipse.lsp4j.services.LanguageClient import is required for the explicit lambda parameter below and is not redundant. No issues here.

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

44-45: Imports for Either and @Nullable correctly match usage

The added imports are consistent with the existing use of Either in getAnnotationParam and @Nullable in the createParameters signature; this removes the need for fully qualified names without changing behavior. Please just ensure the module already depends on org.eclipse.lsp4j and org.jspecify in the same versions used elsewhere so there are no mixed @Nullable sources.


240-243: @Nullable on paramList aligns with existing null-handling

Annotating BSLParser.ParamListContext as nullable matches the current contract (paramList is checked for null and handled via Collections.emptyList()), improving static null-safety without altering logic. Verify that this BSLParser.@Nullable ParamListContext placement is consistent with how other parser contexts are annotated in the project’s style guide.

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

40-40: LGTM: Import added for nullability annotations.

The import is properly placed and necessary for the @Nullable annotation already used on the prevQueryRange field.

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

24-24: Импорт @Nullable выглядит корректным

Добавление org.jspecify.annotations.Nullable согласуется с остальным PR по аннотациям nullability, замечаний к этому импорту нет.

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

36-36: Nullability metadata on LanguageClientHolder is consistent and clear

Using @Nullable on languageClientHolder together with the explicit null check in logException accurately reflects the optional dependency and aligns with the jspecify-based null-safety approach. Lombok + setter injection usage also matches the project guidelines.

Also applies to: 54-56

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

29-32: ParserRuleContext import and insideContext signature look consistent

Importing ParserRuleContext and constraining insideContext to Class<? extends ParserRuleContext> matches how the helper is used (assignment/return contexts) and tightens the API without changing behavior. I don’t see any issues here; any non-parser-context call sites would now fail at compile time, which is desirable.

Also applies to: 709-710


97-103: Consolidated insideStructureOrCorrespondence predicate is correct

The combined boolean expression delegates to the same five specific checks as before and preserves short-circuit behavior. This makes the overall intent clearer without changing the effective logic.


621-634: Conservative use of Optional.orElse(false) for correspondence insert detection

The new checkInsideCorrespondenceInsert / checkInsideCorrespondenceInsertFirstParam logic uses Optional.orElse(false) so that only calls where the variable is confidently inferred as a correspondence (Optional.of(true)) are treated as “inside correspondence”; unknown types (Optional.empty()) now fall back to false. This is a reasonable, conservative choice that should reduce false positives, assuming existing tests still cover both structure and correspondence cases. Please ensure the diagnostic tests for magic values around Вставить/Insert still pass and cover the ambiguous-type scenario.

Also applies to: 644-659, 667-680

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

33-58: @nullable annotations on internal state match actual usage

Marking nodeEndTransaction and nodeEndFile as @Nullable and explicitly initializing them to null aligns with how they are used (checked for null before diagnostics are added and assigned via traversal). This improves null-safety metadata without changing behavior; just make sure org.jspecify.annotations is configured consistently across the project/tooling so these annotations are picked up.

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

33-58: Consistent @nullable usage for BeginTransaction diagnostic state

Applying @Nullable to nodeBeginTransaction and nodeEndFile and initializing them to null matches their lifecycle (set during traversal, checked for null before use). This is consistent with the CommitTransaction diagnostic and improves static nullability information without altering runtime behavior. As with the other file, ensure jspecify annotations are correctly integrated into your build/static analysis setup.

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

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

147-147: Optional: Added blank lines improve readability.

The added blank lines provide visual separation between conditional returns and subsequent logic, which slightly improves readability.

Also applies to: 152-152

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

78-84: Inline default initialization of methodDescriptions to simplify constructor

The non-null initialization is a good safeguard. Since the default value is static and independent of constructor parameters, you can move it to the field declaration and drop the explanatory comment to keep the constructor focused on codeRecognizer setup:

-  private List<MethodDescription> methodDescriptions;
+  private List<MethodDescription> methodDescriptions = Collections.emptyList();
@@
   public CommentedCodeDiagnostic() {
     codeRecognizer = new CodeRecognizer(threshold, new BSLFootprint());
-    methodDescriptions = Collections.emptyList(); // non-null
   }

This keeps the non-null contract while slightly reducing noise.

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

55-59: Avoid relying on ErrorNodeImpl implementation detail

Here you depend on ErrorNodeImpl and its symbol field:

if (((ErrorNodeImpl) node).symbol.getTokenIndex() == -1) {

You can keep the same logic while avoiding the concrete class:

-    if (((ErrorNodeImpl) node).symbol.getTokenIndex() == -1) {
+    if (node.getSymbol().getTokenIndex() == -1) {

This makes the code a bit more robust against ANTLR implementation changes and reads clearer.

📜 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 5db62f2 and b5026ab.

📒 Files selected for processing (15)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/cfg/ControlFlowGraph.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/capabilities/package-info.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/codelens/package-info.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/diagnostics/package-info.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/documentlink/package-info.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/formating/package-info.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/package-info.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/ServerContext.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CommentedCodeDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ParseErrorDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/QueryNestedFieldsByDotDiagnostic.java (2 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/UselessTernaryOperatorDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/CacheConfiguration.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/CachePathProvider.java (3 hunks)
✅ Files skipped from review due to trivial changes (4)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/capabilities/package-info.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/ServerContext.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/diagnostics/package-info.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/QueryNestedFieldsByDotDiagnostic.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UselessTernaryOperatorDiagnostic.java
🧰 Additional context used
📓 Path-based instructions (2)
**/*.java

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.java: Follow the Style Guide provided in docs/en/contributing/StyleGuide.md
Use Lombok annotations to reduce boilerplate code and enable annotation processing in your IDE
Optimize imports before committing but do NOT optimize imports across the entire project unless specifically working on that task
Follow Java naming conventions with meaningful, descriptive names; keep class and method names concise but clear
Write JavaDoc for public APIs and include comments for complex logic
Use Target Java 17 as the language version

Files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CommentedCodeDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/CacheConfiguration.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ParseErrorDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TransferringParametersBetweenClientAndServerDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/codelens/package-info.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/formating/package-info.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/CachePathProvider.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/cfg/ControlFlowGraph.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/documentlink/package-info.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/package-info.java
**/diagnostics/*.java

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Each diagnostic should have a Java implementation class, resource bundle for localized messages, unit tests, and documentation

Files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CommentedCodeDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ParseErrorDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TransferringParametersBetweenClientAndServerDiagnostic.java
🧠 Learnings (5)
📚 Learning: 2025-11-19T09:02:03.154Z
Learnt from: theshadowco
Repo: 1c-syntax/bsl-language-server PR: 3610
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/folding/QueryPackageFoldingRangeSupplier.java:26-26
Timestamp: 2025-11-19T09:02:03.154Z
Learning: В проекте bsl-language-server используется кастомная версия ANTLR4 от 1c-syntax (io.github.1c-syntax:antlr4), которая включает базовый класс org.antlr.v4.runtime.Tokenizer с методами getAst() и getTokens(). SDBLTokenizer и BSLTokenizer наследуются от этого базового класса.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ParseErrorDiagnostic.java
📚 Learning: 2025-04-18T22:46:43.245Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3449
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java:192-203
Timestamp: 2025-04-18T22:46:43.245Z
Learning: В проекте bsl-language-server класс BSLParser.ExpressionContext наследуется от BSLParserRuleContext, а не напрямую от ParserRuleContext. При работе с ним нужно учитывать специфичные методы BSLParserRuleContext.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ParseErrorDiagnostic.java
📚 Learning: 2025-11-27T07:17:33.726Z
Learnt from: CR
Repo: 1c-syntax/bsl-language-server PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T07:17:33.726Z
Learning: Applies to **/*.java : Optimize imports before committing but do NOT optimize imports across the entire project unless specifically working on that task

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/codelens/package-info.java
📚 Learning: 2025-02-10T17:12:56.150Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3408
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ProtectedModuleDiagnostic.java:63-66
Timestamp: 2025-02-10T17:12:56.150Z
Learning: In BSL Language Server, `documentContext.getServerContext().getConfiguration()` is guaranteed to return a non-null value, making null checks unnecessary.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/codelens/package-info.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/formating/package-info.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/documentlink/package-info.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/package-info.java
📚 Learning: 2025-01-19T20:47:40.061Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3388
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/codelens/TestRunnerAdapterOptions.java:46-46
Timestamp: 2025-01-19T20:47:40.061Z
Learning: Configuration classes in the BSL Language Server project use mutable collections (HashMap, ArrayList) and Data annotation from Lombok, allowing for modification of configuration properties after initialization.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/CachePathProvider.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/package-info.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). (12)
  • GitHub Check: Analyse
  • GitHub Check: build
  • GitHub Check: Analyze the repo with CodeSee
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build (21, macOS-latest)
  • GitHub Check: build (17, windows-latest)
  • GitHub Check: build (25, windows-latest)
  • GitHub Check: build (25, macOS-latest)
  • GitHub Check: build (17, macOS-latest)
  • GitHub Check: build (25, ubuntu-latest)
  • GitHub Check: build (21, ubuntu-latest)
  • GitHub Check: build (21, windows-latest)
🔇 Additional comments (12)
src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/CacheConfiguration.java (1)

52-52: LGTM! Good code organization.

Moving the constant to the top of the class alongside other constants improves code readability and follows Java best practices for organizing class members.

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

162-162: Excellent refactoring: helper methods correctly made static.

Both hasVariableWithName and hasClientCompilerDirective don't access instance state, so making them static is appropriate and follows Java best practices. The method reference at line 162 is correctly updated to use the static-qualified form.

Also applies to: 165-165, 172-172

src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/CachePathProvider.java (3)

24-24: LGTM!

The JSpecify @Nullable import is appropriate for null-safety annotations and is required for the parameter annotation added on line 80.


99-99: LGTM!

Making getCurrentDirectory() static is appropriate since it doesn't use any instance state and is purely functional. This is a good refactoring that clarifies the method's independence from instance context.


80-80: LGTM. The @Nullable annotation correctly documents that fullPath can be null, which aligns with the null check on line 81 and is validated by test cases (e.g., line 166). This improves null-safety by making the contract explicit. All callers handle the nullable parameter appropriately.

src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/formating/package-info.java (1)

25-28: Импорт NullMarked размещён корректно и единообразно

Аннотация пакета @NullMarked и импорт org.jspecify.annotations.NullMarked оформлены в стандартном для package-info.java виде; поведение не меняется, выглядит хорошо.

src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/package-info.java (1)

30-33: Единообразное объявление @NullMarked для корневого пакета конфигурации

Добавленный импорт org.jspecify.annotations.NullMarked после объявления пакета соответствует стилю остальных package-info и делает использование аннотации явным. Замечаний нет.

src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/codelens/package-info.java (1)

25-28: Корректное оформление аннотации @NullMarked для пакета codelens

Импорт org.jspecify.annotations.NullMarked после объявления пакета оформлен так же, как в остальных configuration-пакетах; это поддерживает единый стиль, поведение не затрагивается.

src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/documentlink/package-info.java (1)

25-28: Импорт аннотации NullMarked согласован с остальными пакетами

Размещение импорта org.jspecify.annotations.NullMarked после package и использование @NullMarked на пакете выглядят корректно и поддерживают единый стиль package-info в конфигурации.

src/main/java/com/github/_1c_syntax/bsl/languageserver/cfg/ControlFlowGraph.java (2)

27-27: LGTM: Nullability annotation import added.

The import for @Nullable from jspecify is correctly added to support the nullability annotation.


33-33: @nullable annotation on entryPoint is appropriate and correct.

The annotation accurately documents that entryPoint can be null in its initial state (not initialized in the constructor). All code that calls getEntryPoint() handles the nullability appropriately: test code explicitly asserts non-null before use, and production code uses it in null-safe comparisons or guarantees initialization through the builder before any usage. This is a valid documentation improvement that clarifies the nullability contract.

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

65-71: Stream refactor + var usage look good

Using var for ast, initialExpectedString, expectedTokens, sj, and errorToken keeps the code concise while the types remain obvious from the initializers. The class-based filtering (ParserRuleContext.class::isInstance / ::cast) also makes the stream pipeline cleaner and type-safe without changing behavior. No issues from my side here.

Also applies to: 73-75, 80-88

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 (3)
src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/DiagnosticProvider.java (1)

122-129: Explicit lambda parameter type is fine; consider style consistency

Using (LanguageClient languageClient) -> { ... } is type-safe and clear, and matches the new import. For consistency with publishDiagnostics, which uses languageClient -> ..., you might optionally align both usages (either both inferred or both explicit), depending on project style preferences.

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

29-32: ParserRuleContext-based helpers are fine; consider explicit null policy for getExpression(ParserRuleContext)

Using ParserRuleContext directly and the generic insideContext helper improves reuse and keeps dependencies on ANTLR types clear. One small follow-up: getExpression(ParserRuleContext ctx) currently uses Optional.of(ctx) without a null guard, unlike insideContext which explicitly handles expression == null. If there’s any chance callers might pass null, consider either documenting it as @NotNull or switching to an explicit check/Optional.ofNullable to avoid a possible NPE.

Also applies to: 712-719


122-137: Optional/flatMap pipeline for variable type resolution looks correct; boolean encoding could be made more explicit

The refactor around isSecondParameterOfStructureInsert, getVariableTypeFromCallParamList, getVariableTypeFromCallStatement, getVariableTypeFromAST, and the correspondence checks looks sound:

  • paramIndex == 1 is consistently used for the "second parameter" case.
  • getVariableTypeFromCallParamList correctly short-circuits when the call is not an INSERT_METHOD_PATTERN match.
  • The Optional chains (flatMap to getVariableTypeFromCallStatement / getVariableTypeFromAST, then map/orElse(false)) preserve the previous empty-check behavior.
  • The tri-state semantics (Optional<Boolean>: true = correspondence, false = structure, empty = unknown) are used consistently:
    • Structure-only case: map(typeIsCorrespondence -> !typeIsCorrespondence).orElse(false);
    • Correspondence-only cases: variableType.orElse(false);
    • First-parameter-of-insert just checks isInsertMethod(...).isPresent().

The only downside is readability: the meaning of true vs false on the Boolean is not obvious at call sites. If you touch this again, consider replacing Optional<Boolean> with a small enum (e.g. ContainerType { STRUCTURE, CORRESPONDENCE }) or helper methods like isStructureType(...) / isCorrespondenceType(...) to make intent self-documenting.

Also applies to: 218-225, 254-257, 303-313, 635-637, 661-662, 681-683

📜 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 b5026ab and c422ff5.

📒 Files selected for processing (10)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLLanguageServer.java (5 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/SentryAspect.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/LanguageServerConfiguration.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/AbstractMagicValueDiagnostic.java (17 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MagicNumberDiagnostic.java (3 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RefOveruseDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UnsafeFindByCodeDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/ModuleSymbolMarkupContentBuilder.java (3 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/EhCacheAdapter.java (3 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/DiagnosticProvider.java (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UnsafeFindByCodeDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RefOveruseDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/ModuleSymbolMarkupContentBuilder.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/EhCacheAdapter.java
🧰 Additional context used
📓 Path-based instructions (2)
**/*.java

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.java: Follow the Style Guide provided in docs/en/contributing/StyleGuide.md
Use Lombok annotations to reduce boilerplate code and enable annotation processing in your IDE
Optimize imports before committing but do NOT optimize imports across the entire project unless specifically working on that task
Follow Java naming conventions with meaningful, descriptive names; keep class and method names concise but clear
Write JavaDoc for public APIs and include comments for complex logic
Use Target Java 17 as the language version

Files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/SentryAspect.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/LanguageServerConfiguration.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/DiagnosticProvider.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLLanguageServer.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/AbstractMagicValueDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MagicNumberDiagnostic.java
**/diagnostics/*.java

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Each diagnostic should have a Java implementation class, resource bundle for localized messages, unit tests, and documentation

Files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/AbstractMagicValueDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MagicNumberDiagnostic.java
🧠 Learnings (6)
📚 Learning: 2025-01-19T20:47:40.061Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3388
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/codelens/TestRunnerAdapterOptions.java:46-46
Timestamp: 2025-01-19T20:47:40.061Z
Learning: Configuration classes in the BSL Language Server project use mutable collections (HashMap, ArrayList) and Data annotation from Lombok, allowing for modification of configuration properties after initialization.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/SentryAspect.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLLanguageServer.java
📚 Learning: 2025-02-10T17:12:56.150Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3408
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ProtectedModuleDiagnostic.java:63-66
Timestamp: 2025-02-10T17:12:56.150Z
Learning: In BSL Language Server, `documentContext.getServerContext().getConfiguration()` is guaranteed to return a non-null value, making null checks unnecessary.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/LanguageServerConfiguration.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLLanguageServer.java
📚 Learning: 2025-01-19T21:34:39.797Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3388
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/codelens/TestRunnerAdapterOptions.java:46-46
Timestamp: 2025-01-19T21:34:39.797Z
Learning: In BSL Language Server configuration classes, immutable collections (Set.of, List.of) should be used for default values, while mutability is achieved through setters generated by Data annotation.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLLanguageServer.java
📚 Learning: 2025-11-27T07:17:33.726Z
Learnt from: CR
Repo: 1c-syntax/bsl-language-server PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T07:17:33.726Z
Learning: Applies to **/diagnostics/*.java : Each diagnostic should have a Java implementation class, resource bundle for localized messages, unit tests, and documentation

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/AbstractMagicValueDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MagicNumberDiagnostic.java
📚 Learning: 2025-04-18T22:46:43.245Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3449
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java:192-203
Timestamp: 2025-04-18T22:46:43.245Z
Learning: В проекте bsl-language-server класс BSLParser.ExpressionContext наследуется от BSLParserRuleContext, а не напрямую от ParserRuleContext. При работе с ним нужно учитывать специфичные методы BSLParserRuleContext.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/AbstractMagicValueDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MagicNumberDiagnostic.java
📚 Learning: 2025-11-19T09:02:03.154Z
Learnt from: theshadowco
Repo: 1c-syntax/bsl-language-server PR: 3610
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/folding/QueryPackageFoldingRangeSupplier.java:26-26
Timestamp: 2025-11-19T09:02:03.154Z
Learning: В проекте bsl-language-server используется кастомная версия ANTLR4 от 1c-syntax (io.github.1c-syntax:antlr4), которая включает базовый класс org.antlr.v4.runtime.Tokenizer с методами getAst() и getTokens(). SDBLTokenizer и BSLTokenizer наследуются от этого базового класса.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MagicNumberDiagnostic.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). (10)
  • GitHub Check: build (25, macOS-latest)
  • GitHub Check: build (21, windows-latest)
  • GitHub Check: build (21, ubuntu-latest)
  • GitHub Check: build (25, ubuntu-latest)
  • GitHub Check: build (25, windows-latest)
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build (21, macOS-latest)
  • GitHub Check: build (17, windows-latest)
  • GitHub Check: build
  • GitHub Check: Analyse
🔇 Additional comments (15)
src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/DiagnosticProvider.java (2)

24-39: New LanguageClient import is appropriate

The added org.eclipse.lsp4j.services.LanguageClient import correctly reflects its new usage in the typed lambda below; no issues here.


64-68: No functional change in field/spacing region

Only formatting/spacing around clientSupportsRefresh appears to have changed; there is no behavioral impact to review.

src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/SentryAspect.java (2)

36-36: Импорт @Nullable из jspecify выглядит корректным

Импорт org.jspecify.annotations.Nullable согласован с аннотацией поля languageClientHolder; в файле нет других источников @Nullable, конфликтов не видно.

При необходимости проверьте, что зависимость jspecify действительно подключена в модуле и аннотации обрабатываются в используемом инструменте анализа null‑безопасности.


83-100: Рефакторинг logException улучшает null‑безопасность без изменения поведения

Копирование languageClientHolder в локальную переменную, проверка на null и ранний выход до отправки сообщения устраняют возможный NPE при отсутствии клиента; логика по SentryId.EMPTY_ID и отправке сообщения при наличии клиента сохранена.

Имеет смысл прогнать сценарий с отключённым языковым клиентом (или в ранней фазе старта), чтобы убедиться, что исключения по‑прежнему попадают в Sentry, а отсутствие клиента просто тихо подавляет показ сообщения.

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

32-37: Import reordering looks appropriate.

The import reorganization follows standard conventions (framework imports followed by Java standard library). However, note that the PR checklist indicates the precommit task hasn't been run yet. Please execute gradlew precommit before finalizing this PR to ensure all formatting and import optimizations are properly applied.

As per coding guidelines, imports should be optimized before committing.


120-133: Excellent refactoring with improved control flow.

The restructured logic is clearer and more maintainable:

  • Early extraction of expression with proper Optional handling
  • Explicit hierarchical checks with early returns for structure/correspondence and return statements
  • Consolidated final condition (!isNumericExpression(context) || insideCallParam(context)) is more readable than sequential checks
  • Proper handling of absent expression with explicit return false

The refactoring follows Java 17 best practices with appropriate use of var and makes the decision tree more explicit.

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

161-185: Javadoc and @nullable now accurately document behavior.

The updated @return Javadoc and @Nullable on getCustomConfigurationRoot are consistent with the existing logic (null only when the configured root lies outside srcDir). No functional issues here.

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

70-80: Nullable import is appropriate for new lambda annotation.

The added org.jspecify.annotations.Nullable import matches the new usage in initialized() and aligns with the project’s nullability style.


107-137: initialize(): configuration root setup placement looks reasonable.

Calling setConfigurationRoot(params) right after capturing client capabilities keeps initialization concerns localized and does not affect subsequent capability construction.


140-159: Verify downstream handling of possibly-null configurationRoot.

LanguageServerConfiguration.getCustomConfigurationRoot(...) can now return null (e.g., when the configured root lies outside rootPath), and this value is passed directly into context.setConfigurationRoot(configurationRoot). This is fine if ServerContext.setConfigurationRoot and subsequent use sites are designed to accept and correctly handle null; otherwise, it could surface as an NPE or unexpected behavior during populateContext().

If not already done in this PR, please double-check ServerContext.setConfigurationRoot and its callers to ensure a nullable root is either guarded against or treated as a supported “no configuration root” state.


161-172: whenComplete nullability annotation matches CompletableFuture contract.

Annotating the Throwable parameter as @Nullable in whenComplete((Void unused, @Nullable Throwable throwable) -> { ... }) correctly reflects that it can be null on successful completion, and the shutdown/error-logging logic remains unchanged and safe.

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

97-103: Combined insideStructureOrCorrespondence condition is clear and preserves behavior

Refactoring the previous early-return chain into a single short-circuiting boolean expression keeps the evaluation order and semantics while making the control flow easier to scan. No issues here.


263-265: Javadoc alignment/formatting changes are consistent and non-breaking

The updated @param alignment and spacing across these methods improves readability and matches typical JavaDoc style without affecting behavior. Nothing to change here.

Also applies to: 362-365, 388-391, 417-422, 462-465, 708-711


267-272: CallParamInfo record usage is straightforward

The CallParamInfo record cleanly groups callParam, paramIndex, and callParamList, and its usage in getCallParamInfo is idiomatic. The empty body is fine and leaves room for future helper methods if needed.


484-495: Structure-constructor detection refactor is correct and more idiomatic

The refactored checkInsideStructureConstructor and isValidStructureConstructorParameter keep the previous behavior while simplifying the flow:

  • findCallParamContext still guards the path.
  • getStructureTypeName + map(...).orElse(false) is equivalent to the old isEmpty() / get() pattern.
  • Parameter index handling remains: index 0 excluded, others considered, with FixedStructure short-circuiting to true.
  • For non-fixed structures, validating the first parameter as a STRING token for field names is unchanged.

Overall this Optional-based version is cleaner without introducing new edge cases.

Also applies to: 550-575

@theshadowco theshadowco force-pushed the feature/SQFixes251111 branch from c422ff5 to a0b8fbb Compare December 11, 2025 15:33
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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/EhCacheAdapter.java (1)

80-99: Обработка null в put теперь соответствует контракту, но комментарий в get вводит в заблуждение

  • В put(Object key, @Nullable Object value) теперь явно выбрасывается NullPointerException при value == null, что согласуется с allowNullValues = false и документом класса — это хороший и ожидаемый фикс.
  • В get(Object key, Callable<T> valueLoader) условие на Line 86:
if (value != null) { // если нет в кеше, загружаем из valueLoader
  return (T) value;
}

Комментарий описывает поведение ветки else, а не if.

Я бы предложил поправить комментарий, чтобы он соответствовал коду, например:

-    if (value != null) { // если нет в кеше, загружаем из valueLoader
-      return (T) value;
-    }
+    if (value != null) { // значение есть в кеше, просто возвращаем его
+      return (T) value;
+    }
+    // если значения нет в кеше, загружаем из valueLoader

Так будет явно видно, какая ветка за что отвечает.

Also applies to: 101-112

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

134-148: Move @Nullable from method declaration to return type

The @Nullable annotation from JSpecify is a type-use only annotation (@Target(TYPE_USE)). When placed on the method declaration as shown:

@Nullable
private MessageActionItem waitForPermission(CompletableFuture<MessageActionItem> sendQuestion) {

It is syntactically incorrect and will not mark the return type as nullable. The annotation must be placed on the type itself:

private @Nullable MessageActionItem waitForPermission(
  CompletableFuture<MessageActionItem> sendQuestion
) {

This aligns with the project's Style Guide, which specifies using @org.jspecify.annotations.Nullable to indicate nullable return values.

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

74-76: Consider removing the unnecessary else branch.

Empty else branches are typically omitted in Java as they serve no functional purpose. The comment clarifies intent but could be placed above the entire if-else chain if needed.

Apply this diff to remove the no-op else branch:

       } else if (trueBranch != SKIPPED_RULE_INDEX || falseBranch != SKIPPED_RULE_INDEX) {
         diagnosticStorage.addDiagnostic(ctx);
-      } else {
-        // остальное - не ошибка
       }
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CommitTransactionOutsideTryCatchDiagnostic.java (2)

52-53: Consider using consistent annotation style.

Both fields are annotated as nullable but use different styles:

  • Line 52: @Nullable ParserRuleContext (declaration annotation)
  • Line 53: BSLParser.@Nullable StatementContext (type-use annotation)

For consistency, consider using the type-use annotation style for both fields.

Apply this diff for consistency:

-  private @Nullable ParserRuleContext nodeEndTransaction;
+  private @Nullable ParserRuleContext nodeEndTransaction;
   private BSLParser.@Nullable StatementContext nodeEndFile;

Or alternatively, use declaration annotations for both (though type-use is more precise with qualified types):

-  private @Nullable ParserRuleContext nodeEndTransaction;
-  private BSLParser.@Nullable StatementContext nodeEndFile;
+  private @Nullable ParserRuleContext nodeEndTransaction;
+  private @Nullable BSLParser.StatementContext nodeEndFile;

55-58: Optional: Redundant explicit null initialization.

Object fields in Java are automatically initialized to null, making the explicit assignments redundant. You may remove the constructor entirely or, per the coding guidelines recommending Lombok, consider using @NoArgsConstructor if you need an explicit constructor.

Option 1: Remove the constructor entirely (fields default to null):

-  public CommitTransactionOutsideTryCatchDiagnostic() {
-    nodeEndTransaction = null;
-    nodeEndFile = null;
-  }
-

Option 2: Use Lombok (if used elsewhere in the codebase):

+@NoArgsConstructor
 public class CommitTransactionOutsideTryCatchDiagnostic extends AbstractVisitorDiagnostic {
   // ...
-  public CommitTransactionOutsideTryCatchDiagnostic() {
-    nodeEndTransaction = null;
-    nodeEndFile = null;
-  }

Based on learnings, Lombok annotations help reduce boilerplate code.

src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/ModuleSymbolMarkupContentBuilder.java (2)

91-113: Refactor of flags and reuse block looks correct; clarify intent for omitted reuse states

The extraction of flags and the new reuseKey switch look sound and keep the builder logic readable. One thing to double‑check: for DONT_USE and UNKNOWN you now intentionally skip rendering any “return values reuse” line (empty key). If previous behavior showed something for those states, this might be a behavior change.

If the silent omission is desired, the implementation is fine. If not, consider mapping them to explicit resource keys instead of "". Also, instead of using an empty string sentinel, you could use Optional<String> or a nullable String for slightly clearer intent, e.g.:

String reuseKey = switch (returnValueReuse) {
  case DURING_REQUEST -> "duringRequest";
  case DURING_SESSION -> "duringSession";
  case DONT_USE, UNKNOWN -> null;
};

if (reuseKey != null) {
  var reuseHeader = "**" + getResourceString("returnValuesReuse") + ":** ";
  moduleInfoBuilder.add(reuseHeader + getResourceString(reuseKey));
}

115-140: New getModuleFlags helper is straightforward and improves readability

The extracted helper mirrors the previous inline logic, keeps responsibilities separated, and returns a List<String> which is convenient for callers. No functional issues spotted.

If you want a tiny cleanup, you could use var flags = new ArrayList<String>(); consistently with var elsewhere, but that’s purely stylistic and optional.

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

52-58: Nullability on state fields matches their lifecycle; minor style tweak possible

Annotating nodeBeginTransaction and nodeEndFile as nullable aligns with their initialization to null and the explicit null checks before use, which should help static analysis without changing behavior. If there is no project-wide preference, you might consider simplifying private BSLParser.@Nullable StatementContext nodeEndFile; to private @Nullable BSLParser.StatementContext nodeEndFile; for slightly clearer readability and consistency with nodeBeginTransaction.

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

78-88: Consider skipping the dimension-table diagnostic when the cube is missing to avoid cascaded errors

The added check for missing cube dimension tables is logically sound and null-safe; the cubeDimTable != null guard and prior filter chain prevent any issues.

However, the current logic reports both a missing cube and a missing dimension table when only the cube is absent. When nonCubeExists(eds) is true, getCubeDimTable(eds) will also be empty (because the cube lookup fails upstream), triggering both diagnostics for a single root cause. To improve the user experience, consider skipping the dimension-table check when the cube is missing:

-      .forEach((SDBLParser.ExternalDataSourceTableContext eds) -> {
-        if (nonCubeExists(eds)) {
-          diagnosticStorage.addDiagnostic(eds.cubeName, info.getMessage(eds.cubeName.getText()));
-        }
-
-        var cubeDimTable = eds.tableName;
-
-        if (cubeDimTable != null && nonCubeDimTableExists(eds)) {
-          diagnosticStorage.addDiagnostic(cubeDimTable, info.getMessage(eds.tableName.getText()));
-        }
-      });
+      .forEach((SDBLParser.ExternalDataSourceTableContext eds) -> {
+        var cubeMissing = nonCubeExists(eds);
+        if (cubeMissing) {
+          diagnosticStorage.addDiagnostic(eds.cubeName, info.getMessage(eds.cubeName.getText()));
+        }
+
+        var cubeDimTable = eds.tableName;
+
+        if (!cubeMissing && cubeDimTable != null && nonCubeDimTableExists(eds)) {
+          diagnosticStorage.addDiagnostic(cubeDimTable, info.getMessage(eds.tableName.getText()));
+        }
+      });

The test file QueryToMissingMetadataDiagnosticTest.java already exists and covers both missing cubes and missing dimension tables, including the cascaded scenario on line 80 where both errors are expected. Update the test expectations if you adopt the refactor above.

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

24-25: Сделайте nullability fullPath консистентной во всех перегрузках getCachePath

Сейчас 3‑аргументная версия помечает fullPath как @Nullable и корректно обрабатывает null:

public Path getCachePath(String basePath, @Nullable String fullPath, int instanceNumber) {
  if (fullPath != null && !fullPath.isEmpty()) {
    return Path.of(fullPath);
  }
  ...
}

Но 2‑аргументная перегрузка по сигнатуре принимает ненулевой String fullPath:

public Path getCachePath(String basePath, String fullPath) {
  return getCachePath(basePath, fullPath, 0);
}

Если по договору вы действительно допускаете null (а код 3‑аргументного метода к этому готов), имеет смысл:

  • Пометить параметр fullPath в 2‑аргументной версии как @Nullable.
  • Обновить javadoc, явно указав, что null и пустая строка означают "использовать путь по умолчанию".

Например:

-  public Path getCachePath(String basePath, String fullPath) {
+  public Path getCachePath(String basePath, @Nullable String fullPath) {
     return getCachePath(basePath, fullPath, 0);
   }

Так nullability станет однозначной для статического анализа и читателя кода.

Also applies to: 57-59, 80-92, 99-105

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

267-272: Remove unnecessary empty constructor body.

Records automatically provide a canonical constructor, so the explicit empty body adds no value and should be removed.

Apply this diff:

   private record CallParamInfo(
     BSLParser.CallParamContext callParam,
     int paramIndex,
     BSLParser.CallParamListContext callParamList
-  ) {
-  }
+  ) { }

Or simply:

   private record CallParamInfo(
     BSLParser.CallParamContext callParam,
     int paramIndex,
     BSLParser.CallParamListContext callParamList
-  ) {
-  }
+  ) { }

682-682: Simplify nested Optional pattern.

The filter + isPresent pattern can be simplified using flatMap for better readability and idiomatic Optional usage.

Apply this diff:

-    return doCallOpt.filter(doCallContext -> isInsertMethod(doCallContext).isPresent()).isPresent();
+    return doCallOpt.flatMap(AbstractMagicValueDiagnostic::isInsertMethod).isPresent();
📜 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 c422ff5 and a0b8fbb.

📒 Files selected for processing (53)
  • build.gradle.kts (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLLanguageServer.java (5 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/ClientCapabilitiesHolder.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/EventPublisherAspect.java (3 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/SentryAspect.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/PermissionFilterBeforeSendCallback.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/cfg/ControlFlowGraph.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/LanguageServerConfiguration.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/capabilities/package-info.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/codelens/package-info.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/diagnostics/package-info.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/documentlink/package-info.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/formating/package-info.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/package-info.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/ServerContext.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/CognitiveComplexityComputer.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/CyclomaticComplexityComputer.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/computer/ModuleSymbolComputer.java (0 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/ModuleSymbol.java (2 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/AbstractMagicValueDiagnostic.java (17 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/BeginTransactionBeforeTryCatchDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CommentedCodeDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CommitTransactionOutsideTryCatchDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MagicNumberDiagnostic.java (3 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingTemporaryFileDeletionDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ParseErrorDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/QueryNestedFieldsByDotDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/QueryToMissingMetadataDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RefOveruseDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ServerCallsInFormEventsDiagnostic.java (5 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/UnsafeFindByCodeDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UselessTernaryOperatorDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/DescriptionFormatter.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/ModuleSymbolMarkupContentBuilder.java (3 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/CacheConfiguration.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/CachePathProvider.java (3 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/EhCacheAdapter.java (3 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/CommandProvider.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/DiagnosticProvider.java (3 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/RenameProvider.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/SemanticTokensProvider.java (6 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/AnnotationReferenceFinder.java (5 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/ReferenceIndexFiller.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/MdoRefBuilder.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/MultilingualStringAnalyser.java (3 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/Ranges.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/Trees.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/UTF8Control.java (3 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/BslExpression.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java (1 hunks)
💤 Files with no reviewable changes (1)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/ModuleSymbolComputer.java
✅ Files skipped from review due to trivial changes (3)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ServerCallsInFormEventsDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/codelens/package-info.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/formating/package-info.java
🚧 Files skipped from review as they are similar to previous changes (25)
  • build.gradle.kts
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CommentedCodeDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/variable/VariableDescription.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/MethodSymbolComputer.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/CognitiveComplexityComputer.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ParseErrorDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/ServerContext.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/LanguageServerConfiguration.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/RefOveruseDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/DescriptionFormatter.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/DiagnosticProvider.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/package-info.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/CacheConfiguration.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/MultilingualStringAnalyser.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UnsafeFindByCodeDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/capabilities/package-info.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/documentlink/package-info.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/diagnostics/package-info.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/MdoRefBuilder.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/ClientCapabilitiesHolder.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/AnnotationReferenceFinder.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/SemanticTokensProvider.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/Ranges.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/CommandProvider.java
🧰 Additional context used
📓 Path-based instructions (2)
**/*.java

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.java: Follow the Style Guide provided in docs/en/contributing/StyleGuide.md
Use Lombok annotations to reduce boilerplate code and enable annotation processing in your IDE
Optimize imports before committing but do NOT optimize imports across the entire project unless specifically working on that task
Follow Java naming conventions with meaningful, descriptive names; keep class and method names concise but clear
Write JavaDoc for public APIs and include comments for complex logic
Use Target Java 17 as the language version

Files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/EventPublisherAspect.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/RenameProvider.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MagicNumberDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLLanguageServer.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/AbstractMagicValueDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/CachePathProvider.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TransferringParametersBetweenClientAndServerDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/ModuleSymbol.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CommitTransactionOutsideTryCatchDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/cfg/ControlFlowGraph.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/ReferenceIndexFiller.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/EhCacheAdapter.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/Trees.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UselessTernaryOperatorDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/CyclomaticComplexityComputer.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/QueryToMissingMetadataDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/PermissionFilterBeforeSendCallback.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/SentryAspect.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/UTF8Control.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/BslExpression.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/hover/ModuleSymbolMarkupContentBuilder.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingTemporaryFileDeletionDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/BeginTransactionBeforeTryCatchDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/QueryNestedFieldsByDotDiagnostic.java
**/diagnostics/*.java

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Each diagnostic should have a Java implementation class, resource bundle for localized messages, unit tests, and documentation

Files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MagicNumberDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/AbstractMagicValueDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TransferringParametersBetweenClientAndServerDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CommitTransactionOutsideTryCatchDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UselessTernaryOperatorDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/QueryToMissingMetadataDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingTemporaryFileDeletionDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/BeginTransactionBeforeTryCatchDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/QueryNestedFieldsByDotDiagnostic.java
🧠 Learnings (10)
📓 Common learnings
Learnt from: CR
Repo: 1c-syntax/bsl-language-server PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T07:17:33.726Z
Learning: Applies to **/*.java : Use Lombok annotations to reduce boilerplate code and enable annotation processing in your IDE
📚 Learning: 2025-11-27T07:17:33.726Z
Learnt from: CR
Repo: 1c-syntax/bsl-language-server PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T07:17:33.726Z
Learning: Applies to **/diagnostics/*.java : Each diagnostic should have a Java implementation class, resource bundle for localized messages, unit tests, and documentation

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MagicNumberDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/AbstractMagicValueDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/QueryToMissingMetadataDiagnostic.java
📚 Learning: 2025-11-19T09:02:03.154Z
Learnt from: theshadowco
Repo: 1c-syntax/bsl-language-server PR: 3610
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/folding/QueryPackageFoldingRangeSupplier.java:26-26
Timestamp: 2025-11-19T09:02:03.154Z
Learning: В проекте bsl-language-server используется кастомная версия ANTLR4 от 1c-syntax (io.github.1c-syntax:antlr4), которая включает базовый класс org.antlr.v4.runtime.Tokenizer с методами getAst() и getTokens(). SDBLTokenizer и BSLTokenizer наследуются от этого базового класса.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MagicNumberDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/Trees.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingTemporaryFileDeletionDiagnostic.java
📚 Learning: 2025-04-18T22:46:43.245Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3449
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java:192-203
Timestamp: 2025-04-18T22:46:43.245Z
Learning: В проекте bsl-language-server класс BSLParser.ExpressionContext наследуется от BSLParserRuleContext, а не напрямую от ParserRuleContext. При работе с ним нужно учитывать специфичные методы BSLParserRuleContext.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MagicNumberDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/AbstractMagicValueDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/Trees.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/BslExpression.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingTemporaryFileDeletionDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/QueryNestedFieldsByDotDiagnostic.java
📚 Learning: 2025-01-19T20:47:40.061Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3388
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/codelens/TestRunnerAdapterOptions.java:46-46
Timestamp: 2025-01-19T20:47:40.061Z
Learning: Configuration classes in the BSL Language Server project use mutable collections (HashMap, ArrayList) and Data annotation from Lombok, allowing for modification of configuration properties after initialization.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLLanguageServer.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/CachePathProvider.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/EhCacheAdapter.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/SentryAspect.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingTemporaryFileDeletionDiagnostic.java
📚 Learning: 2025-02-10T17:12:56.150Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3408
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ProtectedModuleDiagnostic.java:63-66
Timestamp: 2025-02-10T17:12:56.150Z
Learning: In BSL Language Server, `documentContext.getServerContext().getConfiguration()` is guaranteed to return a non-null value, making null checks unnecessary.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLLanguageServer.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/ModuleSymbol.java
📚 Learning: 2025-11-27T07:17:33.726Z
Learnt from: CR
Repo: 1c-syntax/bsl-language-server PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T07:17:33.726Z
Learning: Applies to **/diagnostics/*Test.java : Write comprehensive unit tests for each diagnostic including test cases for edge cases, following existing test patterns

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/AbstractMagicValueDiagnostic.java
📚 Learning: 2025-01-20T19:33:59.692Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3388
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunAllTestsCodeLensSupplier.java:55-59
Timestamp: 2025-01-20T19:33:59.692Z
Learning: In Spring, self-injection pattern (using Autowired Lazy on a self-reference field) is required to enable caching through Cacheable when methods are called from within the same class, as Spring's proxy-based AOP doesn't work with direct 'this' references.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/EhCacheAdapter.java
📚 Learning: 2025-04-18T22:42:30.042Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 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/utils/expressiontree/BslExpression.java
📚 Learning: 2025-02-10T17:13:41.452Z
Learnt from: theshadowco
Repo: 1c-syntax/bsl-language-server PR: 3408
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ProtectedModuleDiagnostic.java:54-58
Timestamp: 2025-02-10T17:13:41.452Z
Learning: In ProtectedModuleDiagnostic.java, the usage of `Range` field as a diagnostic target is accepted as is, despite being marked as a temporary solution in the comments.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingTemporaryFileDeletionDiagnostic.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). (9)
  • GitHub Check: build (21, windows-latest)
  • GitHub Check: build (21, macOS-latest)
  • GitHub Check: build (17, macOS-latest)
  • GitHub Check: build (25, ubuntu-latest)
  • GitHub Check: build (17, windows-latest)
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build
  • GitHub Check: Benchmark
  • GitHub Check: Analyse
🔇 Additional comments (45)
src/main/java/com/github/_1c_syntax/bsl/languageserver/references/ReferenceIndexFiller.java (1)

247-257: Formatting-only refactor of ifPresent looks good

The findCommonModule(...).ifPresent(...) block is now just reformatted; control flow, null handling, and arguments to addModuleReference are unchanged. This keeps behavior intact while matching the surrounding style.

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

247-249: Explicit no-op else keeps behavior unchanged and clarifies intent

The added else { // no-op } keeps the previous behavior of ignoring non‑MemberContext/OperationContext children while making that choice explicit (and likely silencing static analysis warnings). Looks good as-is; no functional or style issues from the perspective of the current guidelines.

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

113-113: Good refactoring to make the method static.

The method doesn't access any instance state, so making it static is appropriate and follows Java best practices.

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

33-33: LGTM! Appropriate import for nullability annotation.

The JSpecify @Nullable import is correctly added to support the nullability annotation on the getVariableName method.


171-171: LGTM! Nullability annotation correctly applied.

The @Nullable annotation accurately documents that getVariableName can return null (lines 176, 181). The existing null check at line 98 confirms proper handling by callers.

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

43-43: LGTM: Redundant initialization removed.

The explicit initialization to false is unnecessary since boolean fields default to false in Java. This simplification is valid and aligns with the PR's refactoring objectives.


60-60: LGTM: Formatting corrections applied.

Added spaces after if keywords, conforming to standard Java style conventions.

Also applies to: 74-74


68-73: LGTM: Comment formatting improved.

The multi-line block format enhances readability for this explanatory comment without changing its content.

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

33-33: LGTM: Null-safety annotation import.

Adding the JSpecify @Nullable annotation improves null-safety across the codebase.

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

27-33: Nullable entryPoint looks correct; verify Lombok + JSpecify interplay

Marking entryPoint as @Nullable aligns with the broader null‑safety refactor and keeps the Lombok-based API minimal. Please just verify that your Lombok configuration propagates the field’s @Nullable to the generated getEntryPoint() return type in a way that your JSpecify-aware tools understand; if not, you may need to add method-level/nullness annotations via Lombok’s onMethod_ or similar configuration. Based on learnings, this continues the preferred Lombok-based style while tightening null contracts.

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

143-155: Нет функциональных изменений в isCachedValueParameter

Изменения в этом блоке носят только форматный характер (пустые строки), логика кэш‑параметров осталась прежней и выглядит корректной.


157-163: Корректный переход на статический method reference

Замена .anyMatch(this::hasClientCompilerDirective) на .anyMatch(TransferringParametersBetweenClientAndServerDiagnostic::hasClientCompilerDirective) соответствует переводу хелпера в static и убирает лишнюю привязку к экземпляру. Поведения не меняет.


165-179: Статические хелперы оформлены корректно

Перевод hasVariableWithName и hasClientCompilerDirective в private static оправдан (они не используют состояние объекта), сигнатуры и логика не изменились. Использование Optional::stream и сравнение директив выглядит корректным для целевой Java 17.

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

34-34: Import of java.util.List is appropriate

The added List import matches the new helper’s return type and keeps the public contract on the abstract type rather than ArrayList, which is good API style.

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

26-28: LGTM! Import optimization for Lombok annotations.

The addition of nested annotation imports (Builder.Default and EqualsAndHashCode.Include) enables cleaner shorthand notation throughout the file, which is a standard Lombok practice for reducing verbosity.


55-66: LGTM! Consistent use of shorthand Lombok annotations.

The conversion from fully qualified annotation names (@EqualsAndHashCode.Include, @Builder.Default) to their shorthand equivalents (@Include, @Default) is correct and improves code readability. The usage is appropriate:

  • @Include marks fields for inclusion in equals/hashCode (consistent with @EqualsAndHashCode(onlyExplicitlyIncluded = true))
  • @Default provides a default value for the builder
src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/UTF8Control.java (3)

24-25: LGTM: Import addition aligns with project-wide nullability annotations.

The import of @Nullable from org.jspecify is appropriate and consistent with the project's broader refactoring to add nullability annotations throughout the codebase.


50-51: LGTM: Type inference with var reduces verbosity appropriately.

The use of var for local variables is appropriate here as the types are clear from the method calls on the right-hand side (toBundleName(), toResourceName(), getResource(), openConnection(), and new InputStreamReader()). This modernizes the code while maintaining readability.

Also applies to: 55-55, 57-57, 68-68


44-48: @nullable annotation correctly documents null return possibility.

The @Nullable annotation on the return type is appropriate since the method can return null (line 75 returns bundle which is initialized to null at line 52 and remains null when the resource stream is not found). This makes the contract explicit for callers. The annotation uses org.jspecify.annotations.Nullable, which is a modern, tool-agnostic approach suitable for Java 17.

src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/SentryAspect.java (3)

36-36: LGTM!

The import addition is properly placed and supports the nullability annotation added to the languageClientHolder field.


54-54: LGTM!

The @Nullable annotation appropriately marks languageClientHolder as an optional dependency, making the contract explicit and enabling better null-safety checks.


83-100: Excellent refactoring for thread safety and null handling.

The changes properly address the nullable languageClientHolder field while improving thread safety:

  1. TOCTOU prevention: Copying languageClientHolder to the local clientHolder variable (line 89) prevents race conditions in the async context where the field could theoretically be set to null between the null check and usage.

  2. Defensive programming: Early returns (lines 86-88, 90-92) clearly handle invalid states before performing unnecessary work.

  3. Null safety: Explicit null check on clientHolder prevents potential NPE when the dependency is not injected.

The refactoring maintains the same functional behavior while making the code more robust in concurrent scenarios.

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

33-33: Nullable import is correctly introduced and used

The org.jspecify.annotations.Nullable import is justified by the field annotations below and is not unused; no issues here.

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

32-37: Import reordering is consistent with style

Imports are now grouped logically (project, third‑party, then JDK) with clear separation; no functional impact and aligns with typical Java import organization.


99-99: Whitespace-only change

This line change is purely formatting with no behavioral effect; safe to keep as is.


120-133: Refactored isWrongExpression logic looks correct; verify diagnostics coverage

The new Optional-based flow in isWrongExpression is clearer: it preserves the early return for index access, explicitly skips structure/correspondence, flags return statements, and otherwise applies the existing numeric/call-param checks. I don’t see correctness or null-safety issues here.

Given this affects when the magic-number diagnostic is raised, please ensure existing tests and documentation for this diagnostic still match the updated conditions (or add/update them if needed), along with the resource bundle messages, as required for diagnostics. As per coding guidelines and retrieved learnings for diagnostics.

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

31-32: Аннотация @Nullable для parent корректно отражает семантику

Корневые узлы дерева действительно могут не иметь родителя, так что пометка parent как @Nullable и добавленный импорт jspecify выглядят уместно и консистентно с остальным PR.

Also applies to: 46-48

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

33-34: Перевод на jspecify @Nullable и var в рекурсивном поиске выглядит безопасным

Импорт org.jspecify.annotations.Nullable согласуется с уже использующими @Nullable методами, а замена явного Optional<TerminalNode> на var в findTerminalNodeContainsPosition не меняет тип и поведение, улучшая читаемость.

Also applies to: 292-321

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

40-41: Защита от null для applicationEventPublisher улучшает устойчивость аспекта

Аннотация @Nullable для поля и дополнительная проверка applicationEventPublisher == null в publishEvent логично дополняют флаг active и убирают потенциальный NullPointerException во время остановки/инициализации бинов, при этом внешний контракт аспекта не меняется.

Also applies to: 60-62, 103-109

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

70-71: Использование var и явной @Nullable для throwable делает код инициализации чище

  • Перевод локальных переменных (capabilities, rootUri, configurationRoot, фабрика/экзекутор) на var здесь прозрачен по типам и улучшает читаемость без изменения логики.
  • Сигнатура whenComplete((Void unused, @Nullable Throwable throwable) -> ...) точно отражает контракт CompletableFuture.runAsync (результат Void, throwable может быть null), при этом обработка ошибок (LOGGER.error(...)) осталась прежней.

По совокупности изменений поведение initialize/initialized не меняется, только становится более явной nullability.

Also applies to: 109-113, 146-159, 161-173

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

37-38: @nullable Range annotation and null-handling are correctly implemented

The transition to @Nullable Range in getPrepareRename is well-designed. The method correctly returns null when no suitable SourceDefinedSymbol is found, which aligns properly with jspecify annotations:

public @Nullable Range getPrepareRename(DocumentContext documentContext, TextDocumentPositionParams params) {
  return referenceResolver.findReference(documentContext.getUri(), params.getPosition())
    .filter(Reference::isSourceDefinedSymbolReference)
    .map(Reference::getSelectionRange)
    .orElse(null);
}

Null handling is correctly implemented at all call sites:

  • Test cases explicitly validate both null and non-null scenarios (assertThat(range).isNull() and assertThat(range).isEqualTo(...))
  • Production code in BSLTextDocumentService wraps the result in Either3.forFirst(), which is the standard LSP4J pattern for handling optional return values
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/AbstractMagicValueDiagnostic.java (13)

29-32: LGTM!

Import organization is clean and follows standard conventions.


97-103: LGTM!

Replacing sequential early-returns with a single return expression improves readability and maintainability.


128-136: LGTM!

The refactoring to use functional-style Optional handling (map/orElse) is more idiomatic and eliminates explicit emptiness checks.


224-224: LGTM!

Using flatMap for Optional chaining is the idiomatic functional approach.


256-256: LGTM!

Using flatMap for Optional chaining is the idiomatic functional approach.


310-312: LGTM!

Using flatMap for Optional chaining is the idiomatic functional approach.


362-365: LGTM!

Javadoc parameter alignment improves documentation consistency.

Also applies to: 387-390, 417-421, 461-463, 708-710


490-494: LGTM!

The functional-style Optional handling with map/orElse is cleaner and more maintainable.


559-568: LGTM!

Additional blank lines improve readability by visually separating logical sections.


636-636: LGTM!

The orElse(false) pattern is appropriate for this boolean check.


661-661: LGTM!

The orElse(false) pattern is appropriate for this boolean check.


712-713: LGTM!

Parameter alignment in the method signature improves consistency.


38-38: The code at this location is clean with no debug artifacts, commented-out code, or style issues. AbstractMagicValueDiagnostic is properly tested through its concrete implementations (MagicDateDiagnostic and MagicNumberDiagnostic), which have comprehensive test suites. No action required on this file.

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

72-79: Explicitly nullable execute return type matches Sentry’s contract

Making execute return @Nullable SentryEvent correctly documents that returning null drops the event, which aligns with SentryOptions.BeforeSendCallback semantics. The implementation already behaved this way (return null when sendToSentry() is false), so this change improves API clarity without altering behavior. (javadoc.io)

One thing to be aware of: dropping Lombok’s @NonNull on event and hint also removes Lombok-generated runtime null checks. If you still want hard guarantees here (beyond Sentry’s own @NotNull contract), consider adding JSpecify @NonNull type‑use annotations later as part of the broader nullness rollout.

Please re-run your usual build (e.g., ./gradlew compileJava or gradlew precommit) to confirm there are no signature/override mismatches against the Sentry dependency version in this project.

@theshadowco theshadowco enabled auto-merge (squash) December 11, 2025 16:31
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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java (1)

69-73: Potential null safety issue: buildExpressionTree returns non-nullable but calls nullable getter.

buildExpressionTree declares a non-nullable BslExpression return type but delegates to getExpressionTree() which is now @Nullable. Callers may receive null unexpectedly.

Consider either:

  1. Adding @Nullable to buildExpressionTree return type for consistency
  2. Adding a null check with fallback (e.g., return ErrorExpressionNode)
-  public static BslExpression buildExpressionTree(BSLParser.ExpressionContext ctx) {
+  public static @Nullable BslExpression buildExpressionTree(BSLParser.ExpressionContext ctx) {
     var instance = new ExpressionTreeBuildingVisitor();
     instance.visitExpression(ctx);
     return instance.getExpressionTree();
   }
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/AbstractMagicValueDiagnostic.java (2)

393-413: Поиск присваивания берёт первое совпадение, а не ближайшее предшествующее (возможная неверная инференция типа).

findAssignmentInCodeBlock сейчас возвращает первое присваивание переменной в блоке, которое находится текстуально до beforeNode. Если переменная несколько раз переопределяется до вызова (x = New Structure(); x = New Map(); x.Insert(...);), метод вернёт самое раннее присваивание, а не последнее перед вызовом, и тип может быть определён неверно.

Имеет смысл искать последнее присваивание до позиции:

-    for (var statement : codeBlock.statement()) {
-      if (statement == null) {
-        continue;
-      }
-
-      var assignmentOpt = findAssignmentInStatement(statement, beforeLine, beforeChar, variableName);
-      if (assignmentOpt.isPresent()) {
-        return assignmentOpt;
-      }
-    }
-
-    return Optional.empty();
+    var statements = codeBlock.statement();
+    for (var i = statements.size() - 1; i >= 0; i--) {
+      var statement = statements.get(i);
+      if (statement == null) {
+        continue;
+      }
+
+      var assignmentOpt = findAssignmentInStatement(statement, beforeLine, beforeChar, variableName);
+      if (assignmentOpt.isPresent()) {
+        return assignmentOpt;
+      }
+    }
+
+    return Optional.empty();

Такое изменение сделает поведение ближе к описанию в JavaDoc (“до указанного узла”) и фактическому порядку выполнения кода.


692-719: insideContext() should traverse parent chain like other similar methods in this class.

The current implementation only checks the immediate parent via contextClass.isInstance(expression.getParent()). However, expressions can be nested within intermediate nodes (parentheses, unary operators, etc.), causing false negatives. Other methods in the same file—findCallStatement() (line 162), findCallParamContext() (line 506)—already traverse the ancestor chain with depth limits. The insideContext() method should follow the same pattern:

-  protected static boolean insideContext(BSLParser.@Nullable ExpressionContext expression,
-                                         Class<? extends ParserRuleContext> contextClass) {
-    if (expression == null) {
-      return false;
-    }
-    return contextClass.isInstance(expression.getParent());
-  }
+  protected static boolean insideContext(BSLParser.@Nullable ExpressionContext expression,
+                                         Class<? extends ParserRuleContext> contextClass) {
+    if (expression == null) {
+      return false;
+    }
+
+    ParserRuleContext current = expression.getParent();
+    for (int i = 0; i < MAX_PARENT_TRAVERSAL_DEPTH_FOR_CALL_PARAM && current != null; i++) {
+      if (contextClass.isInstance(current)) {
+        return true;
+      }
+      current = current.getParent();
+    }
+
+    return false;
+  }

Since insideSimpleAssignment() and insideReturnStatement() are used in critical diagnostic decision logic (MagicDateDiagnostic, MagicNumberDiagnostic), verify existing test suites pass with this change.

🧹 Nitpick comments (3)
src/main/java/com/github/_1c_syntax/bsl/languageserver/cfg/ControlFlowGraphWalker.java (1)

27-38: Good null-safety improvement; consider adding a diagnostic message

Using Objects.requireNonNull on graph.getEntryPoint() is a solid way to enforce the invariant that currentNode is never null after start(). To make failures easier to diagnose, consider adding a message:

currentNode = Objects.requireNonNull(
  graph.getEntryPoint(),
  "ControlFlowGraph entry point must not be null when starting walker"
);

This keeps the behavior (fail fast) while providing clearer context if the invariant is violated.

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

90-102: Objects.requireNonNull usage is correct; consider a tiny cleanup

The explicit Objects.requireNonNull(node.getParent()) in both addDiagnostic overloads accurately encodes the non‑null precondition and matches the checks in visitBinaryOperation / visitUnaryOperation. Functionally this is safe and improves null-safety signaling.

If you want to tighten it a bit, you could:

  • Reuse the already validated parent instead of re-fetching it, and/or
  • Extract the duplicated startToken computation into a small private helper taking BslExpression parent.

For example:

-  private void addDiagnostic(BinaryOperationNode node) {
-    var startToken = Trees.getTokens(Objects.requireNonNull(node.getParent()).getRepresentingAst())
+  private void addDiagnostic(BinaryOperationNode node) {
+    var parent = Objects.requireNonNull(node.getParent());
+    var startToken = Trees.getTokens(parent.getRepresentingAst())
       .stream()
       .findFirst()
       .orElseThrow();

Same pattern can be applied to the unary case or factored into a common helper. Optional, as current code is already correct.

Also applies to: 104-116

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

119-122: @nullable return is correct; consider explicit Optional usage around sub-context

Marking getSubContext as @Nullable ParserRuleContext correctly reflects that Trees.getAncestorByRuleIndex may return null, without changing behavior. To make the null contract clearer and avoid potential NPEs or nullability warnings around symbolTree.getMethodSymbol(getSubContext(ctx)), you could optionally wrap the sub-context in Optional.ofNullable:

-  private Optional<MethodSymbol> methodSymbol(BSLParser.ProcDeclarationContext ctx) {
-    return Optional.of(documentContext.getSymbolTree())
-      .flatMap(symbolTree -> symbolTree.getMethodSymbol(getSubContext(ctx)));
-  }
+  private Optional<MethodSymbol> methodSymbol(BSLParser.ProcDeclarationContext ctx) {
+    return Optional.of(documentContext.getSymbolTree())
+      .flatMap(symbolTree ->
+        Optional.ofNullable(getSubContext(ctx))
+          .flatMap(symbolTree::getMethodSymbol)
+      );
+  }

This is not strictly required if grammar guarantees a non-null ancestor, but it makes the nullability intent explicit and keeps static analysis happy.

If you adopt this pattern, please verify that the signature of getMethodSymbol is compatible with a potentially absent sub-context and that diagnostics behavior (presence/absence of findings) remains unchanged in your existing tests.

Also applies to: 132-134

📜 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 a0b8fbb and 7d473c8.

📒 Files selected for processing (47)
  • build.gradle.kts (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLTextDocumentService.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/LanguageClientHolder.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/MeasuresAspect.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/PermissionFilterBeforeSendCallback.java (3 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/cfg/CfgBuildingParseTreeVisitor.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/cfg/ControlFlowGraphWalker.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/cli/lsp/FileAwarePrintWriter.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/AbstractRunTestsCodeLensSupplier.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/LanguageServerConfiguration.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/diagnostics/DiagnosticsOptions.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/ServerContext.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/DiagnosticIgnoranceComputer.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/MethodSymbol.java (1 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/variable/VariableDescription.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/AbstractMagicValueDiagnostic.java (19 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CreateQueryInCycleDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DataExchangeLoadingDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DoubleNegativesDiagnostic.java (3 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DuplicatedInsertionIntoCollectionDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/FieldsFromJoinsWithoutIsNullDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/IncorrectUseLikeInQueryDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/IncorrectUseOfStrTemplateDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/IsInRoleMethodDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MagicDateDiagnostic.java (3 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingTempStorageDeletionDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/NestedFunctionInParametersDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/SelectTopWithoutOrderByDiagnostic.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/UnusedParametersDiagnostic.java (0 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UsageWriteLogEventDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UsingExternalCodeToolsDiagnostic.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UsingThisFormDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/metadata/DiagnosticInfo.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/folding/CodeBlockFoldingRangeSupplier.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/LanguageClientAwareAppender.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/jsonrpc/DiagnosticParams.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/SelectionRangeProvider.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/utils/DiagnosticHelper.java (4 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/MultilingualStringAnalyser.java (4 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/UTF8Control.java (3 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/BslExpression.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ErrorExpressionNode.java (2 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java (5 hunks)
💤 Files with no reviewable changes (1)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UnusedParametersDiagnostic.java
✅ Files skipped from review due to trivial changes (21)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/jsonrpc/DiagnosticParams.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/providers/SelectionRangeProvider.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/diagnostics/DiagnosticsOptions.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/BSLTextDocumentService.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/description/DescriptionReader.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/MethodSymbol.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/LanguageClientHolder.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/SymbolOccurrence.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/cfg/CfgBuildingParseTreeVisitor.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/cli/lsp/FileAwarePrintWriter.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/SelectTopWithoutOrderByDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/NestedFunctionInParametersDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/AbstractRunTestsCodeLensSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/CreateQueryInCycleDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UsageWriteLogEventDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/folding/CodeBlockFoldingRangeSupplier.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/TimeoutsInExternalResourcesDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/IsInRoleMethodDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/references/model/Symbol.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MissingTempStorageDeletionDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/DiagnosticIgnoranceComputer.java
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/UTF8Control.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/BslExpression.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/ServerContext.java
  • build.gradle.kts
🧰 Additional context used
📓 Path-based instructions (2)
**/*.java

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.java: Follow the Style Guide provided in docs/en/contributing/StyleGuide.md
Use Lombok annotations to reduce boilerplate code and enable annotation processing in your IDE
Optimize imports before committing but do NOT optimize imports across the entire project unless specifically working on that task
Follow Java naming conventions with meaningful, descriptive names; keep class and method names concise but clear
Write JavaDoc for public APIs and include comments for complex logic
Use Target Java 17 as the language version

Files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/LanguageClientAwareAppender.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DataExchangeLoadingDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/MultilingualStringAnalyser.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UsingThisFormDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/MeasuresAspect.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/metadata/DiagnosticInfo.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UsingExternalCodeToolsDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/IncorrectUseOfStrTemplateDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/AbstractMagicValueDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DoubleNegativesDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ErrorExpressionNode.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/cfg/ControlFlowGraphWalker.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MagicDateDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/variable/VariableDescription.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/IncorrectUseLikeInQueryDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/DiagnosticHelper.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/FieldsFromJoinsWithoutIsNullDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DuplicatedInsertionIntoCollectionDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/LanguageServerConfiguration.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/PermissionFilterBeforeSendCallback.java
**/diagnostics/*.java

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Each diagnostic should have a Java implementation class, resource bundle for localized messages, unit tests, and documentation

Files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DataExchangeLoadingDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UsingThisFormDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UsingExternalCodeToolsDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/IncorrectUseOfStrTemplateDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/AbstractMagicValueDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DoubleNegativesDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MagicDateDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/IncorrectUseLikeInQueryDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/FieldsFromJoinsWithoutIsNullDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DuplicatedInsertionIntoCollectionDiagnostic.java
🧠 Learnings (12)
📓 Common learnings
Learnt from: CR
Repo: 1c-syntax/bsl-language-server PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T07:17:33.726Z
Learning: Applies to **/*.java : Use Lombok annotations to reduce boilerplate code and enable annotation processing in your IDE
📚 Learning: 2025-11-27T07:17:33.726Z
Learnt from: CR
Repo: 1c-syntax/bsl-language-server PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T07:17:33.726Z
Learning: Applies to **/diagnostics/*.java : Each diagnostic should have a Java implementation class, resource bundle for localized messages, unit tests, and documentation

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DataExchangeLoadingDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/metadata/DiagnosticInfo.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UsingExternalCodeToolsDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/AbstractMagicValueDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MagicDateDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/DiagnosticHelper.java
📚 Learning: 2025-04-18T22:46:43.245Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3449
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java:192-203
Timestamp: 2025-04-18T22:46:43.245Z
Learning: В проекте bsl-language-server класс BSLParser.ExpressionContext наследуется от BSLParserRuleContext, а не напрямую от ParserRuleContext. При работе с ним нужно учитывать специфичные методы BSLParserRuleContext.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DataExchangeLoadingDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/MultilingualStringAnalyser.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/IncorrectUseOfStrTemplateDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/AbstractMagicValueDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/FieldsFromJoinsWithoutIsNullDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DuplicatedInsertionIntoCollectionDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java
📚 Learning: 2025-11-19T09:02:03.154Z
Learnt from: theshadowco
Repo: 1c-syntax/bsl-language-server PR: 3610
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/folding/QueryPackageFoldingRangeSupplier.java:26-26
Timestamp: 2025-11-19T09:02:03.154Z
Learning: В проекте bsl-language-server используется кастомная версия ANTLR4 от 1c-syntax (io.github.1c-syntax:antlr4), которая включает базовый класс org.antlr.v4.runtime.Tokenizer с методами getAst() и getTokens(). SDBLTokenizer и BSLTokenizer наследуются от этого базового класса.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/MultilingualStringAnalyser.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/IncorrectUseOfStrTemplateDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/context/symbol/variable/VariableDescription.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/IncorrectUseLikeInQueryDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/DiagnosticHelper.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/FieldsFromJoinsWithoutIsNullDiagnostic.java
📚 Learning: 2025-11-27T07:17:33.726Z
Learnt from: CR
Repo: 1c-syntax/bsl-language-server PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T07:17:33.726Z
Learning: Applies to docs/*/diagnostics/**/*.md : Update diagnostic documentation in both Russian and English with examples of problematic code and fixes

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/UsingExternalCodeToolsDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/DiagnosticHelper.java
📚 Learning: 2025-02-10T17:13:41.452Z
Learnt from: theshadowco
Repo: 1c-syntax/bsl-language-server PR: 3408
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ProtectedModuleDiagnostic.java:54-58
Timestamp: 2025-02-10T17:13:41.452Z
Learning: In ProtectedModuleDiagnostic.java, the usage of `Range` field as a diagnostic target is accepted as is, despite being marked as a temporary solution in the comments.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/IncorrectUseOfStrTemplateDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DuplicatedInsertionIntoCollectionDiagnostic.java
📚 Learning: 2024-07-04T19:35:26.747Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3308
File: src/test/resources/diagnostics/DoubleNegativesDiagnostic.bsl:20-21
Timestamp: 2024-07-04T19:35:26.747Z
Learning: The file `DoubleNegativesDiagnostic.bsl` is a test resource intended to demonstrate the functionality of the DoubleNegatives diagnostic.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/DoubleNegativesDiagnostic.java
📚 Learning: 2025-04-18T22:42:30.042Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 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/utils/expressiontree/ErrorExpressionNode.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java
📚 Learning: 2025-01-19T21:34:39.797Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3388
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/codelens/TestRunnerAdapterOptions.java:46-46
Timestamp: 2025-01-19T21:34:39.797Z
Learning: In BSL Language Server configuration classes, immutable collections (Set.of, List.of) should be used for default values, while mutability is achieved through setters generated by Data annotation.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/cfg/ControlFlowGraphWalker.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/LanguageServerConfiguration.java
📚 Learning: 2025-11-27T07:17:33.726Z
Learnt from: CR
Repo: 1c-syntax/bsl-language-server PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T07:17:33.726Z
Learning: Applies to **/diagnostics/*Test.java : Write comprehensive unit tests for each diagnostic including test cases for edge cases, following existing test patterns

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/MagicDateDiagnostic.java
📚 Learning: 2025-02-10T17:12:56.150Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3408
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/ProtectedModuleDiagnostic.java:63-66
Timestamp: 2025-02-10T17:12:56.150Z
Learning: In BSL Language Server, `documentContext.getServerContext().getConfiguration()` is guaranteed to return a non-null value, making null checks unnecessary.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/DiagnosticHelper.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/LanguageServerConfiguration.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/PermissionFilterBeforeSendCallback.java
📚 Learning: 2025-01-19T20:47:40.061Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3388
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/codelens/TestRunnerAdapterOptions.java:46-46
Timestamp: 2025-01-19T20:47:40.061Z
Learning: Configuration classes in the BSL Language Server project use mutable collections (HashMap, ArrayList) and Data annotation from Lombok, allowing for modification of configuration properties after initialization.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/DiagnosticHelper.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/LanguageServerConfiguration.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/PermissionFilterBeforeSendCallback.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). (9)
  • GitHub Check: build (25, macOS-latest)
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build (21, ubuntu-latest)
  • GitHub Check: build (17, windows-latest)
  • GitHub Check: build (21, windows-latest)
  • GitHub Check: build (25, ubuntu-latest)
  • GitHub Check: build (17, macOS-latest)
  • GitHub Check: build (25, windows-latest)
  • GitHub Check: build
🔇 Additional comments (28)
src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/LanguageClientAwareAppender.java (1)

24-33: Nullable import adjustment is correct

The org.jspecify.annotations.Nullable import matches the @Nullable usage on clientHolder and the reordering has no behavioral impact. Looks good as-is.

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

34-34: LGTM! Import reordering aligns with PR refactoring goals.

The repositioning of the @Nullable import is purely cosmetic and consistent with the broader refactoring effort across the codebase.

src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/MeasuresAspect.java (2)

37-38: Nullability import is consistent and scoped correctly

Adding org.jspecify.annotations.Nullable is appropriate here and is only used for the MeasureCollector field; there’s no unused-import issue or scope bleed.


53-59: @Nullable on measureCollector matches existing guards and lifecycle

Marking measureCollector as @Nullable aligns with the existing measureCollector == null checks in all advice methods and with destroy() explicitly clearing the reference via setMeasureCollector(null). This makes the optional dependency explicit without changing behavior, and keeps Lombok-based setter injection intact. Based on learnings, this is consistent with the project’s Lombok usage recommendations.

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

34-34: Appropriate nullability annotation library.

Using org.jspecify.annotations.Nullable is a good choice for modern Java nullability annotations, providing standardized null-safety semantics.


72-81: Well-applied nullability annotation with proper null-safety handling.

The @Nullable annotation accurately reflects that ctx.IDENTIFIER() can return null in ANTLR-generated parsers. The existing null check on line 73 properly guards against NPE before using the identifier. The diagnostic logic is sound.

src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/DiagnosticHelper.java (4)

30-40: LGTM!

Import reorganization is correct. All imported types (ParseTree, TerminalNode, Tree, @Nullable) are actively used in the file, and the jspecify @Nullable annotation aligns with the project's nullability annotation strategy.


156-180: Good nullability annotation.

The @Nullable annotation correctly documents the existing null-safe behavior since the method already checks for null at line 157. This is a good API clarification.


189-200: Consider nullability consistency with the two-parameter overload.

The two-parameter overload now accepts @Nullable Map<String, Object> configuration, but this three-parameter overload does not annotate its configuration parameter. If a null configuration is passed here, line 194 would throw NPE on configuration.containsKey(name).

If this is intentional (callers must pass non-null here), consider adding @NonNull annotation explicitly for clarity. Otherwise, add a null guard for consistency.


55-57: Minor JavaDoc formatting adjustment.

Whitespace alignment in JavaDoc is acceptable.

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

93-93: LGTM! Type inference simplifies the code without sacrificing clarity.

The use of var here is appropriate since the type BSLParser.ParamListContext is explicitly present in the method call as a parameter (getRuleContext(BSLParser.ParamListContext.class, 0)), making the type inference clear and unambiguous.

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

36-36: LGTM — migration to jspecify nullability annotations.

Using org.jspecify.annotations.Nullable is a good choice as jspecify is the emerging standard for nullability annotations in Java.

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

29-29: LGTM! Nullable annotation correctly documents existing behavior.

The @Nullable annotation on sourceCodeOperator is appropriate since:

  1. The no-arg constructor already implies null is acceptable
  2. Error nodes represent parse failures where source context may be unavailable
  3. Aligns with the broader nullability annotations being added to BslExpression

Also applies to: 47-49

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

60-60: LGTM! Nullable annotations correctly document field behavior.

The field is uninitialized (null by default) and the getter now properly reflects this in its contract.

Also applies to: 78-80


108-116: Clean refactor using pattern matching instanceof.

Good use of Java 17 pattern matching for type checks. The code is now more concise and readable compared to separate instanceof + cast operations.


194-201: LGTM! Nullable parameter is properly handled.

The method correctly guards against null expression at line 198-201 by pushing an ErrorExpressionNode, which aligns with the newly nullable ErrorExpressionNode constructor.

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

33-33: Import reorder is OK; no functional impact

Moving the org.jspecify.annotations.Nullable import under the IOUtils import is stylistic only and does not affect behavior. The file remains consistent with the existing Lombok-based style.

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

32-32: Import reorder is OK

org.jspecify.annotations.Nullable remains in the correct import group after ParserRuleContext; this is a no-op change that keeps style consistent and doesn’t affect behavior.

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

31-39: LGTM! Import organization improved.

The addition of @Nullable import and reordering of existing imports follow the coding guidelines for optimizing imports before committing.


175-178: LGTM! Null handling is correct.

The @Nullable annotation is appropriate, and the method correctly guards against null input by returning false early (lines 176-178). This is consistent with the defensive programming pattern used throughout the codebase.


122-126: No action required—null safety is properly implemented.

The @Nullable annotation on the expressionContext parameter is correct and safe. All three delegated helper methods (insideSimpleAssignment, insideReturnStatement, and insideAssignmentWithDateMethodForSimpleDate) safely handle null parameters. Both insideSimpleAssignment and insideReturnStatement delegate to insideContext() in AbstractMagicValueDiagnostic.java (line 713), which explicitly checks for null at line 715-716 and returns false rather than dereferencing a null value.

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

35-36: Import of java.util.Objects is appropriate and scoped correctly

Objects is used only for requireNonNull in this class, and the import keeps usage clear and localized. No further action needed here.

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

99-107: Consider removing unused constructor or clarifying its intended purpose

The constructor VariableDescription(ParameterDescription param) at lines 99-107 is not called anywhere in the codebase. If this constructor is dead code, it should be removed. If it's intended for future use, add a comment explaining the purpose and consider restoring explicit null-safety (e.g., requireNonNull(param, "param")) since the removal of @NonNull leaves the contract ambiguous—param.link() on line 105 will still NPE if called with null, just without a clear contract.

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

37-37: Nullability import matches ongoing JSpecify adoption

The added org.jspecify.annotations.Nullable import is consistent with the null-safety refactor in diagnostics and keeps this class aligned with the rest of the codebase; no issues here.

Please ensure gradlew precommit still passes JSpecify/nullness checks after this change when you run it for the PR.

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

41-41: Импорт org.jspecify.annotations.Nullable выглядит корректно

Импорт соответствует используемым в классе аннотациям @Nullable и вписывается в порядок импортов (сперва сторонние библиотеки, затем java.*). Функционального поведения изменение не затрагивает.

При последующем запуске ./gradlew precommit убедитесь, что модуль успешно собирается с jspecify в classpath и нет предупреждений от анализаторов по дублюющимся аннотациям nullability.

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

27-27: Nullability contracts and var usage are consistent and safe here

  • Marking variableName and getVariableName(...) as @Nullable matches the actual control flow in parse/istVariableUsingInTemplate and removes implicit assumptions.
  • Annotating getCodeBlock() as returning a nullable CodeBlockContext is correct given the ancestor lookup and is guarded by explicit null checks before use.
  • The switch to var lValue = assignment.lValue(); keeps the logic unchanged and improves readability given Java 17 target.

Looks good; no further changes needed in this class.

Also applies to: 68-69, 108-119, 200-205, 211-221, 223-225

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

47-47: Nullable return of getCustomConfigurationRoot is now correctly specified and implemented

  • The @Nullable on the return type matches the control flow: null is only returned when a configured root exists but lies outside srcDir.
  • The updated Javadoc explicitly documents the nullable return and the condition under which it occurs, which is required for public APIs.
  • The internal logic (using Absolute.path and startsWith for containment) is consistent with the comment and previous intent.

No further changes needed here.

Also applies to: 161-185

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

40-41: Nullable contracts for execute and waitForPermission align with existing usage

  • Declaring execute as returning @Nullable SentryEvent matches the pattern of returning the event only when sendToSentry() is true and otherwise dropping it by returning null.
  • waitForPermission is correctly marked @Nullable and its result is already handled via Optional.ofNullable(answerItem), so the annotation simply documents existing behavior.
  • Removing parameter-level nullability annotations while relying on jspecify for return nullability keeps the implementation straightforward without changing logic.

No issues spotted in this refactor.

Also applies to: 72-79, 93-103, 134-147

@theshadowco theshadowco disabled auto-merge December 12, 2025 04:55
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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/EhCacheAdapter.java (1)

80-99: Fix comment inversion on line 86 and address test failure from exception type change

Line 86 comment says "если нет в кеше, загружаем из valueLoader" but the condition value != null is a cache hit that returns immediately. The comment should say "если есть в кеше, возвращаем значение" (if in cache, return value).

Additionally, put() now throws IllegalArgumentException for null values (line 104), but the test testPutNullValue() expects NullPointerException. This test will fail with the current implementation.

Regarding the class JavaDoc claim "потокобезопасный доступ через get(Object, Callable)" (line 40): the current implementation is not atomic per key—multiple concurrent threads accessing the same key can each execute valueLoader and race on put(). If per-key atomicity is required, use Ehcache's atomic operations or per-key locking.

-    if (value != null) { // если нет в кеше, загружаем из valueLoader
+    if (value != null) { // если есть в кеше, возвращаем значение
       return (T) value;
     }
🧹 Nitpick comments (2)
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/QueryNestedFieldsByDotDiagnostic.java (1)

68-77: Comment reformat + whitespace: OK; consider extracting boolean for readability (optional).
The multi-line comment improves readability; condition remains the same. If this condition keeps growing, consider naming sub-conditions (isVirtualTableColumn, isNestedColumn) to keep if readable.

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

296-326: var node = ... refactor is safe; consider guarding the cast if non-ParserRuleContext children are possible.
Right now child is cast to ParserRuleContext in the else branch. If Trees.getChildren(tree) can ever include non-TerminalNode children that are not ParserRuleContext, this will throw ClassCastException. If that can’t happen for this tree shape, fine; otherwise consider else if (child instanceof ParserRuleContext ctx) { ... }.

-      } else {
-        var node = findTerminalNodeContainsPosition((ParserRuleContext) child, position);
+      } else if (child instanceof ParserRuleContext childCtx) {
+        var node = findTerminalNodeContainsPosition(childCtx, position);
         if (node.isPresent()) {
           return node;
         }
       }
📜 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 7d473c8 and 663a65a.

📒 Files selected for processing (5)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/EventPublisherAspect.java (3 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/cfg/ControlFlowGraph.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/QueryNestedFieldsByDotDiagnostic.java (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/EhCacheAdapter.java (3 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/Trees.java (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/EventPublisherAspect.java
🧰 Additional context used
📓 Path-based instructions (2)
**/*.java

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.java: Follow the Style Guide provided in docs/en/contributing/StyleGuide.md
Use Lombok annotations to reduce boilerplate code and enable annotation processing in your IDE
Optimize imports before committing but do NOT optimize imports across the entire project unless specifically working on that task
Follow Java naming conventions with meaningful, descriptive names; keep class and method names concise but clear
Write JavaDoc for public APIs and include comments for complex logic
Use Target Java 17 as the language version

Files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/Trees.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/QueryNestedFieldsByDotDiagnostic.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/EhCacheAdapter.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/cfg/ControlFlowGraph.java
**/diagnostics/*.java

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Each diagnostic should have a Java implementation class, resource bundle for localized messages, unit tests, and documentation

Files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/QueryNestedFieldsByDotDiagnostic.java
🧠 Learnings (4)
📚 Learning: 2025-11-19T09:02:03.154Z
Learnt from: theshadowco
Repo: 1c-syntax/bsl-language-server PR: 3610
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/folding/QueryPackageFoldingRangeSupplier.java:26-26
Timestamp: 2025-11-19T09:02:03.154Z
Learning: В проекте bsl-language-server используется кастомная версия ANTLR4 от 1c-syntax (io.github.1c-syntax:antlr4), которая включает базовый класс org.antlr.v4.runtime.Tokenizer с методами getAst() и getTokens(). SDBLTokenizer и BSLTokenizer наследуются от этого базового класса.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/Trees.java
📚 Learning: 2025-04-18T22:46:43.245Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3449
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java:192-203
Timestamp: 2025-04-18T22:46:43.245Z
Learning: В проекте bsl-language-server класс BSLParser.ExpressionContext наследуется от BSLParserRuleContext, а не напрямую от ParserRuleContext. При работе с ним нужно учитывать специфичные методы BSLParserRuleContext.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/Trees.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/QueryNestedFieldsByDotDiagnostic.java
📚 Learning: 2025-01-20T19:33:59.692Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3388
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunAllTestsCodeLensSupplier.java:55-59
Timestamp: 2025-01-20T19:33:59.692Z
Learning: In Spring, self-injection pattern (using Autowired Lazy on a self-reference field) is required to enable caching through Cacheable when methods are called from within the same class, as Spring's proxy-based AOP doesn't work with direct 'this' references.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/EhCacheAdapter.java
📚 Learning: 2025-01-19T20:47:40.061Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3388
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/codelens/TestRunnerAdapterOptions.java:46-46
Timestamp: 2025-01-19T20:47:40.061Z
Learning: Configuration classes in the BSL Language Server project use mutable collections (HashMap, ArrayList) and Data annotation from Lombok, allowing for modification of configuration properties after initialization.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/EhCacheAdapter.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). (12)
  • GitHub Check: Benchmark
  • GitHub Check: build (21, ubuntu-latest)
  • GitHub Check: build (25, windows-latest)
  • GitHub Check: build (21, windows-latest)
  • GitHub Check: build (25, macOS-latest)
  • GitHub Check: build (17, windows-latest)
  • GitHub Check: build (21, macOS-latest)
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build (25, ubuntu-latest)
  • GitHub Check: build (17, macOS-latest)
  • GitHub Check: build
  • GitHub Check: Analyse
🔇 Additional comments (5)
src/main/java/com/github/_1c_syntax/bsl/languageserver/diagnostics/QueryNestedFieldsByDotDiagnostic.java (1)

58-64: Cosmetic change only; logic preserved.
Space in the if condition is fine and aligns with the style guide expectations.

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

33-40: Import of @Nullable/Collections looks fine; keep consistent project-wide nullability convention.
No issues here; matches PR direction.


97-102: Document the null-handling contract in JavaDoc.

The method already safely handles null by returning an empty list, which works correctly with all call sites (they use addAll(), for-each loops, and similar idempotent operations). However, the JavaDoc does not document this contract—add a note clarifying that null input returns an empty list so callers understand the intended behavior.

src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/EhCacheAdapter.java (2)

24-24: org.jspecify.annotations.Nullable import is fine—ensure tooling is configured
Just make sure JSpecify nullness checking is actually enabled/consistent in this project (IDE + build), otherwise annotations become documentation-only.


101-112: Fix spacing in if statement and verify exception type against test expectations

The style issue is correct—replace if(value == null) with if (value == null) following standard Java conventions (space after control flow keywords). However, the exception type change from IllegalArgumentException to NullPointerException cannot be fully verified because the referenced test file EhCacheAdapterTest.testPutNullValue() could not be located in this repository. The review comment references a "previous review thread" that explicitly expected NullPointerException, but without access to that test or the previous discussion, the exception type change should be verified against actual test expectations and Spring Framework's Cache contract before implementation. Standard Spring caching implementations often enforce this pattern, but confirmation is needed.

   @Override
   public void put(Object key, @Nullable Object value) {
-    if(value == null) { // не будем в кеш класть null-значения
-      throw new IllegalArgumentException("Null values are not allowed for cache \"" + name + "\"");
+    if (value == null) { // не будем в кеш класть null-значения
+      throw new IllegalArgumentException("Null values are not allowed for cache \"" + name + "\"");
   }

@github-actions
Copy link
Contributor

github-actions bot commented Dec 12, 2025

Test Results

0 tests   0 ✅  0s ⏱️
0 suites  0 💤
0 files    0 ❌

Results for commit 675c8e3.

♻️ This comment has been updated with latest results.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
.github/workflows/gradle.yml (1)

21-22: actions/download-artifact@v6 does not exist—use @v4 instead

Line 67: actions/download-artifact@v6 must be replaced with @v4, which is the current supported GA release. Version 6 of this action does not exist on the GitHub Actions Marketplace.

-        uses: actions/download-artifact@v6
+        uses: actions/download-artifact@v4

Note: actions/checkout@v6 (lines 21, 39) is correct and reflects the latest version.

src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/EhCacheAdapter.java (2)

101-108: The put(key, @Nullable value) method currently allows null values to reach the native cache, violating the adapter's contract — the JavaDoc explicitly states "Не допускает хранение null-значений" and the constructor passes false to super(), indicating allowNullValues = false. The test testPutNullValue() expects a NullPointerException to be thrown.

Add a null check before casting to ensure fail-fast behavior consistent with the get(key, Callable) method (line 92):

  @Override
  public void put(Object key, @Nullable Object value) {
+   if (value == null) {
+     throw new NullPointerException("Null values are not allowed for cache \"" + name + "\"");
+   }
    @SuppressWarnings("unchecked")
    var typedKey = (K) key;
    @SuppressWarnings("unchecked")
    var typedValue = (V) value;
    nativeCache.put(typedKey, typedValue);
  }

24-28: The put() method must reject null values to match its declared contract and test expectations.

The class documents that it does not allow null values (allowNullValues = false), and the test at line 189–192 (testPutNullValue()) explicitly expects put("key1", null) to throw a NullPointerException. However, the current implementation at lines 102–108 accepts the @Nullable parameter and passes it directly to the underlying cache without validation, allowing null to be stored in violation of the contract. Add a null check to throw early:

@Override
public void put(Object key, @Nullable Object value) {
  if (value == null) {
    throw new NullPointerException("Null values are not allowed");
  }
  @SuppressWarnings("unchecked")
  var typedKey = (K) key;
  @SuppressWarnings("unchecked")
  var typedValue = (V) value;
  nativeCache.put(typedKey, typedValue);
}

Also update the parameter annotation from @Nullable to @NonNull to accurately reflect the actual contract.

Minor: The comment at line 86 is misleading. Change if (value != null) { // если нет в кеше, загружаем из valueLoader to reflect that the block executes when a value IS found in the cache, not when it's absent.

The org.jspecify.annotations.Nullable import is appropriate for the project and compatible with Java 17 and Spring Framework.

🧹 Nitpick comments (3)
.github/workflows/gradle.yml (3)

59-64: Tighten job permissions (drop unused issues: read, keep least-privilege)
Unless you’re intentionally reading issues in this job, issues: read is extra surface area.

     permissions:
       checks: write
       pull-requests: write
       contents: read
-      issues: read

12-12: Add parentheses to if: for unambiguous precedence
Current expression (Line 12) mixes && and ||; it likely works as intended but is easy to regress.

-    if: github.event_name == 'pull_request' && startsWith(github.head_ref, 'translations_') == false || github.event_name == 'push'
+    if: (github.event_name == 'pull_request' && startsWith(github.head_ref, 'translations_') == false) || github.event_name == 'push'

70-73: Switch deprecated junit_files input to files

The EnricoMi/publish-unit-test-result-action@v2 action has deprecated the junit_files input parameter. Use files instead to maintain compatibility.

       - name: Publish Test Results
         uses: EnricoMi/publish-unit-test-result-action@v2
         with:
-          junit_files: "artifacts/**/*.xml"
+          files: "artifacts/**/*.xml"
📜 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 7cebd2c and 25306e8.

📒 Files selected for processing (2)
  • .github/workflows/gradle.yml (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/EhCacheAdapter.java (3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.java

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.java: Follow the Style Guide provided in docs/en/contributing/StyleGuide.md
Use Lombok annotations to reduce boilerplate code and enable annotation processing in your IDE
Optimize imports before committing but do NOT optimize imports across the entire project unless specifically working on that task
Follow Java naming conventions with meaningful, descriptive names; keep class and method names concise but clear
Write JavaDoc for public APIs and include comments for complex logic
Use Target Java 17 as the language version

Files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/EhCacheAdapter.java
🧠 Learnings (3)
📚 Learning: 2025-11-27T07:17:33.726Z
Learnt from: CR
Repo: 1c-syntax/bsl-language-server PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-27T07:17:33.726Z
Learning: Always run tests before submitting changes using ./gradlew test and maintain or improve test coverage

Applied to files:

  • .github/workflows/gradle.yml
📚 Learning: 2025-01-20T19:33:59.692Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3388
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunAllTestsCodeLensSupplier.java:55-59
Timestamp: 2025-01-20T19:33:59.692Z
Learning: In Spring, self-injection pattern (using Autowired Lazy on a self-reference field) is required to enable caching through Cacheable when methods are called from within the same class, as Spring's proxy-based AOP doesn't work with direct 'this' references.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/EhCacheAdapter.java
📚 Learning: 2025-01-19T20:47:40.061Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3388
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/codelens/TestRunnerAdapterOptions.java:46-46
Timestamp: 2025-01-19T20:47:40.061Z
Learning: Configuration classes in the BSL Language Server project use mutable collections (HashMap, ArrayList) and Data annotation from Lombok, allowing for modification of configuration properties after initialization.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/infrastructure/EhCacheAdapter.java
🪛 actionlint (1.7.9)
.github/workflows/gradle.yml

73-73: avoid using deprecated input "junit_files" in action "EnricoMi/publish-unit-test-result-action@v2": Use "files" option instead

(action)

⏰ 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: Analyse
  • GitHub Check: build (25, windows-latest)
  • GitHub Check: build (17, windows-latest)
  • GitHub Check: build (21, macOS-latest)
  • GitHub Check: build (17, macOS-latest)
  • GitHub Check: build (25, ubuntu-latest)
  • GitHub Check: build (21, windows-latest)
  • GitHub Check: build (21, ubuntu-latest)
  • GitHub Check: build (25, macOS-latest)
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build

@theshadowco theshadowco enabled auto-merge (squash) December 12, 2025 06:13
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

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

110-116: LGTM! Clean refactor using pattern matching.

The use of pattern-matching instanceof with binding variables improves readability and eliminates explicit casts. The PreprocessorContext case correctly skips processing via the inline comment.

Minor: For consistency and clarity, consider making the no-op explicit:

         } else if (child instanceof BSLParser.PreprocessorContext) {
-          // просто пропускаем
+          // просто пропускаем - no operation needed
+          continue;
         } else {
📜 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 606278e and 675c8e3.

📒 Files selected for processing (2)
  • .github/workflows/gradle.yml (1 hunks)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java (6 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.java

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.java: Follow the Style Guide provided in docs/en/contributing/StyleGuide.md
Use Lombok annotations to reduce boilerplate code and enable annotation processing in your IDE
Optimize imports before committing but do NOT optimize imports across the entire project unless specifically working on that task
Follow Java naming conventions with meaningful, descriptive names; keep class and method names concise but clear
Write JavaDoc for public APIs and include comments for complex logic
Use Target Java 17 as the language version

Files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java
🧠 Learnings (2)
📚 Learning: 2025-04-18T22:46:43.245Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 3449
File: src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java:192-203
Timestamp: 2025-04-18T22:46:43.245Z
Learning: В проекте bsl-language-server класс BSLParser.ExpressionContext наследуется от BSLParserRuleContext, а не напрямую от ParserRuleContext. При работе с ним нужно учитывать специфичные методы BSLParserRuleContext.

Applied to files:

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java
📚 Learning: 2025-04-18T22:42:30.042Z
Learnt from: nixel2007
Repo: 1c-syntax/bsl-language-server PR: 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/utils/expressiontree/ExpressionTreeBuildingVisitor.java
🪛 actionlint (1.7.9)
.github/workflows/gradle.yml

73-73: avoid using deprecated input "junit_files" in action "EnricoMi/publish-unit-test-result-action@v2": Use "files" option instead

(action)

⏰ 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: build (17, macOS-latest)
  • GitHub Check: build (25, macOS-latest)
  • GitHub Check: build (25, ubuntu-latest)
  • GitHub Check: build (25, windows-latest)
  • GitHub Check: build (21, ubuntu-latest)
  • GitHub Check: build (17, windows-latest)
  • GitHub Check: build (21, macOS-latest)
  • GitHub Check: build (21, windows-latest)
  • GitHub Check: build (17, ubuntu-latest)
  • GitHub Check: build
  • GitHub Check: Analyse
🔇 Additional comments (3)
.github/workflows/gradle.yml (1)

50-55: Good practice: if: always() ensures test results are archived on failure.

The addition of if: always() to the Archive test results step is solid—it guarantees test artifacts are collected regardless of build success, which is critical for CI observability. The updated artifact name and path are also appropriately scoped to isolate test results by Java version and OS.

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

196-203: LGTM! Proper null safety handling.

The @Nullable annotation on the expression parameter is correctly paired with an explicit null check at line 200, ensuring safe handling of empty parentheses cases.


80-82: No API breaking change here—@Nullable correctly reflects the field type.

The resultExpression field is already declared as @Nullable BslExpression (line 60), so the method's return type is accurate. All callers handle null appropriately: the internal caller uses assert result != null (line 73), and AbstractExpressionTreeDiagnostic explicitly checks if (expressionTree != null) before use (line 115). The annotation is correct documentation of existing behavior, not a breaking change.

Comment on lines +56 to +73
publish-test-results:
needs: [gatekeeper, check-pr-exists, build]
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
contents: read
issues: read
if: always()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v6
with:
path: artifacts
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
junit_files: "artifacts/**/*.xml"
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Replace deprecated junit_files input with files.

The new publish-test-results job is well-structured with proper permissions and dependencies. However, the action uses a deprecated input parameter.

Apply this diff to use the current action API:

      - name: Publish Test Results
        uses: EnricoMi/publish-unit-test-result-action@v2
        with:
-         junit_files: "artifacts/**/*.xml"
+         files: "artifacts/**/*.xml"

This aligns with the latest EnricoMi/publish-unit-test-result-action@v2 API and avoids potential breaking changes in future versions.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
publish-test-results:
needs: [gatekeeper, check-pr-exists, build]
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
contents: read
issues: read
if: always()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v6
with:
path: artifacts
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
junit_files: "artifacts/**/*.xml"
publish-test-results:
needs: [gatekeeper, check-pr-exists, build]
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
contents: read
issues: read
if: always()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v6
with:
path: artifacts
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: "artifacts/**/*.xml"
🧰 Tools
🪛 actionlint (1.7.9)

73-73: avoid using deprecated input "junit_files" in action "EnricoMi/publish-unit-test-result-action@v2": Use "files" option instead

(action)

🤖 Prompt for AI Agents
.github/workflows/gradle.yml around lines 56 to 73: the
publish-unit-test-result-action usage still uses the deprecated input parameter
`junit_files`; update the action call to replace `junit_files:
"artifacts/**/*.xml"` with the current `files: "artifacts/**/*.xml"` input
(preserve the same glob pattern), and verify the action version remains @v2 so
no other input changes are required.

Comment on lines +72 to +74
var result = instance.getExpressionTree();
assert result != null;
return result;
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Replace assert with proper runtime null check.

Using assert for validating non-null return values is unsafe because assertions can be disabled in production via the -da JVM flag. If disabled, buildExpressionTree() could return null despite its non-null return type, causing NullPointerException downstream.

Apply this diff to use a proper runtime check:

   public static BslExpression buildExpressionTree(BSLParser.ExpressionContext ctx) {
     var instance = new ExpressionTreeBuildingVisitor();
     instance.visitExpression(ctx);
-    var result = instance.getExpressionTree();
-    assert result != null;
-    return result;
+    return Objects.requireNonNull(
+      instance.getExpressionTree(),
+      "Expression tree must not be null after visiting expression context"
+    );
   }
🤖 Prompt for AI Agents
In
src/main/java/com/github/_1c_syntax/bsl/languageserver/utils/expressiontree/ExpressionTreeBuildingVisitor.java
around lines 72 to 74, replace the use of `assert result != null;` with a
runtime null check: if the expression tree is null throw an unchecked exception
(e.g. IllegalStateException or NullPointerException) with a clear message
indicating buildExpressionTree() returned null, otherwise return the result;
this ensures the non-null contract is enforced regardless of JVM assertion
settings.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 12, 2025

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