Files
openide/java/java-impl/resources/inspectionDescriptions/MethodOnlyUsedFromInnerClass.html
Leonid Shalupov 40795fe787 IJI-2422: community/java: move resources under resources root
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
2025-02-05 04:43:28 +00:00

37 lines
907 B
HTML

<html>
<body>
Reports <code>private</code> methods which
are only called from an inner class of the class containing the method. Such
methods can be safely moved into that inner class.
<p>Example:</p>
<pre><code>
public class Outer {
public static void main(String[] args) {
new Inner().run(args[0]);
}
static class Inner {
void run(String arg) {
// Method isEmpty() is used from Inner class only
// consider moving it to the Inner class
if (!isEmpty(arg)) {
System.out.println("Argument is supplied");
}
}
}
private static boolean isEmpty(String s) {
return s != null && s.trim().isEmpty();
}
}
</code></pre>
<!-- tooltip end -->
<p>
Use the first checkbox below to ignore <code>private</code>
methods which are called from an anonymous or local class.
<p>
Use the third checkbox to only report <code>static</code> methods.
<p>
</body>
</html>