[
https://issues.apache.org/jira/browse/WW-5671?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Lukasz Lenart updated WW-5671:
------------------------------
Fix Version/s: 8.0.0
(was: 7.4.0)
Description:
Follow-up to WW-5668.
{{org.apache.struts2.ognl.OgnlCache}} and its factory started life as an
OGNL-specific concern: caching parsed expressions and BeanInfo objects. It has
since become the framework's general-purpose bounded-cache abstraction -- it
also backs the proxy-detection cache, and as of WW-5668 the localized-text
provider caches in {{org.apache.struts2.text}}.
The name and package no longer describe what it is. A developer reading
{{AbstractLocalizedTextProvider}} now finds its resource-bundle cache typed as
an {{OgnlCache}}, which suggests an OGNL relationship that does not exist.
h2. Decision (2026-09-13): clean break at 8.0.0, no deprecated shims
Java has no type aliases. Keeping the old names alive for one minor line would
mean roughly seven deprecated bridge types: the old interfaces as
sub-interfaces of the new ones, the nested {{OgnlCacheFactory.CacheType}} enum
(which cannot be aliased at all) kept alongside a converter to the new enum,
the old implementation classes as subclasses of the new ones, and the old
default factory constructing those subclasses so {{buildOgnlCache()}} can still
return an {{OgnlCache}}. That is not worth carrying, so the rename ships as a
breaking change in 8.0.0 with a Migration Guide entry.
h2. Target shape
New package {{org.apache.struts2.cache}}:
* {{StrutsCache}} (was {{OgnlCache}})
* {{CacheFactory}} (was {{OgnlCacheFactory}}); {{buildOgnlCache()}} becomes
{{buildCache()}}
* {{StrutsCacheFactory}} (was {{DefaultOgnlCacheFactory}}) -- the
plain-interface / {{Struts*}}-implementation convention already used by
{{ProxyCacheFactory}} / {{StrutsProxyCacheFactory}}
* {{CacheType}} becomes a top-level enum in the new package (was nested in
{{OgnlCacheFactory}})
* {{BasicCache}} / {{LruCache}} / {{CaffeineCache}} (were {{OgnlDefaultCache}}
/ {{OgnlLRUCache}} / {{OgnlCaffeineCache}})
Stays put: {{ExpressionCacheFactory}}, {{BeanInfoCacheFactory}} and
{{ProxyCacheFactory}} keep their names and the {{ognl}} package (they are bean
types applications may reference in {{struts.xml}}); they simply extend
{{CacheFactory}}. All {{struts.ognl.*}}, {{struts.proxy.*}} and
{{struts.i18n.*}} property names are unchanged -- they name specific caches,
not the abstraction.
h2. Call sites to update
* {{OgnlUtil}}, {{AbstractLocalizedTextProvider}}, {{ProxyUtil}},
{{StrutsProxyService}}, {{DefaultConfiguration}}
* {{StrutsConstants}} Javadoc links to the {{CacheType}} enum
* {{DefaultOgnlExpressionCacheFactory}}, {{DefaultOgnlBeanInfoCacheFactory}},
{{StrutsProxyCacheFactory}}
* Tests: {{OgnlCacheRemoveTest}}, {{OgnlUtilTest}},
{{StrutsProxyCacheFactoryTest}}, {{StrutsLocalizedTextProviderTest}}, the REST
plugin integration tests that build a cache factory directly
* Docs: {{core-developers/ognl-cache-configuration.md}} in struts-site, plus
the 8.0.0 Migration Guide entry
h2. Acceptance
* The abstraction, its factory and its implementations carry a name that does
not imply OGNL and live in {{org.apache.struts2.cache}}.
* No behavioural change; existing configuration constants and property names
keep working.
was:
Follow-up to WW-5668.
{{org.apache.struts2.ognl.OgnlCache}} and its factory started life as an
OGNL-specific concern: caching parsed expressions and BeanInfo objects. It has
since become the framework's general-purpose bounded-cache abstraction -- it
also backs the proxy-detection cache, and as of WW-5668 the localized-text
provider caches in {{org.apache.struts2.text}}.
The name and package no longer describe what it is. A developer reading
{{AbstractLocalizedTextProvider}} now finds its resource-bundle cache typed as
an {{OgnlCache}}, which suggests an OGNL relationship that does not exist. The
same applies to the configuration constants that select an implementation.
Rename the abstraction to something neutral -- e.g. {{StrutsCache}} -- and move
it out of the {{ognl}} package, so that the type describes a bounded, evicting
cache rather than an OGNL detail. {{OgnlCacheFactory}},
{{DefaultOgnlCacheFactory}}, {{CacheType}} and the three implementations follow.
h2. Scope / acceptance
* The abstraction, its factory and its implementations carry a name that does
not imply OGNL, and live outside the {{ognl}} package.
* All call sites are updated: OGNL expression and BeanInfo caches,
proxy-detection cache, localized-text provider caches.
* Existing configuration constants and property names keep working; the
OGNL-specific settings ({{struts.ognl.expressionCacheType}} and friends) are
naming for a specific cache, not for the abstraction, and are out of scope here.
* The public types are part of the released API, so a minor release must keep
the old names available as deprecated aliases delegating to the new ones. If a
clean break is preferred instead, this should move to 8.0.0.
* No behavioural change.
> Rename the OgnlCache abstraction to a neutral name now that it backs non-OGNL
> caches
> ------------------------------------------------------------------------------------
>
> Key: WW-5671
> URL: https://issues.apache.org/jira/browse/WW-5671
> Project: Struts 2
> Issue Type: Improvement
> Components: Core
> Reporter: Lukasz Lenart
> Assignee: Lukasz Lenart
> Priority: Minor
> Fix For: 8.0.0
>
>
> Follow-up to WW-5668.
> {{org.apache.struts2.ognl.OgnlCache}} and its factory started life as an
> OGNL-specific concern: caching parsed expressions and BeanInfo objects. It
> has since become the framework's general-purpose bounded-cache abstraction --
> it also backs the proxy-detection cache, and as of WW-5668 the localized-text
> provider caches in {{org.apache.struts2.text}}.
> The name and package no longer describe what it is. A developer reading
> {{AbstractLocalizedTextProvider}} now finds its resource-bundle cache typed
> as an {{OgnlCache}}, which suggests an OGNL relationship that does not exist.
> h2. Decision (2026-09-13): clean break at 8.0.0, no deprecated shims
> Java has no type aliases. Keeping the old names alive for one minor line
> would mean roughly seven deprecated bridge types: the old interfaces as
> sub-interfaces of the new ones, the nested {{OgnlCacheFactory.CacheType}}
> enum (which cannot be aliased at all) kept alongside a converter to the new
> enum, the old implementation classes as subclasses of the new ones, and the
> old default factory constructing those subclasses so {{buildOgnlCache()}} can
> still return an {{OgnlCache}}. That is not worth carrying, so the rename
> ships as a breaking change in 8.0.0 with a Migration Guide entry.
> h2. Target shape
> New package {{org.apache.struts2.cache}}:
> * {{StrutsCache}} (was {{OgnlCache}})
> * {{CacheFactory}} (was {{OgnlCacheFactory}}); {{buildOgnlCache()}} becomes
> {{buildCache()}}
> * {{StrutsCacheFactory}} (was {{DefaultOgnlCacheFactory}}) -- the
> plain-interface / {{Struts*}}-implementation convention already used by
> {{ProxyCacheFactory}} / {{StrutsProxyCacheFactory}}
> * {{CacheType}} becomes a top-level enum in the new package (was nested in
> {{OgnlCacheFactory}})
> * {{BasicCache}} / {{LruCache}} / {{CaffeineCache}} (were
> {{OgnlDefaultCache}} / {{OgnlLRUCache}} / {{OgnlCaffeineCache}})
> Stays put: {{ExpressionCacheFactory}}, {{BeanInfoCacheFactory}} and
> {{ProxyCacheFactory}} keep their names and the {{ognl}} package (they are
> bean types applications may reference in {{struts.xml}}); they simply extend
> {{CacheFactory}}. All {{struts.ognl.*}}, {{struts.proxy.*}} and
> {{struts.i18n.*}} property names are unchanged -- they name specific caches,
> not the abstraction.
> h2. Call sites to update
> * {{OgnlUtil}}, {{AbstractLocalizedTextProvider}}, {{ProxyUtil}},
> {{StrutsProxyService}}, {{DefaultConfiguration}}
> * {{StrutsConstants}} Javadoc links to the {{CacheType}} enum
> * {{DefaultOgnlExpressionCacheFactory}}, {{DefaultOgnlBeanInfoCacheFactory}},
> {{StrutsProxyCacheFactory}}
> * Tests: {{OgnlCacheRemoveTest}}, {{OgnlUtilTest}},
> {{StrutsProxyCacheFactoryTest}}, {{StrutsLocalizedTextProviderTest}}, the
> REST plugin integration tests that build a cache factory directly
> * Docs: {{core-developers/ognl-cache-configuration.md}} in struts-site, plus
> the 8.0.0 Migration Guide entry
> h2. Acceptance
> * The abstraction, its factory and its implementations carry a name that does
> not imply OGNL and live in {{org.apache.struts2.cache}}.
> * No behavioural change; existing configuration constants and property names
> keep working.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)