if (type instanceof Type.Builtin) { switch (type.getNativeType()) { case CHAR: case UCHAR: case SHORT: case USHORT: case INT: case UINT: case LONG: case ULONG: case LONG_LONG: case ULONG_LONG: case FLOAT: case DOUBLE: case POINTER: case STRING: case BOOL: return true; } } else if (type instanceof CallbackInfo) { return true; } return false;
if (paramType instanceof Type.Builtin) { switch (paramType.getNativeType()) { case CHAR: case UCHAR: case SHORT: case USHORT: case INT: case UINT: case BOOL: // case FLOAT: return true; case LONG: case ULONG: return Platform.getPlatform().longSize() == 32; } } return false;
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/ext/ffi/jffi/CallbackManager.java File path: /jruby-1.4.0/src/org/jruby/ext/ffi/jffi/FastIntMethodFactory.java
Method name: boolean isParameterTypeValid(Type) Method name: boolean isFastIntParam(Type)
Number of AST nodes: 21 Number of AST nodes: 14
1
if (type instanceof Type.Builtin) {
1
if (paramType instanceof Type.Builtin) {
2
            switch (type.getNativeType()) {
2
            switch (paramType.getNativeType()) {
3
                case CHAR:
3
                case CHAR:
4
                case UCHAR:
4
                case UCHAR:
5
                case SHORT:
5
                case SHORT:
6
                case USHORT:
6
                case USHORT:
7
                case INT:
7
                case INT:
8
                case UINT:
8
                case UINT:
9
                case LONG:
9
                case 
10
                case ULONG:
11
                case LONG_LONG:
12
                case ULONG_LONG:
10
BOOL:
13
                case FLOAT:
11
//                case FLOAT:
14
                case DOUBLE:
12
                
15
                case POINTER:
13
    return true;
16
                case STRING:
14
                case LONG:
17
                case BOOL:
15
                case ULONG:
18
                    return true;
16
                    return 
19
            }
20
        } else if (type instanceof CallbackInfo) {
17
Platform.getPlatform().longSize() == 32;
21
            return true;
18
            }
22
        }
19
        }
23
        return false;
20
        return false;
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.6
Clones locationClones are in different classes
Number of node comparisons78
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements11
    Number of unmapped statements in the first code fragment6
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)4.7
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    2
    switch (type.getNativeType())
    2
    switch (type.getNativeType())
    2
    switch (paramType.getNativeType())
    Differences
    Expression1Expression2Difference
    typeparamTypeVARIABLE_NAME_MISMATCH
    2
    switch (paramType.getNativeType())
    3
    case CHAR:
    3
    case CHAR:
    4
    case UCHAR:
    4
    case UCHAR:
    5
    case SHORT:
    5
    case SHORT:
    6
    case USHORT:
    6
    case USHORT:
    7
    case INT:
    7
    case INT:
    8
    case UINT:
    8
    case UINT:
    9
    case LONG:
    11
    case LONG:
    10
    case ULONG:
    12
    case ULONG:
    11
    case LONG_LONG:
    11
    case LONG_LONG:
    9
    case BOOL:
    Differences
    Expression1Expression2Difference
    LONG_LONGBOOLVARIABLE_NAME_MISMATCH
    9
    case BOOL:
    12
    case ULONG_LONG:
                                            
                                                                                                          
    13
    return Platform.getPlatform().longSize() == 32;
    Preondition Violations
    Unmatched return Platform.getPlatform().longSize() == 32;
    13
    return Platform.getPlatform().longSize() == 32;
    13
    case FLOAT:
                                  
    14
    case DOUBLE:
                                    
    15
    case POINTER:
                                      
    16
    case STRING:
                                    
    17
    case BOOL:
                                
    18
    return true;
    10
    return true;
    Precondition Violations (1)
    Row Violation
    1Unmatched return Platform.getPlatform().longSize() == 32;