Allow CodeBehind Result Annotations to be Overridden by Child Classes
---------------------------------------------------------------------
Key: WW-2443
URL: https://issues.apache.org/struts/browse/WW-2443
Project: Struts 2
Issue Type: Bug
Components: Plugin - CodeBehind, Plugin - Convention
Affects Versions: 2.1.0
Reporter: Blake Byrnes
Priority: Minor
I'm in edge struts 2 (2.1.1-SNAPSHOT), so I'm not sure if this is a problem in
2.0.11.
When using codebehind, I expected that if a parent class has a @Result
annotation with a given name, and a child class has a Result annotation with
the same name, that the child annotation would "override" any parent results of
the same name. This would seem like expected inheritence behavior (at least to
me). It appears that annotations are being taken in the opposite order (parent
overrides child setting).
example:
@Result(name="input", value="parent.action")
parentClass
@Result(name="input", value="chlid.action")
childClass extends parentClass
currently the childClass will go to /parent.action, instead of child.action
Looking through the code, it looks like when the ResultMap is being created, it
loops from the current class to the superclass, each time overwriting with
parent class results. Is this something intended, or can it be changed to work
in reverse? The change is simple - just do a check if the entry already exists
in the map before inserting.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.