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) { }
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: 4
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) { }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are in the same method
Number of node comparisons16
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)3.9
    Clone typeType 2
    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) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression clas.getDeclaredField(fieldName) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    field = clas.getDeclaredField(fieldName);
    4
    ReflectManager.RMSetAccessible(field);
    9
    ReflectManager.RMSetAccessible(field);
    5
    return field;
    10
    return field;
    Precondition Violations (2)
    Row Violation
    1Expression clas.getField(fieldName) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression clas.getDeclaredField(fieldName) cannot be parameterized, because it has dependencies to/from statements that will be extracted