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

33 lines
815 B
HTML

<html>
<body>
Reports redundant constructors declared inside Java records.
<p><b>Example 1:</b></p>
<pre><code>
record Point(int x, int y) {
public Point {} // could be removed
}
record Point(int x, int y) {
public Point(int x, int y) { // could be removed
this.x = x;
this.y = y;
}
}
</code></pre>
<p>The quick-fix removes the redundant constructors.</p>
<p><b>Example 2:</b></p>
<pre><code>
// could be converted to compact constructor
record Range(int from, int to) {
public Range(int from, int to) {
if (from > to) throw new IllegalArgumentException();
this.from = from;
this.to = to;
}
}
</code></pre>
<p>The quick-fix converts this code into a compact constructor.</p>
<!-- tooltip end -->
<p><small>New in 2020.1</small></p>
</body>
</html>