[
https://issues.apache.org/jira/browse/WW-5654?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Lukasz Lenart updated WW-5654:
------------------------------
Description:
Follow-up to WW-5539 (Concurrency performance enhancements, [PR
#1799|https://github.com/apache/struts/pull/1799]).
WW-5539 added {{TypeConverterHolder#computeMappingIfAbsent(Class, Function)}}
and deprecated the three check-then-act primitives it subsumes, marking them
{{@Deprecated(since = "7.3.0", forRemoval = true)}}. It also retained the
{{StrutsTypeConverterHolder.unknownMappings}} field as a deprecated, unused
vestige solely to preserve binary compatibility (retyping it would have thrown
{{NoSuchFieldError}} for subclasses compiled against an earlier version).
This ticket tracks their removal. Because dropping public SPI methods is a
binary-incompatible change, it targets the next major release (8.0.0).
h3. To remove
* {{TypeConverterHolder#getMapping(Class)}}
* {{TypeConverterHolder#addMapping(Class, Map)}}
* {{TypeConverterHolder#containsNoMapping(Class)}}
* {{StrutsTypeConverterHolder}} — the three corresponding overrides
* {{StrutsTypeConverterHolder.unknownMappings}} (deprecated {{protected
HashSet<String>}} vestige; live storage already lives in the private
{{unknownMappingsInternal}} set)
h3. Consequential work — not just deleting annotations
* The {{default}} implementation of {{computeMappingIfAbsent}} on the interface
is written in terms of the three primitives (it is the compatibility fallback
for third-party holders that do not override the method). Once the primitives
are gone that default body no longer compiles: either rewrite it without them,
or make {{computeMappingIfAbsent}} an abstract method every implementation must
provide.
* {{XWorkConverter.conditionalReload}} calls {{addMapping}} to force an
unconditional overwrite on config reload — something {{computeMappingIfAbsent}}
cannot express. A replacement primitive (e.g.
{{putMapping}}/{{replaceMapping}}) or an alternative reload mechanism must
exist before {{addMapping}} can be dropped.
* Remove the now-unnecessary combined deprecation/removal {{@SuppressWarnings}}
from {{XWorkConverter.conditionalReload}}, and the removal-only
{{@SuppressWarnings}} from the three {{StrutsTypeConverterHolder}} overrides.
* Third-party {{TypeConverterHolder}} implementations that call or implement
these methods will break — note this in the release notes / migration guide.
h3. Migration
Callers resolving a class-level converter mapping should use
{{computeMappingIfAbsent(clazz, builder)}}, which resolves and caches the
result — including the negative (no-mapping) case — in a single call.
was:
Follow-up to WW-5539 (Concurrency performance enhancements, PR #1799).
WW-5539 added `TypeConverterHolder#computeMappingIfAbsent(Class, Function)` and
deprecated
the three check-then-act primitives it subsumes, marking them
`@Deprecated(since = "7.3.0", forRemoval = true)`. It also retained the
`StrutsTypeConverterHolder.unknownMappings` field as a deprecated, unused
vestige solely to
preserve binary compatibility (retyping it would have thrown `NoSuchFieldError`
for
subclasses compiled against an earlier version).
This ticket tracks their removal. Because dropping public SPI methods is a
binary-incompatible change, it targets the next major release (8.0.0).
To remove:
- `TypeConverterHolder#getMapping(Class)`
- `TypeConverterHolder#addMapping(Class, Map)`
- `TypeConverterHolder#containsNoMapping(Class)`
- `StrutsTypeConverterHolder` — the three corresponding overrides
- `StrutsTypeConverterHolder.unknownMappings` (deprecated `protected
HashSet<String>`
vestige; live storage already lives in the private `unknownMappingsInternal`
set)
Consequential work — this is not just deleting annotations:
- The `default` implementation of `computeMappingIfAbsent` on the interface is
written in
terms of the three primitives (it is the compatibility fallback for
third-party holders
that do not override the method). Once the primitives are gone that default
body no longer
compiles: either rewrite it without them, or make `computeMappingIfAbsent` an
abstract
method every implementation must provide.
- `XWorkConverter.conditionalReload` calls `addMapping` to force an
unconditional overwrite
on config reload — something `computeMappingIfAbsent` cannot express. A
replacement
primitive (e.g. `putMapping`/`replaceMapping`) or an alternative reload
mechanism must
exist before `addMapping` can be dropped.
- Remove the now-unnecessary `@SuppressWarnings({"deprecation", "removal"})`
from
`XWorkConverter.conditionalReload` and `@SuppressWarnings("removal")` from
the three
`StrutsTypeConverterHolder` overrides.
- Third-party `TypeConverterHolder` implementations that call or implement
these methods
will break — note this in the release notes / migration guide.
Migration: callers resolving a class-level converter mapping should use
`computeMappingIfAbsent(clazz, builder)`, which resolves and caches the result
— including
the negative (no-mapping) case — in a single call.
> Remove deprecated TypeConverterHolder mapping primitives (getMapping,
> addMapping, containsNoMapping)
> ----------------------------------------------------------------------------------------------------
>
> Key: WW-5654
> URL: https://issues.apache.org/jira/browse/WW-5654
> Project: Struts 2
> Issue Type: Improvement
> Components: Core
> Affects Versions: 7.3.0
> Reporter: Lukasz Lenart
> Priority: Minor
> Fix For: 8.0.0
>
>
> Follow-up to WW-5539 (Concurrency performance enhancements, [PR
> #1799|https://github.com/apache/struts/pull/1799]).
> WW-5539 added {{TypeConverterHolder#computeMappingIfAbsent(Class, Function)}}
> and deprecated the three check-then-act primitives it subsumes, marking them
> {{@Deprecated(since = "7.3.0", forRemoval = true)}}. It also retained the
> {{StrutsTypeConverterHolder.unknownMappings}} field as a deprecated, unused
> vestige solely to preserve binary compatibility (retyping it would have
> thrown {{NoSuchFieldError}} for subclasses compiled against an earlier
> version).
> This ticket tracks their removal. Because dropping public SPI methods is a
> binary-incompatible change, it targets the next major release (8.0.0).
> h3. To remove
> * {{TypeConverterHolder#getMapping(Class)}}
> * {{TypeConverterHolder#addMapping(Class, Map)}}
> * {{TypeConverterHolder#containsNoMapping(Class)}}
> * {{StrutsTypeConverterHolder}} — the three corresponding overrides
> * {{StrutsTypeConverterHolder.unknownMappings}} (deprecated {{protected
> HashSet<String>}} vestige; live storage already lives in the private
> {{unknownMappingsInternal}} set)
> h3. Consequential work — not just deleting annotations
> * The {{default}} implementation of {{computeMappingIfAbsent}} on the
> interface is written in terms of the three primitives (it is the
> compatibility fallback for third-party holders that do not override the
> method). Once the primitives are gone that default body no longer compiles:
> either rewrite it without them, or make {{computeMappingIfAbsent}} an
> abstract method every implementation must provide.
> * {{XWorkConverter.conditionalReload}} calls {{addMapping}} to force an
> unconditional overwrite on config reload — something
> {{computeMappingIfAbsent}} cannot express. A replacement primitive (e.g.
> {{putMapping}}/{{replaceMapping}}) or an alternative reload mechanism must
> exist before {{addMapping}} can be dropped.
> * Remove the now-unnecessary combined deprecation/removal
> {{@SuppressWarnings}} from {{XWorkConverter.conditionalReload}}, and the
> removal-only {{@SuppressWarnings}} from the three
> {{StrutsTypeConverterHolder}} overrides.
> * Third-party {{TypeConverterHolder}} implementations that call or implement
> these methods will break — note this in the release notes / migration guide.
> h3. Migration
> Callers resolving a class-level converter mapping should use
> {{computeMappingIfAbsent(clazz, builder)}}, which resolves and caches the
> result — including the negative (no-mapping) case — in a single call.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)