Skip to content

Simplify production value-source and delimiter code - #110

Merged
slachiewicz merged 1 commit into
masterfrom
agent/sweep-prod-simplifications
Nov 18, 2026
Merged

slachiewicz merged 1 commit into
masterfrom
agent/sweep-prod-simplifications

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

Why

Production code still carried two hand-rolled patterns the rest of the codebase already avoids: a duplicated prefix-trimming loop and a manual null-safe equals chain.

Area

Main sources only; no tests, docs, or build files changed.

Changes

  • ValueSourceUtils.trimPrefix(String, String[], boolean) delegates to the Collection<String> overload via Arrays.asList.
  • DelimiterSpecification.equals uses Objects.equals on both fields after the class check.
  • Both PrefixedValueSourceWrapper classes and FieldBasedObjectInterpolator use toArray(new String[0]), matching PrefixAwareRecursionInterceptor.

Verification

  • JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-21.jdk/Contents/Home mvn -B -o spotless:apply — BUILD SUCCESS
  • JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-21.jdk/Contents/Home mvn -B -o spotless:check — BUILD SUCCESS
  • JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-21.jdk/Contents/Home mvn -B -o test — BUILD SUCCESS; Tests run: 138, Failures: 0, Errors: 0, Skipped: 0
  • Surefire per-class comparison (master baseline vs branch): 138 -> 138 tests, 0 classes lost tests.

The String[] overload of trimPrefix duplicated the Collection overload verbatim, and the null-safe field comparison in DelimiterSpecification.equals was hand-rolled. The zero-length toArray idiom is already used in PrefixAwareRecursionInterceptor and avoids a redundant sizing pass.
@slachiewicz slachiewicz added the maintenance Cleanup, refactoring or other internal change label Nov 18, 2026
@slachiewicz
slachiewicz merged commit 7eb663a into master Nov 18, 2026
13 checks passed
@slachiewicz
slachiewicz deleted the agent/sweep-prod-simplifications branch November 29, 2026 11:02
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.

1 participant