385-15-16

Locale saved = Locale.getDefault(); Locale.setDefault(Locale.ITALY); Calendar cal = Calendar.getInstance(Locale.ITALY); cal.set(2006, Calendar.JANUARY, 16, 3, 47, 55); cal.set(Calendar.MILLISECOND, 555); Millisecond m = new Millisecond(555, 55, 47, 3, 16, 1, 2006); assertEquals(cal.getTime(), m.getStart()); Locale.setDefault(saved);
Locale saved = Locale.getDefault(); Locale.setDefault(Locale.ITALY); Calendar cal = Calendar.getInstance(Locale.ITALY); cal.set(2006, Calendar.JANUARY, 16, 3, 47, 55); cal.set(Calendar.MILLISECOND, 555); Millisecond m = new Millisecond(555, 55, 47, 3, 16, 1, 2006); assertEquals(cal.getTime(), m.getEnd()); Locale.setDefault(saved);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/data/time/junit/MillisecondTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/data/time/junit/MillisecondTests.java
Method name: `void testGetStart()` |  | Method name: `void testGetEnd()`
Number of AST nodes: 8 |  | Number of AST nodes: 8

1

    Locale saved = Locale.getDefault();↵

1

    Locale saved = Locale.getDefault();↵

2

            Locale.setDefault(Locale.ITALY);↵

2

            Locale.setDefault(Locale.ITALY);↵

3

            Calendar cal = Calendar.getInstance(Locale.ITALY);↵

3

            Calendar cal = Calendar.getInstance(Locale.ITALY);↵

4

            cal.set(2006, Calendar.JANUARY, 16, 3, 47, 55);↵

4

            cal.set(2006, Calendar.JANUARY, 16, 3, 47, 55);↵

5

            cal.set(Calendar.MILLISECOND, 555);↵

5

            cal.set(Calendar.MILLISECOND, 555);↵

6

            Millisecond m = new Millisecond(555, 55, 47, 3, 16, 1, 2006);↵

6

            Millisecond m = new Millisecond(555, 55, 47, 3, 16, 1, 2006);↵

7

            assertEquals(cal.getTime(), m.getStart());↵

7

            assertEquals(cal.getTime(), m.getEnd());↵

8

            Locale.setDefault(saved);

8

            Locale.setDefault(saved);

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 declared in the same class
Number of node comparisons | 30

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 8
   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.0
   Clone type | Type 2

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

   1

       Locale saved = Locale.getDefault();

   1

       Locale saved = Locale.getDefault();

   2

       Locale.setDefault(Locale.ITALY);

   2

       Locale.setDefault(Locale.ITALY);

   3

       Calendar cal = Calendar.getInstance(Locale.ITALY);

   3

       Calendar cal = Calendar.getInstance(Locale.ITALY);

   4

       cal.set(2006, Calendar.JANUARY, 16, 3, 47, 55);

   4

       cal.set(2006, Calendar.JANUARY, 16, 3, 47, 55);

   5

       cal.set(Calendar.MILLISECOND, 555);

   5

       cal.set(Calendar.MILLISECOND, 555);

   6

       Millisecond m = new Millisecond(555, 55, 47, 3, 16, 1, 2006);

   6

       Millisecond m = new Millisecond(555, 55, 47, 3, 16, 1, 2006);

   7

       assertEquals(cal.getTime(), m.getStart());

   7 | assertEquals(cal.getTime(), m.getStart());
   7 | assertEquals(cal.getTime(), m.getEnd());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getStart | getEnd | METHOD_INVOCATION_NAME_MISMATCH

   Preondition Violations
   Expression m.getStart() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression m.getEnd() cannot be parameterized, because it has dependencies to/from statements that will be extracted

   7

       assertEquals(cal.getTime(), m.getEnd());

   8

       Locale.setDefault(saved);

   8

       Locale.setDefault(saved);

   Precondition Violations (2)
   Row | Violation
   --- | ---
   1 | Expression m.getStart() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression m.getEnd() cannot be parameterized, because it has dependencies to/from statements that will be extracted