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; }
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; } }
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/FastIntMethodFactory.java
Method name: boolean needsDefinitionCheck(Node) Method name: boolean isFastIntResult(Type)
Number of AST nodes: 21 Number of AST nodes: 17
1
if (type instanceof Type.Builtin) {
1
switch (node.getNodeType()) {
2
            switch (type.getNativeType()) {
2
        case CLASSVARASGNNODE:
3
                case 
4
VOID:
3
        case CLASSVARDECLNODE:
5
          
4
        case CONSTDECLNODE:
5
        case DASGNNODE:
6
        case GLOBALASGNNODE:
7
        case LOCALASGNNODE:
8
        case MULTIPLEASGNNODE:
9
        case OPASGNNODE:
10
        case OPELEMENTASGNNODE:
11
        case DVARNODE:
6
      case CHAR:
7
                case UCHAR:
8
                case SHORT:
9
                case USHORT:
10
                case INT:
12
        case FALSENODE:
11
                case UINT:
13
        case TRUENODE:
12
        
14
        case LOCALVARNODE:
13
        case 
15
        case MATCH2NODE:
16
        case MATCH3NODE:
17
        case NILNODE:
14
BOOL:
15
                    return true;
16
                case POINTER:
18
        case SELFNODE:
17
                case STRING:
19
            // all these types are immediately considered "defined"
18
            
20
            return false;
21
        default:
22
            return true;
19
        return Platform.getPlatform().addressSize() == 32;
20
                case LONG:
21
                case ULONG:
22
                    return Platform.getPlatform().longSize() == 32;
23
            }
23
        }
24
        }
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