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(); }
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(); }
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: 10 Number of AST nodes: 9
1
try {
1
try {
2
					final Object returnValue;
2
					
3
					if ( ReflectHelper.isPublic( persistentClass, method ) ) {
3
if ( ReflectHelper.isPublic( persistentClass, thisMethod ) ) {
4
						if ( !method.getDeclaringClass().isInstance( target ) ) {
4
						if ( !thisMethod.getDeclaringClass().isInstance( target ) ) {
5
							throw new ClassCastException( target.getClass().getName() );
5
							throw new ClassCastException( target.getClass().getName() );
6
						}
6
						}
7
						returnValue = method.invoke( target, args );
7
						returnValue = thisMethod.invoke( target, args );
8
					}
8
					}
9
					else {
9
					else {
10
						if ( !method.isAccessible() ) {
10
						if ( !thisMethod.isAccessible() ) {
11
							method.setAccessible( true );
11
							thisMethod.setAccessible( true );
12
						}
12
						}
13
						returnValue = method.invoke( target, args );
13
						returnValue = thisMethod.invoke( target, args );
14
					}
14
					}
15
					return returnValue == target ? proxy : returnValue;
15
					return returnValue == target ? proxy : returnValue;
16
				}
16
				}
17
				catch ( InvocationTargetException ite ) {
17
				catch ( InvocationTargetException ite ) {
18
					throw ite.getTargetException();
18
					throw ite.getTargetException();
19
				}
19
				}
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)1.0
Clones locationClones are in different classes having the same super class
Number of node comparisons26
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)12.7
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    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;
    Precondition Violations (1)
    Row Violation
    1Not all possible execution flows end in a return statement