Re: Custom Annotations in jenkins

24 views
Skip to first unread message
Message has been deleted

varun vikas

unread,
Aug 18, 2019, 1:01:17 AM8/18/19
to Jenkins Developers


On Sunday, 18 August 2019 10:07:18 UTC+5:30, varun vikas wrote:
Hi,

I am going through SystemProperties.java file code in jenkins Core .
There are many custom annotations defined there e.g 
@SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "Currently Jenkins instance may have one ond only one context")
@Restricted(NoExternalUse.class)

Above annotations are defined in SuppressFBWarnings.class and Restricted.class.
Till now, we have only created the annotation and then used it. The main reason we are using annotations are because they are metadata. So it means we should be able to fetch this metadata to utilize the annotation information when we need it.
It seems, code of Fetching metadata is written in hudson.util.ReflectionUtils.java file. 
 
 
 
so, my question is when this ReflectionUtil.java file is called and what is code flow of fetching these metadata to utilize annotation information.

Thanks,
varun

Jesse Glick

unread,
Aug 19, 2019, 10:40:33 AM8/19/19
to Jenkins Dev
On Sun, Aug 18, 2019 at 12:37 AM varun vikas <varun...@gmail.com> wrote:
> where is code written in jenkins code base of Processing above annotations using Reflection?

Depends on the annotation. Neither of those examples are processed by
Jenkins code at all. One is read by the FindBugs/SpotBugs tool; one is
read by the `access-modifier-checker` Maven plugin during the build.
Reply all
Reply to author
Forward
0 new messages