-
Notifications
You must be signed in to change notification settings - Fork 6k
Return type of oauth2.core.ClaimAccessor#containsClaim(String) could be a primitive boolean #9201
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
Comments
@grimsa It's not clear to me if you are reporting an issue?
Which code are you referencing in |
@jgrandja I'm referencing My observation is - if It is definitely not a bug, just a possibility for minor enhancement. |
@grimsa What enhancement are you proposing? Change return type from |
Changing to |
Changing return type to |
Sure. Let me know what the javadoc should be and I'll create a PR with that change. |
@grimsa On second thought... Let's
And add:
We should also ensure there are no reference to Sound good? |
Current Behavior
In
org.springframework.security.oauth2.core.ClaimAccessor
interface there is acontainsClaim
method:Return type of this method is a nullable Boolean.
Expected Behavior
It seems the method could return a non-nullable primitive
boolean
. This is supported by all of:null
return valueMap#containsKey
returning primitive booleanreturn !containsClaim(claim) ? ... : ...
Context
Noticed this when SonarQube marked
if (!accessTokenJwt.containsClaim(CUSTOM_CLAIM)) {
code as non-compliant for ruleBoxed "Boolean" should be avoided in boolean expressions
.The text was updated successfully, but these errors were encountered: