-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extract method mulriple exit cleanup
- Loading branch information
Showing
7 changed files
with
185 additions
and
0 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
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
23 changes: 23 additions & 0 deletions
23
...ring/resources/ExtractMethodWorkSpace/ExtractMethodTests/invalidSelection/A_test3000.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,23 @@ | ||
package invalidSelection; | ||
|
||
public class A_test3000 { | ||
public int m(boolean b) { | ||
int x = 42; | ||
try { | ||
// from | ||
/*]*/if(b) { | ||
x = 23; | ||
throw new Exception(); | ||
} /*[*/ | ||
// to | ||
|
||
} catch(Exception e) { | ||
return x; | ||
} | ||
return x; | ||
} | ||
public int test(){ | ||
return m(true); | ||
} | ||
} | ||
|
33 changes: 33 additions & 0 deletions
33
...ring/resources/ExtractMethodWorkSpace/ExtractMethodTests/invalidSelection/A_test3001.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 invalidSelection; | ||
|
||
public class A_test3001 { | ||
public int calculateSum(int[] numbers) { | ||
int sum = 0; | ||
try { | ||
/*]*/for (int i = 0; i < numbers.length; i++) { | ||
if (numbers[i] < 0) { | ||
|
||
throw new Exception(); | ||
} | ||
sum += numbers[i]; | ||
}/*[*/ | ||
} catch (Exception e) { | ||
return sum; | ||
} | ||
return sum; | ||
} | ||
|
||
|
||
public int test() { | ||
int[] numbers = {1, 2, -3, 4, 5}; | ||
int result = calculateSum(numbers); | ||
System.out.println("Sum: " + result); | ||
return result; | ||
} | ||
|
||
public static void main(String[] args) { | ||
A_test3001 b = new A_test3001(); | ||
b.test(); | ||
} | ||
} | ||
|
33 changes: 33 additions & 0 deletions
33
...ring/resources/ExtractMethodWorkSpace/ExtractMethodTests/invalidSelection/A_test3002.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 invalidSelection; | ||
|
||
public class A_test3002 { | ||
public int calculateSum(int[] numbers) { | ||
int sum = 0; | ||
try { | ||
for (int i = 0; i < numbers.length; i++) { | ||
/*]*/if (numbers[i] < 0) { | ||
//sum++ | ||
throw new Exception(); | ||
}/*[*/ | ||
sum += numbers[i]; | ||
} | ||
} catch (Exception e) { | ||
return sum; | ||
} | ||
return sum; | ||
} | ||
|
||
|
||
public int test() { | ||
int[] numbers = {1, 2, -3, 4, 5}; | ||
int result = calculateSum(numbers); | ||
System.out.println("Sum: " + result); | ||
return result; | ||
} | ||
|
||
public static void main(String[] args) { | ||
A_test3002 b = new A_test3002(); | ||
b.test(); | ||
} | ||
} | ||
|
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