Skip to content

Commit

Permalink
migrate to java17
Browse files Browse the repository at this point in the history
javax -> jakarta/spotbugs


jdk17


fix compile error


import reordering


fix guava exclusion


Выключена ругань на неверную компиляцию picocli

See https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/core/LocalVariableTableParameterNameDiscoverer.html

Война с Nullable


Update build.gradle.kts
Обновление перехвата System.exit под jdk17+


Update qodana.yaml
  • Loading branch information
nixel2007 committed Jan 19, 2023
1 parent a60f966 commit c406f31
Show file tree
Hide file tree
Showing 42 changed files with 63 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
java_version: ['11', '17']
java_version: ['17', '19']
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/checkout@v3
Expand Down
10 changes: 6 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ dependencies {
api("info.picocli:picocli-spring-boot-starter:4.7.0")

// lsp4j core
api("org.eclipse.lsp4j", "org.eclipse.lsp4j", "0.19.0")
api("org.eclipse.lsp4j", "org.eclipse.lsp4j.websocket", "0.19.0")
api("org.eclipse.lsp4j", "org.eclipse.lsp4j", "0.19.0") {
exclude(group = "com.google.guava", module = "guava")
}
api("org.eclipse.lsp4j", "org.eclipse.lsp4j.websocket.jakarta", "0.19.0")

// 1c-syntax
api("com.github.1c-syntax", "bsl-parser", "167aaad827322e09ccde4658a71152dad234de4b") {
Expand Down Expand Up @@ -133,8 +135,8 @@ dependencies {
}

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withSourcesJar()
withJavadocJar()
}
Expand Down
4 changes: 2 additions & 2 deletions docs/contributing/EnvironmentSetting.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Необходимое ПО

* Java Development Kit 11
* Java Development Kit 17
* [IntelliJ IDEA Community Edition](https://www.jetbrains.com/idea/download/)
* Плагины IntelliJ IDEA
* Lombok Plugin
Expand All @@ -14,7 +14,7 @@

### Настройки IntelliJ IDEA

* Настроить [Java SDK на JDK11](https://www.jetbrains.com/help/idea/sdk.html#manage_sdks)
* Настроить [Java SDK на JDK17](https://www.jetbrains.com/help/idea/sdk.html#manage_sdks)
* Включить обработку аннотаций: `File -> Settings -> Build, Execution, Deployment -> Compiler -> Annotation Processors -> Enable annotation processing`
* Выполнить настройки автоимпорта, подробно описано в [статье](https://www.jetbrains.com/help/idea/creating-and-optimizing-imports.html). Отдельно стоит обратить внимание на оптимизацию импорта.
* Не надо запускать оптимизацию импортов всего проекта, за этим следят мейнтейнеры. Если после оптимизации импортов появились измененные файлы, которые не менялись в процессе разработки, стоит уведомить мейнтейнеров и откатить эти изменения.
4 changes: 2 additions & 2 deletions docs/en/contributing/EnvironmentSetting.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Development is underway using [IntelliJ IDEA Community Edition](https://www.jetb

## Required Software

* Java Development Kit 11
* Java Development Kit 17
* [IntelliJ IDEA Community Edition](https://www.jetbrains.com/idea/download/)
* Plugins IntelliJ IDEA
* Lombok Plugin
Expand All @@ -14,7 +14,7 @@ Please note that plugins do not have to be installed - if you have Internet acce

### IntelliJ IDEA Settings

* Configure [Java SDK на JDK11](https://www.jetbrains.com/help/idea/sdk.html#manage_sdks)
* Configure [Java SDK на JDK17](https://www.jetbrains.com/help/idea/sdk.html#manage_sdks)
* Enable annotation processing: `File -> Settings -> Build, Execution, Deployment -> Compiler -> Annotation Processors -> Enable annotation processing`
* Configure auto import settings, details in the [article](https://www.jetbrains.com/help/idea/creating-and-optimizing-imports.html). Pay special attention to import optimization.
* There is no need to start optimization of imports of the entire project, this is followed by maintainers. If, after optimizing imports, changed files appeared that did not change during the development process, you should notify the maintainers and roll back these changes.
2 changes: 1 addition & 1 deletion docs/en/systemRequirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Using `BSL Language Server` has some limitations, listed bellow

`BSL Language Server` is a console Java application and requires the presence of a Java virtual machine on the computer.

The minimum supported version is Java 11, but as part of the build pipelines, a health check is performed when using more recent versions. Java versions 11 and 17 are currently supported.
The minimum supported version is Java 17, but as part of the build pipelines, a health check is performed when using more recent versions. Java versions 17 and 19 are currently supported.

JDK vendor is also interesting. Due to the changed licensing policy of Oracle, it is recommended to use open implementations of the `OpenJDK` virtual machine: AdoptOpenJDK, Liberica JDK.

Expand Down
2 changes: 1 addition & 1 deletion docs/systemRequirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

`BSL Language Server` представляет собой консольное Java приложение, соответственно, для его функционирования необходимо наличие виртуальной машины Java на компьютере.

На данный момент минимальной поддерживаемой версией является Java 11, но в рамках сборочных конвейеров происходит проверка работоспособности при использовании более свежих версий. На данный момент поддерживаются Java версий 11 и 17.
На данный момент минимальной поддерживаемой версией является Java 17, но в рамках сборочных конвейеров происходит проверка работоспособности при использовании более свежих версий. На данный момент поддерживаются Java версий 17 и 19.

Кроме версии Java интересен и вендор JDK. В связи с изменившейся политикой лицензирования Oracle, рекомендуется использование открытых реализаций виртуальной машины `OpenJDK`: AdoptOpenJDK, Liberica JDK.

Expand Down
1 change: 1 addition & 0 deletions qodana.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version: "1.0"
linter: jetbrains/qodana-jvm-community:2022.3
projectJDK: 17
profile:
name: qodana.starter
include:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
*/
package com.github._1c_syntax.bsl.languageserver;

import jakarta.annotation.PostConstruct;
import lombok.EqualsAndHashCode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.github._1c_syntax.bsl.languageserver.context.events.DocumentContextContentChangedEvent;
import com.github._1c_syntax.bsl.languageserver.context.events.ServerContextPopulatedEvent;
import com.github._1c_syntax.bsl.languageserver.events.LanguageServerInitializeRequestReceivedEvent;
import jakarta.annotation.PreDestroy;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
Expand All @@ -39,7 +40,6 @@
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.ApplicationEventPublisherAware;

import javax.annotation.PreDestroy;
import java.io.File;
import java.util.Collection;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.github._1c_syntax.bsl.languageserver.context.DocumentContext;
import com.github._1c_syntax.bsl.languageserver.context.ServerContext;
import com.github._1c_syntax.bsl.languageserver.diagnostics.BSLDiagnostic;
import jakarta.annotation.PreDestroy;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
Expand All @@ -36,7 +37,6 @@
import org.aspectj.lang.annotation.Before;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.PreDestroy;
import java.io.File;
import java.util.Collection;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
package com.github._1c_syntax.bsl.languageserver.aop;

import io.sentry.Sentry;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import lombok.NoArgsConstructor;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
import io.sentry.Scope;
import io.sentry.Sentry;
import io.sentry.protocol.User;
import jakarta.annotation.PostConstruct;
import lombok.RequiredArgsConstructor;
import org.eclipse.lsp4j.ServerInfo;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.context.annotation.DependsOn;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.UUID;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import com.github._1c_syntax.bsl.languageserver.configuration.formating.FormattingOptions;
import com.github._1c_syntax.utils.Absolute;
import edu.umd.cs.findbugs.annotations.Nullable;
import jakarta.annotation.PostConstruct;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
Expand All @@ -45,7 +46,6 @@
import org.springframework.context.annotation.Role;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
Expand Down Expand Up @@ -175,6 +175,10 @@ public static Path getCustomConfigurationRoot(LanguageServerConfiguration config

}

@SuppressFBWarnings(
value = "RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE",
justification = "False positive"
)
private static File getConfigurationFile(Path rootPath) {
File configurationFile = null;
List<Path> listPath = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import com.github._1c_syntax.bsl.languageserver.configuration.events.LanguageServerConfigurationChangedEvent;
import com.github._1c_syntax.utils.Absolute;
import com.sun.nio.file.SensitivityWatchEventModifier;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.Synchronized;
Expand All @@ -33,8 +35,6 @@
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import java.io.File;
import java.io.IOException;
import java.nio.file.FileSystems;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import com.github._1c_syntax.mdclasses.mdo.AbstractMDObjectBase;
import com.github._1c_syntax.utils.Lazy;
import edu.umd.cs.findbugs.annotations.Nullable;
import jakarta.annotation.PostConstruct;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
Expand All @@ -60,7 +61,6 @@
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.io.File;
import java.io.IOException;
import java.net.URI;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.github._1c_syntax.bsl.parser.BSLParserBaseListener;
import com.github._1c_syntax.bsl.parser.BSLParserRuleContext;
import com.github._1c_syntax.utils.StringInterner;
import jakarta.annotation.PostConstruct;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
Expand All @@ -40,7 +41,6 @@
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.github._1c_syntax.bsl.parser.BSLParserBaseListener;
import com.github._1c_syntax.bsl.parser.BSLParserRuleContext;
import com.github._1c_syntax.utils.StringInterner;
import jakarta.annotation.PostConstruct;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
Expand All @@ -41,7 +42,6 @@
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
import com.github._1c_syntax.bsl.languageserver.utils.Ranges;
import com.github._1c_syntax.bsl.languageserver.utils.RelatedInformation;
import com.github._1c_syntax.bsl.parser.BSLParser;
import jakarta.annotation.PostConstruct;
import org.antlr.v4.runtime.tree.ParseTree;
import org.eclipse.lsp4j.DiagnosticRelatedInformation;

import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
import com.github._1c_syntax.bsl.languageserver.utils.Ranges;
import com.github._1c_syntax.bsl.languageserver.utils.RelatedInformation;
import com.github._1c_syntax.bsl.parser.BSLParser;
import jakarta.annotation.PostConstruct;
import org.antlr.v4.runtime.tree.ParseTree;
import org.eclipse.lsp4j.DiagnosticRelatedInformation;

import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
import com.github._1c_syntax.bsl.languageserver.diagnostics.metadata.DiagnosticType;
import com.github._1c_syntax.bsl.languageserver.providers.CodeActionProvider;
import com.github._1c_syntax.bsl.parser.BSLLexer;
import jakarta.annotation.PostConstruct;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.Token;
import org.eclipse.lsp4j.CodeAction;
import org.eclipse.lsp4j.CodeActionParams;
import org.eclipse.lsp4j.Diagnostic;
import org.eclipse.lsp4j.TextEdit;

import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
import com.github._1c_syntax.bsl.languageserver.utils.Trees;
import com.github._1c_syntax.bsl.parser.BSLParser;
import com.github._1c_syntax.bsl.parser.BSLParser.NewExpressionContext;
import jakarta.annotation.PostConstruct;
import org.antlr.v4.runtime.tree.ParseTree;
import org.eclipse.lsp4j.DiagnosticRelatedInformation;

import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
import com.github._1c_syntax.bsl.languageserver.utils.RelatedInformation;
import com.github._1c_syntax.bsl.parser.BSLParser;
import com.github._1c_syntax.bsl.parser.BSLParserRuleContext;
import jakarta.annotation.PostConstruct;
import org.antlr.v4.runtime.tree.ParseTree;
import org.eclipse.lsp4j.DiagnosticRelatedInformation;

import javax.annotation.PostConstruct;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.github._1c_syntax.bsl.languageserver.codelenses.databind.CodeLensDataObjectMapper;
import com.github._1c_syntax.bsl.languageserver.configuration.events.LanguageServerConfigurationChangedEvent;
import com.github._1c_syntax.bsl.languageserver.context.DocumentContext;
import jakarta.annotation.PostConstruct;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import org.eclipse.lsp4j.ClientCapabilities;
Expand All @@ -40,7 +41,6 @@
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.Collection;
import java.util.List;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import org.eclipse.lsp4j.services.LanguageClient;
import org.eclipse.lsp4j.services.LanguageClientAware;
import org.eclipse.lsp4j.services.LanguageServer;
import org.eclipse.lsp4j.websocket.WebSocketEndpoint;
import org.eclipse.lsp4j.websocket.jakarta.WebSocketEndpoint;
import org.springframework.stereotype.Component;

import java.util.Collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
*/
package com.github._1c_syntax.bsl.languageserver.websocket;

import jakarta.websocket.server.ServerEndpointConfig;
import org.eclipse.lsp4j.services.LanguageClient;
import org.eclipse.lsp4j.websocket.WebSocketEndpoint;
import org.eclipse.lsp4j.websocket.jakarta.WebSocketEndpoint;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
Expand All @@ -31,8 +32,6 @@
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
import org.springframework.web.socket.server.standard.ServerEndpointRegistration;

import javax.websocket.server.ServerEndpointConfig;

/**
* Конфигурация модуля веб-сокетов.
*/
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ logging.level.org.hibernate.engine.jdbc.spi.SqlExceptionHelper=fatal
logging.level.org.springframework.data.repository.config.RepositoryConfigurationDelegate=warn
logging.level.org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean=warn
logging.level.org.springframework.context.support.PostProcessorRegistrationDelegate=warn
logging.level.org.springframework.core.LocalVariableTableParameterNameDiscoverer=error
spring.application.name=BSL Language Server
app.globalConfiguration.path=${user.home}/.bsl-language-server.json
app.configuration.path=.bsl-language-server.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.github._1c_syntax.bsl.languageserver.configuration.LanguageServerConfiguration;
import com.github._1c_syntax.bsl.languageserver.util.TestUtils;
import com.github._1c_syntax.bsl.languageserver.utils.Ranges;
import jakarta.annotation.PostConstruct;
import org.eclipse.lsp4j.CodeAction;
import org.eclipse.lsp4j.CodeActionContext;
import org.eclipse.lsp4j.CodeActionParams;
Expand All @@ -36,7 +37,6 @@
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.DirtiesContext;

import javax.annotation.PostConstruct;
import java.util.List;
import java.util.stream.Collectors;

Expand Down
Loading

0 comments on commit c406f31

Please sign in to comment.