Back to Intellij Community

FieldMayBeStatic

java/java-impl/resources/inspectionDescriptions/FieldMayBeStatic.html

2025.3-rc-2374 B
Original Source

Reports instance variables that can safely be made static. A field can be static if it is declared final and initialized with a constant.

Example:

public final String str = "sample";

The inspection does not report final fields that can be implicitly written. Use the "Annotations" button to modify the list of annotations that assume implicit field write.