MINOR: Replace Collections factory methods with Java 11+ equivalents in clients#22060
MINOR: Replace Collections factory methods with Java 11+ equivalents in clients#22060see-quick wants to merge 2 commits intoapache:trunkfrom
Conversation
clolov
left a comment
There was a problem hiding this comment.
There are a few files where I believe you can fully clean up the usage of Collections, but let me know if I am missing something obvious! Thank you for persevering with this 😊
| private List<String> requiredScope() { | ||
| String requiredSpaceDelimitedScope = option(REQUIRED_SCOPE_OPTION); | ||
| return Utils.isBlank(requiredSpaceDelimitedScope) ? Collections.emptyList() : OAuthBearerScopeUtils.parseScope(requiredSpaceDelimitedScope.trim()); | ||
| return Utils.isBlank(requiredSpaceDelimitedScope) ? List.of() : OAuthBearerScopeUtils.parseScope(requiredSpaceDelimitedScope.trim()); |
There was a problem hiding this comment.
Similarly, there is a usage of Collections.unmodifiableMap which you can try to modify (put intended) and then remove the whole of Collections.
There was a problem hiding this comment.
Hmm I am not sure here I can modify it into Map.copy(...)
this.moduleOptions = Collections
.unmodifiableMap((Map<String, String>) jaasConfigEntries.get(0).getOptions());as I think .getOptions() could return NPE.
There was a problem hiding this comment.
I will do another check through the codebase. I believe I understand what you mean i.e. not that the map itself could be null, but that a value in the options could be null. Somehow I doubt that we would create a configuration with a key pointing to null (hence wanting to check how/where we use this) and if we don't, I would prefer that we error on the map creation anyway.
|
Could you also rebase and resolve the conflict so that tests can run? |
…in clients Signed-off-by: see-quick <maros.orsak159@gmail.com>
Signed-off-by: see-quick <maros.orsak159@gmail.com>
6a3e34b to
32199b4
Compare
This is the 4th part of improving replace collections factory methods with its Java 11 equivalents in the clients module.