public class FieldRefCPInfo extends ConstantPoolEntry { /** Name of the field's class */ private String fieldClassName; /** name of the field in that class */ private String fieldName; /** The type of the field */ private String fieldType; /** Index into the constant pool for the class */ private int classIndex; /** Index into the constant pool for the name and type entry */ private int nameAndTypeIndex; /** Constructor. */ public FieldRefCPInfo() { super(CONSTANT_FIELDREF, 1); } /** * read a constant pool entry from a class stream. * * @param cpStream the DataInputStream which contains the constant pool * entry to be read. * @exception IOException if there is a problem reading the entry from * the stream. */ public void read(DataInputStream cpStream) throws IOException { classIndex = cpStream.readUnsignedShort(); nameAndTypeIndex = cpStream.readUnsignedShort(); } /** * Resolve this constant pool entry with respect to its dependents in * the constant pool. * * @param constantPool the constant pool of which this entry is a member * and against which this entry is to be resolved. */ public void resolve(ConstantPool constantPool) { ClassCPInfo fieldClass = (ClassCPInfo) constantPool.getEntry(classIndex); fieldClass.resolve(constantPool); fieldClassName = fieldClass.getClassName(); NameAndTypeCPInfo nt = (NameAndTypeCPInfo) constantPool.getEntry(nameAndTypeIndex); nt.resolve(constantPool); fieldName = nt.getName(); fieldType = nt.getType(); super.resolve(constantPool); } /** * Print a readable version of the constant pool entry. * * @return the string representation of this constant pool entry. */ public String toString() { String value; if (isResolved()) { value = "Field : Class = " + fieldClassName + ", name = " + fieldName + ", type = " + fieldType; } else { value = "Field : Class index = " + classIndex + ", name and type index = " + nameAndTypeIndex; } return value; } /** * Gets the name of the class defining the field * * @return the name of the class defining the field */ public String getFieldClassName() { return fieldClassName; } /** * Get the name of the field * * @return the field's name */ public String getFieldName() { return fieldName; } /** * Get the type of the field * * @return the field's type in string format */ public String getFieldType() { return fieldType;
public class MethodRefCPInfo extends ConstantPoolEntry { /** the name of the class defining this method */ private String methodClassName; /** the name of the method */ private String methodName; /** the method's type descriptor */ private String methodType; /** The index into the constant pool which defines the class of this method. */ private int classIndex; /** * the index into the constant pool which defined the name and type * signature of the method */ private int nameAndTypeIndex; /** Constructor. */ public MethodRefCPInfo() { super(CONSTANT_METHODREF, 1); } /** * read a constant pool entry from a class stream. * * @param cpStream the DataInputStream which contains the constant pool * entry to be read. * @exception IOException if there is a problem reading the entry from * the stream. */ public void read(DataInputStream cpStream) throws IOException { classIndex = cpStream.readUnsignedShort(); nameAndTypeIndex = cpStream.readUnsignedShort(); } /** * Print a readable version of the constant pool entry. * * @return the string representation of this constant pool entry. */ public String toString() { String value; if (isResolved()) { value = "Method : Class = " + methodClassName + ", name = " + methodName + ", type = " + methodType; } else { value = "Method : Class index = " + classIndex + ", name and type index = " + nameAndTypeIndex; } return value; } /** * Resolve this constant pool entry with respect to its dependents in * the constant pool. * * @param constantPool the constant pool of which this entry is a member * and against which this entry is to be resolved. */ public void resolve(ConstantPool constantPool) { ClassCPInfo methodClass = (ClassCPInfo) constantPool.getEntry(classIndex); methodClass.resolve(constantPool); methodClassName = methodClass.getClassName(); NameAndTypeCPInfo nt = (NameAndTypeCPInfo) constantPool.getEntry(nameAndTypeIndex); nt.resolve(constantPool); methodName = nt.getName(); methodType = nt.getType(); super.resolve(constantPool); } /** * Get the name of the class defining the method * * @return the name of the class defining this method */ public String getMethodClassName() { return methodClassName; } /** * Get the name of the method. * * @return the name of the method. */ public String getMethodName() { return methodName; } /** * Get the type signature of the method. * * @return the type signature of the method. */ public String getMethodType() { return methodType;
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/depend/constantpool/FieldRefCPInfo.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/depend/constantpool/MethodRefCPInfo.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public class FieldRefCPInfo extends ConstantPoolEntry {
1
public class MethodRefCPInfo extends ConstantPoolEntry {
2
    /** Name of the field's class */
2
    /** the name of the class defining this method */
3
    private String fieldClassName;
3
    private String methodClassName;
4
    /** name of the field in that class */
4
    /** the name of the method */
5
    private String fieldName;
5
    private String methodName;
6
    /** The type of the field */
6
    /** the method's type descriptor */
7
    private String fieldType;
7
    private String methodType;
8
    /** Index into the constant pool for the class */
8
    /** The index into the constant pool which defines the class of this method. */
9
    private int classIndex;
9
    private int classIndex;
10
    /** I
10
    /**
11
ndex into the constant pool for the name and type entry
11
     * the index into the constant pool which defined the name and type
12
     * signature of the method
12
 */
13
     */
13
    private int nameAndTypeIndex;
14
    private int nameAndTypeIndex;
14
    /** Constructor.  */
15
    /** Constructor. */
15
    public FieldRefCPInfo() {
16
    public MethodRefCPInfo() {
16
        super(CONSTANT_FIELDREF, 1);
17
        super(CONSTANT_METHODREF, 1);
17
    }
18
    }
18
    /**
19
    /**
19
     * read a constant pool entry from a class stream.
20
     * read a constant pool entry from a class stream.
20
     *
21
     *
21
     * @param cpStream the DataInputStream which contains the constant pool
22
     * @param cpStream the DataInputStream which contains the constant pool
22
     *      entry to be read.
23
     *      entry to be read.
23
     * @exception IOException if there is a problem reading the entry from
24
     * @exception IOException if there is a problem reading the entry from
24
     *      the stream.
25
     *      the stream.
25
     */
26
     */
26
    public void read(DataInputStream cpStream) throws IOException {
27
    public void read(DataInputStream cpStream) throws IOException {
27
        classIndex = cpStream.readUnsignedShort();
28
        classIndex = cpStream.readUnsignedShort();
28
        nameAndTypeIndex = cpStream.readUnsignedShort();
29
        nameAndTypeIndex = cpStream.readUnsignedShort();
29
    }
30
    }
31
    /**
32
     * Print a readable version of the constant pool entry.
33
     *
34
     * @return the string representation of this constant pool entry.
35
     */
36
    public String toString() {
37
        String value;
38
        if (isResolved()) {
39
            value = "Method : Class = " + methodClassName + ", name = "
40
                 + methodName + ", type = " + methodType;
41
        } else {
42
            value = "Method : Class index = " + classIndex
43
                 + ", name and type index = " + nameAndTypeIndex;
44
        }
45
        return value;
46
    }
30
    /**
47
    /**
31
     * Resolve this constant pool entry with respect to its dependents in
48
     * Resolve this constant pool entry with respect to its dependents in
32
     * the constant pool.
49
     * the constant pool.
33
     *
50
     *
34
     * @param constantPool the constant pool of which this entry is a member
51
     * @param constantPool the constant pool of which this entry is a member
35
     *      and against which this entry is to be resolved.
52
     *      and against which this entry is to be resolved.
36
     */
53
     */
37
    public void resolve(ConstantPool constantPool) {
54
    public void resolve(ConstantPool constantPool) {
38
        ClassCPInfo fieldClass
55
        ClassCPInfo methodClass
39
            = (ClassCPInfo) constantPool.getEntry(classIndex);
56
             = (ClassCPInfo) constantPool.getEntry(classIndex);
40
        fieldClass.resolve(constantPool);
57
        methodClass.resolve(constantPool);
41
        fieldClassName = fieldClass.getClassName();
58
        methodClassName = methodClass.getClassName();
42
        NameAndTypeCPInfo nt
59
        NameAndTypeCPInfo nt
43
            = (NameAndTypeCPInfo) constantPool.getEntry(nameAndTypeIndex);
60
             = (NameAndTypeCPInfo) constantPool.getEntry(nameAndTypeIndex);
44
        nt.resolve(constantPool);
61
        nt.resolve(constantPool);
45
        fieldName = nt.getName();
62
        methodName = nt.getName();
46
        fieldType = nt.getType();
63
        methodType = nt.getType();
47
        super.resolve(constantPool);
64
        super.resolve(constantPool);
48
    }
65
    }
49
    /**
50
     * Print a readable version of the constant pool entry.
51
     *
52
     * @return the string representation of this constant pool entry.
53
     */
54
    public String toString() {
55
        String value;
56
        if (isResolved()) {
57
            value = "Field : Class = " + fieldClassName + ", name = "
58
                + fieldName + ", type = " + fieldType;
59
        } else {
60
            value = "Field : Class index = " + classIndex
61
                + ", name and type index = " + nameAndTypeIndex;
62
        }
63
        return value;
64
    }
65
    /**
66
    /**
66
     * Gets the name of the class defining the field
67
     * Get the name of the class defining the method
67
     *
68
     *
68
     * @return the name of the class defining the field
69
     * @return the name of the class defining this method
69
     */
70
     */
70
    public String getFieldClassName() {
71
    public String getMethodClassName() {
71
        return fieldClassName;
72
        return methodClassName;
72
    }
73
    }
73
    /**
74
    /**
74
     * Get the name of the field
75
     * Get the name of the method.
75
     *
76
     *
76
     * @return the field's name
77
     * @return the name of the method.
77
     */
78
     */
78
    public String getFieldName() {
79
    public String getMethodName() {
79
        return fieldName;
80
        return methodName;
80
    }
81
    }
81
    /**
82
    /**
82
     * Get the type of the field
83
     * Get the type signature of the method.
83
     *
84
     *
84
     * @return the field's type in string format
85
     * @return the type signature of the method.
85
     */
86
     */
86
    public String getFieldType() {
87
    public String getMethodType() {
87
        return fieldType;
88
        return methodType;
88
    
89
    
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0