mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-383350 [java-intentions] fix 'Bind parameters to fields' producing red code when field is assigned indirectly
GitOrigin-RevId: 8879b800315a194e8e04e9e0e6f7ca1b5b5205bc
This commit is contained in:
committed by
intellij-monorepo-bot
parent
81c107b047
commit
485b1b4336
+10
@@ -0,0 +1,10 @@
|
||||
// "Bind constructor parameters to fields" "false"
|
||||
|
||||
class Test {
|
||||
private final String value;
|
||||
|
||||
Test(String <caret>input) {
|
||||
String processed = input.toUpperCase();
|
||||
this.value = processed;
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// "Bind constructor parameters to fields" "false"
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
class Person {
|
||||
String name;
|
||||
int age;
|
||||
|
||||
Person(String name, int age) {
|
||||
this.name = name;
|
||||
this.age = age;
|
||||
}
|
||||
}
|
||||
|
||||
class Interesting extends Person {
|
||||
private final String[] hobbies;
|
||||
|
||||
Interesting(String name, int age, String... <caret>hobbies) {
|
||||
super(name, age);
|
||||
LinkedHashSet hobbySet = new LinkedHashSet<>();
|
||||
Collections.addAll(hobbySet, hobbies);
|
||||
this.hobbies = hobbySet.toArray(new String[hobbySet.size()]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user