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

Feature: Add ConsistentOverrides errorprone rule #1712

Merged
merged 11 commits into from
Apr 19, 2021

Conversation

ferozco
Copy link
Contributor

@ferozco ferozco commented Apr 1, 2021

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?

@policy-bot policy-bot bot requested a review from CRogers April 1, 2021 20:13
Copy link
Contributor

@carterkozak carterkozak left a 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"

@ferozco
Copy link
Contributor Author

ferozco commented Apr 1, 2021

For sure! I just put a quick scaffold to start the discussion :)

@ferozco ferozco changed the title Feature: Add ConsistentInterfaceImplementation errorprone rule Feature: Add ConsistentInterfaces errorprone rule Apr 5, 2021
@ferozco
Copy link
Contributor Author

ferozco commented Apr 5, 2021

@carterkozak think this is ready for a look

Copy link
Contributor

@carterkozak carterkozak left a 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.

@carterkozak
Copy link
Contributor

Any updates, @ferozco?

@ferozco
Copy link
Contributor Author

ferozco commented Apr 12, 2021

Builds are breaking because of a bintray brown out that should hopefully end soon

@ferozco ferozco changed the title Feature: Add ConsistentInterfaces errorprone rule Feature: Add ConsistentOverrides errorprone rule Apr 14, 2021
@carterkozak
Copy link
Contributor

👍

@carterkozak
Copy link
Contributor

needs one more +1

@ferozco
Copy link
Contributor Author

ferozco commented Apr 19, 2021

👍

@bulldozer-bot bulldozer-bot bot merged commit 1a8fe3f into develop Apr 19, 2021
@bulldozer-bot bulldozer-bot bot deleted the fo/consistent-implementation branch April 19, 2021 17:12
@svc-autorelease
Copy link
Collaborator

Released 3.79.0

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

Successfully merging this pull request may close these issues.

None yet

3 participants