JavaMethodFactory factory = methodFactories.get(returnType); if (factory == null) { return JAVA_OBJECT_METHOD_FACTORY; } return factory;
RubyConverter converter = ARRAY_CONVERTERS.get(type); if (converter == null) { return ARRAY_OBJECT_CONVERTER; } return converter;
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/java/MiniJava.java File path: /jruby-1.4.0/src/org/jruby/javasupport/JavaUtil.java
Method name: JavaMethodFactory getMethodFactory(Class) Method name: RubyConverter getArrayConverter(Class)
Number of AST nodes: 4 Number of AST nodes: 4
1
JavaMethodFactory factory = methodFactories.get(returnType);
1
RubyConverter converter = ARRAY_CONVERTERS.get(type);
2
        if (factory == null) {
2
        if (converter == null) {
3
            return JAVA_OBJECT_METHOD_FACTORY;
3
            return ARRAY_OBJECT_CONVERTER;
4
        }
4
        }
5
        return factory;
5
        return converter;
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 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
    RubyConverter converter = ARRAY_CONVERTERS.get(type);
    1
    JavaMethodFactory factory = methodFactories.get(returnType);
                                                                                                                              
    2
    if (factory == null)
    2
    if (factory == null)
    2
    if (converter == null)
    Differences
    Expression1Expression2Difference
    factoryconverterVARIABLE_NAME_MISMATCH
    org.jruby.java.MiniJava.JavaMethodFactoryorg.jruby.javasupport.JavaUtil.RubyConverterVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jruby.java.MiniJava.JavaMethodFactory of variable factory does not match with type org.jruby.javasupport.JavaUtil.RubyConverter of variable converter
    • Make classes org.jruby.java.MiniJava.JavaMethodFactory and org.jruby.javasupport.JavaUtil.RubyConverter extend a common superclass
    2
    if (converter == null)
                                                                      
    3
    return ARRAY_OBJECT_CONVERTER;
    Preondition Violations
    Unmatched return ARRAY_OBJECT_CONVERTER;
    3
    return ARRAY_OBJECT_CONVERTER;
    3
    return JAVA_OBJECT_METHOD_FACTORY;
    3
    return JAVA_OBJECT_METHOD_FACTORY;
    Preondition Violations
    Unmatched return JAVA_OBJECT_METHOD_FACTORY;
                                                                              
                                            
    4
    return converter;
    Preondition Violations
    Unmatched return converter;
    4
    return converter;
    4
    return factory;
    4
    return factory;
    Preondition Violations
    Unmatched return factory;
                                        
    Precondition Violations (5)
    Row Violation
    1Type org.jruby.java.MiniJava.JavaMethodFactory of variable factory does not match with type org.jruby.javasupport.JavaUtil.RubyConverter of variable converter
    2Unmatched return ARRAY_OBJECT_CONVERTER;
    3Unmatched return JAVA_OBJECT_METHOD_FACTORY;
    4Unmatched return converter;
    5Unmatched return factory;