Method meth = javaClass().getEnclosingMethod(); if (meth != null) { return new JavaMethod(getRuntime(), meth); } return getRuntime().getNil();
Constructor<?> ctor = javaClass().getEnclosingConstructor(); if (ctor != null) { return new JavaConstructor(getRuntime(), ctor); } return getRuntime().getNil();
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: IRubyObject enclosing_method() Method name: IRubyObject enclosing_constructor()
Number of AST nodes: 4 Number of AST nodes: 4
1
Method meth = javaClass().getEnclosingMethod();
1
Constructor<?> ctor = javaClass().getEnclosingConstructor();
2
        if (meth != null) {
2
        if (ctor != null) {
3
            return new JavaMethod(getRuntime(), meth);
3
            return new JavaConstructor(getRuntime(), ctor);
4
        }
4
        }
5
        return getRuntime().getNil();
5
        return getRuntime().getNil();
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are declared in the same class
Number of node comparisons8
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                              
    1
    Constructor<?> ctor = javaClass().getEnclosingConstructor();
    1
    Method meth = javaClass().getEnclosingMethod();
                                                                                                    
    2
    if (meth != null)
    2
    if (meth != null)
    2
    if (ctor != null)
    Differences
    Expression1Expression2Difference
    methctorVARIABLE_NAME_MISMATCH
    java.lang.reflect.Methodjava.lang.reflect.ConstructorSUBCLASS_TYPE_MISMATCH
    2
    if (ctor != null)
    3
    return new JavaMethod(getRuntime(), meth);
    3
    return new JavaMethod(getRuntime(), meth);
    3
    return new JavaConstructor(getRuntime(), ctor);
    Differences
    Expression1Expression2Difference
    org.jruby.javasupport.JavaMethodorg.jruby.javasupport.JavaConstructorSUBCLASS_TYPE_MISMATCH
    methctorVARIABLE_NAME_MISMATCH
    java.lang.reflect.Methodjava.lang.reflect.ConstructorSUBCLASS_TYPE_MISMATCH
    3
    return new JavaConstructor(getRuntime(), ctor);
    4
    return getRuntime().getNil();
    4
    return getRuntime().getNil();
    Precondition Violations (0)
    Row Violation