| Previous CloneSet | Next CloneSet | Back to Main Report |
| Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
|---|---|---|---|---|
| 17 | 2 | 6 | 0.955 | class_body_declaration |
| Clone Abstraction | Parameter Bindings |
| Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
|---|---|---|---|
| 1 | 17 | 288 | plugins/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/dom/Bindings.java |
| 2 | 17 | 438 | plugins/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/dom/Bindings.java |
| ||||
/**
* Finds the field specified by <code>fieldName</code> in
* the type hierarchy denoted by the given type. Returns <code>null</code> if no such field
* exists. If the field is defined in more than one super type only the first match is
* returned. First the super class is examined and than the implemented interfaces.
* @param type The type to search the field in
* @param fieldName The name of the field to find
* @return the variable binding representing the field
*/
public static IVariableBinding findFieldInHierarchy(ITypeBinding type, String fieldName) {
IVariableBinding field = findFieldInType(type, fieldName);
if (field != null)
return field;
ITypeBinding superClass = type.getSuperclass();
if (superClass != null) {
field = findFieldInHierarchy(superClass, fieldName);
if (field != null)
return field;
}
ITypeBinding[] interfaces = type.getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
field = findFieldInHierarchy(interfaces[i], fieldName);
if (field != null) // no private fields in interfaces
return field;
}
return null;
}
|
| ||||
/**
* Finds a method in the hierarchy of <code>type</code> that is overridden by </code>binding</code>.
* Returns <code>null</code> if no such method exists. If the method is defined in more than one super type only the first match is
* returned. First the super class is examined and than the implemented interfaces.
* @param type The type to search the method in
* @param binding The method that overrrides
* @return the method binding overridden the method
*/
public static IMethodBinding findOverriddenMethodInHierarchy(ITypeBinding type, IMethodBinding binding) {
IMethodBinding method = findOverriddenMethodInType(type, binding);
if (method != null)
return method;
ITypeBinding superClass = type.getSuperclass();
if (superClass != null) {
method = findOverriddenMethodInHierarchy(superClass, binding);
if (method != null)
return method;
}
ITypeBinding[] interfaces = type.getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
method = findOverriddenMethodInHierarchy(interfaces[i], binding);
if (method != null)
return method;
}
return null;
}
|
| |||
/**
* Finds the field specified by <code>fieldName</code> in
* the type hierarchy denoted by the given type. Returns <code>null</code> if no such field
* exists. If the field is defined in more than one super type only the first match is
* returned. First the super class is examined and than the implemented interfaces.
* @param type The type to search the field in
* @param fieldName The name of the field to find
* @return the variable binding representing the field
*/
/**
* Finds a method in the hierarchy of <code>type</code> that is overridden by </code>binding</code>.
* Returns <code>null</code> if no such method exists. If the method is defined in more than one super type only the first match is
* returned. First the super class is examined and than the implemented interfaces.
* @param type The type to search the method in
* @param binding The method that overrrides
* @return the method binding overridden the method
*/
public static [[#variablec19280c0]] [[#variablec1928060]](ITypeBinding type, [[#variableb3403f80]] [[#variableb3403ee0]]) {
[[#variablec19280c0]] [[#variableb3403e40]]= [[#variableb3403dc0]](type, [[#variableb3403ee0]]);
if ( [[#variableb3403e40]]!= null)
return [[#variableb3403e40]];
ITypeBinding superClass = type.getSuperclass();
if (superClass != null) {
[[#variableb3403e40]]= [[#variablec1928060]](superClass, [[#variableb3403ee0]]);
if ( [[#variableb3403e40]]!= null)
return [[#variableb3403e40]];
}
ITypeBinding[] interfaces = type.getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
[[#variableb3403e40]]= [[#variablec1928060]](interfaces[i], [[#variableb3403ee0]]);
if ( [[#variableb3403e40]]!= null) // no private fields in interfaces
return [[#variableb3403e40]];
}
return null;
}
|
| CloneAbstraction |
| Parameter Index | Clone Instance | Parameter Name | Value |
|---|---|---|---|
| 1 | 1 | [[#c19280c0]] | IVariableBinding |
| 1 | 2 | [[#c19280c0]] | IMethodBinding |
| 2 | 1 | [[#c1928060]] | findFieldInHierarchy |
| 2 | 2 | [[#c1928060]] | findOverriddenMethodInHierarchy |
| 3 | 1 | [[#b3403f80]] | String |
| 3 | 2 | [[#b3403f80]] | IMethodBinding |
| 4 | 1 | [[#b3403ee0]] | fieldName |
| 4 | 2 | [[#b3403ee0]] | binding |
| 5 | 1 | [[#b3403e40]] | field |
| 5 | 2 | [[#b3403e40]] | method |
| 6 | 1 | [[#b3403dc0]] | findFieldInType |
| 6 | 2 | [[#b3403dc0]] | findOverriddenMethodInType |