407-1-2

if (annotation == null) { throw new IllegalArgumentException("Null 'annotation' argument."); } boolean removed = this.annotations.remove(annotation); if (removed && notify) { fireChangeEvent(); } return removed;
if (annotation == null) { throw new IllegalArgumentException("Null 'annotation' argument."); } boolean removed = this.annotations.remove(annotation); if (removed && notify) { fireChangeEvent(); } return removed;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/CategoryPlot.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/XYPlot.java
Method name: `boolean removeAnnotation(CategoryAnnotation, boolean)` |  | Method name: `boolean removeAnnotation(XYAnnotation, boolean)`
Number of AST nodes: 6 |  | Number of AST nodes: 6

1

    if (annotation == null) {↵

1

    if (annotation == null) {↵

2

                throw new IllegalArgumentException("Null 'annotation' argument.");↵

2

                throw new IllegalArgumentException("Null 'annotation' argument.");↵

3

            }↵

3

            }↵

4

            boolean removed = this.annotations.remove(annotation);↵

4

            boolean removed = this.annotations.remove(annotation);↵

5

            if (removed && notify) {↵

5

            if (removed && notify) {↵

6

                fireChangeEvent();↵

6

                fireChangeEvent();↵

7

            }↵

7

            }↵

8

            return removed;

8

            return removed;

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.3
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 17

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 6
   Number of unmapped statements in the first code fragment | 0
   Number of unmapped statements in the second code fragment | 0
   Time elapsed for statement mapping (ms) | 0.8
   Clone type | Type 2

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   1

       if (annotation == null)

   1 | if (annotation == null)
   1 | if (annotation == null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.annotations.CategoryAnnotation | org.jfree.chart.annotations.XYAnnotation | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.annotations.CategoryAnnotation of variable annotation does not match with type org.jfree.chart.annotations.XYAnnotation of variable annotation
   - Make classes org.jfree.chart.annotations.CategoryAnnotation and org.jfree.chart.annotations.XYAnnotation extend a common superclass

   1

       if (annotation == null)

   2

       throw new IllegalArgumentException("Null 'annotation' argument.");

   2

       throw new IllegalArgumentException("Null 'annotation' argument.");

   3

       boolean removed = this.annotations.remove(annotation);

   3 | boolean removed = this.annotations.remove(annotation);
   3 | boolean removed = this.annotations.remove(annotation);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.annotations.CategoryAnnotation | org.jfree.chart.annotations.XYAnnotation | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.annotations.CategoryAnnotation of variable annotation does not match with type org.jfree.chart.annotations.XYAnnotation of variable annotation
   - Make classes org.jfree.chart.annotations.CategoryAnnotation and org.jfree.chart.annotations.XYAnnotation extend a common superclass

   3

       boolean removed = this.annotations.remove(annotation);

   4

       if (removed && notify)

   4

       if (removed && notify)

   5

       fireChangeEvent();

   5

       fireChangeEvent();

   6

       return removed;

   6

       return removed;

   Precondition Violations (2)
   Row | Violation
   --- | ---
   1 | Type org.jfree.chart.annotations.CategoryAnnotation of variable annotation does not match with type org.jfree.chart.annotations.XYAnnotation of variable annotation
   2 | Type org.jfree.chart.annotations.CategoryAnnotation of variable annotation does not match with type org.jfree.chart.annotations.XYAnnotation of variable annotation