while( c != null ) { Method [] m = c.getDeclaredMethods(); for(int i=0; i<m.length; i++) mv.add( m[i] ); c = c.getSuperclass(); }
if(context != null) { context.actionNames = null; String[] actions = getActionNames(); for(int i = 0; i < actions.length; i++) { context.actionHash.remove(actions[i]); } }
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/bsh/Reflect.java File path: /jEdit-4.2/src/org/gjt/sp/jedit/ActionSet.java
Method name: Method resolveJavaMethod(BshClassManager, Class, String, Class[], boolean) Method name: void removeAllActions()
Number of AST nodes: 5 Number of AST nodes: 5
1
while( c != null )
1
if(context != null)
2
			{
2
		{
3
				Method [] m
3
			context.actionNames = null;
4
 = c.getDeclaredMethods();
4
			String[] actions = getActionNames();
5
				for(int i=0; i<m.length; i++)
5
			for(int i = 0; i < actions.length; i++)
6
					mv.add( m[i] );
6
			
7
				c = c.getSuperclass(
7
{
8
);
8
				context.actionHash.remove(actions[i]);
9
			}
9
			}
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.2
Clones locationClones are in different classes
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)0.8
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                            
    2
    context.actionNames = null;
                                                                              
    3
    String[] actions = getActionNames();
    17
    Method[] m = c.getDeclaredMethods();
    17
    Method[] m = c.getDeclaredMethods();
    Preondition Violations
    Unmatched statement Method[] m=c.getDeclaredMethods(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                
    18
    for (int i = 0; i < m.length; i++)
    18
    for (int i = 0; i < m.length; i++)
    4
    for (int i = 0; i < actions.length; i++)
    Differences
    Expression1Expression2Difference
    mactionsVARIABLE_NAME_MISMATCH
    java.lang.reflect.Method[]java.lang.String[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.reflect.Method[] of variable m does not match with type java.lang.String[] of variable actions
    • Make classes java.lang.reflect.Method[] and java.lang.String[] extend a common superclass
    4
    for (int i = 0; i < actions.length; i++)
                                                                                      
    5
    context.actionHash.remove(actions[i]);
    Preondition Violations
    Unmatched statement context.actionHash.remove(actions[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    context.actionHash.remove(actions[i]);
    19
    mv.add(m[i]);
    19
    mv.add(m[i]);
    Preondition Violations
    Unmatched statement mv.add(m[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                      
    Precondition Violations (4)
    Row Violation
    1Unmatched statement Method[] m=c.getDeclaredMethods(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Type java.lang.reflect.Method[] of variable m does not match with type java.lang.String[] of variable actions
    3Unmatched statement context.actionHash.remove(actions[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement mv.add(m[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted