File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/bytecode/cglib/BytecodeProviderImpl.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/bytecode/javassist/BytecodeProviderImpl.java | |||
Method name: ReflectionOptimizer getReflectionOptimizer(Class, String[], String[], Class[])
|
Method name: ReflectionOptimizer getReflectionOptimizer(Class, String[], String[], Class[])
|
|||
Number of AST nodes: 13 | Number of AST nodes: 13 | |||
1 | FastClass fastClass;↵ | 1 | FastClass fastClass;↵ | |
2 | BulkBean bulkBean;↵ | 2 | BulkAccessor bulkAccessor;↵ | |
3 | try {↵ | 3 | try {↵ | |
4 | fastClass = FastClass.create( clazz );↵ | 4 | fastClass = FastClass.create( clazz );↵ | |
5 | bulkBean = BulkBean.create( clazz, getterNames, setterNames, types );↵ | 5 | bulkAccessor = BulkAccessor.create( clazz, getterNames, setterNames, types );↵ | |
6 | if ( !clazz.isInterface() && !Modifier.isAbstract( clazz.getModifiers() ) ) {↵ | 6 | if ( !clazz.isInterface() && !Modifier.isAbstract( clazz.getModifiers() ) ) {↵ | |
7 | if ( fastClass == null ) {↵ | 7 | if ( fastClass == null ) {↵ | |
8 | bulkBean = null;↵ | 8 | bulkAccessor = null;↵ | |
9 | }↵ | 9 | }↵ | |
10 | else {↵ | 10 | else {↵ | |
11 | //test out the optimizer:↵ | 11 | //test out the optimizer:↵ | |
12 | Object instance = fastClass.newInstance();↵ | 12 | Object instance = fastClass.newInstance();↵ | |
13 | bulkBean.setPropertyValues( instance, bulkBean.getPropertyValues( instance ) );↵ | 13 | bulkAccessor.setPropertyValues( instance, bulkAccessor.getPropertyValues( instance ) );↵ | |
14 | }↵ | 14 | }↵ | |
15 | }↵ | 15 | }↵ | |
16 | }↵ | 16 | }↵ | |
17 | catch( Throwable t ) {↵ | 17 | catch ( Throwable t ) {↵ | |
18 | fastClass = null;↵ | 18 | fastClass = null;↵ | |
19 | bulkBean = null;↵ | 19 | bulkAccessor = null;↵ | |
20 | String message = "reflection optimizer disabled for: " +↵ | 20 | String message = "reflection optimizer disabled for: " +↵ | |
21 | clazz.getName() +↵ | 21 | clazz.getName() +↵ | |
22 | " [" +↵ | 22 | " [" +↵ | |
23 | StringHelper.unqualify( t.getClass().getName() ) +↵ | 23 | StringHelper.unqualify( t.getClass().getName() ) +↵ | |
24 | ": " +↵ | 24 | ": " +↵ | |
25 | t.getMessage();↵ | 25 | t.getMessage();↵ | |
26 | if (t instanceof BulkBeanException ) {↵ | 26 | if ( t instanceof BulkAccessorException ) {↵ | |
27 | int index = ( (BulkBeanException) t ).getIndex();↵ | 27 | int index = ( ( BulkAccessorException ) t ).getIndex();↵ | |
28 | if (index >= 0) {↵ | 28 | if ( index >= 0 ) {↵ | |
29 | message += " (property " + setterNames[index] + ")";↵ | 29 | message += " (property " + setterNames[index] + ")";↵ | |
30 | }↵ | 30 | }↵ | |
31 | }↵ | 31 | }↵ | |
32 | log.debug( message );↵ | 32 | log.debug( message );↵ | |
33 | }↵ | 33 | }↵ | |
34 | if ( fastClass != null && bulkBean != null ) {↵ | 34 | if ( fastClass != null && bulkAccessor != null ) {↵ | |
35 | return new ReflectionOptimizerImpl(↵ | 35 | return new ReflectionOptimizerImpl(↵ | |
36 | new InstantiationOptimizerAdapter( fastClass ),↵ | 36 | new InstantiationOptimizerAdapter( fastClass ),↵ | |
37 | new AccessOptimizerAdapter( bulkBean, clazz )↵ | 37 | new AccessOptimizerAdapter( bulkAccessor, clazz )↵ | |
38 | );↵ | 38 | );↵ | |
39 | }↵ | 39 | }↵ | |
40 | else {↵ | 40 | else {↵ | |
41 | return null;↵ | 41 | return null;↵ | |
42 | } | 42 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.5 |
Clones location | Clones are in different classes |
Number of node comparisons | 22 |
Number of mapped statements | 4 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 2.4 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 4 | fastClass = FastClass.create(clazz); | |||||||||||||||||||||||
4 | fastClass = FastClass.create(clazz); | | |||||||||||||||||||||||
| 5 | bulkAccessor = BulkAccessor.create(clazz, getterNames, setterNames, types); | |||||||||||||||||||||||
5 | bulkBean = BulkBean.create(clazz, getterNames, setterNames, types); | | |||||||||||||||||||||||
6 | if (!clazz.isInterface() && !Modifier.isAbstract(clazz.getModifiers())) | 6 | if (!clazz.isInterface() && !Modifier.isAbstract(clazz.getModifiers())) | ||||||||||||||||||||||
7 | if (fastClass == null) |
| 7 | if (fastClass == null) | |||||||||||||||||||||
| 8 | bulkAccessor = null; | |||||||||||||||||||||||
8 | bulkBean = null; | | |||||||||||||||||||||||
else | else | ||||||||||||||||||||||||
9 | Object instance = fastClass.newInstance(); |
| 9 | Object instance = fastClass.newInstance(); | |||||||||||||||||||||
10 | bulkBean.setPropertyValues(instance, bulkBean.getPropertyValues(instance)); |
| 10 | bulkAccessor.setPropertyValues(instance, bulkAccessor.getPropertyValues(instance)); |
Row | Violation |
---|---|
1 | Type net.sf.cglib.reflect.FastClass of variable fastClass does not match with type org.hibernate.bytecode.javassist.FastClass of variable fastClass |
2 | Type net.sf.cglib.reflect.FastClass of variable fastClass does not match with type org.hibernate.bytecode.javassist.FastClass of variable fastClass |
3 | Type net.sf.cglib.beans.BulkBean of variable bulkBean does not match with type org.hibernate.bytecode.javassist.BulkAccessor of variable bulkAccessor |
4 | Type net.sf.cglib.beans.BulkBean of variable bulkBean does not match with type org.hibernate.bytecode.javassist.BulkAccessor of variable bulkAccessor |