2023-05-03 11:06:20 +02:00
|
|
|
== Why is this an issue?
|
|
|
|
|
2023-05-25 14:18:12 +02:00
|
|
|
There is no need to use the ``++final++`` modifier inside a ``++final++`` class. Everything in it is ``++final++`` by default.
|
2020-06-30 12:47:33 +02:00
|
|
|
|
|
|
|
|
2023-05-25 14:18:12 +02:00
|
|
|
=== Noncompliant code example
|
|
|
|
|
|
|
|
[source,text]
|
|
|
|
----
|
|
|
|
final class MyClass {
|
|
|
|
|
|
|
|
public final String getName() { // Noncompliant
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
----
|
|
|
|
|
|
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
|
|
|
|
[source,text]
|
|
|
|
----
|
|
|
|
final class MyClass {
|
|
|
|
|
|
|
|
public String getName() { // Compliant
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
----
|
|
|
|
|