Write-only object
Reports objects that are modified but never queried.
The inspection relies on the method mutation contract, which could be inferred or pre-annotated for some library methods. This inspection does not report collections, maps, and string builders, as these types are reported by other more precise inspections.
Example:
Use the Ignore impure constructors option to control whether to process objects created by constructor or method whose purity is not known. Unchecking the option may introduce some false-positives if the object reference is intentionally leaked during the construction.
New in 2021.2
Inspection options
Option | Type | Default |
---|---|---|
Ignore impure constructors | Checkbox | true |
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Java, 233.SNAPSHOT |