switch (node.getNodeType()) { case CLASSVARASGNNODE: case CLASSVARDECLNODE: case CONSTDECLNODE: case DASGNNODE: case GLOBALASGNNODE: case LOCALASGNNODE: case MULTIPLEASGNNODE: case OPASGNNODE: case OPELEMENTASGNNODE: case DVARNODE: case FALSENODE: case TRUENODE: case LOCALVARNODE: case MATCH2NODE: case MATCH3NODE: case NILNODE: case SELFNODE: // all these types are immediately considered "defined" return false; default: return true; }
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; }
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/compiler/ASTCompiler.java File path: /jruby-1.4.0/src/org/jruby/ext/ffi/jffi/CallbackManager.java
Method name: boolean needsDefinitionCheck(Node) Method name: boolean isParameterTypeValid(Type)
Number of AST nodes: 21 Number of AST nodes: 17
1
switch (node.getNodeType()) {
1
switch (type.getNativeType()) {
2
        case CLASSVARASGNNODE:
2
         
3
       case CHAR:
3
        case CLASSVARDECLNODE:
4
                case 
4
        case CONSTDECLNODE:
5
UCHAR:
5
        case DASGNNODE:
6
                case 
6
        case GLOBALASGNNODE:
7
        case LOCALASGNNODE:
7
SHORT:
8
                case USHORT:
9
                case INT:
8
        case MULTIPLEASGNNODE:
10
                case 
11
UINT:
9
        case OPASGNNODE:
12
                case 
13
LONG:
10
        case OPELEMENTASGNNODE:
14
                case 
11
        case DVARNODE:
15
ULONG:
12
        case FALSENODE:
16
                case LONG_LONG:
13
        case TRUENODE:
17
        
14
        case LOCALVARNODE:
18
        case ULO
15
        case MATCH2NODE:
16
        case MATCH3NODE:
17
        case NILNODE:
19
NG_LONG:
20
                case FLOAT:
21
                case DOUBLE:
18
        case SELFNODE:
22
                case POINTER:
19
            // all these types are immediately considered "defined"
23
            
20
            return false;
21
        default:
24
    case STRING:
25
                case BOOL:
22
            return true;
26
                    return true;
23
        }
27
            }
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are in different classes
Number of node comparisons1