jenkinsci / jenkinsci/configuration-as-code-plugin

Remove jsr-305 dependency

Open
#1,360 0 comments 0 reactions 1 assignee Claimed by @jetersen View on GitHub
Dominant language
Java
Stars
2.8k
Forks
756
Avg merge
9h 47m
Merged PRs (30d)
10

Description

jenkins core 2.231 removed jsr305 which broke JCasC, as a quick fix we've added the dependency in jcasc (https://github.com/jenkinsci/configuration-as-code-plugin/pull/1359) but we should really remove it.

_Note: ensure testing is done interactively in a standalone instance of jenkins, jenkins rule and hpi:run have weird classloading_

_Originally posted by @jtnord in https://github.com/jenkinsci/configuration-as-code-plugin/pull/1359#issuecomment-614102100_

> Is their no better way to achieve the same without JSR 305?

check the annotation classname rather than the class itself. (which is what spotbugs acutally does to support a viarety of `Nonnull` classes.

re-introducing jsr-305 goes against the point of getting rid of it as it has a horrible license.

now the annotation won't be present unless the annotation class can be loaded (and this may well cause you not to find the annotations even if you provide it - if the classloader of the class with the use of the annotation can not load the class via itself or its parents. So what you are trying to achieve here is probably doomed to failure anyway (or the other plugin will have the class but it will be a different one due to the classloader and then probably not match when you expect it would - and your unit tests give false positives due to the Classloading differences in Jenkins vs JenkinsRule)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.