1251-1-39

Font f = getTickLabelFont(); String fName = f.getFontName(); Font newFont = new Font(fName, f.getStyle(), (f.getSize() + delta)); setTickLabelFont(newFont);
WindItemRenderer r1 = new WindItemRenderer(); WindItemRenderer r2 = new WindItemRenderer(); assertTrue(r1.equals(r2)); int h1 = r1.hashCode(); int h2 = r2.hashCode(); assertEquals(h1, h2);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/JThermometer.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/chart/renderer/xy/junit/WindItemRendererTests.java
Method name: `void changeTickFontSize(int)` |  | Method name: `void testHashcode()`
Number of AST nodes: 4 |  | Number of AST nodes: 6

1

    Font f = getTickLabelFont();
    ↵

1

    WindItemRenderer r1 = new WindItemRenderer();↵

2

            String fName = f.getFontName();
    ↵

2

            WindItemRenderer r2 = new WindItemRenderer();↵

3

            Font newFont = new Font(fName, f.getStyle(), (f.getSize() + delta)↵

3

            assertTrue(r1.equals(r2));↵

4

            int h1 = r1.hashCode();↵

4

    );
    ↵

5

            int h2 = r2.hashCode();↵

5

            setTickLabelFont(newFont);

6

            assertEquals(h1, h2);

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.0
Clones location | Clones are in different classes
Number of node comparisons | 24

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 1
   Number of unmapped statements in the first code fragment | 3
   Number of unmapped statements in the second code fragment | 5
   Time elapsed for statement mapping (ms) | 0.0
   Clone type | Type 3

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

   1

       WindItemRenderer r1 = new WindItemRenderer();

   1

       Font f = getTickLabelFont();

   2

       WindItemRenderer r2 = new WindItemRenderer();

   2

       String fName = f.getFontName();

   3

       assertTrue(r1.equals(r2));

   3

       Font newFont = new Font(fName, f.getStyle(), (f.getSize() + delta));

   4

       int h1 = r1.hashCode();

   5

       int h2 = r2.hashCode();

   4

       setTickLabelFont(newFont);

   4 | setTickLabelFont(newFont);
   6 | assertEquals(h1, h2);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   setTickLabelFont | assertEquals | METHOD_INVOCATION_NAME_MISMATCH
   setTickLabelFont(newFont) | assertEquals(h1,h2) | ARGUMENT_NUMBER_MISMATCH

   Preondition Violations
   Expression setTickLabelFont(newFont) is a void method call, and thus it cannot be parameterized
   Expression assertEquals(h1,h2) is a void method call, and thus it cannot be parameterized
   Expression setTickLabelFont(newFont) is a void method call, and thus it cannot be parameterized
   Expression assertEquals(h1,h2) is a void method call, and thus it cannot be parameterized

   6

       assertEquals(h1, h2);

   Precondition Violations (4)
   Row | Violation
   --- | ---
   1 | Expression setTickLabelFont(newFont) is a void method call, and thus it cannot be parameterized
   2 | Expression assertEquals(h1,h2) is a void method call, and thus it cannot be parameterized
   3 | Expression setTickLabelFont(newFont) is a void method call, and thus it cannot be parameterized
   4 | Expression assertEquals(h1,h2) is a void method call, and thus it cannot be parameterized