mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
30 lines
1.3 KiB
HTML
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> |