try { field = clas.getField(fieldName); ReflectManager.RMSetAccessible( field ); return field; } catch ( NoSuchFieldException e ) { }
try { field = clas.getDeclaredField(fieldName); ReflectManager.RMSetAccessible( field ); return field; // Not found, fall through to next class } catch(NoSuchFieldException e) { } clas = clas.getSuperclass();
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/bsh/Reflect.java File path: /jEdit-4.2/src/bsh/Reflect.java
Method name: Field findAccessibleField(Class, String) Method name: Field findAccessibleField(Class, String)
Number of AST nodes: 4 Number of AST nodes: 5
1
try {
1
try {
2
			field = clas.getField(fieldName);
2
				field = clas.getDeclaredField(fieldName);
3
			ReflectManager.RMSetAccessible( field );
3
				ReflectManager.RMSetAccessible( field );
4
			return field;
4
				return field;
5
				// Not found, fall through to next class
5
		} catch ( NoSuchFieldException e ) { }
6
			} catch(NoSuchFieldException e) { }
7
			clas = clas.getSuperclass();
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.1
Clones locationClones are in the same method
Number of node comparisons16
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.1
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    2
    try
    7
    try
    3
    field = clas.getField(fieldName);
    3
    field = clas.getField(fieldName);
    8
    field = clas.getDeclaredField(fieldName);
    Differences
    Expression1Expression2Difference
    getFieldgetDeclaredFieldMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression clas.getField(fieldName) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    Expression clas.getDeclaredField(fieldName) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    8
    field = clas.getDeclaredField(fieldName);
    4
    ReflectManager.RMSetAccessible(field);
    9
    ReflectManager.RMSetAccessible(field);
    5
    return field;
    10
    return field;
                                                                
    11
    clas = clas.getSuperclass();
    Preondition Violations
    Unmatched statement clas=clas.getSuperclass(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    11
    clas = clas.getSuperclass();
    Precondition Violations (3)
    Row Violation
    1Expression clas.getField(fieldName) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    2Expression clas.getDeclaredField(fieldName) is a method call throwing exception(s) that should be caught by a try block that will be extracted
    3Unmatched statement clas=clas.getSuperclass(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted