Constructors and methods with the same name should appear sequentially with no other code in between, even when modifiers such as static or private differ between the methods. Please re-order or re-name methods.


The problem

The Google Java Style Guide ยง3.4.2.1 requires overloads to be grouped together:

When a class has multiple constructors, or multiple methods with the same name, these appear sequentially, with no other code in between (not even private members).

Overloaded methods/constructors represent the same functionality, but with different modes of interaction with the caller. They belong together. More concretely, one danger of splitting overloads is that someone looking for one but finding the other may easily assume the other does not exist.

If the ungrouped overloads do not represent the same functionality, consider renaming the methods.

NOTE: this rule implies that a private helper used by a single method, which you might normally place just below that method, should be placed below all overloads of that method.


Suppress false positives by adding the suppression annotation @SuppressWarnings("UngroupedOverloads") to the enclosing element.