Inspectopedia Help

'final' method in 'final' class

Reports final methods in final classes.

Since final classes cannot be inherited, marking a method as final may be unnecessary and confusing.

Example:

record Bar(int a, int b) { public final int sum() { return a + b; } }
record Bar(int a, int b) { public int sum() { return a + b; } }

As shown in the example, a class can be marked as final explicitly or implicitly.

Inspection Details

By default bundled with:

IntelliJ IDEA 2024.1, Qodana for JVM 2024.1,

Can be installed with plugin:

Java, 241.14841

Last modified: 12 March 2024