Better name generation for nested resources in ResourceLeakFixer
Closed this issue · 0 comments
andrecsilva commented
After the transformation by ResourceLeakFixer, the following example will result in:
public void nestedReaders() throws IOException {
BufferedReader br = new BufferedReader(new BufferedReader(new FileReader("~/test.txt")));
}
public void nestedReaders() throws IOException {
try (FileReader resource1 = new FileReader("~/test.txt");
BufferedReader resource = new BufferedReader(resource1);
BufferedReader br = new BufferedReader(resource)) {
}
}
The resource1
name is a poor choice and can be improved.