Detecting deprecated JSR-305 imports Probe
This blog post describes the latest addition to the plugin health scoring system developed as part of my Google summer of Code Project: a probe that detects usages of the
JSR-305 framework in plugins.
JSR-305 framework provides annotations to detect software defects.
Its executive committee voted it as dormant since May 2012.
It is important to stop using the framework for the following reasons:
It is no longer maintained.
The annotations have questionable license.
The annotations are in the reserved javax namespace and there is no public release of the spec. Since it is not actively maintained, there is little chance this would be published.
For more insight, refer to the Jenkins developer mailing list conversation.
@CheckForNull annotations, which are part of JSR-305, have been deprecated since 2016.
JSR-305 probe checks whether the deprecated annotations are used in a plugin.
This probe identifies the outdated annotations used in a plugin and highlight them in the scoring system.
The outdated annotations are imported in
My first approach was to go for an abstract class because I assumed there could be other probes that may need to look for code in
After a series of reviews, one of the mentors pointed out that to comply with the OpenWrite rule, all imports from the
javax.annotation package should be checked for deprecation.
Also, based on the YAGNI principle ("You Aren’t Gonna Need It"), which means features are developed only when you need them, the
abstract wasn’t the current requirement.
I restructured the code and used a single class to implement the probe.
This probe will identify the deprecated annotations and let maintainers know which imports in a plugin require replacement.
For more information or to find answers to any questions you might have, please visit the official GSoC 2023 project Adding Probes to "Plugin Health Score" description page.