This issue has been created
There is 1 update.
 
 
XWiki Rendering / cid:jira-generated-image-avatar-9dd814a3-ff86-46a1-895a-a11ed3ed89db XRENDERING-809 Open

MacroDescriptor legacy getDefaultCategory() aspect is never weaved

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-621048b4-67dc-4fac-a664-bc5eb6a43b71 Vincent Massol created this issue on 23/Jul/26 22:13
 
Summary: MacroDescriptor legacy getDefaultCategory() aspect is never weaved
Issue Type: cid:jira-generated-image-avatar-9dd814a3-ff86-46a1-895a-a11ed3ed89db Bug
Affects Versions: 15.10.14
Assignee: Unassigned
Components: Transformation
Created: 23/Jul/26 22:13
Priority: cid:jira-generated-image-static-major-a64f890d-eae3-434a-802e-c21947308ba7 Major
Reporter: Vincent Massol
Description:

Problem

The backward-compatibility aspect MacroDescriptorAspect (in the xwiki-rendering-legacy-transformation-macro module) defines an @Around advice aroundGetDefaultCategory whose purpose is to make the deprecated MacroDescriptor.getDefaultCategory() return a value derived from the modern getDefaultCategories().

This advice is never weaved. The build emits (only as a warning):

advice defined in org.xwiki.rendering.macro.descriptor.MacroDescriptorAspect has not been applied [Xlint:adviceDidNotMatch]

The pointcut is execution(String MacroDescriptor.getDefaultCategory()) && within(MacroDescriptor), but getDefaultCategory() has no method body inside MacroDescriptor: it exists only as a default method on CompatibilityMacroDescriptor (added to MacroDescriptor through @DeclareParents) and as an inter-type declaration on AbstractMacroDescriptor. So the join point targeted by within(MacroDescriptor) does not exist and the advice matches nothing.

User-visible impact

For any MacroDescriptor implementation that implements only the modern getDefaultCategories() and does not extend AbstractMacroDescriptor, the deprecated getDefaultCategory() returns null instead of one of the configured categories. Legacy code still calling getDefaultCategory() therefore silently loses the macro's default category, breaking the backward-compatibility guarantee.

Fix

Retarget the pointcut to CompatibilityMacroDescriptor (where the method body actually lives) and add a !cflowbelow(...) guard so that this advice and the symmetric getDefaultCategories() advice do not recurse infinitely when a descriptor implements neither method. Add unit tests covering both the derivation and the neither-implemented cases.

Note: this went unnoticed because AspectJ only reports an unmatched advice as a warning. See the companion Commons issue about failing the build in that case.

 
 

1 update

 
cid:jira-generated-image-avatar-621048b4-67dc-4fac-a664-bc5eb6a43b71 Changes by Vincent Massol on 23/Jul/26 22:13
 
Fix Version: 18.7.0-rc-1