File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/bytecode/javassist/FieldTransformer.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/bytecode/javassist/FieldTransformer.java | |||
Method name: int transformInvokevirtualsIntoPutfields(ClassFile, CodeIterator, int)
|
Method name: int transformInvokevirtualsIntoGetfields(ClassFile, CodeIterator, int)
|
|||
Number of AST nodes: 14 | Number of AST nodes: 14 | |||
1 | ConstPool cp = classfile.getConstPool();↵ | 1 | ConstPool cp = classfile.getConstPool();↵ | |
2 | int c = iter.byteAt(pos);↵ | 2 | int c = iter.byteAt(pos);↵ | |
3 | if (c != Opcode.PUTFIELD) {↵ | 3 | if (c != Opcode.GETFIELD) {↵ | |
4 | return pos;↵ | 4 | return pos;↵ | |
5 | }↵ | 5 | }↵ | |
6 | int index = iter.u16bitAt(pos + 1);↵ | 6 | int index = iter.u16bitAt(pos + 1);↵ | |
7 | String fieldName = cp.getFieldrefName(index);↵ | 7 | String fieldName = cp.getFieldrefName(index);↵ | |
8 | String className = cp.getFieldrefClassName(index);↵ | 8 | String className = cp.getFieldrefClassName(index);↵ | |
9 | if ( !filter.handleWriteAccess( className, fieldName ) ) {↵ | 9 | if ( !filter.handleReadAccess( className, fieldName ) ) {↵ | |
10 | return pos;↵ | 10 | return pos;↵ | |
11 | }↵ | 11 | }↵ | |
12 | String desc = "(" + cp.getFieldrefType( index ) + ")V";↵ | 12 | String desc = "()" + cp.getFieldrefType( index );↵ | |
13 | int write_method_index = cp.addMethodrefInfo(↵ | 13 | int read_method_index = cp.addMethodrefInfo(↵ | |
14 | cp.getThisClassInfo(),↵ | 14 | cp.getThisClassInfo(),↵ | |
15 | EACH_WRITE_METHOD_PREFIX + fieldName,↵ | 15 | EACH_READ_METHOD_PREFIX + fieldName,↵ | |
16 | desc↵ | 16 | desc↵ | |
17 | );↵ | 17 | );↵ | |
18 | iter.writeByte(Opcode.INVOKEVIRTUAL, pos);↵ | 18 | iter.writeByte(Opcode.INVOKEVIRTUAL, pos);↵ | |
19 | iter.write16bit(write_method_index, pos + 1);↵ | 19 | iter.write16bit(read_method_index, pos + 1);↵ | |
20 | return pos; | 20 |
| |
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.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 113 |
Number of mapped statements | 14 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 4.1 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | ConstPool cp = classfile.getConstPool(); | 1 | ConstPool cp = classfile.getConstPool(); | ||||||||||||||||
2 | int c = iter.byteAt(pos); | 2 | int c = iter.byteAt(pos); | ||||||||||||||||
3 | if (c != Opcode.PUTFIELD) |
| 3 | if (c != Opcode.GETFIELD) | |||||||||||||||
4 | return pos; | 4 | return pos; | ||||||||||||||||
5 | int index = iter.u16bitAt(pos + 1); | 5 | int index = iter.u16bitAt(pos + 1); | ||||||||||||||||
6 | String fieldName = cp.getFieldrefName(index); | 6 | String fieldName = cp.getFieldrefName(index); | ||||||||||||||||
7 | String className = cp.getFieldrefClassName(index); | 7 | String className = cp.getFieldrefClassName(index); | ||||||||||||||||
8 | if (!filter.handleWriteAccess(className, fieldName)) |
| 8 | if (!filter.handleReadAccess(className, fieldName)) | |||||||||||||||
9 | return pos; | 9 | return pos; | ||||||||||||||||
10 | String desc = "(" + cp.getFieldrefType(index) + ")V"; |
| 10 | String desc = "()" + cp.getFieldrefType(index); | |||||||||||||||
11 | int write_method_index = cp.addMethodrefInfo(cp.getThisClassInfo(), EACH_WRITE_METHOD_PREFIX + fieldName, desc); |
| 11 | int read_method_index = cp.addMethodrefInfo(cp.getThisClassInfo(), EACH_READ_METHOD_PREFIX + fieldName, desc); | |||||||||||||||
12 | iter.writeByte(Opcode.INVOKEVIRTUAL, pos); | 12 | iter.writeByte(Opcode.INVOKEVIRTUAL, pos); | ||||||||||||||||
13 | iter.write16bit(write_method_index, pos + 1); |
| 13 | iter.write16bit(read_method_index, pos + 1); | |||||||||||||||
14 | return pos; | 14 | return pos; |
Row | Violation |
---|---|
1 | Expression filter.handleWriteAccess(className,fieldName) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression filter.handleReadAccess(className,fieldName) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression "(" + cp.getFieldrefType(index) + ")V" cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression "()" + cp.getFieldrefType(index) cannot be parameterized, because it has dependencies to/from statements that will be extracted |