Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/bindFieldsFromParameters/beforeVarargIndirectlyUsed.java
2025-12-12 15:39:43 +00:00

26 lines
562 B
Java

// "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()]);
}
}