From 7643189ef8da0017f686364e1b89e9767cfd7cf4 Mon Sep 17 00:00:00 2001 From: Steven Looman Date: Thu, 14 Sep 2023 23:39:13 +0200 Subject: [PATCH] Linting --- .../sw/magik/languageserver/MagikTextDocumentService.java | 6 +++--- .../diagnostics/MagikTypedChecksDiagnosticsProvider.java | 3 +-- .../implementation/ImplementationProvider.java | 2 +- .../languageserver/definitions/DefinitionsProviderTest.java | 2 +- .../selectionrange/SelectionRangeProviderTest.java | 2 +- .../main/java/nl/ramsolutions/sw/MagikToolsProperties.java | 3 +-- 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/magik-language-server/src/main/java/nl/ramsolutions/sw/magik/languageserver/MagikTextDocumentService.java b/magik-language-server/src/main/java/nl/ramsolutions/sw/magik/languageserver/MagikTextDocumentService.java index 5178feba..8a42b1b1 100644 --- a/magik-language-server/src/main/java/nl/ramsolutions/sw/magik/languageserver/MagikTextDocumentService.java +++ b/magik-language-server/src/main/java/nl/ramsolutions/sw/magik/languageserver/MagikTextDocumentService.java @@ -300,7 +300,7 @@ public CompletableFuture hover(final HoverParams params) { LOGGER.debug("Implementations found: {}", locations.size()); final List lsp4jLocations = locations.stream() - .map(location -> Lsp4jConversion.locationToLsp4j(location)) + .map(Lsp4jConversion::locationToLsp4j) .collect(Collectors.toList()); return Either.forLeft(lsp4jLocations); }); @@ -351,7 +351,7 @@ public CompletableFuture, List lsp4jLocations = locations.stream() - .map(location -> Lsp4jConversion.locationToLsp4j(location)) + .map(Lsp4jConversion::locationToLsp4j) .collect(Collectors.toList()); return Either.forLeft(lsp4jLocations); }); @@ -370,7 +370,7 @@ public CompletableFuture> references(final ReferencePar this.referencesProvider.provideReferences(magikFile, position); LOGGER.debug("References found: {}", locations.size()); return locations.stream() - .map(location -> Lsp4jConversion.locationToLsp4j(location)) + .map(Lsp4jConversion::locationToLsp4j) .collect(Collectors.toList()); }); } diff --git a/magik-language-server/src/main/java/nl/ramsolutions/sw/magik/languageserver/diagnostics/MagikTypedChecksDiagnosticsProvider.java b/magik-language-server/src/main/java/nl/ramsolutions/sw/magik/languageserver/diagnostics/MagikTypedChecksDiagnosticsProvider.java index 6de62e7e..cf401f62 100644 --- a/magik-language-server/src/main/java/nl/ramsolutions/sw/magik/languageserver/diagnostics/MagikTypedChecksDiagnosticsProvider.java +++ b/magik-language-server/src/main/java/nl/ramsolutions/sw/magik/languageserver/diagnostics/MagikTypedChecksDiagnosticsProvider.java @@ -61,8 +61,7 @@ private Set createTypedChecks() { final Set parameters = Collections.emptySet(); final MagikCheckHolder holder = new MagikCheckHolder((Class) checkClass, parameters, true); - final MagikTypedCheck magikCheck = (MagikTypedCheck) holder.createCheck(); - return magikCheck; + return (MagikTypedCheck) holder.createCheck(); } catch (final ReflectiveOperationException exception) { LOGGER.error(exception.getMessage(), exception); } diff --git a/magik-language-server/src/main/java/nl/ramsolutions/sw/magik/languageserver/implementation/ImplementationProvider.java b/magik-language-server/src/main/java/nl/ramsolutions/sw/magik/languageserver/implementation/ImplementationProvider.java index 8d09e1ed..8732bb40 100644 --- a/magik-language-server/src/main/java/nl/ramsolutions/sw/magik/languageserver/implementation/ImplementationProvider.java +++ b/magik-language-server/src/main/java/nl/ramsolutions/sw/magik/languageserver/implementation/ImplementationProvider.java @@ -73,7 +73,7 @@ private List implementionsForMethod(final MagikTypedFile magikFile, fi .filter(anyType -> anyType != type) .filter(anyType -> anyType.isKindOf(type)) .flatMap(anyType -> anyType.getLocalMethods(methodName).stream()) - .map(method -> method.getLocation()) + .map(Method::getLocation) .filter(Objects::nonNull) .collect(Collectors.toList()); } diff --git a/magik-language-server/src/test/java/nl/ramsolutions/sw/magik/languageserver/definitions/DefinitionsProviderTest.java b/magik-language-server/src/test/java/nl/ramsolutions/sw/magik/languageserver/definitions/DefinitionsProviderTest.java index 69b304c5..8efe337b 100644 --- a/magik-language-server/src/test/java/nl/ramsolutions/sw/magik/languageserver/definitions/DefinitionsProviderTest.java +++ b/magik-language-server/src/test/java/nl/ramsolutions/sw/magik/languageserver/definitions/DefinitionsProviderTest.java @@ -18,7 +18,7 @@ * Test DefinitionsProvider. */ @SuppressWarnings("checkstyle:MagicNumber") -public class DefinitionsProviderTest { +class DefinitionsProviderTest { private static final URI TEST_URI = URI.create("tests://unittest"); private static final Location EMPTY_LOCATION = new Location( diff --git a/magik-language-server/src/test/java/nl/ramsolutions/sw/magik/languageserver/selectionrange/SelectionRangeProviderTest.java b/magik-language-server/src/test/java/nl/ramsolutions/sw/magik/languageserver/selectionrange/SelectionRangeProviderTest.java index e95fad7e..1f218baa 100644 --- a/magik-language-server/src/test/java/nl/ramsolutions/sw/magik/languageserver/selectionrange/SelectionRangeProviderTest.java +++ b/magik-language-server/src/test/java/nl/ramsolutions/sw/magik/languageserver/selectionrange/SelectionRangeProviderTest.java @@ -16,7 +16,7 @@ * Test SelectionRangeProvider. */ @SuppressWarnings("checkstyle:MagicNumber") -public class SelectionRangeProviderTest { +class SelectionRangeProviderTest { private List getSelectionRanges( final String code, diff --git a/magik-squid/src/main/java/nl/ramsolutions/sw/MagikToolsProperties.java b/magik-squid/src/main/java/nl/ramsolutions/sw/MagikToolsProperties.java index 177befb9..86d1295a 100644 --- a/magik-squid/src/main/java/nl/ramsolutions/sw/MagikToolsProperties.java +++ b/magik-squid/src/main/java/nl/ramsolutions/sw/MagikToolsProperties.java @@ -1,7 +1,6 @@ package nl.ramsolutions.sw; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.nio.file.Path; @@ -31,7 +30,7 @@ public MagikToolsProperties() throws IOException { LOGGER.debug("Read default configuration from: {}", DEFAULT_PROPERTIES_FILENAME); } - public MagikToolsProperties(final Path path) throws FileNotFoundException, IOException { + public MagikToolsProperties(final Path path) throws IOException { this(new FileInputStream(path.toFile())); LOGGER.debug("Read configuration from: {}", path.toAbsolutePath()); }