jenkinsci / stapler

Stapler web framework
BSD 2-Clause "Simplified" License
163 stars 104 forks source link

Log warning when doing bytecode analysis #529

Closed basil closed 6 months ago

basil commented 6 months ago

The use of BytecodeReadingParanamer is not sustainable in the long term, so introduce a warning to more aggressively call out plugins that are still being built with an ancient HPI/JPI toolchain. I tried this out on the plugins in BOM and none of them showed a warning. Print the warning only a single time per signature to avoid spamming log files.

The only plugin I am aware of that will trigger this warning in production is the Gradle plugin.

Testing done

Compiled Text Finder with mvn clean verify -Dmaven.compiler.parameters=false and saw these warning as expected:

o.k.s.BytecodeReadingParanamer#lookupParameterNames: Looking up parameter names for public hudson.util.FormValidation hudson.plugins.textfinder.TextFinder$DescriptorImpl.doCheckRegexp(java.lang.String); update plugin to a version created with a newer harness o.k.s.BytecodeReadingParanamer#lookupParameterNames: Looking up parameter names for public hudson.util.FormValidation hudson.plugins.textfinder.TextFinder$DescriptorImpl.doCheckRegexp(java.lang.String); update plugin to a version created with a newer harness o.k.s.BytecodeReadingParanamer#lookupParameterNames: Looking up parameter names for public hudson.plugins.textfinder.TextFinder(java.lang.String); update plugin to a version created with a newer harness

Ensured that these warnings appeared only once even after refreshing the pages that produced them.

basil commented 6 months ago

@jenkinsci/gradle-plugin-developers After this is released, users of the Gradle plugin will start seeing the following warnings:

o.k.s.BytecodeReadingParanamer#lookupParameterNames: Looking up parameter names for public hudson.util.FormValidation hudson.plugins.gradle.enriched.EnrichedSummaryConfig.doCheckHttpClientTimeoutInSeconds(int); update plugin to a version created with a newer harness
o.k.s.BytecodeReadingParanamer#lookupParameterNames: Looking up parameter names for public hudson.util.FormValidation hudson.plugins.gradle.enriched.EnrichedSummaryConfig.doCheckHttpClientMaxRetries(int); update plugin to a version created with a newer harness
o.k.s.BytecodeReadingParanamer#lookupParameterNames: Looking up parameter names for public hudson.util.FormValidation hudson.plugins.gradle.enriched.EnrichedSummaryConfig.doCheckHttpClientDelayBetweenRetriesInSeconds(int); update plugin to a version created with a newer harness
o.k.s.BytecodeReadingParanamer#lookupParameterNames: Looking up parameter names for public hudson.util.FormValidation hudson.plugins.gradle.injection.InjectionConfig.doCheckServer(java.lang.String); update plugin to a version created with a newer harness
o.k.s.BytecodeReadingParanamer#lookupParameterNames: Looking up parameter names for public hudson.util.FormValidation hudson.plugins.gradle.injection.InjectionConfig.doCheckAccessKey(java.lang.String); update plugin to a version created with a newer harness
o.k.s.BytecodeReadingParanamer#lookupParameterNames: Looking up parameter names for public hudson.util.FormValidation hudson.plugins.gradle.injection.InjectionConfig.doCheckGradlePluginVersion(java.lang.String); update plugin to a version created with a newer harness
o.k.s.BytecodeReadingParanamer#lookupParameterNames: Looking up parameter names for public hudson.util.FormValidation hudson.plugins.gradle.injection.InjectionConfig.doCheckCcudPluginVersion(java.lang.String); update plugin to a version created with a newer harness
o.k.s.BytecodeReadingParanamer#lookupParameterNames: Looking up parameter names for public hudson.util.FormValidation hudson.plugins.gradle.injection.InjectionConfig.doCheckGradlePluginRepositoryUrl(java.lang.String); update plugin to a version created with a newer harness
o.k.s.BytecodeReadingParanamer#lookupParameterNames: Looking up parameter names for public hudson.util.FormValidation hudson.plugins.gradle.injection.InjectionConfig.doCheckMavenExtensionCustomCoordinates(java.lang.String); update plugin to a version created with a newer harness
o.k.s.BytecodeReadingParanamer#lookupParameterNames: Looking up parameter names for public hudson.util.FormValidation hudson.plugins.gradle.injection.InjectionConfig.doCheckCcudExtensionCustomCoordinates(java.lang.String); update plugin to a version created with a newer harness

To perform this migration, please recompile the Gradle plugin with the -parameters flag to javac. This is done automatically in recent versions of maven-hpi-plugin and I assume should also be done by gradle-jpi-plugin (or should be fixed otherwise).