Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes parallelStream use with non-thread safe collectors #861

Merged
merged 1 commit into from Dec 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -194,7 +194,7 @@ public ArtifactVersions lookupArtifactVersions(
.getRemoteProjectRepositories(),
"lookupArtifactVersions"))
.getVersions()
.parallelStream()
.stream()
.filter(v -> ignoredVersions.stream().noneMatch(i -> {
if (TYPE_REGEX.equals(i.getType())
&& Pattern.compile(i.getVersion())
Expand Down
Expand Up @@ -61,7 +61,7 @@ public static Set<Dependency> extractPluginDependenciesFromPluginsInPluginManage
* or an empty set if none have been retrieveddependencies or an empty set if none have been retrieved
*/
public static Set<Dependency> extractDependenciesFromPlugins(MavenProject project) {
return project.getBuildPlugins().parallelStream()
return project.getBuildPlugins().stream()
.filter(plugin -> plugin.getDependencies() != null)
.flatMap(plugin -> plugin.getDependencies().stream())
.collect(() -> new TreeSet<>(DependencyComparator.INSTANCE), Set::add, Set::addAll);
Expand Down
Expand Up @@ -268,7 +268,7 @@ private static VersionsHelper createVersionsHelper(
return new DefaultVersionsHelper.Builder()
.withRepositorySystem(ruleHelper.getComponent(RepositorySystem.class))
.withAetherRepositorySystem(ruleHelper.getComponent(org.eclipse.aether.RepositorySystem.class))
.withWagonMap(ruleHelper.getComponentMap(Wagon.class.getName()).entrySet().parallelStream()
.withWagonMap(ruleHelper.getComponentMap(Wagon.class.getName()).entrySet().stream()
.filter(e -> e.getValue() instanceof Wagon)
.collect(HashMap::new, (m, e) -> m.put(e.getKey(), (Wagon) e.getValue()), HashMap::putAll))
.withServerId(serverId)
Expand Down Expand Up @@ -349,7 +349,7 @@ public void execute(EnforcerRuleHelper ruleHelper) throws EnforcerRuleException
? of(SUBINCREMENTAL)
: ignoreIncrementalUpdates ? of(INCREMENTAL) : ignoreMinorUpdates ? of(MINOR) : empty();
List<ArtifactVersions> upgradable =
versionsHelper.lookupDependenciesUpdates(dependencies, false).values().parallelStream()
versionsHelper.lookupDependenciesUpdates(dependencies, false).values().stream()
.filter(v -> v.getVersions(v.restrictionForIgnoreScope(ignoredSegment), true).length > 0)
.collect(Collectors.toList());
if (upgradable.size() > maxUpdates) {
Expand Down
Expand Up @@ -429,8 +429,8 @@ public void execute() throws MojoExecutionException, MojoFailureException {
getHelper()
.lookupDependenciesUpdates(
filterDependencies(
getProject().getDependencies().parallelStream()
.filter(dep -> finalDependencyManagement.parallelStream()
getProject().getDependencies().stream()
.filter(dep -> finalDependencyManagement.stream()
.noneMatch(depMan -> dependenciesMatch(dep, depMan)))
.collect(
() -> new TreeSet<>(DependencyComparator.INSTANCE),
Expand Down
Expand Up @@ -856,7 +856,7 @@ private static boolean getPluginInherited(Object plugin) {
* @since 1.0-alpha-1
*/
private Map<String, Plugin> getLifecyclePlugins(MavenProject project) throws MojoExecutionException {
return getBoundPlugins(project).parallelStream()
return getBoundPlugins(project).stream()
.filter(Objects::nonNull)
.filter(p -> p.getKey() != null)
.collect(HashMap<String, Plugin>::new, (m, p) -> m.put(p.getKey(), p), Map::putAll);
Expand All @@ -874,7 +874,7 @@ private Map<String, Plugin> getLifecyclePlugins(MavenProject project) throws Moj
private Set<Plugin> getBoundPlugins(MavenProject project) {
// we need to provide a copy with the version blanked out so that inferring from super-pom
// works as for 2.x as 3.x fills in the version on us!
return lifecycleExecutor.getPluginsBoundByDefaultToAllLifecycles(project.getPackaging()).parallelStream()
return lifecycleExecutor.getPluginsBoundByDefaultToAllLifecycles(project.getPackaging()).stream()
.map(p -> new Plugin() {
{
setGroupId(p.getGroupId());
Expand Down