NumericConverter converter = NUMERIC_CONVERTERS.get(target); if (converter == null) { return NUMERIC_TO_OTHER; } return converter;
JavaMethodFactory factory = methodFactories.get(returnType); if (factory == null) { return JAVA_OBJECT_METHOD_FACTORY; } return factory;
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/javasupport/JavaUtil.java File path: /jruby-1.4.0/src/org/jruby/java/MiniJava.java
Method name: NumericConverter getNumericConverter(Class) Method name: JavaMethodFactory getMethodFactory(Class)
Number of AST nodes: 4 Number of AST nodes: 4
1
NumericConverter converter = NUMERIC_CONVERTERS.get(target);
1
JavaMethodFactory factory = methodFactories.get(returnType);
2
        if (converter == null) {
2
        if (factory == null) {
3
            return NUMERIC_TO_OTHER;
3
            return JAVA_OBJECT_METHOD_FACTORY;
4
        }
4
        }
5
        return converter;
5
        return factory;
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.1
Clones locationClones are in different classes
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)0.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                              
    1
    JavaMethodFactory factory = methodFactories.get(returnType);
    1
    NumericConverter converter = NUMERIC_CONVERTERS.get(target);
                                                                                                                              
    2
    if (converter == null)
    2
    if (converter == null)
    2
    if (factory == null)
    Differences
    Expression1Expression2Difference
    converterfactoryVARIABLE_NAME_MISMATCH
    org.jruby.javasupport.JavaUtil.NumericConverterorg.jruby.java.MiniJava.JavaMethodFactoryVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jruby.javasupport.JavaUtil.NumericConverter of variable converter does not match with type org.jruby.java.MiniJava.JavaMethodFactory of variable factory
    • Make classes org.jruby.javasupport.JavaUtil.NumericConverter and org.jruby.java.MiniJava.JavaMethodFactory extend a common superclass
    2
    if (factory == null)
                                                                              
    3
    return JAVA_OBJECT_METHOD_FACTORY;
    Preondition Violations
    Unmatched return JAVA_OBJECT_METHOD_FACTORY;
    3
    return JAVA_OBJECT_METHOD_FACTORY;
    3
    return NUMERIC_TO_OTHER;
    3
    return NUMERIC_TO_OTHER;
    Preondition Violations
    Unmatched return NUMERIC_TO_OTHER;
                                                          
                                        
    4
    return factory;
    Preondition Violations
    Unmatched return factory;
    4
    return factory;
    4
    return converter;
    4
    return converter;
    Preondition Violations
    Unmatched return converter;
                                            
    Precondition Violations (5)
    Row Violation
    1Type org.jruby.javasupport.JavaUtil.NumericConverter of variable converter does not match with type org.jruby.java.MiniJava.JavaMethodFactory of variable factory
    2Unmatched return JAVA_OBJECT_METHOD_FACTORY;
    3Unmatched return NUMERIC_TO_OTHER;
    4Unmatched return factory;
    5Unmatched return converter;