Skip to content

WW-5256 Decouple FreeMarker whitespace stripping from devMode#1743

Merged
lukaszlenart merged 5 commits into
mainfrom
WW-5256-textarea-whitespace-devmode
Jun 15, 2026
Merged

WW-5256 Decouple FreeMarker whitespace stripping from devMode#1743
lukaszlenart merged 5 commits into
mainfrom
WW-5256-textarea-whitespace-devmode

Conversation

@lukaszlenart

Copy link
Copy Markdown
Member

Summary

In 7.2.0, FreemarkerManager disabled FreeMarker whitespace stripping whenever devMode was enabled (whitespaceStripping && !devMode). This regressed behavior versus 6.x and had two visible effects in development:

  • s:textarea rendered blank lines — the <#if nameValue??> / </#if> directive lines inside <textarea>…</textarea> were no longer collapsed, and whitespace there is significant page content, so an empty textarea showed up as blank lines on screen.
  • Bloated HTML output — every directive-only line across all UI templates emitted its newline/indentation.

The && !devMode term also overrode the struts.freemarker.whitespaceStripping setting, leaving developers no way to re-enable stripping while in devMode.

This change makes whitespace stripping governed solely by struts.freemarker.whitespaceStripping (default true), restoring 6.x behavior by default while keeping an explicit opt-out. The now-unused devMode field/setter/injection (added in 7.2.0 only for this coupling) is removed, and the constant's Javadoc is updated.

Changes

  • FreemarkerManager: drop the && !devMode coupling; remove the dead devMode field, setDevMode setter and its @Inject.
  • StrutsConstants: remove the stale "Automatically disabled when devMode is enabled" note from STRUTS_FREEMARKER_WHITESPACE_STRIPPING.
  • Tests: remove the two devMode-coupling tests; keep default-on and explicit-off coverage.
  • Design + implementation plan docs under docs/superpowers/.

Test Plan

  • mvn test -DskipAssembly -pl core -Dtest=FreemarkerManagerTest — passes
  • mvn test -DskipAssembly -pl core -Dtest=TextareaTest — passes (rendering guard)
  • mvn test -DskipAssembly -pl core — full core module, 2969 tests, 0 failures

Fixes WW-5256

🤖 Generated with Claude Code

lukaszlenart and others added 5 commits June 15, 2026 12:04
… devMode

Fixes s:textarea rendering blank lines and HTML whitespace bloat in devMode
by honoring struts.freemarker.whitespaceStripping unconditionally.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…om devMode

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@lukaszlenart lukaszlenart merged commit 59e3424 into main Jun 15, 2026
10 checks passed
@lukaszlenart lukaszlenart deleted the WW-5256-textarea-whitespace-devmode branch June 15, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant