Skip to content

Commit

Permalink
javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
nixel2007 committed Jan 20, 2025
1 parent 393ae5f commit 11377b2
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,17 @@ public void handleEvent(LanguageServerInitializeRequestReceivedEvent event) {
clientIsSupported = "Visual Studio Code".equals(clientName);
}

/**
* Обработчик события {@link LanguageServerConfigurationChangedEvent}.
* <p>
* Сбрасывает кеш при изменении конфигурации.
*
* @param event Событие
*/
@EventListener
@CacheEvict(allEntries = true)
public void handleLanguageServerConfigurationChange(LanguageServerConfigurationChangedEvent event) {
// No-op. Служит для сброса кеша при изменении конфигурации
}

/**
Expand All @@ -89,8 +97,21 @@ public boolean isApplicable(DocumentContext documentContext) {
&& clientIsSupported;
}

/**
* Получить self-injected экземпляр себя для работы механизмов кэширования.
*
* @return Управляемый Spring'ом экземпляр себя
*/
protected abstract AbstractRunTestsCodeLensSupplier<T> getSelf();

/**
* Получить список каталогов с тестами с учетом корня рабочей области.
* <p>
* public для работы @Cachable.
*
* @param configurationRoot Корень конфигурации
* @return Список исходных файлов тестов
*/
@Cacheable
public Set<URI> getTestSources(@Nullable Path configurationRoot) {
var configurationRootString = Optional.ofNullable(configurationRoot)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class RunAllTestsCodeLensSupplier
private final TestRunnerAdapter testRunnerAdapter;
private final Resources resources;

// Self-injection для работы кэша в базовом классе.
@Autowired

Check notice on line 56 in src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunAllTestsCodeLensSupplier.java

View workflow job for this annotation

GitHub Actions / Qodana for JVM

Non recommended 'field' injections

Field injection is not recommended

Check notice

Code scanning / QDJVM

Non recommended 'field' injections Note

Field injection is not recommended
@Lazy
@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public class RunTestCodeLensSupplier
private final TestRunnerAdapter testRunnerAdapter;
private final Resources resources;

// Self-injection для работы кэша в базовом классе.
@Autowired

Check notice on line 63 in src/main/java/com/github/_1c_syntax/bsl/languageserver/codelenses/RunTestCodeLensSupplier.java

View workflow job for this annotation

GitHub Actions / Qodana for JVM

Non recommended 'field' injections

Field injection is not recommended

Check notice

Code scanning / QDJVM

Non recommended 'field' injections Note

Field injection is not recommended
@Lazy
@Getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ public class TestRunnerAdapter {

private final LanguageServerConfiguration configuration;

/**
* Обработчик события {@link LanguageServerConfigurationChangedEvent}.
* <p>
* Очищает кэш при изменении конфигурации.
*
* @param event Событие
*/
@EventListener
@CacheEvict(allEntries = true)
public void handleEvent(LanguageServerConfigurationChangedEvent event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Configuration;

/**
* Spring-конфигурация кэширования.
*/
@Configuration
@EnableCaching
public class CacheConfiguration {
Expand Down

0 comments on commit 11377b2

Please sign in to comment.