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
(Partially) Closes #351: Javadocs for map APIs #887
Conversation
map
APIs
eclipse-collections-code-generator/src/main/resources/api/map/immutableObjectPrimitiveMap.stg
Show resolved
Hide resolved
/** | ||
* Retrieves the value associated with the key if one exists; if it does not, | ||
* associates a value with the key. | ||
* a new value with they key |
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.
This sentence fragment looks like it might be superfluous.
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.
Good catch! I'll fix it.
V getIfAbsentPut(<type> key, V value); | ||
|
||
/** | ||
* Retrieves the value associated with the key if one exists; if it does not, | ||
* associates the result of invoking the value supplier with the key. |
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.
I don't believe the key is passed to the function, as it is a Function0
which means it takes no parameters.
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.
That is what I meant, but I agree it's a bit confusing. By saying "value supplier" I was hoping that readers would realize a Function0
== Supplier<>
from Java 8. I was trying to say "associates ... with the key" not "associates ... invoking ... with the key". I'll try to word it more clearly.
eclipse-collections-code-generator/src/main/resources/api/map/mutablePrimitiveObjectMap.stg
Show resolved
Hide resolved
eclipse-collections-code-generator/src/main/resources/api/map/mutablePrimitivePrimitiveMap.stg
Outdated
Show resolved
Hide resolved
eclipse-collections-code-generator/src/main/resources/api/map/mutablePrimitivePrimitiveMap.stg
Show resolved
Hide resolved
eclipse-collections-code-generator/src/main/resources/api/map/mutablePrimitivePrimitiveMap.stg
Show resolved
Hide resolved
eclipse-collections-code-generator/src/main/resources/api/map/mutablePrimitivePrimitiveMap.stg
Show resolved
Hide resolved
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.
Hi @jdimeo, I've reviewed all of the docs. They look great for the most part, but I've request a few changes. This was surprisingly fun to read and I very much appreciate the time you have taken to write all this. This is a tremendous contribution to the framework. Thank you very much!
After you make the requested changes and rebase and squash your commits I will approve and merge.
One final thing, I saw the JavadocUtil class. This looks very interesting and useful. I think it would be great if you would be open to writing a blog or adding a wiki page with examples showing how to use this in practice.
@donraab thank you for the review, feedback, and encouragement! I saw this earlier in the week and wanted my next comment to be another push with the requested changes, but I was unable to get to this this week. It's on the to-do list for next week, and I'll see if I can knock out a couple other packages as well ( |
I would suggest let’s get this PR merged before you add more packages. That way the changes and commits are small and reviews and feedback can be faster |
@jdimeo I would like to close out the feature set for 10.3.0 and release it soon. That way we can open the major version 11.0.0 target. If possible, let us try to get this PR in as Javadocs help us throughout the development experience. Once all the comments suggested by @donraab are addressed, I will need your (@jdimeo ) help in a bit of house keeping especially to squash the merge commits and commits which have just stylistic changes. We can visit them once all the changes are approved. We are super close, and it would be great to have this merged. Thanks a ton for this valuable contribution! |
@donraab @nikhilnanivadekar I've pushed a commit that addresses the review items. Don't you all squash when you merge the PR? I've reverted the Happy to contribute to a wiki or blog. Just let me know where/how to submit a draft for review (I see that it appears I can directly edit the wiki, but I assume you would want to review it first?) |
@jdimeo we normally like to squash commits, however, the changes in terms of LOC are pretty high, and I would like you to get the proper number of commit credit where it is due. So, let me elaborate the housekeeping things which I think we need to do before having a final pass review:
After this we will do a final review, merge your PR and then I will cut a milestone release for testing. |
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.
Elaborated house-keeping changes in the comments below.
eclipse-collections-code-generator/src/main/resources/api/map/mutablePrimitiveObjectMap.stg
Show resolved
Hide resolved
@nikhilnanivadekar I've actually never done a "fix up" commit before since I usually work on smaller projects. But I understand now how that works with autosquash. I personally would've been fine with a massive "Javadoc all the things" commit, but this is definitely better. I'll address it tomorrow (I hope!) P.S. I did revert the tap change so the net effect is zero (I snuck in the commit between donraab's first review comment and all the others so it's easy to miss) . Are you OK with me adding the |
@jdimeo If you have
If you do an interactive rebase (points 3, 4 above), git gives you the chance to move around commits. Rebase can be dangerous, especially when doing it for the first time as it is essentially rewriting history. So I would suggest to take a back up of the files before doing the rebase. |
You can add the Override tag, but please add it as a separate commit for tracking. It just helps me while I write Release Notes. |
@nikhilnanivadekar doing the fixup of 23d1ffe created a weird merge conflict in the middle of the interactive rebase that I wasn't sure how to correctly resolve, Do I need to figure that out or can we roll with every other change except that one? |
Let’s roll with the others and then revisit this. I can help you offline with that one later |
This will copy back any Javadocs present in a generated class back to the corresponding template. This is so that you can open a generated class in your IDE and benefit from auto complete and auto formatting while writing the Javadoc, and then copy it back to the .stg template file which will apply to all other specializations. Invoke it with pairs of arguments: the generated class name followed by the template path (relative to the template root). it assumes the API folder is a sibling to the working directory. Signed-off-by: John Dimeo <dimeo@elderresearch.com>
Thanks @nikhilnanivadekar I just forced push my history rewrite. Please tell me if I did it correctly! I also rebased on |
Also a minor nit pick, can you reword this commit: a9f5d4b |
@nikhilnanivadekar I allocated a |
Signed-off-by: John Dimeo <dimeo@elderresearch.com>
Signed-off-by: John Dimeo <dimeo@elderresearch.com>
Signed-off-by: John Dimeo <dimeo@elderresearch.com>
Signed-off-by: John Dimeo <dimeo@elderresearch.com>
Signed-off-by: John Dimeo <dimeo@elderresearch.com>
Signed-off-by: John Dimeo <dimeo@elderresearch.com>
@nikhilnanivadekar Yes! it worked this time no merge required. I also caught a missing " for " and added some |
Signed-off-by: John Dimeo <dimeo@elderresearch.com>
Signed-off-by: John Dimeo <dimeo@elderresearch.com>
Signed-off-by: John Dimeo <dimeo@elderresearch.com>
Signed-off-by: John Dimeo <dimeo@elderresearch.com>
Signed-off-by: John Dimeo <dimeo@elderresearch.com>
Signed-off-by: John Dimeo <dimeo@elderresearch.com>
Signed-off-by: John Dimeo <dimeo@elderresearch.com>
…ons. Signed-off-by: John Dimeo <dimeo@elderresearch.com>
@nikhilnanivadekar done (I hope!) |
@nikhilnanivadekar Just confirming you don't need anything else from me. Also, I noticed this in
that could explain why we can safely remove the |
Mutable<name>Set keySet(); | ||
|
||
/** | ||
* Returns a view of the keys in this map. This iterable is backed by the map, so | ||
* any modifications to the underlying map will be reflected in the keys returned |
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.
We might want to update the wording a bit in a future iteration. But it is not super important.
keysView()
keyValueView()
essentially all *View()
APIs are supposed to be lazy. So, the idea of changes in the map reflecting in the view might be a bit awkward.
It is ok for now
new JavadocUtil().generatedClass(args[i]).template(args[i + 1]).process(); | ||
} | ||
} | ||
} |
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.
This utility is awesome! May be if it is possible, can you contribute another utility which will move code to the template? It will be super useful to be able to write code in one of the primitive files and reverse engineer it to a template. It need not be fully polished and working, but should provide a starting point. Thoughts?
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.
@nikhilnanivadekar I haven't forgotten about this request, but regretfully I'm not sure when I'll have the time to tackle it!
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.
LGTM. Thanks for your contribution!
@jdimeo sorry didnt get a chance during the week to work on this. Finally got some time and did a final review. Looks good to me! Thanks a lot for your contribution! |
@nikhilnanivadekar No worries! just wanted to make sure I wasn't the blocker. Happy to help. |
I meant a blog in your personal space to showcase your experience. May be on Wordpress or even GitHub pages or Medium? |
I have completed Javadocs on the API's
map
package. I am opening a PR to being the review process now before I (or someone else!) moves on to the other packages (list
,set
,bag
, etc.). In my view,map
was the highest priority with methods likegetIfAbsentPutWith
that benefited most from Javadocs. Additionally, I'm envisioning many Javadocs in those packages will be copy-paste from what I have here, so I want to confirm the verbiage is right before doing so.Some non-Javadoc changes included in this PR (which can be taken out if needed):
\r
checkstyle check. I don't see what benefit it provides (from what I can tell, my commits still have just\n
even from Windows) while just making it a lot harder to contribute from Windows and get a clean buildtap()
declaration inimmutableObjectPrimitiveMap.stg
Additionally, this includes a helper
JavadocUtil
that will copy Javadocs back from a generated class to a template. It's not perfect but it saved me a ton of time, so that I could edit the Javadocs on an example concrete class and benefit from Eclipse's Javadoc assists that would otherwise be unavailable when directly editing the template.