Buffer buffer = view.getBuffer(); try { buffer.beginCompoundEdit(); handler.runMacro(view,this); } finally { buffer.endCompoundEdit(); }
try { buffer.beginCompoundEdit(); setSelectedText("\n"); buffer.indentLine(caretLine,true); } finally { buffer.endCompoundEdit(); }
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/Macros.java File path: /jEdit-4.2/src/org/gjt/sp/jedit/textarea/JEditTextArea.java
Method name: void invoke(View) Method name: void insertEnterAndIndent()
Number of AST nodes: 4 Number of AST nodes: 4
1
Buffer buffer = view.getBuffer();
2
				try
1
try
3
				{
2
			{
4
					buffer.beginCompoundEdit();
3
				buffer.beginCompoundEdit();
5
					handler.runMacro(view,this
4
				setSelectedText("\n");
6
);
5
				buffer.indentLine(caretLine,true);
7
				}
6
			}
8
				finally
7
			finally
9
				{
8
			{
10
					buffer.endCompoundEdit();
9
				buffer.endCompoundEdit();
11
				}
10
			}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.5
Clones locationClones are in different classes
Number of node comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)546.5
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    3
    Buffer buffer = view.getBuffer();
                                                                        
    4
    try
    3
    try
    5
    buffer.beginCompoundEdit();
    4
    buffer.beginCompoundEdit();
    6
    handler.runMacro(view, this);
    6
    handler.runMacro(view, this);
    5
    setSelectedText("\n");
    Differences
    Expression1Expression2Difference
    runMacrosetSelectedTextMETHOD_INVOCATION_NAME_MISMATCH
    handler.runMacro(view,this)setSelectedText("\n")ARGUMENT_NUMBER_MISMATCH
    handlerMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression setSelectedText("\n") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression handler.runMacro(view,this) is a void method call, and thus it cannot be parameterized
    Expression setSelectedText("\n") is a void method call, and thus it cannot be parameterized
    Expression setSelectedText("\n") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression handler.runMacro(view,this) is a void method call, and thus it cannot be parameterized
    Expression setSelectedText("\n") is a void method call, and thus it cannot be parameterized
    5
    setSelectedText("\n");
                                                                              
    6
    buffer.indentLine(caretLine, true);
    Preondition Violations
    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
    6
    buffer.indentLine(caretLine, true);
    Precondition Violations (7)
    Row Violation
    1Expression setSelectedText("\n") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression handler.runMacro(view,this) is a void method call, and thus it cannot be parameterized
    3Expression setSelectedText("\n") is a void method call, and thus it cannot be parameterized
    4Expression setSelectedText("\n") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression handler.runMacro(view,this) is a void method call, and thus it cannot be parameterized
    6Expression setSelectedText("\n") is a void method call, and thus it cannot be parameterized
    7Unmatched 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