Skip to content

Commit

Permalink
Organize imports
Browse files Browse the repository at this point in the history
  • Loading branch information
fabapp2 committed Oct 18, 2023
1 parent 8d3cda1 commit 3881a18
Show file tree
Hide file tree
Showing 44 changed files with 64 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down Expand Up @@ -92,6 +94,7 @@ public RewriteProjectParsingResult parse(Path baseDir) {
*/
public RewriteProjectParsingResult parse(Path givenBaseDir, List<Resource> resources) {
scanScope.clear(beanFactory);

final Path baseDir = normalizePath(givenBaseDir);

eventPublisher.publishEvent(new StartedParsingProjectEvent(resources));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package org.springframework.sbm.parsers.events;

import org.openrewrite.Parser;
import org.springframework.context.ApplicationEvent;

/**
* @author Fabian Krüger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package org.springframework.sbm.project.resource;

import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

@RequiredArgsConstructor
public class ProjectResourceSetSerializer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<List<RewriteSourceFileHolder<? extends SourceFile>>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 3881a18

Please sign in to comment.