google / google/error-prone

Check Identical Methods

Open
#99 4 comments 0 reactions 0 assignees View on GitHub
migrated Priority-Low Type-NewCheck
Dominant language
Java
Stars
7.2k
Forks
820
Avg merge
5h 9m
Merged PRs (30d)
50

Description

_[Original issue](https://code.google.com/p/error-prone/issues/detail?id=99) created by **impjdi@google.com** on 2013-02-28 at 02:32 AM_

---

Well, not a strict `new error check request'', but more like`brain storming''.

Assume you have a program that reads from the database and converts retrieved data to some other data structure. The source database row has a column named flag. Now, to convert that flag to a set of individual boolean variables, you write one method for one bit mask. Then you copy and paste this method 1-63 times and just change the bit mask constant manually one by one. While doing that, the methods all look similar, and you can easily jump over one, and maybe just have changed the method name, but not the bit mask.

I think having two methods that do exactly the same thing is not so common (although possible). Maybe you could throw out a warning if two or more methods are identical...

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.