Affects Version/s: 2.0.8, 2.0.9, 2.1.12, 2.1.13
Fix Version/s: None
The mojarra implementation of @ResourceDependencies and @ResourceDependency scanner makes @ResourceDependency take precedence over @ResourceDependencies.
It breaks the possibility to extends component and renderer.
When a super class of a renderer/component is annotated with @ResourceDependency, this annotation is taken even if we annotate an extending class with @resourceDependencies. If the extending class is annotated with @ResourceDependency, behavior is the expected.
I create a case wich reproduced the issue (maven project zipped in attachement).
There are 3 components and 3 renderers packaged in a jar. A simple page is packaged with this jar in a war.
Each component extends javax.faces.component.UIComponentBase and has its own renderer.
There are RedPanelRenderer wich extends javax.faces.render.Renderer, GreenPanelRenderer and BluePanelRenderer wich extend RedPanelRenderer.
RedPanelRenderer and BluePanelRenderer are annotated with @ResourceDependency and behavior is the expected.
GreenPanelRenderer is annotated with @ResourceDependencies and at runtime, CSS file in resource dependencies is not loaded. @ResourceDependency of RedPanelRenderer is instead.
I suggest a patch in attachment. It resolves this issue:
Scanner try for each component/renderer to get the @resourcesDependency AND the @ResourceDependencies. (Before it tried to get the @resourcesDependency and if not exists the @ResourceDependencies)
As these annotations are @Inherited this is the only way to work as expected.
Now @resourcesDependencies takes the precedence over @RessourceDependency and @resourceDependency is always loaded even if a @resourceDependencies is present and loaded.
I think it's the better solution...