-
Notifications
You must be signed in to change notification settings - Fork 135
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
Feature: Add ConsistentOverrides errorprone rule #1712
Conversation
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.
As I said earlier: "we should discuss first to iron out edge cases"
For sure! I just put a quick scaffold to start the discussion :) |
@carterkozak think this is ready for a look |
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 thought we decided only to require variable names to match the contract for any two parameters that can be switched without breaking compilation, I think that requiring every name to match the interface is unnecessarily strict. You were worried about the StdDeserializer names p
and ctxt
which would be flagged by this PR in its current state.
Note that this will also need to retain leading underscores as to allow StrictUnusedVariable to work correctly.
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/ConsistentInterfaces.java
Outdated
Show resolved
Hide resolved
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/ConsistentInterfaces.java
Outdated
Show resolved
Hide resolved
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/ConsistentInterfaces.java
Outdated
Show resolved
Hide resolved
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/ConsistentInterfaces.java
Outdated
Show resolved
Hide resolved
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/ConsistentInterfaces.java
Outdated
Show resolved
Hide resolved
Any updates, @ferozco? |
...line-error-prone/src/test/java/com/palantir/baseline/errorprone/ConsistentOverridesTest.java
Show resolved
Hide resolved
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/ConsistentOverrides.java
Outdated
Show resolved
Hide resolved
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/ConsistentOverrides.java
Outdated
Show resolved
Hide resolved
baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/ConsistentOverrides.java
Outdated
Show resolved
Hide resolved
Builds are breaking because of a bintray brown out that should hopefully end soon |
27d3cae
to
e37661b
Compare
👍 |
needs one more +1 |
👍 |
Released 3.79.0 |
Before this PR
We've encountered a few cases where folks would implement an interface with methods with multiple parameters of the same type and inadvertently switch the variable names around resulting in unexpected behaviour.
After this PR
==COMMIT_MSG==
Add ConsistentInterfaceImplementation errorprone rule
==COMMIT_MSG==
The rule will catch cases where a sequence of parameters of the same type have the same variable names as the interface but in a different order
Possible downsides?