Inspectopedia Help

Return of 'this'

Reports methods returning this.

While such a return is valid, it is rarely necessary, and usually indicates that the method is intended to be used as part of a chain of similar method calls (for example, buffer.append("foo").append("bar").append("baz")). Such chains are frowned upon by many coding standards.


public Builder append(String str) { // [...] return this; }

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3


Java, 233.SNAPSHOT

Last modified: 13 July 2023