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 VOID: case BOOL: return true; } } else if (type instanceof CallbackInfo) { return true; } return false;
if (type instanceof Type.Builtin) { switch (type.getNativeType()) { case VOID: case CHAR: case UCHAR: case SHORT: case USHORT: case INT: case UINT: case BOOL: return true; case POINTER: case STRING: return Platform.getPlatform().addressSize() == 32; 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 isReturnTypeValid(Type) Method name: boolean isFastIntResult(Type)
Number of AST nodes: 21 Number of AST nodes: 18
1
if (type instanceof Type.Builtin) {
1
if (type instanceof Type.Builtin) {
2
            switch (type.getNativeType()) {
2
            switch (type.getNativeType()) {
3
                case VOID:
3
                case CHAR:
4
                case CHAR:
4
                case UCHAR:
5
                case UCHAR:
5
                case SHORT:
6
                case SHORT:
6
                case USHORT:
7
                case USHORT:
7
                case INT:
8
                case INT:
8
                case UINT:
9
                case UINT:
9
                case LONG:
10
                case BOOL:
10
                case ULONG:
11
                
11
                case LONG_LONG:
12
    return true;
12
                case ULONG_LONG:
13
                case POINTER:
13
                case FLOAT:
14
                case 
14
  
15
STRING:
15
              case DOUBLE:
16
              
16
                case POINTER:
17
      return Platform.getPlatform().addressSize() == 32;
17
                case VOID:
18
                case LONG:
18
                case BOOL:
19
                case ULONG:
19
                    return true;
20
                    return 
20
            }
21
        } else if (type instanceof CallbackInfo) {
21
Platform.getPlatform().longSize() == 32;
22
            return true;
22
            }
23
        }
23
        }
24
        return false;
24
        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.7
Clones locationClones are in different classes
Number of node comparisons120
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements14
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)6.9
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    2
    switch (type.getNativeType())
    2
    switch (type.getNativeType())
    3
    case CHAR:
    4
    case CHAR:
    4
    case UCHAR:
    5
    case UCHAR:
    5
    case SHORT:
    6
    case SHORT:
    6
    case USHORT:
    7
    case USHORT:
    7
    case INT:
    8
    case INT:
    8
    case UINT:
    9
    case UINT:
                                                                                                                
    14
    return Platform.getPlatform().addressSize() == 32;
    Preondition Violations
    Unmatched return Platform.getPlatform().addressSize() == 32;
    14
    return Platform.getPlatform().addressSize() == 32;
    9
    case LONG:
    15
    case LONG:
    10
    case ULONG:
    16
    case ULONG:
    11
    case LONG_LONG:
    11
    case LONG_LONG:
    10
    case BOOL:
    Differences
    Expression1Expression2Difference
    LONG_LONGBOOLVARIABLE_NAME_MISMATCH
    10
    case BOOL:
    12
    case ULONG_LONG:
    12
    case ULONG_LONG:
    12
    case POINTER:
    Differences
    Expression1Expression2Difference
    ULONG_LONGPOINTERVARIABLE_NAME_MISMATCH
    12
    case POINTER:
    13
    case FLOAT:
    13
    case FLOAT:
    13
    case STRING:
    Differences
    Expression1Expression2Difference
    FLOATSTRINGVARIABLE_NAME_MISMATCH
    13
    case STRING:
    14
    case DOUBLE:
    14
    case DOUBLE:
    3
    case VOID:
    Differences
    Expression1Expression2Difference
    DOUBLEVOIDVARIABLE_NAME_MISMATCH
    3
    case VOID:
    15
    case POINTER:
                                      
    16
    case VOID:
                                
    17
    case BOOL:
                                
    18
    return true;
    11
    return true;
                                                                                                          
    17
    return Platform.getPlatform().longSize() == 32;
    Preondition Violations
    Unmatched return Platform.getPlatform().longSize() == 32;
    17
    return Platform.getPlatform().longSize() == 32;
    Precondition Violations (2)
    Row Violation
    1Unmatched return Platform.getPlatform().addressSize() == 32;
    2Unmatched return Platform.getPlatform().longSize() == 32;