-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Fix checkstyle violations #2624
Conversation
Can one of the admins please verify this patch? |
|
||
ChunkImpl that = (ChunkImpl) obj; | ||
|
||
return Objects.equal(this.chunkPos, that.chunkPos); |
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 one makes me wonder. Under regular circumstances you would indeed expect two chunks at the same location to equal each other. But are we setting ourselves up for potential bugs here?
Two cases come to mind:
- We have a known issue about duplicate chunks being loaded (Crash in multiplayer - chunk loading / rendering null issue, maybe related to dupe chunk loading [$50] #2590) - could this somehow affect that? If somehow a dupe chunk loads but a system interaction changes only one of them. I don't know if dupe chunks at all persist beyond a timing issue or something causing two load requests to be issued.
- In the future could somebody come up with a way where we could have two valid chunks in the same location? Imagine something related to dimensions somehow, either completely separate worlds (why anybody would compare two such chunks I don't know .. but MC does relate the position of Nether chunks vs Overworld chunks so who knows) or in-place chunks where a weird bizarro world shows two different players different chunks. Or phasing maybe (like bits of world with progression locked to individual players)
Perhaps we should add in hashing some additional stuff from each chunk and compare those as well? I don't know how frequently this method is likely used (or really a parent implementation)
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.
In case of another dimension, we surely should hash another value and also compare another value. But you are correct this could have unforeseen changes.
The important part of the Object
contract here should be:
hashCode()
must always return the same code for two objects which are equal according to the equals()
implementation.
This is true here. I'll adjust the implementation so that equals
calls only super and provide a comment why the super equals()
implementation is correct in this case.
public static float triggerThreshold = .25f; | ||
int LEFT_CONTROLLER = 0; | ||
int RIGHT_CONTROLLER = 1; | ||
int EAXIS_TRIGGER = 1; |
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.
Any chance these names are made to match naming in another place, like the VR provider itself?
@indianajohn - ping! :-)
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.
In this case, I'd suggest adding the SuppressionWarnings module to the checkstyle.xml and add a @SuppressWarnings
annotation to the class.
Hooray Jenkins reported success with all tests good! |
We don't know the consequences of changing the equals() implementation, therefore we just test for instance equality like before.
Fixes all error violations in the Core project and also refactors some inner classes inside the debug.BenchmarkScreen to standalone classes.
Hooray Jenkins reported success with all tests good! |
Thanks! Merged and added to credits :-) |
Have you noticed I also fixed the violations in the core project? I missed that at first and don't want to sneak in any unnoticed changes. |
I looked over all the affected files just in case, but am not too worried exactly where they are. It's all in the same repository after all :-) |
Contains
Fixes all checkstyle error violations.
How to test
Run ./gradlew checkstyleMain or open the project in eclipse with the checkstyle plugin active (should also work with any other IDE).
Critical parts