Repository navigation
Resolve generic overrides exactly in SecureAnnotationsInterceptor - #3679
Merged
Merged
Conversation
Contributor
|
Thanks @coheigea, LGTM. Matching a method only to the generic methods it actually overrides, as Just one Nit: getGenericallyOverriddenMethods rebuilds the type-argument map of the whole class hierarchy for every method, and findRoles calls it for every class in the hierarchy. It only runs at setup, so it doesn't matter much, though the map could be computed once per class. |
coheigea
added a commit
that referenced
this pull request
Nov 4, 2026
) (cherry picked from commit 5948451)
coheigea
added a commit
that referenced
this pull request
Nov 4, 2026
) (cherry picked from commit 5948451)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When no rule applied to a method's signature, every role annotation
recorded for its name applied. A method implementing a generic
interface method, whose erased signature differs, therefore needed the
roles of every method with the same name, an unannotated overload
needed the roles of its annotated overloads, and an implementation's
class-level @RolesAllowed, which applies to its own signature, hid the
method-level @RolesAllowed of the generic interface method.
As in OAuthScopesFilter and ClaimsAuthorizingInterceptor, the generic
parameter types of the superclass and interface methods are now
resolved against the class's type arguments
(ReflectionUtil.getGenericallyOverriddenMethods), so a method also gets
the rules of exactly the generic methods it overrides, and the
name-based fallback is only used for methods which are not part of the
secured object.