[
https://issues.apache.org/jira/browse/SLING-11507?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17626410#comment-17626410
]
Carsten Ziegeler commented on SLING-11507:
------------------------------------------
Unfortunately, just looking at the header is not enough . it is possible to use
any class as a Sling Model through API without declaring it in a manifest
header.
So, I think ultimately we need to scan all classes for the inject annotation -
but that is actually simplifying it as we can just blindly go through all
classes.
> Field injection should not inject static fields
> -----------------------------------------------
>
> Key: SLING-11507
> URL: https://issues.apache.org/jira/browse/SLING-11507
> Project: Sling
> Issue Type: Task
> Components: Sling Models
> Affects Versions: Models Impl 1.4.14
> Reporter: Joerg Hoh
> Priority: Major
> Fix For: Sling Models Implementation 1.5
>
>
> Currently this injection works:
> {noformat}
> @SlingObject
> private static ResourceResolver resourceResolver;
> {noformat}
> but it should not. Sling Models are Pojos and injection must never inject
> into static fields. Instead it should throw an exception and an error message
> indicating the problem (another option would be to refuse the injection with
> a proper error message).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)