Back to blog

Detecting deprecated JSR-305 imports Probe

Jagruti Tiwari
Jagruti Tiwari
September 9, 2023

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.

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.

About the author

Jagruti Tiwari

Jagruti Tiwari

Jagruti works as a Senior Project Engineer in one of the reputable firms in India. Her open-source journey started in Jan 2022. She has a strong background in Java, JavaScript, and an intermediate knowledge of Python. Jagruti’s association with Jenkins started in Hacktoberfest 2022. This year (in 2023) she has been selected in the GSoC project titled "Adding Probes to Plugin Health Score System" which is her first GSoC. She hopes to continue being involved in the community and someday help mentoring new open source enthusiasts in the near future.