stream.defaultReadObject(); this.store = new HashMap(); int keyCount = stream.readInt(); for (int i = 0; i < keyCount; i++) { Comparable key = (Comparable) stream.readObject(); Paint paint = SerialUtilities.readPaint(stream); this.store.put(key, paint); }
stream.defaultReadObject(); this.store = new TreeMap(); int keyCount = stream.readInt(); for (int i = 0; i < keyCount; i++) { Comparable key = (Comparable) stream.readObject(); Stroke stroke = SerialUtilities.readStroke(stream); this.store.put(key, stroke); }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/PaintMap.java File path: /jfreechart-1.0.10/src/org/jfree/chart/StrokeMap.java
Method name: void readObject(ObjectInputStream) Method name: void readObject(ObjectInputStream)
Number of AST nodes: 7 Number of AST nodes: 7
1
stream.defaultReadObject();
1
stream.defaultReadObject();
2
        this.store = new HashMap();
2
        this.store = new TreeMap();
3
        int keyCount = stream.readInt();
3
        int keyCount = stream.readInt();
4
        for (int i = 0; i < keyCount; i++) {
4
        for (int i = 0; i < keyCount; i++) {
5
            Comparable key = (Comparable) stream.readObject();
5
            Comparable key = (Comparable) stream.readObject();
6
            Paint paint = SerialUtilities.readPaint(stream);
6
            Stroke stroke = SerialUtilities.readStroke(stream);
7
            this.store.put(key, paint);
7
            this.store.put(key, stroke);
8
        }
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.1
Clones locationClones are in different classes
Number of node comparisons21
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)11.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    stream.defaultReadObject();
    1
    stream.defaultReadObject();
    2
    this.store = new HashMap();
    2
    this.store = new HashMap();
    2
    this.store = new TreeMap();
    Differences
    Expression1Expression2Difference
    java.util.HashMapjava.util.TreeMapSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new HashMap() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new TreeMap() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2
    this.store = new TreeMap();
    3
    int keyCount = stream.readInt();
    3
    int keyCount = stream.readInt();
    4
    for (int i = 0; i < keyCount; i++)
    4
    for (int i = 0; i < keyCount; i++)
    5
    Comparable key = (Comparable)stream.readObject();
    5
    Comparable key = (Comparable)stream.readObject();
                                                                                                            
    6
    Stroke stroke = SerialUtilities.readStroke(stream);
    Preondition Violations
    Unmatched statement Stroke stroke=SerialUtilities.readStroke(stream); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement Stroke stroke=SerialUtilities.readStroke(stream); 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
    Stroke stroke = SerialUtilities.readStroke(stream);
    6
    Paint paint = SerialUtilities.readPaint(stream);
    6
    Paint paint = SerialUtilities.readPaint(stream);
    Preondition Violations
    Unmatched statement Paint paint=SerialUtilities.readPaint(stream); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement Paint paint=SerialUtilities.readPaint(stream); 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
                                                                                                      
    7
    this.store.put(key, paint);
    7
    this.store.put(key, paint);
    7
    this.store.put(key, stroke);
    Differences
    Expression1Expression2Difference
    paintstrokeVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.awt.StrokeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable paint does not match with type java.awt.Stroke of variable stroke
    • Make classes java.awt.Paint and java.awt.Stroke extend a common superclass
    7
    this.store.put(key, stroke);
    Precondition Violations (7)
    Row Violation
    1Expression new HashMap() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new TreeMap() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched statement Stroke stroke=SerialUtilities.readStroke(stream); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement Stroke stroke=SerialUtilities.readStroke(stream); 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
    5Unmatched statement Paint paint=SerialUtilities.readPaint(stream); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement Paint paint=SerialUtilities.readPaint(stream); 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
    7Type java.awt.Paint of variable paint does not match with type java.awt.Stroke of variable stroke