if(context != null) { context.actionNames = null; String[] actions = getActionNames(); for(int i = 0; i < actions.length; i++) { context.actionHash.remove(actions[i]); } }
String[] classes = jar.getClasses(); if(classes != null) { for(int i = 0; i < classes.length; i++) { classHash.put(classes[i],this); } }
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/ActionSet.java File path: /jEdit-4.2/src/org/gjt/sp/jedit/JARClassLoader.java
Method name: void removeAllActions() Method name: void activate()
Number of AST nodes: 5 Number of AST nodes: 4
1
if(context != null)
2
		{
3
			context.actionNam
1
String[] classes = jar.getClasses();
4
es = null;
2
		if(classes != null)
5
			String[] actions = getActionNames();
3
		{
6
			for(int i = 0; i < actions.length; i++)
4
			for(int i = 0; i < classes.length; i++)
7
			{
5
			{
8
				context.actionHash.remove(actions[i]);
6
				classHash.put(classes[i],this);
9
			}
7
			}
10
		}
8
		}
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.3
Clones locationClones are in different classes
Number of node comparisons7
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.3
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                              
    1
    String[] classes = jar.getClasses();
    1
    if (context != null)
    1
    if (context != null)
    2
    if (classes != null)
    Differences
    Expression1Expression2Difference
    contextclassesVARIABLE_NAME_MISMATCH
    org.gjt.sp.jedit.ActionContextjava.lang.String[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.gjt.sp.jedit.ActionContext of variable context does not match with type java.lang.String[] of variable classes
    • Make classes org.gjt.sp.jedit.ActionContext and java.lang.String[] extend a common superclass
    2
    if (classes != null)
    2
    context.actionNames = null;
                                                            
    3
    String[] actions = getActionNames();
                                                                              
    4
    for (int i = 0; i < actions.length; i++)
    4
    for (int i = 0; i < actions.length; i++)
    3
    for (int i = 0; i < classes.length; i++)
    Differences
    Expression1Expression2Difference
    actionsclassesVARIABLE_NAME_MISMATCH
    3
    for (int i = 0; i < classes.length; i++)
    5
    context.actionHash.remove(actions[i]);
    5
    context.actionHash.remove(actions[i]);
    4
    classHash.put(classes[i], this);
    Differences
    Expression1Expression2Difference
    removeputMETHOD_INVOCATION_NAME_MISMATCH
    context.actionHashclassHashTYPE_COMPATIBLE_REPLACEMENT
    context.actionHash.remove(actions[i])classHash.put(classes[i],this)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression context.actionHash.remove(actions[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression classHash.put(classes[i],this) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression context.actionHash.remove(actions[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression classHash.put(classes[i],this) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    classHash.put(classes[i], this);
    Precondition Violations (5)
    Row Violation
    1Type org.gjt.sp.jedit.ActionContext of variable context does not match with type java.lang.String[] of variable classes
    2Expression context.actionHash.remove(actions[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression classHash.put(classes[i],this) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression context.actionHash.remove(actions[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression classHash.put(classes[i],this) cannot be parameterized, because it has dependencies to/from statements that will be extracted