Skip to content
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

Improved documentation for BlockState snapshots and indicated nullability #29

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

TheBusyBiscuit
Copy link

I really like PaperLib and it has helped us optimize our projects a lot so far. However I think some parts lack a bit of documentation, so I decided to propose a few changes.

1. BlockStateSnapshot

I personally find this interface name a bit confusing, as it does not represent a snapshot but rather functions as a way to obtain block states, snapshot or not.
I have renamed this to BlockStateSnapshotHandler for now but I am open for other suggestions.
I am also aware that this naming pattern is applied elsewhere, so let me know if this should remain unchanged.

annotations

I added a FunctionalInterface annotation to this class to indicate this as a single-method-interface.
I don't think there will be any other methods added to this in the future but feel free to correct me on this.

I have also added Nonnull annotations to the method and all methods in it's implementations to indicate the nullability of this method and its arguments. This is also consistent with the rest of PaperLib, the annotations I used were from FindBugs which was also consistent with the rest of the project.

documentation

I added a javadocs block to the interface, as well as the method inside which explains how this fits into the bigger puzzle. This can improve maintainability and help other developers understand what is going on.
The same applies to all implementations of this interface.

2. BlockStateSnapshotResult

This class has received a bunch of documentation and Nonnull annotations.

Anyway, let me know what you think of these changes and whether I got something wrong.

@TheBusyBiscuit TheBusyBiscuit changed the title Improved documentation and indicated nullability Improved documentation for BlockState snapshots and indicated nullability Aug 2, 2020
@MiniDigger
Copy link
Member

why was this closed?
I am sorry that it is taking so long to review this, but this looks like something that would provide value

@TheBusyBiscuit
Copy link
Author

Alright, I'm gonna reopen it then.
I thought that this went stale after three months and decided it is small enough to just close it.

No rush with the review though, I'll just reopen it and will be available once these changes are to be discussed.

@TheBusyBiscuit TheBusyBiscuit reopened this Nov 3, 2020
Proximyst
Proximyst previously approved these changes Nov 4, 2020
Copy link

@Proximyst Proximyst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me. Some nitpicks on javadocs, but those should be relatively easy to just commit with GH's UI and we'll squash on merge.

Thanks for your contribution!

@aikar
Copy link
Member

aikar commented Nov 4, 2020

javaddocs and nullability is fine, but eh on the rename. That's an API break that I don't think is big enough value to warrant.

Can just put a TODO to rename it if we ever justify a 2.0, but i'm not a fan of releasing a 2.0 just for that.

also the functional interface doesn't really add any value. doesn't do anything nor does the intent of the handler even declare it SHOULD be a single method. don't see much value in adding that to only remove it later if we were to add another method (though extremely unlikely)

Co-authored-by: Mariell <proximyst@proximyst.com>
@TheBusyBiscuit
Copy link
Author

javaddocs and nullability is fine, but eh on the rename. That's an API break that I don't think is big enough value to warrant.
Can just put a TODO to rename it if we ever justify a 2.0, but i'm not a fan of releasing a 2.0 just for that.

I can understand this, I did expect the renaming to pose a rather unwanted change too, but I did include it at first to hear your opinions about the naming of these classes nonetheless.
I am gonna undo the name changes in a follow-up commit then.

also the functional interface doesn't really add any value. doesn't do anything nor does the intent of the handler even declare it SHOULD be a single method. don't see much value in adding that to only remove it later if we were to add another method (though extremely unlikely)

I cannot really think of any additional methods for the interface, so I thought this would be a sensible addition.
But I can understand if this choice was left open by design, after all noone's probably gonna rely on it to be a Single-Method-Interface in their code anyway, so I am gonna remove that too then.

Thanks for the feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants