Skip to content

Finish plexus-utils StringUtils removal with JDK equivalents - #650

Merged
slachiewicz merged 1 commit into
masterfrom
agent/sweep-modello-stringutils-jdk
Nov 18, 2026
Merged

slachiewicz merged 1 commit into
masterfrom
agent/sweep-modello-stringutils-jdk

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

The earlier plexus-utils migration (3c63a85) left a few StringUtils calls
behind. The JDK covers all of them, so finish the cleanup and drop the imports
that are now unused.

Area: production sources in modello-core, modello-maven-plugin and
modello-plugin-stax, plus one stax test helper. No behavior change.

Changes:

  • ModelloCli.validateNamedArguments(): replaced the two
    StringUtils.isEmpty((String) parameters.get(...)) checks with local
    variables and null/empty checks, matching the rest of the file.
  • ModelClass.hashCode(): replaced !StringUtils.isEmpty(getPackageName())
    with an explicit null/empty check on a local variable; dropped the import.
  • AbstractModelloGeneratorMojo: StringUtils.join(iterator, ",") to
    String.join(",", packagedVersions). The stripEnd call and its import stay.
  • StaxSerializerGenerator: StringUtils.join(names.iterator(), ", ") to
    String.join(", ", names); dropped the import.
  • AbstractStaxGeneratorTestCase: StringUtils.join(versions, ",") to
    String.join(",", versions); dropped the import.

Verification (JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-21.jdk/Contents/Home):

  • mvn -B -o spotless:apply - BUILD SUCCESS, no reformatting needed
  • mvn -B -o spotless:check - BUILD SUCCESS
  • mvn -B -o test - BUILD SUCCESS, 178 tests run, 0 failures/errors/skips
    across all 15 reactor modules

Commit 3c63a85 migrated most StringUtils usage to JDK APIs but left a few
stragglers. Use null/empty checks and String.join where the JDK provides the
same behavior, and drop the now-unused imports so the plexus-utils dependency
can be reduced over time.

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Clean, correct migration of the remaining StringUtils.isEmpty() and StringUtils.join() calls to JDK equivalents. All replacements are behaviorally equivalent — StringUtils.isEmpty() in plexus-utils resolves to (str == null) || str.isEmpty(), which is exactly what the new code does. The ModelClass.hashCode() change also improves readability by caching getPackageName() in a local variable, avoiding the double getter call.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

@slachiewicz
slachiewicz merged commit 86f54cf into master Nov 18, 2026
13 of 19 checks passed
@slachiewicz
slachiewicz deleted the agent/sweep-modello-stringutils-jdk branch November 18, 2026 22:25
@slachiewicz slachiewicz added the maintenance Cleanup, refactoring or other internal change label Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Cleanup, refactoring or other internal change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants