From 1623f327ddf2adac4050a43a1cd95aeb1b5b8352 Mon Sep 17 00:00:00 2001 From: Nikita Fedkin Date: Thu, 6 Jun 2024 20:57:23 +0000 Subject: [PATCH] Fix depreciation warnings from jdk21 --- .../configuration/watcher/ConfigurationFileSystemWatcher.java | 3 +++ .../context/computer/DiagnosticIgnoranceComputer.java | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/watcher/ConfigurationFileSystemWatcher.java b/src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/watcher/ConfigurationFileSystemWatcher.java index c7175da391e..37999e7f76a 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/watcher/ConfigurationFileSystemWatcher.java +++ b/src/main/java/com/github/_1c_syntax/bsl/languageserver/configuration/watcher/ConfigurationFileSystemWatcher.java @@ -56,6 +56,7 @@ @Component @Slf4j @RequiredArgsConstructor +@SuppressWarnings("removal") // SensitivityWatchEventModifier is deprecated in jdk21 public class ConfigurationFileSystemWatcher { private final LanguageServerConfiguration configuration; @@ -131,6 +132,8 @@ private void registerWatchService(File configurationFile) { registeredPath = configurationDir; + // TODO: SensitivityWatchEventModifier is deprecated in java 21 and marked for removal. + // We need to drop usage of it here when we change our baseline to jdk 21 watchKey = registeredPath.register( watchService, new WatchEvent.Kind[]{ diff --git a/src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/DiagnosticIgnoranceComputer.java b/src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/DiagnosticIgnoranceComputer.java index 28ace78241f..5c3ee42e89a 100644 --- a/src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/DiagnosticIgnoranceComputer.java +++ b/src/main/java/com/github/_1c_syntax/bsl/languageserver/context/computer/DiagnosticIgnoranceComputer.java @@ -227,7 +227,7 @@ private boolean checkIgnoreOn( private void addIgnoredRange(DiagnosticCode diagnosticKey, int ignoreRangeStart, int ignoreRangeEnd) { // convert antlr4 line numbers (1..n) to lsp (0..n) - Range ignoreRange = Range.between(ignoreRangeStart - 1, ignoreRangeEnd - 1); + Range ignoreRange = Range.of(ignoreRangeStart - 1, ignoreRangeEnd - 1); final List> ranges = diagnosticIgnorance.computeIfAbsent(diagnosticKey, s -> new ArrayList<>()); ranges.add(ignoreRange); }