try
{
buffer.beginCompoundEdit();
setSelectedText("\n");
buffer.indentLine(caretLine,true);
}
finally
{
buffer.endCompoundEdit();
}
try
{
buffer.beginCompoundEdit();
BeanShell.eval(view,BeanShell.getNameSpace(),
"for(int i = 1; i < "
+ getRepeatCount() + "; i++)\n{\n"
+ readNextChar + "\n}");
}
finally
{
buffer.endCompoundEdit();
}
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/textarea/JEditTextArea.java
|
|
File path: /jEdit-4.2/src/org/gjt/sp/jedit/gui/InputHandler.java
|
Method name: void insertEnterAndIndent()
|
|
Method name: void invokeReadNextChar(char)
|
Number of AST nodes: 4
|
|
Number of AST nodes: 3
|
|
1 | try↵ | | 1 | try↵
|
2 | {↵ | | 2 | {↵
|
3 | buffer.beginCompoundEdit();↵ | | 3 | buffer.beginCompoundEdit();↵
|
|
4 | setSelectedText("\n");↵ | | 4 | ↵
|
5 | buffer.indentLine(caretLine,true↵ | | 5 | BeanShell.eval(view,BeanShell.getNameSpace(),↵
|
| | | 6 | "for(int i = 1; i < "↵
|
| | | 7 | + getRepeatCount() + "; i++)\n{\n"↵
|
6 | );↵ | | 8 | + readNextChar + "\n}");↵
|
7 | }↵ | | 9 | }↵
|
8 | finally↵ | | 10 | finally↵
|
9 | {↵ | | 11 | {↵
|
10 | buffer.endCompoundEdit();↵ | | 12 | buffer.endCompoundEdit();↵
|
11 | } | | 13 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.3 |
Clones location | Clones are in different classes |
Number of node comparisons | 12 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 2 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 2.8 |
Clone type | Type 3 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
3 | try | | 10 | try |
4 | buffer.beginCompoundEdit(); | | 11 | buffer.beginCompoundEdit(); |
5 | | | | |
6 | buffer.indentLine(caretLine, true); | | | |
| | | 12 | BeanShell.eval(view, BeanShell.getNameSpace(), "for(int i = 1; i < " + getRepeatCount() + "; i++)\n{\n" + readNextChar + "\n}"); |
Precondition Violations (2)
Row |
Violation |
1 | Unmatched statement setSelectedText("\n"); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |
2 | Unmatched statement buffer.indentLine(caretLine,true); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |