Skip to content

Commit

Permalink
Drop deprecated non prefixed properties (#796)
Browse files Browse the repository at this point in the history
* Drop deprecated non-prefixed properties

These were added in #724 in January,
four months ago.

* Drop deprecated MavenMojoProjectParser constructor
  • Loading branch information
timtebeek authored Jun 13, 2024
1 parent c338bdc commit 2730dc2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 49 deletions.
53 changes: 10 additions & 43 deletions src/main/java/org/openrewrite/maven/ConfigurableRewriteMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,10 @@ public abstract class ConfigurableRewriteMojo extends AbstractMojo {
@Parameter(property = "rewrite.activeRecipes")
protected LinkedHashSet<String> activeRecipes;

/**
* @deprecated Use {@code rewrite.activeRecipes} instead.
*/
@Nullable
@Parameter(property = "activeRecipes")
@Deprecated
protected LinkedHashSet<String> deprecatedActiveRecipes;

@Nullable
@Parameter(property = "rewrite.activeStyles")
protected LinkedHashSet<String> activeStyles;

/**
* @deprecated Use {@code rewrite.activeStyles} instead.
*/
@Nullable
@Parameter(property = "activeStyles")
@Deprecated
protected LinkedHashSet<String> deprecatedActiveStyles;

@Nullable
@Parameter(property = "rewrite.metricsUri", alias = "metricsUri")
protected String metricsUri;
Expand Down Expand Up @@ -116,29 +100,16 @@ public abstract class ConfigurableRewriteMojo extends AbstractMojo {
@Parameter(property = "rewrite.exclusions")
private LinkedHashSet<String> exclusions;

/**
* @deprecated Use {@code rewrite.exclusions} instead.
*/
@Nullable
@Deprecated
@Parameter(property = "exclusions")
private LinkedHashSet<String> deprecatedExclusions;

protected Set<String> getExclusions() {
return getMergedAndCleaned(exclusions, deprecatedExclusions);
return getCleanedSet(exclusions);
}

@Nullable
@Parameter(property = "rewrite.plainTextMasks")
private LinkedHashSet<String> plainTextMasks;

@Nullable
@Parameter(property = "plainTextMasks")
@Deprecated
private LinkedHashSet<String> deprecatedPlainTextMasks;

protected Set<String> getPlainTextMasks() {
Set<String> masks = getMergedAndCleaned(plainTextMasks, deprecatedPlainTextMasks);
Set<String> masks = getCleanedSet(plainTextMasks);
if (!masks.isEmpty()) {
return masks;
}
Expand Down Expand Up @@ -240,7 +211,7 @@ protected Set<String> getActiveRecipes() {
if (computedRecipes == null) {
synchronized (this) {
if (computedRecipes == null) {
computedRecipes = getMergedAndCleaned(activeRecipes, deprecatedActiveRecipes);
computedRecipes = getCleanedSet(activeRecipes);
}
}
}
Expand All @@ -252,7 +223,7 @@ protected Set<String> getActiveStyles() {
if (computedStyles == null) {
synchronized (this) {
if (computedStyles == null) {
computedStyles = getMergedAndCleaned(activeStyles, deprecatedActiveStyles);
computedStyles = getCleanedSet(activeStyles);
}
}
}
Expand Down Expand Up @@ -313,27 +284,23 @@ protected Set<String> getRecipeArtifactCoordinates() {
if (computedRecipeArtifactCoordinates == null) {
synchronized (this) {
if (computedRecipeArtifactCoordinates == null) {
computedRecipeArtifactCoordinates = getMergedAndCleaned(recipeArtifactCoordinates, null);
computedRecipeArtifactCoordinates = getCleanedSet(recipeArtifactCoordinates);
}
}
}
//noinspection ConstantConditions
return computedRecipeArtifactCoordinates;
}

private static Set<String> getMergedAndCleaned(@Nullable LinkedHashSet<String> set, @Nullable LinkedHashSet<String> deprecatedSet) {
Stream<String> merged = Stream.empty();
if (set != null) {
merged = set.stream();
}
if (deprecatedSet != null) {
merged = Stream.concat(merged, deprecatedSet.stream());
private static Set<String> getCleanedSet(@Nullable Set<String> set) {
if (set == null) {
return Collections.emptySet();
}
LinkedHashSet<String> collected = merged
Set<String> cleaned = set.stream()
.filter(Objects::nonNull)
.map(String::trim)
.filter(s -> !s.isEmpty())
.collect(Collectors.toCollection(LinkedHashSet::new));
return Collections.unmodifiableSet(collected);
return Collections.unmodifiableSet(cleaned);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,6 @@ public class MavenMojoProjectParser {
private final boolean runPerSubmodule;
private final boolean parseAdditionalResources;

@Deprecated
@SuppressWarnings("BooleanParameter")
public MavenMojoProjectParser(Log logger, Path baseDir, boolean pomCacheEnabled, @Nullable String pomCacheDirectory, RuntimeInformation runtime, boolean skipMavenParsing, Collection<String> exclusions, Collection<String> plainTextMasks, int sizeThresholdMb, MavenSession session, SettingsDecrypter settingsDecrypter, boolean runPerSubmodule) {
this(logger, baseDir, pomCacheEnabled, pomCacheDirectory, runtime, skipMavenParsing, exclusions, plainTextMasks, sizeThresholdMb, session, settingsDecrypter, runPerSubmodule, false);
}

@SuppressWarnings("BooleanParameter")
public MavenMojoProjectParser(Log logger, Path baseDir, boolean pomCacheEnabled, @Nullable String pomCacheDirectory, RuntimeInformation runtime, boolean skipMavenParsing, Collection<String> exclusions, Collection<String> plainTextMasks, int sizeThresholdMb, MavenSession session, SettingsDecrypter settingsDecrypter, boolean runPerSubmodule, boolean parseAdditionalResources) {
this.logger = logger;
Expand Down

0 comments on commit 2730dc2

Please sign in to comment.