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-lint/src/main/java/nl/ramsolutions/sw/magik/lint/MagikLint.java b/magik-lint/src/main/java/nl/ramsolutions/sw/magik/lint/MagikLint.java index 2f3dde9e..93b24c30 100644 --- a/magik-lint/src/main/java/nl/ramsolutions/sw/magik/lint/MagikLint.java +++ b/magik-lint/src/main/java/nl/ramsolutions/sw/magik/lint/MagikLint.java @@ -260,7 +260,9 @@ public void run(final MagikFile magikFile) throws ReflectiveOperationException, final URI uri = magikFile.getUri(); final Path magikFilePath = Path.of(uri); final Path configPath = ConfigurationLocator.locateConfiguration(magikFilePath); - final MagikChecksConfiguration checksConfig = new MagikChecksConfiguration(configPath); + final MagikChecksConfiguration checksConfig = configPath != null + ? new MagikChecksConfiguration(configPath) + : new MagikChecksConfiguration(); final Iterable holders = checksConfig.getAllChecks(); final Comparator byLine = Comparator.comparing(MagikIssue::startLine); final Comparator byColumn = Comparator.comparing(MagikIssue::startColumn); 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()); }