for (String methodName: methods.keySet()) { if (!EXCLUDE_METHODS.contains(methodName)) { names.add(methodName); methodNames.append(runtime.newString(methodName)); } }
for (String s : ARCH_NAMES.keySet()) { if (s.equalsIgnoreCase(arch)) { return ARCH_NAMES.get(s); } }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/javasupport/proxy/JavaProxyClass.java File path: /jruby-1.4.0/src/org/jruby/platform/Platform.java
Method name: RubyObject get_with_class(IRubyObject, IRubyObject) Method name: String initArchitecture()
Number of AST nodes: 4 Number of AST nodes: 3
1
for (String methodName: methods.keySet()) {
1
for (String 
2
                            if (!EXCLUDE_METHODS.contains(methodName)) {
3
                                names.add(methodName);
4
                                methodNames.append(runtime.newString(methodName));
5
                            }
6
                
2
s : ARCH_NAMES.keySet()) {
3
            if (s.equalsIgnoreCase(arch)) {
4
                return ARCH_NAMES.get(s);
5
            }
7
        }
6
        }
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.2
Clones locationClones are in different classes
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)2.5
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    48
    for (String methodName : methods.keySet())
    48
    for (String methodName : methods.keySet())
    2
    for (String s : ARCH_NAMES.keySet())
    Differences
    Expression1Expression2Difference
    methodNamesVARIABLE_NAME_MISMATCH
    methodsARCH_NAMESVARIABLE_NAME_MISMATCH
    java.util.Mapjava.util.MapVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.Map<java.lang.String,org.jruby.internal.runtime.methods.DynamicMethod> of variable methods does not match with type java.util.Map<java.lang.String,java.lang.String> of variable ARCH_NAMES
    • Make classes java.util.Map and java.util.Map extend a common superclass
    2
    for (String s : ARCH_NAMES.keySet())
    49
    if (!EXCLUDE_METHODS.contains(methodName))
    49
    if (!EXCLUDE_METHODS.contains(methodName))
    3
    if (s.equalsIgnoreCase(arch))
    Differences
    Expression1Expression2Difference
    !EXCLUDE_METHODS.contains(methodName)s.equalsIgnoreCase(arch)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression !EXCLUDE_METHODS.contains(methodName) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression s.equalsIgnoreCase(arch) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    if (s.equalsIgnoreCase(arch))
                                                            
    4
    return ARCH_NAMES.get(s);
    Preondition Violations
    Unmatched statement return ARCH_NAMES.get(s); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched return ARCH_NAMES.get(s);
    4
    return ARCH_NAMES.get(s);
    50
    names.add(methodName);
    50
    names.add(methodName);
    Preondition Violations
    Unmatched statement names.add(methodName); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                        
    51
    methodNames.append(runtime.newString(methodName));
    51
    methodNames.append(runtime.newString(methodName));
    Preondition Violations
    Unmatched statement methodNames.append(runtime.newString(methodName)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                
    Precondition Violations (7)
    Row Violation
    1Type java.util.Map<java.lang.String,org.jruby.internal.runtime.methods.DynamicMethod> of variable methods does not match with type java.util.Map<java.lang.String,java.lang.String> of variable ARCH_NAMES
    2Expression !EXCLUDE_METHODS.contains(methodName) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression s.equalsIgnoreCase(arch) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Unmatched statement return ARCH_NAMES.get(s); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched return ARCH_NAMES.get(s);
    6Unmatched statement names.add(methodName); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement methodNames.append(runtime.newString(methodName)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted