installStaticMethods(staticCallbacks, javaClass, method, name + METHOD_MANGLE); AssignedName assignedName = staticNames.get(name); if (assignedName == null) { staticNames.put(name, new AssignedName(name, Priority.METHOD)); } else { if (Priority.METHOD.lessImportantThan(assignedName)) continue; if (!Priority.METHOD.asImportantAs(assignedName)) { staticCallbacks.remove(name); staticCallbacks.remove(name + '='); staticNames.put(name, new AssignedName(name, Priority.METHOD)); } } installStaticMethods(staticCallbacks, javaClass, method, name);
installInstanceMethods(instanceCallbacks, javaClass, method, name + METHOD_MANGLE); AssignedName assignedName = instanceNames.get(name); if (assignedName == null) { instanceNames.put(name, new AssignedName(name, Priority.METHOD)); } else { if (Priority.METHOD.lessImportantThan(assignedName)) continue; if (!Priority.METHOD.asImportantAs(assignedName)) { instanceCallbacks.remove(name); instanceCallbacks.remove(name + '='); instanceNames.put(name, new AssignedName(name, Priority.METHOD)); } } installInstanceMethods(instanceCallbacks, javaClass, method, name);
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/javasupport/JavaClass.java File path: /jruby-1.4.0/src/org/jruby/javasupport/JavaClass.java
Method name: void setupClassMethods(Class, Map, Map, Map, Map) Method name: void setupClassMethods(Class, Map, Map, Map, Map)
Number of AST nodes: 11 Number of AST nodes: 11
1
installStaticMethods(staticCallbacks, javaClass, method, name + METHOD_MANGLE);
1
installInstanceMethods(instanceCallbacks, javaClass, method, name + METHOD_MANGLE);
2
                
3
                AssignedName assignedName = staticNames.get(name);
2
                AssignedName assignedName = instanceNames.get(name);
4
                if (assignedName == null) {
3
                if (assignedName == null) {
5
                    staticNames.put(name, new AssignedName(name, Priority.METHOD));
4
                    instanceNames.put(name, new AssignedName(name, Priority.METHOD));
6
                } else {
5
                } else {
7
                    if (Priority.METHOD.lessImportantThan(assignedName)) continue;
6
                    if (Priority.METHOD.lessImportantThan(assignedName)) continue;
8
                    if (!Priority.METHOD.asImportantAs(assignedName)) {
7
                    if (!Priority.METHOD.asImportantAs(assignedName)) {
9
                        staticCallbacks.remove(name);
8
                        instanceCallbacks.remove(name);
10
                        staticCallbacks.remove(name + '=');
9
                        instanceCallbacks.remove(name + '=');
11
                        staticNames.put(name, new AssignedName(name, Priority.METHOD));
10
                        instanceNames.put(name, new AssignedName(name, Priority.METHOD));
12
                    }
11
                    }
13
                }
12
                }
14
                installStaticMethods(staticCallbacks, javaClass, method, name);
13
                installInstanceMethods(instanceCallbacks, javaClass, method, name);
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.7
Clones locationClones are in the same method
Number of node comparisons43
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)53.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    6
    installStaticMethods(staticCallbacks, javaClass, method, name + METHOD_MANGLE);
    6
    installStaticMethods(staticCallbacks, javaClass, method, name + METHOD_MANGLE);
    Preondition Violations
    Unmatched statement installStaticMethods(staticCallbacks,javaClass,method,name + METHOD_MANGLE); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                  
                                                                                                                                                                            
    17
    installInstanceMethods(instanceCallbacks, javaClass, method, name + METHOD_MANGLE);
    Preondition Violations
    Unmatched statement installInstanceMethods(instanceCallbacks,javaClass,method,name + METHOD_MANGLE); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    17
    installInstanceMethods(instanceCallbacks, javaClass, method, name + METHOD_MANGLE);
    7
    AssignedName assignedName = staticNames.get(name);
    7
    AssignedName assignedName = staticNames.get(name);
    18
    AssignedName assignedName = instanceNames.get(name);
    Differences
    Expression1Expression2Difference
    staticNamesinstanceNamesVARIABLE_NAME_MISMATCH
    18
    AssignedName assignedName = instanceNames.get(name);
    8
    if (assignedName == null)
    19
    if (assignedName == null)
    9
    staticNames.put(name, new AssignedName(name, Priority.METHOD));
    9
    staticNames.put(name, new AssignedName(name, Priority.METHOD));
    20
    instanceNames.put(name, new AssignedName(name, Priority.METHOD));
    Differences
    Expression1Expression2Difference
    staticNamesinstanceNamesVARIABLE_NAME_MISMATCH
    20
    instanceNames.put(name, new AssignedName(name, Priority.METHOD));
    else
    else
    10
    if (Priority.METHOD.lessImportantThan(assignedName))
    21
    if (Priority.METHOD.lessImportantThan(assignedName))
    11
    continue;
    11
    continue;
    22
    continue;
    Preondition Violations
    Statement continue; without innermost loop
    Statement continue; without innermost loop
    22
    continue;
    12
    if (!Priority.METHOD.asImportantAs(assignedName))
    23
    if (!Priority.METHOD.asImportantAs(assignedName))
    13
    staticCallbacks.remove(name);
    13
    staticCallbacks.remove(name);
    24
    instanceCallbacks.remove(name);
    Differences
    Expression1Expression2Difference
    staticCallbacksinstanceCallbacksVARIABLE_NAME_MISMATCH
    24
    instanceCallbacks.remove(name);
    14
    staticCallbacks.remove(name + '=');
    14
    staticCallbacks.remove(name + '=');
    25
    instanceCallbacks.remove(name + '=');
    Differences
    Expression1Expression2Difference
    staticCallbacksinstanceCallbacksVARIABLE_NAME_MISMATCH
    25
    instanceCallbacks.remove(name + '=');
    15
    staticNames.put(name, new AssignedName(name, Priority.METHOD));
    15
    staticNames.put(name, new AssignedName(name, Priority.METHOD));
    26
    instanceNames.put(name, new AssignedName(name, Priority.METHOD));
    Differences
    Expression1Expression2Difference
    staticNamesinstanceNamesVARIABLE_NAME_MISMATCH
    26
    instanceNames.put(name, new AssignedName(name, Priority.METHOD));
    16
    installStaticMethods(staticCallbacks, javaClass, method, name);
    16
    installStaticMethods(staticCallbacks, javaClass, method, name);
    Preondition Violations
    Unmatched statement installStaticMethods(staticCallbacks,javaClass,method,name); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                    
                                                                                                                                            
    27
    installInstanceMethods(instanceCallbacks, javaClass, method, name);
    Preondition Violations
    Unmatched statement installInstanceMethods(instanceCallbacks,javaClass,method,name); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    27
    installInstanceMethods(instanceCallbacks, javaClass, method, name);
    Precondition Violations (6)
    Row Violation
    1Unmatched statement installStaticMethods(staticCallbacks,javaClass,method,name + METHOD_MANGLE); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement installInstanceMethods(instanceCallbacks,javaClass,method,name + METHOD_MANGLE); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Statement continue; without innermost loop
    4Statement continue; without innermost loop
    5Unmatched statement installStaticMethods(staticCallbacks,javaClass,method,name); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement installInstanceMethods(instanceCallbacks,javaClass,method,name); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted