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