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

[JENKINS-73768] Handle base=derived case in Util#isOverridden #9728

Merged
merged 2 commits into from
Oct 21, 2024

Conversation

daniel-beck
Copy link
Member

See JENKINS-73768.

It looks like #4833 does not properly consider the case where base == derived. Somehow the existing test coverage is insufficient, did not dig further into this yet.

I encountered this when looking at the system log and being surprised about exception output using "Caused by" rather than "Causes" when what was thrown was a raw Throwable in test code -- hence the choice of types in the test.

An alternative solution could be to change the last line to use equals instead of !=, but that seems more likely to have unintended consequences.

CC @Zastai in case you're still around/interested.

Testing done

None.

Proposed changelog entries

  • human-readable text

Proposed upgrade guidelines

N/A

Submitter checklist

Desired reviewers

@mention

Before the changes are marked as ready-for-merge:

Maintainer checklist

@Zastai
Copy link
Contributor

Zastai commented Sep 13, 2024

LGTM.

I suppose the second test assert is not 100% future proof (there's no guarantee that Exception will never override printStackTrace()). The test class could declare a nested private static class that extends Throwable for that purpose; not sure it's necessarily worth the effort though.

@zbynek
Copy link
Contributor

zbynek commented Oct 12, 2024

Looks like the method was copied to https://github.com/jenkinsci/stapler/blob/c4f6b569053629f8ede0e176bce6538a2450585f/core/src/main/java/org/kohsuke/stapler/ReflectionUtils.java#L102 and both methods are called by core. Would it make sense to also apply the fix there? Or maybe deduplicate the methods?

@daniel-beck
Copy link
Member Author

@zbynek

Would it make sense to also apply the fix there?

Probably. Note that the problem only matters if you have a caller passing types that are not hardcoded, not the case in Stapler AFAICT.

@timja timja added the skip-changelog Should not be shown in the changelog label Oct 13, 2024
@timja
Copy link
Member

timja commented Oct 20, 2024

/label ready-for-merge


This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback.

Thanks!

@comment-ops-bot comment-ops-bot bot added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Oct 20, 2024
@timja timja merged commit 2c92eae into jenkinsci:master Oct 21, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback skip-changelog Should not be shown in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants