[
https://issues.apache.org/jira/browse/WW-3871?focusedWorklogId=1032297&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1032297
]
ASF GitHub Bot logged work on WW-3871:
--------------------------------------
Author: ASF GitHub Bot
Created on: 26/Jul/26 15:52
Start Date: 26/Jul/26 15:52
Worklog Time Spent: 10m
Work Description: Copilot commented on code in PR #1812:
URL: https://github.com/apache/struts/pull/1812#discussion_r3652858758
##########
core/src/main/java/org/apache/struts2/conversion/annotations/TypeConversion.java:
##########
@@ -67,8 +74,11 @@
* <tr>
* <td>key</td>
* <td>no</td>
- * <td>The annotated property/key name</td>
- * <td>The optional property name mostly used within TYPE level
annotations.</td>
+ * <td>The resolved property name on a method; the field's own name on a
field</td>
+ * <td>The property name the rule applies to. The matching prefix for the
given rule
+ * (<code>Key_</code>, <code>Element_</code>, <code>KeyProperty_</code>,
<code>CreateIfNull_</code>, or the deprecated
+ * <code>Collection_</code>) is prepended automatically unless the key already
carries it. Required on TYPE level annotations,
+ * where there is no member name to derive it from.</td>
Review Comment:
The `key` parameter table lists an effective default for methods/fields, but
it doesn’t mention that `key` is required when `@TypeConversion` is used inside
a class-level `@Conversion(conversions=...)` (where there’s no member name to
derive from). As written, the “Default” column can be read as universally
applicable, which contradicts the class-level requirement enforced by
`XWorkConverter.processClassLevelAnnotations`. Consider updating the row to
explicitly call out the per-context default/requirement.
Issue Time Tracking
-------------------
Worklog Id: (was: 1032297)
Time Spent: 1h 40m (was: 1.5h)
> TypeConversion annotation support improvement
> ---------------------------------------------
>
> Key: WW-3871
> URL: https://issues.apache.org/jira/browse/WW-3871
> Project: Struts 2
> Issue Type: Improvement
> Components: Plugin - Convention
> Affects Versions: 2.3.4.1
> Reporter: Pavan Ananth
> Assignee: Lukasz Lenart
> Priority: Major
> Fix For: 7.3.0
>
> Time Spent: 1h 40m
> Remaining Estimate: 0h
>
> The annotation support for TypeConversion in Struts 2 is too literal an
> interpretation of the XML support. For instance, I am required to supply this
> if I have choose the CreateIfNull feature at a property level :
> @TypeConversion(key="CreateIfNull_users", rule=ConversionRule.CreateIfNull,
> value="true")
> List<User> users;
> Given that the rule is CreateIfNull, the key can be constructed implicitly
> using property name - why is it asked of an user to type in the full key.
> This holds good for the other supported ConversionRules as well
--
This message was sent by Atlassian Jira
(v8.20.10#820010)