[ 
https://issues.apache.org/jira/browse/SLING-11507?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17630312#comment-17630312
 ] 

Dirk Rudolph commented on SLING-11507:
--------------------------------------

I don't know the full history of this either, but agree that this may have been 
overlooked in the past. 

I can take this up and continue on what [~rombert] already started, first 
adding some ITs using the maven-invoker-plugin and adapting the annotation 
processor to handle all cases. 

I already added a first IT for reference in 
https://github.com/apache/sling-org-apache-sling-models-api/pull/8/commits/8f1f05f69b4de2ad510c335a2e939de2c2fbb133

> Field injection should not inject static fields
> -----------------------------------------------
>
>                 Key: SLING-11507
>                 URL: https://issues.apache.org/jira/browse/SLING-11507
>             Project: Sling
>          Issue Type: Bug
>          Components: Sling Models
>    Affects Versions: Models Impl 1.4.14
>            Reporter: Joerg Hoh
>            Priority: Critical
>             Fix For: Sling Models Implementation 1.5
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> 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)

Reply via email to