int args = paramsLength; if (args == 0) { actualRequired = 0; } else { if (isStatic) { args--; } if (hasContext) { args--; } if (hasBlock) { args--; // minus one more for IRubyObject[] } args--; // TODO: confirm expected args are IRubyObject (or similar) actualRequired = args; } if (actualRequired != 0) { throw new RuntimeException("Combining specific args with IRubyObject[] is not yet supported"); }
int args = paramsLength; if (args == 0) { actualRequired = 0; } else { if (isStatic) { args--; } if (hasContext) { args--; } if (hasBlock) { args--; // TODO: confirm expected args are IRubyObject (or similar) } actualRequired = args; }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/anno/AnnotationBinder.java File path: /jruby-1.4.0/src/org/jruby/anno/AnnotationBinder.java
Method name: int calculateActualRequired(int, int, boolean, boolean, boolean, boolean) Method name: int calculateActualRequired(int, int, boolean, boolean, boolean, boolean)
Number of AST nodes: 13 Number of AST nodes: 10
1
int args = paramsLength;
1
int args = paramsLength;
2
                    if (args == 0) {
2
                    if (args == 0) {
3
                        actualRequired = 0;
3
                        actualRequired = 0;
4
                    } else {
4
                    } else {
5
                        if (isStatic) {
5
                        if (isStatic) {
6
                            args--;
6
                            args--;
7
                        }
7
                        }
8
                        if (hasContext) {
8
                        if (hasContext) {
9
                            args--;
9
                            args--;
10
                        }
10
                        }
11
                        if (hasBlock) {
11
                        if (hasBlock) {
12
                            args--;                        // minus one more for IRubyObject[]
12
                            args--;
13
                        }
14
                        args--;
15
                        // TODO: confirm expected args are IRubyObject (or similar)
13
                        // TODO: confirm expected args are IRubyObject (or similar)
16
                        actualRequired = args;
14
                        
17
                    }
18
                    if (
15
}
19
actualRequired != 0) {
16
                        actualRequired = 
20
                        throw new RuntimeException("Combining specific args with IRubyObject[] is not yet supported");
17
args;
21
                    }
18
                    }
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 comparisons41
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.3
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    13
    int args = paramsLength;
    3
    int args = paramsLength;
    14
    if (args == 0)
    4
    if (args == 0)
    15
    actualRequired = 0;
    5
    actualRequired = 0;
    else
    else
    16
    if (isStatic)
    6
    if (isStatic)
    17
    args--;
    7
    args--;
    18
    if (hasContext)
    8
    if (hasContext)
    19
    args--;
    9
    args--;
    20
    if (hasBlock)
    10
    if (hasBlock)
    21
    args--;
    11
    args--;
    22
    args--;
    22
    args--;
    Preondition Violations
    Unmatched statement args--; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                          
    23
    actualRequired = args;
    12
    actualRequired = args;
    Precondition Violations (2)
    Row Violation
    1Unmatched statement args--; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Clone fragment #1 returns variables args, actualRequired , while Clone fragment #2 returns variables actualRequired