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

30 lines
1.3 KiB
HTML

<html>
<body>
Reports usages of classes in a field or method signature where the class has less visibility than the member that uses it.
While legal Java, such members cannot be used outside of the visibility scope of the class type they reference.
<p><b>Example:</b></p>
<pre><code>
public class Parent {
public Child getChild() {
return new Child();
}
private class Child {}
}
</code></pre>
<p>
Additionally, in Java 9 and higher, a module may hide some of its classes from other modules by not exporting their packages.
However, if a member that is part of the exported API references a non-exported class in its signature,
such a member cannot be used outside of the module.
<!-- tooltip end -->
<p>Configure the inspection:</p>
<ul>
<li>Use the <b>Report non-exported classes exposed in module API (Java 9+)</b> option to report module API members
that expose non-exported classes.<br>Note that the language level of the project or module needs to be 9 or higher for this option.</li>
<li>Use the <b>Report non-accessible classes exposed in public API</b> option to report on public members
that expose classes with a smaller visibility scope.</li>
<li>Use the <b>Report private classes exposed in package-local API</b> option to report on package-local members
that expose <code>private</code> classes.</li>
</ul>
</body>
</html>