From 3881a18226b51aafd44b238959a0c96765e3ea64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Kr=C3=BCger?= Date: Wed, 18 Oct 2023 13:18:51 +0200 Subject: [PATCH] Organize imports --- .../autoconfigure/ParserPropertiesPostProcessor.java | 1 - .../sbm/boot/autoconfigure/ScopeConfiguration.java | 3 ++- .../org/springframework/sbm/parsers/MavenProject.java | 10 +++++++--- .../org/springframework/sbm/parsers/ModuleParser.java | 5 ++++- .../org/springframework/sbm/parsers/ParserContext.java | 1 - .../springframework/sbm/parsers/ParserProperties.java | 6 ++---- .../springframework/sbm/parsers/ProjectScanner.java | 1 - .../sbm/parsers/RewriteMavenArtifactDownloader.java | 1 - .../sbm/parsers/RewriteParserConfiguration.java | 2 +- .../sbm/parsers/RewriteProjectParser.java | 7 +++++-- .../sbm/parsers/RewriteResourceParser.java | 4 +++- .../springframework/sbm/parsers/SourceFileParser.java | 5 ----- .../org/springframework/sbm/parsers/StyleDetector.java | 9 ++++----- .../parsers/events/StartedParsingResourceEvent.java | 1 - .../sbm/parsers/maven/BuildFileParser.java | 3 +-- .../sbm/parsers/maven/MavenModelReader.java | 1 - .../sbm/parsers/maven/MavenPasswordDecrypter.java | 1 - .../parsers/maven/MavenProvenanceMarkerFactory.java | 5 ++++- .../sbm/parsers/maven/ProvenanceMarkerFactory.java | 6 +++--- .../sbm/project/RewriteSourceFileWrapper.java | 1 - .../project/resource/ProjectResourceSetSerializer.java | 1 - .../project/resource/RewriteMigrationResultMerger.java | 1 - .../sbm/project/resource/SbmApplicationProperties.java | 1 - .../resource/finder/AbsolutePathResourcesFinder.java | 5 ++++- .../sbm/project/resource/finder/GenericTypeFinder.java | 5 +---- .../project/resource/finder/GenericTypeListFinder.java | 2 +- .../PathPatternMatchingProjectResourceFinder.java | 2 +- .../finder/RewriteSourceFileHolderListFinder.java | 4 ++-- .../sbm/recipes/RewriteRecipeDiscovery.java | 4 +--- .../sbm/utils/OsAgnosticPathMatcher.java | 1 - .../java/io/example/recipes/AnotherDummyRecipe.java | 1 - .../org/openrewrite/maven/CalculateClasspathTest.java | 1 - .../java/org/openrewrite/maven/MavenParserTest.java | 1 - .../sbm/parsers/BuildFileParserTest.java | 1 - .../parsers/ParserEventPublicationIntegrationTest.java | 2 +- .../sbm/parsers/maven/MavenConfigFileParserTest.java | 1 - .../parsers/maven/MavenExecutionRequestFactory.java | 1 - .../sbm/parsers/maven/MavenPomCacheTest.java | 6 ++++-- .../sbm/parsers/maven/MavenProjectAnalyzerTest.java | 1 - .../sbm/parsers/maven/ProvenanceMarkerFactoryTest.java | 9 ++++++--- .../sbm/parsers/maven/RewriteMavenProjectParser.java | 10 ++++++---- .../parsers/maven/RewriteMavenProjectParserTest.java | 6 +----- .../sbm/parsers/maven/SbmTestConfiguration.java | 3 --- .../springframework/sbm/test/util/DummyResource.java | 1 - 44 files changed, 64 insertions(+), 79 deletions(-) diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/boot/autoconfigure/ParserPropertiesPostProcessor.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/boot/autoconfigure/ParserPropertiesPostProcessor.java index c5dd2db69..3eaa2f590 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/boot/autoconfigure/ParserPropertiesPostProcessor.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/boot/autoconfigure/ParserPropertiesPostProcessor.java @@ -22,7 +22,6 @@ import org.springframework.core.env.PropertySource; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; -import org.springframework.stereotype.Component; import org.springframework.util.Assert; import java.io.IOException; diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/boot/autoconfigure/ScopeConfiguration.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/boot/autoconfigure/ScopeConfiguration.java index d9d1cdf84..bf83a1bd9 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/boot/autoconfigure/ScopeConfiguration.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/boot/autoconfigure/ScopeConfiguration.java @@ -17,11 +17,12 @@ import org.openrewrite.ExecutionContext; import org.openrewrite.InMemoryExecutionContext; +import org.openrewrite.java.AddOrUpdateAnnotationAttribute; import org.openrewrite.maven.MavenExecutionContextView; import org.openrewrite.maven.cache.MavenPomCache; import org.springframework.beans.factory.config.BeanFactoryPostProcessor; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.AutoConfiguration; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.sbm.scopes.ExecutionScope; import org.springframework.sbm.scopes.ProjectMetadata; diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/MavenProject.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/MavenProject.java index 725560384..300488531 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/MavenProject.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/MavenProject.java @@ -20,8 +20,9 @@ import org.apache.maven.model.Model; import org.apache.maven.model.Plugin; import org.jetbrains.annotations.NotNull; -import org.openrewrite.SourceFile; -import org.openrewrite.maven.tree.*; +import org.openrewrite.maven.tree.MavenResolutionResult; +import org.openrewrite.maven.tree.ResolvedDependency; +import org.openrewrite.maven.tree.Scope; import org.openrewrite.maven.utilities.MavenArtifactDownloader; import org.openrewrite.xml.tree.Xml; import org.springframework.core.io.Resource; @@ -30,7 +31,10 @@ import java.io.File; import java.nio.file.Path; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.Properties; import java.util.function.Predicate; diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/ModuleParser.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/ModuleParser.java index 61d8c8121..0b1d4cc41 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/ModuleParser.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/ModuleParser.java @@ -33,7 +33,10 @@ import java.nio.file.Path; import java.nio.file.Paths; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Set; import java.util.function.Predicate; import java.util.function.UnaryOperator; import java.util.stream.Collectors; diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/ParserContext.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/ParserContext.java index 81d5f55a9..2e3b052f6 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/ParserContext.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/ParserContext.java @@ -17,7 +17,6 @@ import lombok.Getter; import lombok.RequiredArgsConstructor; -import org.openrewrite.SourceFile; import org.openrewrite.xml.tree.Xml; import org.springframework.core.io.Resource; import org.springframework.sbm.utils.ResourceUtil; diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/ParserProperties.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/ParserProperties.java index fc14e1cea..1aa8cdd67 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/ParserProperties.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/ParserProperties.java @@ -15,12 +15,10 @@ */ package org.springframework.sbm.parsers; -import lombok.*; +import lombok.Getter; +import lombok.Setter; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.PropertySource; -import org.springframework.stereotype.Component; -import java.nio.file.PathMatcher; import java.util.HashSet; import java.util.List; import java.util.Set; diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/ProjectScanner.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/ProjectScanner.java index 46329739b..cb90eafb0 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/ProjectScanner.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/ProjectScanner.java @@ -23,7 +23,6 @@ import org.springframework.core.io.support.ResourcePatternUtils; import org.springframework.sbm.utils.LinuxWindowsPathUnifier; import org.springframework.sbm.utils.ResourceUtil; -import org.springframework.stereotype.Component; import java.io.IOException; import java.nio.file.Path; diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/RewriteMavenArtifactDownloader.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/RewriteMavenArtifactDownloader.java index 0c2a1c69c..183772206 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/RewriteMavenArtifactDownloader.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/RewriteMavenArtifactDownloader.java @@ -21,7 +21,6 @@ import org.openrewrite.maven.MavenSettings; import org.openrewrite.maven.cache.MavenArtifactCache; import org.openrewrite.maven.utilities.MavenArtifactDownloader; -import org.springframework.stereotype.Component; import java.util.function.Consumer; diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/RewriteParserConfiguration.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/RewriteParserConfiguration.java index bc2c8e1e0..325c3533c 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/RewriteParserConfiguration.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/RewriteParserConfiguration.java @@ -29,12 +29,12 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Import; import org.springframework.sbm.boot.autoconfigure.ParserPropertiesPostProcessor; +import org.springframework.sbm.boot.autoconfigure.ScopeConfiguration; import org.springframework.sbm.parsers.events.RewriteParsingEventListenerAdapter; import org.springframework.sbm.parsers.maven.*; import org.springframework.sbm.project.resource.SbmApplicationProperties; import org.springframework.sbm.scopes.ProjectMetadata; import org.springframework.sbm.scopes.ScanScope; -import org.springframework.sbm.boot.autoconfigure.ScopeConfiguration; import java.io.PrintWriter; import java.io.StringWriter; diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/RewriteProjectParser.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/RewriteProjectParser.java index a343179aa..3756f35d0 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/RewriteProjectParser.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/RewriteProjectParser.java @@ -28,15 +28,17 @@ import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.context.ApplicationEventPublisher; import org.springframework.core.io.Resource; -import org.springframework.sbm.parsers.events.SuccessfullyParsedProjectEvent; import org.springframework.sbm.parsers.events.StartedParsingProjectEvent; +import org.springframework.sbm.parsers.events.SuccessfullyParsedProjectEvent; import org.springframework.sbm.parsers.maven.BuildFileParser; import org.springframework.sbm.parsers.maven.MavenProjectAnalyzer; import org.springframework.sbm.parsers.maven.ProvenanceMarkerFactory; import org.springframework.sbm.scopes.ScanScope; import java.nio.file.Path; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; /** * Project parser parsing resources under a given {@link Path} to OpenRewrite abstract syntax tree (AST). @@ -92,6 +94,7 @@ public RewriteProjectParsingResult parse(Path baseDir) { */ public RewriteProjectParsingResult parse(Path givenBaseDir, List resources) { scanScope.clear(beanFactory); + final Path baseDir = normalizePath(givenBaseDir); eventPublisher.publishEvent(new StartedParsingProjectEvent(resources)); diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/RewriteResourceParser.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/RewriteResourceParser.java index 20fbebfd0..6d7e91c8f 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/RewriteResourceParser.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/RewriteResourceParser.java @@ -33,7 +33,9 @@ import org.springframework.core.io.Resource; import org.springframework.sbm.utils.ResourceUtil; -import java.nio.file.*; +import java.nio.file.Path; +import java.nio.file.PathMatcher; +import java.nio.file.Paths; import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/SourceFileParser.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/SourceFileParser.java index dfe725d8d..ec573f7a5 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/SourceFileParser.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/SourceFileParser.java @@ -19,19 +19,14 @@ import lombok.extern.slf4j.Slf4j; import org.openrewrite.ExecutionContext; import org.openrewrite.SourceFile; -import org.openrewrite.java.JavaParser; import org.openrewrite.marker.Marker; import org.openrewrite.style.NamedStyles; import org.openrewrite.xml.tree.Xml; import org.springframework.core.io.Resource; import org.springframework.sbm.parsers.maven.MavenModuleParser; -import org.springframework.sbm.utils.ResourceUtil; import java.nio.file.Path; -import java.nio.file.PathMatcher; import java.util.*; -import java.util.stream.Collectors; -import java.util.stream.Stream; /** * @author Fabian Krüger diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/StyleDetector.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/StyleDetector.java index d0b54d4c1..6b51bf0b4 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/StyleDetector.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/StyleDetector.java @@ -18,17 +18,16 @@ import org.openrewrite.SourceFile; import org.openrewrite.Tree; import org.openrewrite.internal.ListUtils; -import org.openrewrite.java.style.Autodetect; import org.openrewrite.java.tree.JavaSourceFile; import org.openrewrite.marker.Marker; import org.openrewrite.style.NamedStyles; import org.openrewrite.xml.tree.Xml; -import org.springframework.util.ReflectionUtils; -import java.lang.reflect.Method; -import java.util.*; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; import java.util.function.UnaryOperator; -import java.util.stream.Collectors; import java.util.stream.Stream; /** diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/events/StartedParsingResourceEvent.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/events/StartedParsingResourceEvent.java index 9470ae673..ac3d4db9f 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/events/StartedParsingResourceEvent.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/events/StartedParsingResourceEvent.java @@ -16,7 +16,6 @@ package org.springframework.sbm.parsers.events; import org.openrewrite.Parser; -import org.springframework.context.ApplicationEvent; /** * @author Fabian Krüger diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/maven/BuildFileParser.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/maven/BuildFileParser.java index bcab0f97b..466f1944a 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/maven/BuildFileParser.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/maven/BuildFileParser.java @@ -43,8 +43,7 @@ */ @Slf4j @RequiredArgsConstructor -public -class BuildFileParser { +public class BuildFileParser { /** * Parse a list of Maven Pom files to a Map of {@code Path} and their parsed {@link Xml.Document}s. diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/maven/MavenModelReader.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/maven/MavenModelReader.java index fe15c3da9..5f3277e0e 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/maven/MavenModelReader.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/maven/MavenModelReader.java @@ -20,7 +20,6 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import org.springframework.core.io.Resource; import org.springframework.sbm.utils.ResourceUtil; -import org.springframework.stereotype.Component; import java.io.IOException; import java.nio.file.Path; diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/maven/MavenPasswordDecrypter.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/maven/MavenPasswordDecrypter.java index de7ff382d..4a9ef930f 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/maven/MavenPasswordDecrypter.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/maven/MavenPasswordDecrypter.java @@ -19,7 +19,6 @@ import org.openrewrite.maven.MavenSettings; import org.sonatype.plexus.components.sec.dispatcher.SecDispatcher; import org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException; -import org.springframework.stereotype.Component; import java.nio.file.Path; import java.util.List; diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/maven/MavenProvenanceMarkerFactory.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/maven/MavenProvenanceMarkerFactory.java index bc23eb3b1..7de77d695 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/maven/MavenProvenanceMarkerFactory.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/maven/MavenProvenanceMarkerFactory.java @@ -24,7 +24,10 @@ import org.openrewrite.internal.lang.Nullable; import org.openrewrite.java.marker.JavaProject; import org.openrewrite.java.marker.JavaVersion; -import org.openrewrite.marker.*; +import org.openrewrite.marker.BuildTool; +import org.openrewrite.marker.GitProvenance; +import org.openrewrite.marker.Marker; +import org.openrewrite.marker.OperatingSystemProvenance; import org.openrewrite.marker.ci.BuildEnvironment; import org.springframework.sbm.parsers.MavenProject; diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/maven/ProvenanceMarkerFactory.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/maven/ProvenanceMarkerFactory.java index b5cddfcf3..eb7259c8b 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/maven/ProvenanceMarkerFactory.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/parsers/maven/ProvenanceMarkerFactory.java @@ -16,15 +16,15 @@ package org.springframework.sbm.parsers.maven; import lombok.RequiredArgsConstructor; -import org.apache.maven.project.MavenProject; import org.openrewrite.marker.Marker; import org.springframework.core.io.Resource; import org.springframework.sbm.parsers.ParserContext; -import org.springframework.sbm.parsers.maven.MavenProvenanceMarkerFactory; import org.springframework.sbm.utils.ResourceUtil; import java.nio.file.Path; -import java.util.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * @author Fabian Krüger diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/RewriteSourceFileWrapper.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/RewriteSourceFileWrapper.java index 4bb8be908..d18f9cdb4 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/RewriteSourceFileWrapper.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/RewriteSourceFileWrapper.java @@ -17,7 +17,6 @@ import org.openrewrite.SourceFile; import org.springframework.sbm.project.resource.RewriteSourceFileHolder; -import org.springframework.stereotype.Component; import java.nio.file.Path; import java.util.List; diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/ProjectResourceSetSerializer.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/ProjectResourceSetSerializer.java index 1ab2248d5..d4632f4ab 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/ProjectResourceSetSerializer.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/ProjectResourceSetSerializer.java @@ -16,7 +16,6 @@ package org.springframework.sbm.project.resource; import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Component; @RequiredArgsConstructor public class ProjectResourceSetSerializer { diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/RewriteMigrationResultMerger.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/RewriteMigrationResultMerger.java index 4409cf291..59e13e9aa 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/RewriteMigrationResultMerger.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/RewriteMigrationResultMerger.java @@ -20,7 +20,6 @@ import org.openrewrite.SourceFile; import org.springframework.sbm.project.RewriteSourceFileWrapper; import org.springframework.sbm.project.resource.finder.AbsolutePathResourceFinder; -import org.springframework.stereotype.Component; import java.nio.file.Path; import java.util.List; diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/SbmApplicationProperties.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/SbmApplicationProperties.java index ea5e72362..cd8391e03 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/SbmApplicationProperties.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/SbmApplicationProperties.java @@ -18,7 +18,6 @@ import lombok.Getter; import lombok.Setter; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.List; diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/finder/AbsolutePathResourcesFinder.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/finder/AbsolutePathResourcesFinder.java index 20b4d5120..399bea66e 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/finder/AbsolutePathResourcesFinder.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/finder/AbsolutePathResourcesFinder.java @@ -20,7 +20,10 @@ import org.springframework.sbm.project.resource.RewriteSourceFileHolder; import java.nio.file.Path; -import java.util.*; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import java.util.stream.Collectors; public class AbsolutePathResourcesFinder implements ProjectResourceFinder>> { diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/finder/GenericTypeFinder.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/finder/GenericTypeFinder.java index 3cebac90d..265e02b3b 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/finder/GenericTypeFinder.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/finder/GenericTypeFinder.java @@ -15,11 +15,8 @@ */ package org.springframework.sbm.project.resource.finder; -import org.springframework.sbm.project.resource.ProjectResourceSet; -import org.springframework.sbm.project.resource.finder.GenericTypeListFinder; -import org.springframework.sbm.project.resource.finder.ProjectResourceFinder; -import org.springframework.sbm.project.resource.finder.ResourceFilterException; import lombok.Getter; +import org.springframework.sbm.project.resource.ProjectResourceSet; import java.util.List; import java.util.Optional; diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/finder/GenericTypeListFinder.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/finder/GenericTypeListFinder.java index 8c951e7ed..8683fecb6 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/finder/GenericTypeListFinder.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/finder/GenericTypeListFinder.java @@ -15,8 +15,8 @@ */ package org.springframework.sbm.project.resource.finder; -import org.springframework.sbm.project.resource.ProjectResourceSet; import lombok.Getter; +import org.springframework.sbm.project.resource.ProjectResourceSet; import java.util.List; import java.util.stream.Collectors; diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/finder/PathPatternMatchingProjectResourceFinder.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/finder/PathPatternMatchingProjectResourceFinder.java index 065b41e6e..e04a3a7fa 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/finder/PathPatternMatchingProjectResourceFinder.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/finder/PathPatternMatchingProjectResourceFinder.java @@ -15,9 +15,9 @@ */ package org.springframework.sbm.project.resource.finder; -import org.springframework.sbm.utils.OsAgnosticPathMatcher; import org.springframework.sbm.project.resource.ProjectResource; import org.springframework.sbm.project.resource.ProjectResourceSet; +import org.springframework.sbm.utils.OsAgnosticPathMatcher; import org.springframework.util.PathMatcher; import java.util.Arrays; diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/finder/RewriteSourceFileHolderListFinder.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/finder/RewriteSourceFileHolderListFinder.java index 0c276caca..3ab0da64b 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/finder/RewriteSourceFileHolderListFinder.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/project/resource/finder/RewriteSourceFileHolderListFinder.java @@ -15,10 +15,10 @@ */ package org.springframework.sbm.project.resource.finder; -import org.springframework.sbm.project.resource.ProjectResourceSet; -import org.springframework.sbm.project.resource.RewriteSourceFileHolder; import lombok.RequiredArgsConstructor; import org.openrewrite.SourceFile; +import org.springframework.sbm.project.resource.ProjectResourceSet; +import org.springframework.sbm.project.resource.RewriteSourceFileHolder; import java.util.List; import java.util.stream.Collectors; diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/recipes/RewriteRecipeDiscovery.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/recipes/RewriteRecipeDiscovery.java index 7b8f3fb38..9c11ff68e 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/recipes/RewriteRecipeDiscovery.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/recipes/RewriteRecipeDiscovery.java @@ -23,11 +23,9 @@ import org.openrewrite.config.Environment; import org.openrewrite.config.RecipeDescriptor; import org.openrewrite.config.ResourceLoader; -import org.openrewrite.internal.lang.Nullable; -import org.springframework.sbm.parsers.RecipeValidationErrorException; import org.springframework.sbm.parsers.ParserProperties; +import org.springframework.sbm.parsers.RecipeValidationErrorException; -import java.nio.file.Path; import java.util.ArrayList; import java.util.Collection; import java.util.List; diff --git a/sbm-support-rewrite/src/main/java/org/springframework/sbm/utils/OsAgnosticPathMatcher.java b/sbm-support-rewrite/src/main/java/org/springframework/sbm/utils/OsAgnosticPathMatcher.java index 1496f16e3..fc6cfdb4e 100644 --- a/sbm-support-rewrite/src/main/java/org/springframework/sbm/utils/OsAgnosticPathMatcher.java +++ b/sbm-support-rewrite/src/main/java/org/springframework/sbm/utils/OsAgnosticPathMatcher.java @@ -15,7 +15,6 @@ */ package org.springframework.sbm.utils; -import org.springframework.sbm.utils.LinuxWindowsPathUnifier; import org.springframework.util.AntPathMatcher; import org.springframework.util.PathMatcher; diff --git a/sbm-support-rewrite/src/test/java/io/example/recipes/AnotherDummyRecipe.java b/sbm-support-rewrite/src/test/java/io/example/recipes/AnotherDummyRecipe.java index edf085d01..a370337a8 100644 --- a/sbm-support-rewrite/src/test/java/io/example/recipes/AnotherDummyRecipe.java +++ b/sbm-support-rewrite/src/test/java/io/example/recipes/AnotherDummyRecipe.java @@ -22,7 +22,6 @@ import org.openrewrite.Recipe; import org.openrewrite.config.RecipeExample; -import java.net.URI; import java.util.List; import java.util.Set; diff --git a/sbm-support-rewrite/src/test/java/org/openrewrite/maven/CalculateClasspathTest.java b/sbm-support-rewrite/src/test/java/org/openrewrite/maven/CalculateClasspathTest.java index c87f2c54d..cc18f507b 100644 --- a/sbm-support-rewrite/src/test/java/org/openrewrite/maven/CalculateClasspathTest.java +++ b/sbm-support-rewrite/src/test/java/org/openrewrite/maven/CalculateClasspathTest.java @@ -27,7 +27,6 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.core.io.Resource; import org.springframework.sbm.boot.autoconfigure.ScannerConfiguration; -import org.springframework.sbm.parsers.RewriteExecutionContext; import org.springframework.sbm.parsers.RewriteProjectParser; import org.springframework.sbm.parsers.RewriteProjectParsingResult; import org.springframework.sbm.test.util.DummyResource; diff --git a/sbm-support-rewrite/src/test/java/org/openrewrite/maven/MavenParserTest.java b/sbm-support-rewrite/src/test/java/org/openrewrite/maven/MavenParserTest.java index fa31f3667..758cbec33 100644 --- a/sbm-support-rewrite/src/test/java/org/openrewrite/maven/MavenParserTest.java +++ b/sbm-support-rewrite/src/test/java/org/openrewrite/maven/MavenParserTest.java @@ -15,7 +15,6 @@ */ package org.openrewrite.maven; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junitpioneer.jupiter.ExpectedToFail; diff --git a/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/BuildFileParserTest.java b/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/BuildFileParserTest.java index f881c89d5..3d6082ea0 100644 --- a/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/BuildFileParserTest.java +++ b/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/BuildFileParserTest.java @@ -36,7 +36,6 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.mockito.Mockito.mock; /** * @author Fabian Krüger diff --git a/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/ParserEventPublicationIntegrationTest.java b/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/ParserEventPublicationIntegrationTest.java index 3f3be48ee..527f77ec3 100644 --- a/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/ParserEventPublicationIntegrationTest.java +++ b/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/ParserEventPublicationIntegrationTest.java @@ -24,9 +24,9 @@ import org.springframework.context.event.EventListener; import org.springframework.core.io.Resource; import org.springframework.sbm.boot.autoconfigure.ScannerConfiguration; -import org.springframework.sbm.parsers.events.SuccessfullyParsedProjectEvent; import org.springframework.sbm.parsers.events.FinishedParsingResourceEvent; import org.springframework.sbm.parsers.events.StartedParsingProjectEvent; +import org.springframework.sbm.parsers.events.SuccessfullyParsedProjectEvent; import java.nio.file.Path; import java.util.ArrayList; diff --git a/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/MavenConfigFileParserTest.java b/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/MavenConfigFileParserTest.java index 51eb014a5..0ac82aba6 100644 --- a/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/MavenConfigFileParserTest.java +++ b/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/MavenConfigFileParserTest.java @@ -17,7 +17,6 @@ import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; -import org.springframework.sbm.parsers.maven.MavenConfigFileParser; import java.nio.file.Path; import java.util.List; diff --git a/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/MavenExecutionRequestFactory.java b/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/MavenExecutionRequestFactory.java index 3d99c880c..924dcd341 100644 --- a/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/MavenExecutionRequestFactory.java +++ b/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/MavenExecutionRequestFactory.java @@ -26,7 +26,6 @@ import org.apache.maven.repository.UserLocalArtifactRepository; import org.codehaus.plexus.PlexusContainer; import org.codehaus.plexus.component.repository.exception.ComponentLookupException; -import org.springframework.sbm.parsers.maven.MavenConfigFileParser; import java.nio.file.Path; import java.util.List; diff --git a/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/MavenPomCacheTest.java b/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/MavenPomCacheTest.java index 77fb7127f..04b1f7cc3 100644 --- a/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/MavenPomCacheTest.java +++ b/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/MavenPomCacheTest.java @@ -15,7 +15,10 @@ */ package org.springframework.sbm.parsers.maven; -import org.junit.jupiter.api.*; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; import org.junitpioneer.jupiter.SetSystemProperty; import org.openrewrite.maven.cache.CompositeMavenPomCache; import org.openrewrite.maven.cache.InMemoryMavenPomCache; @@ -28,7 +31,6 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Import; import org.springframework.sbm.boot.autoconfigure.ScannerConfiguration; -import org.springframework.sbm.boot.autoconfigure.ScopeConfiguration; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.util.ReflectionTestUtils; diff --git a/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/MavenProjectAnalyzerTest.java b/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/MavenProjectAnalyzerTest.java index b8cac286f..84e110cf6 100644 --- a/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/MavenProjectAnalyzerTest.java +++ b/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/MavenProjectAnalyzerTest.java @@ -38,7 +38,6 @@ import java.util.concurrent.atomic.AtomicReference; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; /** * @author Fabian Krüger diff --git a/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/ProvenanceMarkerFactoryTest.java b/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/ProvenanceMarkerFactoryTest.java index b1791df44..ecc9c6e07 100644 --- a/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/ProvenanceMarkerFactoryTest.java +++ b/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/ProvenanceMarkerFactoryTest.java @@ -23,7 +23,6 @@ import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.io.TempDir; import org.openrewrite.java.marker.JavaProject; import org.openrewrite.java.marker.JavaVersion; import org.openrewrite.marker.BuildTool; @@ -46,11 +45,15 @@ import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.nio.file.Path; -import java.util.*; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.UUID; import java.util.stream.Stream; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.ArgumentMatchers.*; +import static org.mockito.ArgumentMatchers.isA; +import static org.mockito.ArgumentMatchers.isNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/RewriteMavenProjectParser.java b/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/RewriteMavenProjectParser.java index 60bd0d3b7..110da2c49 100644 --- a/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/RewriteMavenProjectParser.java +++ b/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/RewriteMavenProjectParser.java @@ -18,10 +18,10 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.maven.artifact.DependencyResolutionRequiredException; -import org.apache.maven.execution.*; +import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.project.*; -import org.codehaus.plexus.*; +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.PlexusContainer; import org.jetbrains.annotations.NotNull; import org.openrewrite.ExecutionContext; import org.openrewrite.SourceFile; @@ -39,7 +39,9 @@ import org.springframework.sbm.scopes.ScanScope; import java.nio.file.Path; -import java.util.*; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.concurrent.atomic.AtomicReference; import java.util.function.UnaryOperator; import java.util.stream.Stream; diff --git a/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/RewriteMavenProjectParserTest.java b/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/RewriteMavenProjectParserTest.java index 325b683f9..86c57e224 100644 --- a/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/RewriteMavenProjectParserTest.java +++ b/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/RewriteMavenProjectParserTest.java @@ -16,7 +16,6 @@ package org.springframework.sbm.parsers.maven; import org.intellij.lang.annotations.Language; -import org.jetbrains.annotations.Nullable; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.DisplayName; @@ -39,9 +38,7 @@ import org.openrewrite.marker.ci.GithubActionsBuildEnvironment; import org.openrewrite.maven.MavenExecutionContextView; import org.openrewrite.maven.MavenSettings; -import org.openrewrite.maven.cache.*; -import org.openrewrite.maven.cache.LocalMavenArtifactCache; -import org.openrewrite.maven.cache.MavenArtifactCache; +import org.openrewrite.maven.cache.CompositeMavenPomCache; import org.openrewrite.maven.tree.MavenResolutionResult; import org.openrewrite.shaded.jgit.api.Git; import org.openrewrite.shaded.jgit.api.errors.GitAPIException; @@ -64,7 +61,6 @@ import java.io.File; import java.nio.charset.Charset; import java.nio.file.Path; -import java.nio.file.Paths; import java.time.Duration; import java.time.Instant; import java.time.ZoneId; diff --git a/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/SbmTestConfiguration.java b/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/SbmTestConfiguration.java index e7586026c..367cb5941 100644 --- a/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/SbmTestConfiguration.java +++ b/sbm-support-rewrite/src/test/java/org/springframework/sbm/parsers/maven/SbmTestConfiguration.java @@ -26,11 +26,8 @@ import org.springframework.context.annotation.Import; import org.springframework.sbm.parsers.ParserProperties; import org.springframework.sbm.parsers.RewriteParserConfiguration; -import org.springframework.sbm.parsers.maven.*; import org.springframework.sbm.scopes.ScanScope; -import static org.mockito.Mockito.mock; - /** * @author Fabian Krüger */ diff --git a/sbm-support-rewrite/src/test/java/org/springframework/sbm/test/util/DummyResource.java b/sbm-support-rewrite/src/test/java/org/springframework/sbm/test/util/DummyResource.java index 7ef788e6d..2d0fa6375 100644 --- a/sbm-support-rewrite/src/test/java/org/springframework/sbm/test/util/DummyResource.java +++ b/sbm-support-rewrite/src/test/java/org/springframework/sbm/test/util/DummyResource.java @@ -15,7 +15,6 @@ */ package org.springframework.sbm.test.util; -import lombok.RequiredArgsConstructor; import org.springframework.core.io.Resource; import java.io.ByteArrayInputStream;