if(o instanceof ErrorEntry) { ErrorEntry e = (ErrorEntry)o; return e.path.equals(path); } else return false;
if(o instanceof Descriptor) { Descriptor d = (Descriptor)o; return d.clazz.equals(clazz) && d.name.equals(name); } else return false;
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/gui/ErrorListDialog.java File path: /jEdit-4.2/src/org/gjt/sp/jedit/ServiceManager.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 4 Number of AST nodes: 4
1
if(o instanceof ErrorEntry)
1
if(o instanceof Descriptor)
2
			{
2
			{
3
				ErrorEntry e = (ErrorEntry)o;
3
				
4
				return e.path
4
Descriptor d = (Descriptor)o;
5
				return d.clazz.equals(clazz)
5
.equals(path);
6
					&& d.name.equals(name);
6
			}
7
			}
7
			else
8
			else
8
				return false;
9
				return false;
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 comparisons16
  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)1.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (o instanceof ErrorEntry)
    1
    if (o instanceof ErrorEntry)
    1
    if (o instanceof Descriptor)
    Differences
    Expression1Expression2Difference
    org.gjt.sp.jedit.gui.ErrorListDialog.ErrorEntryorg.gjt.sp.jedit.ServiceManager.DescriptorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.gjt.sp.jedit.gui.ErrorListDialog.ErrorEntry does not match with type org.gjt.sp.jedit.ServiceManager.Descriptor
    • Make classes org.gjt.sp.jedit.gui.ErrorListDialog.ErrorEntry and org.gjt.sp.jedit.ServiceManager.Descriptor extend a common superclass
    1
    if (o instanceof Descriptor)
                                                                
    2
    Descriptor d = (Descriptor)o;
    Preondition Violations
    Unmatched statement Descriptor d=(Descriptor)o; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2
    Descriptor d = (Descriptor)o;
    2
    ErrorEntry e = (ErrorEntry)o;
    2
    ErrorEntry e = (ErrorEntry)o;
    Preondition Violations
    Unmatched statement ErrorEntry e=(ErrorEntry)o; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                
    3
    return e.path.equals(path);
    3
    return e.path.equals(path);
    3
    return d.clazz.equals(clazz) && d.name.equals(name);
    Differences
    Expression1Expression2Difference
    e.path.equals(path)d.clazz.equals(clazz) && d.name.equals(name)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression e.path.equals(path) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression d.clazz.equals(clazz) && d.name.equals(name) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    return d.clazz.equals(clazz) && d.name.equals(name);
    else
    else
    4
    return false;
    4
    return false;
    Precondition Violations (5)
    Row Violation
    1Type org.gjt.sp.jedit.gui.ErrorListDialog.ErrorEntry does not match with type org.gjt.sp.jedit.ServiceManager.Descriptor
    2Unmatched statement Descriptor d=(Descriptor)o; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement ErrorEntry e=(ErrorEntry)o; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Expression e.path.equals(path) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression d.clazz.equals(clazz) && d.name.equals(name) cannot be parameterized, because it has dependencies to/from statements that will be extracted