-
-
Notifications
You must be signed in to change notification settings - Fork 8.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
Code cleanup #12934
Code cleanup #12934
Conversation
be4a386
to
b3f6be9
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## trunk #12934 +/- ##
=======================================
Coverage 58.07% 58.07%
=======================================
Files 88 88
Lines 5340 5340
Branches 224 224
=======================================
Hits 3101 3101
Misses 2015 2015
Partials 224 224 ☔ View full report in Codecov by Sentry. |
Thank you! However, the tests are failing with the error "Cannot use final field org.openqa.selenium.grid.server.BaseServerFlags#bindHost as a parameter; compile-time constant inlining may hide new values written to it." Those changes need to be reverted. |
1dd43de
to
c82ff91
Compare
@pujagani Thank you for the hint (to be honest, it's hard to me to understand where is flaky test, and where is a real problem in Selenium tests output). I've reverted |
We need to be careful changing public or protected designations, people might be using them (even if maybe they shouldn't be). Ideally we don't change that without warning. |
@@ -21,8 +21,8 @@ | |||
|
|||
/** A copy of java.awt.Point, to remove dependency on awt. */ | |||
public class Point { | |||
public int x; |
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.
Following up on Titus's point, this might be a breaking change for some users.
1c0c4f9
to
3acb20a
Compare
@titusfortner @pujagani I agree, there is a small risk that some people do modify these fields (tough, they should not). In this case, there is no warning that could help. We cannot mark these fields as "@deprecated" or something like that. We can only write a blog post, but people would not notice it. So making such a change in a next major released is the only option I see. |
We should be able to mark fields as deprecated, though, right? And point people to the getters/setters? |
No, using getters-setters is not better than just using fields. Getters-setters is the biggest bullshit in Java. They don't really make anything better. |
I haven't looked at this PR and think I won't. 62 files are way too much to review for this type of change. I'd be happy to quickly review PRs with a few changes to make this whole process faster. |
I'm confused. If you don't like getters and setters, then why are you making the fields not public? |
Now I'm confused :)
Unless you really need the field to be mutable (which is not really often needed), make it |
Right, but exposing access to the private fields means using getters and setters. |
Yes. But you don't really need to expose access to private fields. |
The entire point of |
I believe people want to ASK width and height, not CHANGE them. |
Rectangle is used to set window size and position. Points for mouse movement and scrolling. You can create new instances and set values with the constructor, but there's nothing inherently immutable about storing integers with contextually relevant attributes. |
Ok, so re-reading, I see what you are saying. Yes, they are immutable after creation, so we do not want to give access to those fields directly. BUT, we also don't want to remove functionality without marking them deprecated. If we are going to change it, we need to mark them as deprecated for a 2 releases. So, we can merge this if you update that and revert the changes to Thanks. |
And please send smaller change sets in future PRs. This would have been merged much faster. |
What exactly should I mark as deprecated? public class Rectangle {
// Where should I add @Deprecated here?
public int x; // -> private final
public int y; // -> private final |
you can deprecate public methods that you are going to make internal instead of removing. |
Yes, I understand. But what about fields? What if we want to make fields private/immutable? @titusfortner |
3acb20a
to
68c80dd
Compare
68c80dd
to
0f01329
Compare
@titusfortner Sorry for such a long delay. Thank you for your patience. |
Final version LGTM |
Description
Code cleanup. Just applied few IDEA suggestions to shorten the code.
Types of changes