1087-3-11

TimeZone zone = TimeZone.getTimeZone("GMT"); Millisecond m1 = new Millisecond(new Date(1016729759122L), zone); Millisecond m2 = new Millisecond(new Date(1016729759123L), zone); assertEquals(122, m1.getMillisecond()); assertEquals(1016729759122L, m1.getLastMillisecond(zone)); assertEquals(123, m2.getMillisecond()); assertEquals(1016729759123L, m2.getFirstMillisecond(zone));
try { TimeZone zone = TimeZone.getTimeZone("GMT"); GregorianCalendar gc = new GregorianCalendar(zone); gc.set(2005, Calendar.JANUARY, 1, 12, 0, 0); Week w = new Week(gc.getTime(), zone); assertEquals(53, w.getWeek()); assertEquals(new Year(2004), w.getYear()); } finally { 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/WeekTests.java
Method name: `void testDateConstructor1()` |  | Method name: `void testBug1498805()`
Number of AST nodes: 7 |  | Number of AST nodes: 7

1

    try {↵

1

    TimeZone zone = TimeZone.getTimeZone("GMT");↵

2

                TimeZone zone = TimeZone.getTimeZone("GMT");↵

2

            Millisecond m1 = new Millisecond(new Date(1016729759122L), zone);↵

3

            ↵

3

            Millisecond m2 = new Millisecond(new Date(1016729759123L↵

4

        GregorianCalendar gc = new GregorianCalendar(zone);↵

5

                gc.set(2005, Calendar.JANUARY, 1, 12, 0, 0);↵

4

    ), zone);↵

6

                Week w = new Week(gc.getTime(), zone);↵

5

            assertEquals(122, m1.getMillisecond());↵

7

                assertEquals(53, w.getWeek());↵

6

            assertEquals(1016729759122L, m1.getLastMillisecond(zone));↵

8

                assertEquals(↵

7

            assertEquals(123, m2.getMillisecond());↵

8

            assertEquals(1016729759123L, m2.getFirstMillisecond(zone));

9

    new Year(2004), w.getYear());↵

10

            }↵

11

            finally {↵

12

                Locale.setDefault(saved);↵

13

            }

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 having the same super class
Number of node comparisons | 33

1. {Non-refactorable}

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

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

   1

       TimeZone zone = TimeZone.getTimeZone("GMT");

   4

       TimeZone zone = TimeZone.getTimeZone("GMT");

   2

       Millisecond m1 = new Millisecond(new Date(1016729759122L), zone);

   2 | Millisecond m1 = new Millisecond(new Date(1016729759122L), zone);
   7 | Week w = new Week(gc.getTime(), zone);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.time.Millisecond | org.jfree.data.time.Week | SUBCLASS_TYPE_MISMATCH
   m1 | w | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.Millisecond | org.jfree.data.time.Week | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.time.Millisecond | org.jfree.data.time.Week | SUBCLASS_TYPE_MISMATCH
   new Date(1016729759122L) | gc.getTime() | TYPE_COMPATIBLE_REPLACEMENT

   Preondition Violations
   Expression new Millisecond(new Date(1016729759122L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression new Week(gc.getTime(),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression gc.getTime() cannot be parameterized, because it has dependencies to/from statements that will be extracted

   7

       Week w = new Week(gc.getTime(), zone);

   3

       Millisecond m2 = new Millisecond(new Date(1016729759123L), zone);

   3 | Millisecond m2 = new Millisecond(new Date(1016729759123L), zone);

   Preondition Violations
   Unmatched statement Millisecond m2=new Millisecond(new Date(1016729759123L),zone); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   4

       assertEquals(122, m1.getMillisecond());

   5

       assertEquals(1016729759122L, m1.getLastMillisecond(zone));

   6

       assertEquals(123, m2.getMillisecond());

   6 | assertEquals(123, m2.getMillisecond());
   6 | gc.set(2005, Calendar.JANUARY, 1, 12, 0, 0);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   assertEquals | set | METHOD_INVOCATION_NAME_MISMATCH
   assertEquals(123,m2.getMillisecond()) | gc.set(2005,Calendar.JANUARY,1,12,0,0) | ARGUMENT_NUMBER_MISMATCH
   | gc | MISSING_METHOD_INVOCATION_EXPRESSION

   Preondition Violations
   Expression assertEquals(123,m2.getMillisecond()) is a void method call, and thus it cannot be parameterized
   Expression gc.set(2005,Calendar.JANUARY,1,12,0,0) is a void method call, and thus it cannot be parameterized
   Expression assertEquals(123,m2.getMillisecond()) is a void method call, and thus it cannot be parameterized
   Expression gc.set(2005,Calendar.JANUARY,1,12,0,0) is a void method call, and thus it cannot be parameterized

   6

       gc.set(2005, Calendar.JANUARY, 1, 12, 0, 0);

   7

       assertEquals(1016729759123L, m2.getFirstMillisecond(zone));

   7 | assertEquals(1016729759123L, m2.getFirstMillisecond(zone));
   8 | assertEquals(53, w.getWeek());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   1016729759123L | 53 | LITERAL_VALUE_MISMATCH

   8

       assertEquals(53, w.getWeek());

   Precondition Violations (9)
   Row | Violation
   --- | ---
   1 | Expression new Millisecond(new Date(1016729759122L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression new Week(gc.getTime(),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression gc.getTime() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Unmatched statement Millisecond m2=new Millisecond(new Date(1016729759123L),zone); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   5 | Expression assertEquals(123,m2.getMillisecond()) is a void method call, and thus it cannot be parameterized
   6 | Expression gc.set(2005,Calendar.JANUARY,1,12,0,0) is a void method call, and thus it cannot be parameterized
   7 | Expression assertEquals(123,m2.getMillisecond()) is a void method call, and thus it cannot be parameterized
   8 | Expression gc.set(2005,Calendar.JANUARY,1,12,0,0) is a void method call, and thus it cannot be parameterized
   9 | Clone fragment #1 returns variables zone, m1 , while Clone fragment #2 returns variables zone, w