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;
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;
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: String[] getTypeDescriptors(CallStack, Interpreter, String) Method name: Object eval(CallStack, Interpreter)
Number of AST nodes: 9 Number of AST nodes: 9
1
if ( typeDescriptors != null )
1
if ( paramTypes != null )
2
			return typeDescriptors;
2
			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
		{
6
		{
7
			BSHFormalParameter param = (BSHFormalParameter)jjtGetChild(i);
7
			BSHFormalParameter param = (BSHFormalParameter)jjtGetChild(i);
8
			typeDesc[i] = param.getTypeDescriptor( 
8
			
9
				callstack, interpreter, defaultPackage );
9
paramTypes[i] = (Class)param.eval( callstack, interpreter
10
		}
11
		this.typeDescriptors = typeDesc;
10
 );
11
		}
12
		this.paramTypes = paramTypes;
12
		return typeDesc;
13
		return paramTypes;
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.3
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)1.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (typeDescriptors != null)
    1
    if (typeDescriptors != null)
    1
    if (paramTypes != null)
    Differences
    Expression1Expression2Difference
    typeDescriptorsparamTypesVARIABLE_NAME_MISMATCH
    java.lang.String[]java.lang.Class[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String[] of variable typeDescriptors does not match with type java.lang.Class[] of variable paramTypes
    • Make classes java.lang.String[] and java.lang.Class[] extend a common superclass
    1
    if (paramTypes != null)
                                              
    2
    return paramTypes;
    Preondition Violations
    Unmatched return paramTypes;
    2
    return paramTypes;
    2
    return typeDescriptors;
    2
    return typeDescriptors;
    Preondition Violations
    Unmatched 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
    BSHFormalParameter param = (BSHFormalParameter)jjtGetChild(i);
    6
    BSHFormalParameter param = (BSHFormalParameter)jjtGetChild(i);
                                                                                                                        
    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
    7
    paramTypes[i] = (Class)param.eval(callstack, interpreter);
    7
    typeDesc[i] = param.getTypeDescriptor(callstack, interpreter, defaultPackage);
    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
                                                                                                                                                              
                                                                
    8
    this.paramTypes = paramTypes;
    8
    this.typeDescriptors = typeDesc;
                                                                      
                                              
    9
    return paramTypes;
    Preondition Violations
    Unmatched return paramTypes;
    9
    return paramTypes;
    9
    return typeDesc;
    9
    return typeDesc;
    Preondition Violations
    Unmatched return typeDesc;
                                          
    Precondition Violations (8)
    Row Violation
    1Type java.lang.String[] of variable typeDescriptors does not match with type java.lang.Class[] of variable paramTypes
    2Unmatched return paramTypes;
    3Unmatched return typeDescriptors;
    4Unmatched 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
    5Unmatched 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
    6Unmatched return paramTypes;
    7Unmatched return typeDesc;
    8Clone fragment #1 returns variables i, param , while Clone fragment #2 returns variables i, param