
|
If you were logged in you would be able to see more operations.
|
|
|
|
Original Estimate:
|
Unknown
|
Remaining Estimate:
|
Unknown
|
Time Spent:
|
Unknown
|
|
Issue Links:
|
Duplicate
|
|
|
|
This issue is duplicated by:
|
|
IDEA-17295
Extract Method creates invalid code
|
|
|
|
IDEADEV-24692
Bogus parameter offered during extrac...
|
|
|
|
|
|
| Build: |
3,326
|
| Fixed in build: |
8,745
|
| Severity: |
Medium
|
Given this code:
class Tester {
String x() {
String o = "";
// selection start
String s;
try {
s = o;
} finally {
}
return s;
// selection end
}
}
Select the specified text and choose Extract Method. IDEA shows "String s" as one of the parameters to the method even though it is defined in the extracted code. Click OK, IDEA produces this code which contains two errors:
class Tester {
String x() {
String o = "";
return extracted(o, s);
}
private String extracted(String o, String s) {
String s;
try { s = o; } } finally {
}
return s;
}
}
|
|
Description
|
Given this code:
class Tester {
String x() {
String o = "";
// selection start
String s;
try {
s = o;
} finally {
}
return s;
// selection end
}
}
Select the specified text and choose Extract Method. IDEA shows "String s" as one of the parameters to the method even though it is defined in the extracted code. Click OK, IDEA produces this code which contains two errors:
class Tester {
String x() {
String o = "";
return extracted(o, s);
}
private String extracted(String o, String s) {
String s;
try { s = o; } } finally {
}
return s;
}
} |
Show » |
|
class Extract {
void test() {
try {
final FileInputStream fileInputStream = new FileInputStream("test");
try { fileInputStream.read(); } finally { fileInputStream.close(); }
} catch(IOException e) { e.printStackTrace(); }
}
}
When extracting the enter contents of the method, IDEA suggests a method parameter for the IOException.