-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Mark GrantedAuthority#getAuthority
as @Nullable
#18014
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
Conversation
Currently, the build crashes in the
Note: Now it is fixed |
...a/org/springframework/security/web/access/DelegatingMissingAuthorityAccessDeniedHandler.java
Show resolved
Hide resolved
54f53fc
to
e16ab55
Compare
...a/org/springframework/security/web/access/DelegatingMissingAuthorityAccessDeniedHandler.java
Outdated
Show resolved
Hide resolved
* precision). | ||
*/ | ||
String getAuthority(); | ||
@Nullable String getAuthority(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question :: though this implementation supports null case, but it is supposed to be avoided (as per the documentation -> returning null should be avoided unless actually required. ) So dont we losing the feature/control with the overall changes?
@therepanic @rwinch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ronodhirSoumik, good question. The documentation also says that null
"should be returned" in cases where it cannot be expressed with sufficient precision. In other words, returning null is recommended when needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @therepanic! I've left some feedback inline.
...a/org/springframework/security/web/access/DelegatingMissingAuthorityAccessDeniedHandler.java
Outdated
Show resolved
Hide resolved
...a/org/springframework/security/web/access/DelegatingMissingAuthorityAccessDeniedHandler.java
Outdated
Show resolved
Hide resolved
Thanks for the review, @jzheaux. I agree with everything. It was a bad idea to mark authority as I don't think the build crashes because of the changes in the PR. |
Closes: spring-projectsgh-17999 Signed-off-by: Andrey Litvitski <[email protected]>
Thanks, @therepanic! This is now merged into |
Since the
GrantedAuthority#getAuthority
contract itself implies that it can return null, we should mark it as@Nullable
.Closes: gh-17999