Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove ASM dependency #396

Merged
merged 1 commit into from
Aug 9, 2022
Merged

Conversation

basil
Copy link
Member

@basil basil commented Aug 7, 2022

One of my goals for reducing core dependency debt is to remove ASM from core (possibly by detaching it into a library plugin), which means first removing any usages of ASM from core. A big one was JNR, which I have already detached. Stapler is probably the second-biggest one.

This PR replaces the ASM dependency with an inlined copy of https://github.com/paul-hammant/paranamer/blob/master/paranamer/src/java/com/thoughtworks/paranamer/BytecodeReadingParanamer.java which is basically just the portions of ASM that we need, inlined into a single file. This removes the risk of linkage errors because we're just invoking a regular static method on a regular Java class, and it brings us one step forward to removing ASM from the core WAR.

One might be concerned about the fact that we're unlikely to get updates to this code, but it doesn't need to be able to deal with class files from new Java versions: this is a fallback code path for plugins that were compiled before our plugin parent POM enabled parameter names in the compiler options, which is only the case for very old plugins compiled for Java 8 or earlier. Hopefully in some hypothetical glorious future this will be part of the Java Platform and the need for ASM will be a thing of the past.

BTW I loaded this up on my Jenkins installation with 150 plugins and set breakpoints on the fallback ASM code path and clicked around in the UI. The only two plugins I had installed that triggered the fallback codepath were docker-commons and docker-workflow, which were using older parent POMs. I think that demonstrates the low risk of this change: almost all critical plugins are compiled with a recent parent POM and not using this legacy code path. It is effectively just there for backward compatibility with ancient plugins.

@basil basil added the internal label Aug 7, 2022
@basil basil merged commit 56ec835 into jenkinsci:master Aug 9, 2022
@basil basil deleted the BytecodeReadingParanamer branch August 9, 2022 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants