Files
openide/java/java-impl/resources/inspectionDescriptions/DesignForExtension.html
2025-02-05 04:43:28 +00:00

27 lines
1.0 KiB
HTML

<html>
<body>
Reports methods which are not <code>static</code>, <code>private</code>, <code>final</code> or <code>abstract</code>, and whose bodies
are not empty.
<p>
Coding in a style that avoids such methods protects the contracts of classes from being broken by their subclasses. The
benefit of this style is that subclasses cannot corrupt the state of the superclass by forgetting to call the super method. The cost is
that
subclasses are limited in their flexibility, in particular they cannot prevent execution of code in the superclass. Use the quick-fix to
add
the missing modifiers.</p>
<p><b>Example:</b></p>
<pre><code>
class Foo {
public boolean equals(Object o) { return true; }
}
</code></pre>
<p>After the quick-fix is applied:</p>
<pre><code>
class Foo {
public final boolean equals(Object o) { return true; }
}
</code></pre>
This inspection is intended for code that is going to be used in secure environments, and is probably not appropriate for less restrictive environments.
<!-- tooltip end -->
</body>
</html>