if ( result == INVOKE_IMPLEMENTATION ) { Object target = getImplementation(); try { final Object returnValue; if ( ReflectHelper.isPublic( persistentClass, method ) ) { if ( !method.getDeclaringClass().isInstance( target ) ) { throw new ClassCastException( target.getClass().getName() ); } returnValue = method.invoke( target, args ); } else { if ( !method.isAccessible() ) { method.setAccessible( true ); } returnValue = method.invoke( target, args ); } return returnValue == target ? proxy : returnValue; } catch ( InvocationTargetException ite ) { throw ite.getTargetException(); } } else { return result; }
if ( result == INVOKE_IMPLEMENTATION ) { Object target = getImplementation(); final Object returnValue; try { if ( ReflectHelper.isPublic( persistentClass, thisMethod ) ) { if ( !thisMethod.getDeclaringClass().isInstance( target ) ) { throw new ClassCastException( target.getClass().getName() ); } returnValue = thisMethod.invoke( target, args ); } else { if ( !thisMethod.isAccessible() ) { thisMethod.setAccessible( true ); } returnValue = thisMethod.invoke( target, args ); } return returnValue == target ? proxy : returnValue; } catch ( InvocationTargetException ite ) { throw ite.getTargetException(); } } else { return result; }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/proxy/pojo/cglib/CGLIBLazyInitializer.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/proxy/pojo/javassist/JavassistLazyInitializer.java
Method name: Object invoke(Object, Method, Object[]) Method name: Object invoke(Object, Method, Method, Object[])
Number of AST nodes: 13 Number of AST nodes: 13
1
if ( result == INVOKE_IMPLEMENTATION ) {
1
if ( result == INVOKE_IMPLEMENTATION ) {
2
				Object target = getImplementation();
2
				Object target = getImplementation();
3
				try {
3
				
4
					final Object returnValue;
4
final Object returnValue;
5
				
5
				try {
6
	if ( ReflectHelper.isPublic( persistentClass, method ) ) {
6
					if ( ReflectHelper.isPublic( persistentClass, thisMethod ) ) {
7
						if ( !method.getDeclaringClass().isInstance( target ) ) {
7
						if ( !thisMethod.getDeclaringClass().isInstance( target ) ) {
8
							throw new ClassCastException( target.getClass().getName() );
8
							throw new ClassCastException( target.getClass().getName() );
9
						}
9
						}
10
						returnValue = method.invoke( target, args );
10
						returnValue = thisMethod.invoke( target, args );
11
					}
11
					}
12
					else {
12
					else {
13
						if ( !method.isAccessible() ) {
13
						if ( !thisMethod.isAccessible() ) {
14
							method.setAccessible( true );
14
							thisMethod.setAccessible( true );
15
						}
15
						}
16
						returnValue = method.invoke( target, args );
16
						returnValue = thisMethod.invoke( target, args );
17
					}
17
					}
18
					return returnValue == target ? proxy : returnValue;
18
					return returnValue == target ? proxy : returnValue;
19
				}
19
				}
20
				catch ( InvocationTargetException ite ) {
20
				catch ( InvocationTargetException ite ) {
21
					throw ite.getTargetException();
21
					throw ite.getTargetException();
22
				}
22
				}
23
			}
23
			}
24
			else {
24
			else {
25
				return result;
25
				return result;
26
			}
26
			}
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)1.1
Clones locationClones are in different classes having the same super class
Number of node comparisons41
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements12
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)2.3
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    3
    if (result == INVOKE_IMPLEMENTATION)
    5
    if (result == INVOKE_IMPLEMENTATION)
    4
    Object target = getImplementation();
    6
    Object target = getImplementation();
                                                            
    7
    final Object returnValue;
    5
    try
    8
    try
    6
    final Object returnValue;
                                                            
    7
    if (ReflectHelper.isPublic(persistentClass, method))
    7
    if (ReflectHelper.isPublic(persistentClass, method))
    9
    if (ReflectHelper.isPublic(persistentClass, thisMethod))
    Differences
    Expression1Expression2Difference
    methodthisMethodVARIABLE_NAME_MISMATCH
    9
    if (ReflectHelper.isPublic(persistentClass, thisMethod))
    8
    if (!method.getDeclaringClass().isInstance(target))
    8
    if (!method.getDeclaringClass().isInstance(target))
    10
    if (!thisMethod.getDeclaringClass().isInstance(target))
    Differences
    Expression1Expression2Difference
    methodthisMethodVARIABLE_NAME_MISMATCH
    10
    if (!thisMethod.getDeclaringClass().isInstance(target))
    9
    throw new ClassCastException(target.getClass().getName());
    11
    throw new ClassCastException(target.getClass().getName());
    10
    returnValue = method.invoke(target, args);
    10
    returnValue = method.invoke(target, args);
    12
    returnValue = thisMethod.invoke(target, args);
    Differences
    Expression1Expression2Difference
    methodthisMethodVARIABLE_NAME_MISMATCH
    12
    returnValue = thisMethod.invoke(target, args);
    else
    else
    11
    if (!method.isAccessible())
    11
    if (!method.isAccessible())
    13
    if (!thisMethod.isAccessible())
    Differences
    Expression1Expression2Difference
    methodthisMethodVARIABLE_NAME_MISMATCH
    13
    if (!thisMethod.isAccessible())
    12
    method.setAccessible(true);
    12
    method.setAccessible(true);
    14
    thisMethod.setAccessible(true);
    Differences
    Expression1Expression2Difference
    methodthisMethodVARIABLE_NAME_MISMATCH
    14
    thisMethod.setAccessible(true);
    13
    returnValue = method.invoke(target, args);
    13
    returnValue = method.invoke(target, args);
    15
    returnValue = thisMethod.invoke(target, args);
    Differences
    Expression1Expression2Difference
    methodthisMethodVARIABLE_NAME_MISMATCH
    15
    returnValue = thisMethod.invoke(target, args);
    14
    return returnValue == target ? proxy : returnValue;
    16
    return returnValue == target ? proxy : returnValue;
    else
    else
    15
    return result;
    17
    return result;
    Precondition Violations (0)
    Row Violation