Introduction
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.
The 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.
The @Nonnull
and @CheckForNull
annotations, which are part of JSR-305, have been deprecated since 2016.
The JSR-305
probe checks whether the deprecated annotations are used in a plugin.
Importance of the probe
This probe identifies the outdated annotations used in a plugin and highlight them in the scoring system.
Challenges and Learning
The outdated annotations are imported in .java
files.
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 .java
files.
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.
Conclusion and Outcome
This probe will identify the deprecated annotations and let maintainers know which imports in a plugin require replacement.
Links
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.