forked from eclipse-jdt/eclipse.jdt.ui
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix false error on extraction of for loop contents
- fix ExtractMethodAnalyzer.canHandleBranches() to not flag a non-labelled break statement if the for loop is included - add new test to ExtractMethodTests - fixes eclipse-jdt#1291
- Loading branch information
jjohnstn
committed
May 21, 2024
1 parent
df564dc
commit 94ca7f9
Showing
4 changed files
with
77 additions
and
9 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
24 changes: 24 additions & 0 deletions
24
....refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_in/A_test770.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,24 @@ | ||
package branch_in; | ||
|
||
import java.util.List; | ||
|
||
public class A_test770 { | ||
|
||
public static void foo(List<List<String>> defs) { | ||
for (List<String> def : defs) { | ||
/*]*/ | ||
boolean isLeftRecursive= false; | ||
for (String rule : def) { | ||
if (!rule.isEmpty()) { | ||
break; | ||
} | ||
} | ||
|
||
if (!isLeftRecursive) { | ||
continue; | ||
} | ||
/*[*/ | ||
} | ||
} | ||
} | ||
|
28 changes: 28 additions & 0 deletions
28
...refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/branch_out/A_test770.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 branch_out; | ||
|
||
import java.util.List; | ||
|
||
public class A_test770 { | ||
|
||
public static void foo(List<List<String>> defs) { | ||
for (List<String> def : defs) { | ||
/*]*/ | ||
extracted(def); | ||
/*[*/ | ||
} | ||
} | ||
|
||
protected static void extracted(List<String> def) { | ||
boolean isLeftRecursive= false; | ||
for (String rule : def) { | ||
if (!rule.isEmpty()) { | ||
break; | ||
} | ||
} | ||
|
||
if (!isLeftRecursive) { | ||
return; | ||
} | ||
} | ||
} | ||
|
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