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

Reduce ASM dep in ClassDescriptor #233

Merged
merged 9 commits into from Jun 1, 2021
Merged

Reduce ASM dep in ClassDescriptor #233

merged 9 commits into from Jun 1, 2021

Conversation

basil
Copy link
Member

@basil basil commented May 30, 2021

See stapler/stapler#226 (comment). Amends that PR to try MethodParameters first (the most efficient and supported system) then fall back to using ASM for LocalVariableTable if necessary. Tested interactively in Jenkins core in the following scenarios:

In the first scenario I verified that ASM was correctly used as a fallback. In the second scenario I verified that ASM was not used as a fallback.

@basil basil changed the title Asm Reduce ASM dep in ClassDescriptor May 30, 2021
assertNotNull("Method missing for " + entry.getKey(), testMethod);
String[] result = ClassDescriptor.loadParameterNamesFromReflection(testMethod);
assertNotNull("Null result for " + entry.getKey(), result);
if (!Arrays.equals(entry.getValue(), result)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use a standard Matcher for this I think.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just trying to change the existing code as little as possible. This is pretty much a copy of loadParametersFromAsm. There is a lot that can be cleaned up in this repository. Once the dependencies are up-to-date I'll start looking into cleanups like this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In particular the use of reflection in the ASM test is unnecessary (fixed in #226).

pom.xml Outdated
@@ -60,6 +60,9 @@
<changelist>999999-SNAPSHOT</changelist>
<scmTag>HEAD</scmTag>
<spotbugs.excludeFilterFile>${project.basedir}/../src/spotbugs/spotbugs-excludes.xml</spotbugs.excludeFilterFile>

<!-- Generate metadata for reflection on method parameters -->
<maven.compiler.parameters>true</maven.compiler.parameters>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better style to use plugin configuration.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better style

Do you have a reference to a style guide?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could not find one. I wrote up what I know: https://stackoverflow.com/a/67794133/12916

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, this still seems like a fairly subjective argument to me, but I trust your judgment.

@jglick
Copy link
Member

jglick commented Jun 1, 2021

LMK if you intend to do any follow-ups; otherwise this can be merged as is.

pom.xml Outdated Show resolved Hide resolved
Co-authored-by: Jesse Glick <jglick@cloudbees.com>
pom.xml Outdated
@@ -89,6 +89,14 @@
</ignores>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, for official plugins this can be omitted if you like:

Suggested change
<groupId>org.apache.maven.plugins</groupId>

or kept for legibility.

@jglick jglick enabled auto-merge June 1, 2021 19:37
@jglick jglick disabled auto-merge June 1, 2021 19:37
pom.xml Outdated Show resolved Hide resolved
Co-authored-by: Jesse Glick <jglick@cloudbees.com>
@jglick
Copy link
Member

jglick commented Jun 1, 2021

@jglick jglick enabled auto-merge June 1, 2021 19:57
@jglick jglick merged commit 3da2d02 into jenkinsci:master Jun 1, 2021
@basil basil deleted the asm branch June 1, 2021 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants