mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
33 lines
815 B
HTML
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> |