-
Notifications
You must be signed in to change notification settings - Fork 22
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
SLING-11878 | Update ModifiableValueMap javadoc to cover missing methods inherited from java.util.Map #48
Conversation
@stefanseifert I've got a follow-up question. Should we also cover |
@toniedzwiedz yes, i think we can include them as well - please update the PR if possible |
7c5945e
to
fa2b237
Compare
@stefanseifert |
@toniedzwiedz just stumbled over the |
@stefanseifert good spot. Could be, assuming that implementations actually support it correctly. I think this snowballed a little, to a point where I'm not 100% sure I've covered everything in my quick experiments with the Groovy console. Are there any tests we can fall back on, to ensure these recommendations actually hold water between releases? |
i'm quite sure all these method added in 1.8 still use the default JDK implementation and thus should not be affected by Sling module updates (looking e.g. at https://github.com/apache/sling-org-apache-sling-jcr-resource/blob/master/src/main/java/org/apache/sling/jcr/resource/internal/JcrModifiableValueMap.java). so i think it should be safe to rely on the documentation on those methods in the JDK javadocs, and according to them all compute and merge methods may modify the map. |
and to my knowledge there are no test cases that actually cover this - as they are default JDK methods not implemented directly. |
inherited from java.util.Map The original javadoc for `ModifiableValueMap` was written before the addition of new methods to `java.util.Map` as of Java 8. This commit updates the javadoc to mention the following methods that can can be used to modify resources underlying a `ModifiableValueMap`: - `replace` - `replaceAll` - `compute` - `computeIfAbsent` - `computeIfPresent` - `merge` Refer to https://issues.apache.org/jira/browse/SLING-11878 for context.
fa2b237
to
7558508
Compare
@stefanseifert okay, I'm not familiar with how I guess if all those methods do is eventually call Anyway, I've added |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
The original javadoc for
ModifiableValueMap
was written before the addition of new methods tojava.util.Map
as of Java 8. This commit updates the javadoc to mention thereplace
andreplaceAll
methods that can be used to modify resources underlying aModifiableValueMap
instance.Refer to https://issues.apache.org/jira/browse/SLING-11878 for context.