WW-5256 Decouple FreeMarker whitespace stripping from devMode#1743
Merged
Conversation
… 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>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
In 7.2.0,
FreemarkerManagerdisabled FreeMarker whitespace stripping wheneverdevModewas enabled (whitespaceStripping && !devMode). This regressed behavior versus 6.x and had two visible effects in development:s:textarearendered 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.The
&& !devModeterm also overrode thestruts.freemarker.whitespaceStrippingsetting, leaving developers no way to re-enable stripping while in devMode.This change makes whitespace stripping governed solely by
struts.freemarker.whitespaceStripping(defaulttrue), restoring 6.x behavior by default while keeping an explicit opt-out. The now-unuseddevModefield/setter/injection (added in 7.2.0 only for this coupling) is removed, and the constant's Javadoc is updated.Changes
FreemarkerManager: drop the&& !devModecoupling; remove the deaddevModefield,setDevModesetter and its@Inject.StrutsConstants: remove the stale "Automatically disabled when devMode is enabled" note fromSTRUTS_FREEMARKER_WHITESPACE_STRIPPING.docs/superpowers/.Test Plan
mvn test -DskipAssembly -pl core -Dtest=FreemarkerManagerTest— passesmvn test -DskipAssembly -pl core -Dtest=TextareaTest— passes (rendering guard)mvn test -DskipAssembly -pl core— full core module, 2969 tests, 0 failuresFixes WW-5256
🤖 Generated with Claude Code