if ( paramTypes != null ) return paramTypes; insureParsed(); Class [] paramTypes = new Class[numArgs]; for(int i=0; i<numArgs; i++) { BSHFormalParameter param = (BSHFormalParameter)jjtGetChild(i); paramTypes[i] = (Class)param.eval( callstack, interpreter ); } this.paramTypes = paramTypes; return paramTypes;
if ( typeDescriptors != null ) return typeDescriptors; insureParsed(); String [] typeDesc = new String[numArgs]; for(int i=0; i<numArgs; i++) { BSHFormalParameter param = (BSHFormalParameter)jjtGetChild(i); typeDesc[i] = param.getTypeDescriptor( callstack, interpreter, defaultPackage ); } this.typeDescriptors = typeDesc; return typeDesc;
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/bsh/BSHFormalParameters.java File path: /jEdit-4.2/src/bsh/BSHFormalParameters.java
Method name: Object eval(CallStack, Interpreter) Method name: String[] getTypeDescriptors(CallStack, Interpreter, String)
Number of AST nodes: 9 Number of AST nodes: 9
1
if ( paramTypes != null )
1
if ( typeDescriptors != null )
2
			return paramTypes;
2
			return typeDescriptors;
3
		insureParsed();
3
		insureParsed();
4
		Class [] paramTypes = new Class[numArgs];
4
		String [] typeDesc = new String[numArgs];
5
		for(int i=0; i<numArgs; i++)
5
		for(int i=0; i<numArgs; i++)
6
		{
6
		{
7
			BSHFormalParameter param = (BSHFormalParameter)jjtGetChild(i);
7
			BSHFormalParameter param = (BSHFormalParameter)jjtGetChild(i);
8
			paramTypes[i] = (Class)param.eval( 
8
			typeDesc[i] = param.getTypeDescriptor( 
9
callstack, interpreter );
9
				callstack, interpreter
10
		}
11
		this.paramTypes = paramTypes;
10
, defaultPackage );
11
		}
12
		this.typeDescriptors = typeDesc;
12
		return paramTypes;
13
		return typeDesc;
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.8
Clones locationClones are declared in the same class
Number of node comparisons31
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment5
    Number of unmapped statements in the second code fragment5
    Time elapsed for statement mapping (ms)2.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (paramTypes != null)
    1
    if (paramTypes != null)
    1
    if (typeDescriptors != null)
    Differences
    Expression1Expression2Difference
    paramTypestypeDescriptorsVARIABLE_NAME_MISMATCH
    java.lang.Class[]java.lang.String[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Class[] of variable paramTypes does not match with type java.lang.String[] of variable typeDescriptors
    • Make classes java.lang.Class[] and java.lang.String[] extend a common superclass
    1
    if (typeDescriptors != null)
                                                        
    2
    return typeDescriptors;
    Preondition Violations
    Unmatched return typeDescriptors;
    2
    return typeDescriptors;
    2
    return paramTypes;
    2
    return paramTypes;
    Preondition Violations
    Unmatched return paramTypes;
                                              
    3
    insureParsed();
    3
    insureParsed();
                                                                                      
    4
    String[] typeDesc = new String[numArgs];
    4
    Class[] paramTypes = new Class[numArgs];
                                                                                      
    5
    for (int i = 0; i < numArgs; i++)
    5
    for (int i = 0; i < numArgs; i++)
    6
    BSHFormalParameter param = (BSHFormalParameter)jjtGetChild(i);
    6
    BSHFormalParameter param = (BSHFormalParameter)jjtGetChild(i);
                                                                                                                                                              
    7
    typeDesc[i] = param.getTypeDescriptor(callstack, interpreter, defaultPackage);
    Preondition Violations
    Unmatched statement typeDesc[i]=param.getTypeDescriptor(callstack,interpreter,defaultPackage); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    typeDesc[i] = param.getTypeDescriptor(callstack, interpreter, defaultPackage);
    7
    paramTypes[i] = (Class)param.eval(callstack, interpreter);
    7
    paramTypes[i] = (Class)param.eval(callstack, interpreter);
    Preondition Violations
    Unmatched statement paramTypes[i]=(Class)param.eval(callstack,interpreter); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                        
                                                                      
    8
    this.typeDescriptors = typeDesc;
    8
    this.paramTypes = paramTypes;
                                                                
                                          
    9
    return typeDesc;
    Preondition Violations
    Unmatched return typeDesc;
    9
    return typeDesc;
    9
    return paramTypes;
    9
    return paramTypes;
    Preondition Violations
    Unmatched return paramTypes;
                                              
    Precondition Violations (8)
    Row Violation
    1Type java.lang.Class[] of variable paramTypes does not match with type java.lang.String[] of variable typeDescriptors
    2Unmatched return typeDescriptors;
    3Unmatched return paramTypes;
    4Unmatched statement typeDesc[i]=param.getTypeDescriptor(callstack,interpreter,defaultPackage); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement paramTypes[i]=(Class)param.eval(callstack,interpreter); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched return typeDesc;
    7Unmatched return paramTypes;
    8Clone fragment #1 returns variables i, param , while Clone fragment #2 returns variables i, param