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

24 lines
846 B
HTML

<html>
<body>
Reports <code>public</code> constructors in non-<code>public</code> classes.
<p>Usually, there is no reason for creating a <code>public</code> constructor in a class with a lower access level.
Please note, however, that this inspection changes the behavior of some reflection calls. In particular,
<code>Class.getConstructor()</code> won't be able to find the updated constructor
(<code>Class.getDeclaredConstructor()</code> should be used instead). Do not use the inspection if your code
or code of some used frameworks relies on constructor accessibility via <code>getConstructor()</code>.
</p>
<p><b>Example:</b></p>
<pre><code>
class House {
public House() {}
}
</code></pre>
<p>After the quick-fix is applied:</p>
<pre><code>
class House {
House() {}
}
</code></pre>
<!-- tooltip end -->
</body>
</html>