WW-5729 fix(jasperreports): override HashMap.get/containsKey in ValueStackShadowMap - #1920
Merged
Conversation
lukaszlenart
marked this pull request as draft
September 12, 2026 09:07
lukaszlenart
force-pushed
the
WW-5729-shadowmap-override
branch
from
September 12, 2026 09:11
2e039a6 to
9a7fdb6
Compare
…StackShadowMap The two methods took a String parameter, so they overloaded rather than overrode HashMap.get(Object) and containsKey(Object). JasperReports holds the parameter map as java.util.Map and calls the Object variants, which meant the value-stack fallback the class exists for never ran when a report was filled: only the entries the result put explicitly reached JasperReports, and a declared parameter exposed as an action property rendered as null. The Object overrides were the original code; 2908d74 (2019, "Minor code optimization") narrowed them to String when it added the generics, and the regression first shipped in 6.0.0. The jasperreports7 copy already declares both as @OverRide with an Object parameter. Both copies now let an explicit map entry win even when its value is null, so containsKey and get agree and JasperReports skips the default value expression consistently. The String overloads stay in the 6.x plugin as deprecated delegates for binary compatibility. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
lukaszlenart
force-pushed
the
WW-5729-shadowmap-override
branch
from
September 12, 2026 09:13
9a7fdb6 to
8853c4d
Compare
lukaszlenart
marked this pull request as ready for review
September 12, 2026 09:14
The deprecated String delegates are reachable only by callers holding a ValueStackShadowMap reference, so the result-level tests never hit them. Co-Authored-By: Claude Opus 5 (1M context) <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.


Fixes WW-5729
What
ValueStackShadowMapin thejasperreportsplugin is meant to fall back toValueStack.findValue(name)for any report parameter not put in the map explicitly, so a parameter declared in the.jaspercan be resolved straight from the action. ItscontainsKey(String)/get(String)were overloads of theHashMapmethods, not overrides, and JasperReports — which holds the map asjava.util.Map— calls theObjectvariants. The fallback therefore never ran: a declared parameter exposed only as an action property rendered asnull.This is a regression: the
Objectoverrides were the original code,2908d746c(2019, "Minor code optimization") narrowed them toStringwhile adding the generics, and it first shipped in 6.0.0. Thejasperreports7copy already has the@Overrideform.Changes
jasperreports/ValueStackShadowMap:containsKey(Object)/get(Object)are now real overrides; theStringoverloads stay as@Deprecated(since = "7.4.0", forRemoval = true)delegates for binary compatibility — removal tracked in WW-5730 at 8.0.0.null, socontainsKeyandgetagree and JasperReports skips the parameter's default-value expression consistently.$P{title}resolved from an action getter with noreportParameters(watched failing withnull Reportbefore the fix), and an explicittitle → nullentry not shadowed by the getter.Behaviour change — for the version notes
Users of the 6.x-line plugin whose reports declare a parameter with the same name as an action property (or a Struts context key such as
session,request,parameters,locale) will see that parameter start resolving from the value stack instead of its default-value expression, as the class Javadoc has always described and as thejasperreports7plugin already does. The lookup is type-blind — aLongparameter meeting anintgetter, or asessionparameter meeting the StrutsSessionMap, fails at fill time with aClassCastException. Rename the report parameter or supply it throughreportParametersin that case.🤖 Generated with Claude Code