-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix refactor method false error regarding ambiguous return value (#673)
- fixes #671 - add BreakStatement method in InputFlowAnalyzer.LoopReentranceVisitor to ignore break statements that precede the selected code - fix binding equality check in ExtractMethodAnalyzer - add new test to ExtractMethodTests
- Loading branch information
Showing
5 changed files
with
78 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...resources/ExtractMethodWorkSpace/ExtractMethodTests/validSelection_in/A_testIssue671.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package validSelection_in; | ||
|
||
public class A_testIssue671 { | ||
protected void foo() { | ||
while (true) { | ||
List<String> line = List.of(); | ||
if (line == null) { | ||
break; | ||
} | ||
/*[*/// comment | ||
MyType plcTableType; | ||
String plcTableTypeText = ""; | ||
if (plcTableTypeText.isEmpty()) { | ||
plcTableType = null; | ||
} else { | ||
plcTableType = new MyType(); | ||
} | ||
// comment 2/*]*/ | ||
|
||
if (plcTableType == null) { | ||
return; | ||
} | ||
} | ||
} | ||
|
||
public static class MyType { | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...esources/ExtractMethodWorkSpace/ExtractMethodTests/validSelection_out/A_testIssue671.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package validSelection_out; | ||
|
||
public class A_testIssue671 { | ||
protected void foo() { | ||
while (true) { | ||
List<String> line = List.of(); | ||
if (line == null) { | ||
break; | ||
} | ||
MyType plcTableType = extracted(); | ||
|
||
if (plcTableType == null) { | ||
return; | ||
} | ||
} | ||
} | ||
|
||
protected MyType extracted() { | ||
/*[*/// comment | ||
MyType plcTableType; | ||
String plcTableTypeText = ""; | ||
if (plcTableTypeText.isEmpty()) { | ||
plcTableType = null; | ||
} else { | ||
plcTableType = new MyType(); | ||
} | ||
// comment 2/*]*/ | ||
return plcTableType; | ||
} | ||
|
||
public static class MyType { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters