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

23 lines
707 B
HTML

<html>
<body>
Reports annotations used on record components that have no effect.
<p>This can happen in two cases:</p>
<ul>
<li>The reported annotation has the METHOD target, but the corresponding accessor is explicitly defined.</li>
<li>The reported annotation has the PARAMETER target, but the canonical constructor is explicitly defined.</li>
</ul>
<p>Example:</p>
<pre><code>
@Target(ElementType.METHOD)
@interface A { }
// The annotation will not appear in bytecode at all,
// as it should be propagated to the accessor but accessor is explicitly defined
record R(@A int x) {
public int x() { return x; }
}
</code></pre>
<!-- tooltip end -->
<p><small>New in 2021.1</small></p>
</body>
</html>