-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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 cleanups #15860
Code cleanups #15860
Conversation
@@ -750,10 +750,9 @@ protected void checkCursor(RecordCursor cursor, List<TestColumn> testColumns, in | |||
Type type = types.get(i); | |||
Object fieldFromCursor = getFieldFromCursor(cursor, type, i); | |||
if (fieldFromCursor == null) { | |||
assertEquals(null, testColumn.getExpectedValue(), "Expected null for column " + testColumn.getName()); | |||
assertNull(testColumn.getExpectedValue(), "Expected null for column " + testColumn.getName()); |
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.
seems unrelated to instanceof
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.
my mistake, reverted
@@ -902,7 +901,7 @@ public TestColumn( | |||
this.writeValue = writeValue; | |||
this.expectedValue = expectedValue; | |||
this.partitionKey = partitionKey; | |||
checkArgument(dereferenceNames.size() == 0 || partitionKey == false, "partial column cannot be a partition key"); | |||
checkArgument(dereferenceNames.size() == 0 || !partitionKey, "partial column cannot be a partition 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.
seems unrelated to instanceof
sb.append(", partitionKey=").append(partitionKey); | ||
sb.append('}'); | ||
return sb.toString(); | ||
String sb = "TestColumn{" + "baseName='" + baseName + "'" + |
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.
seems unrelated to instanceof
@@ -1152,8 +1152,8 @@ public List<TableInfo> getReferencedTables() | |||
|
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.
typo in commit message
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.
thanks, fixed
There currently is no truly viable alternative, so it is ok to use the method in current and new code.
cdbad05
to
acdba18
Compare
@@ -31,7 +31,6 @@ | |||
* If the node is not a GroupReference, it returns the | |||
* argument as is. | |||
*/ | |||
@Deprecated |
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.
The purpose of this is to discourage people from using this method or at least pause and think whether what they are trying to do can be done in a different way. Let’s keep it and add an explanation of why it’s marked this way.
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.
Thanks for explaining this. However, the result is that we have warnings in the code, we become used to them, and that makes responding to legitimate IDE warnings less likely. Should we sprinkle the codebase with many @SuppressWarnings("deprecation")
, wherever we use this method?
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 suggestions @martint how to mark this method in a way that doesn't trigger code-level warnings in IDEs?
(otherwise I am leaning towards merging as-is, I hope that's fine)
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.
Btw, i've seen this having detrimental effect on new contributors. Old timers know they can use the method, but some of the newcomers simply don't want to use a deprecated method in new code. However, there is no existing code they can follow to do that. In retrospect, we deprecated the method a few years too early, too optimistically.
(2ef99f8, Aug 2017, cc @sopel39)
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.
The issue with this is that the more rules we have using it, the harder it will be reverse in the future.
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.
It seems something is broken with my Intellij code navigation. It shows me 51 code places using this method, and no code places using the alternative.
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.
Old timers know they can use the method, but some of the newcomers simply don't want to use a deprecated method in new code.
That is precisely why we marked it as deprecated. Not because we were going to remove it soon, but to discourage using it for the common case where a pattern matcher can be used instead. Newcomers should pause, reach out and ask someone who has the context when they see no apparent alternative.
If there were another alternative to tag a method to say there are gotchas or warnings associated with it, we would use they instead. Sadly, there isn’t, so we’re left with using deprecation to signal this.
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.
Newcomers should pause, reach out and ask someone who has the context when they see no apparent alternative.
This method was already used in many places, and the code comment here doesn't suggest any alternatives like a deprecated method is supposed to. So to someone new, this "deprecation" always looked like either a mistake or an incomplete work that somebody forgot to follow up on.
There might have been lesser confusion if the actual intent behind this was clarified in the code comment in simple language like it is in this thread.
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.
Indeed. That’s why I suggested adding such explanation above.
CI #12535 |
CI some product tests failed with apparently no logs left behind |
@@ -31,7 +31,6 @@ | |||
* If the node is not a GroupReference, it returns the | |||
* argument as is. | |||
*/ | |||
@Deprecated |
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.
The issue with this is that the more rules we have using it, the harder it will be reverse in the future.
CI #11344 |
Instead of pointed changes in individual PRs, let's update the codebase at once.
Fewer commits => faster review overall.