| Previous CloneSet | Next CloneSet | Back to Main Report |
| Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
|---|---|---|---|---|
| 32 | 2 | 3 | 0.987 | class_body_declaration |
| Clone Abstraction | Parameter Bindings |
| Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
|---|---|---|---|
| 1 | 32 | 2971 | plugins/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java |
| 2 | 32 | 3014 | plugins/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java |
| ||||
/**
* Returns whether the given marker references the given Java element.
* Used for markers, which denote a Java element rather than a resource.
*
* @param element the element
* @param marker the marker
* @return <code>true</code> if the marker references the element, false otherwise
* @exception CoreException if the <code>IMarker.getAttribute</code> on the marker fails
*/
public static boolean isReferencedBy(IJavaElement element, IMarker marker) throws CoreException {
// only match units or classfiles
if (element instanceof IMember) {
IMember member = (IMember) element;
if (member.isBinary()) {
element = member.getClassFile();
}
else {
element = member.getCompilationUnit();
}
}
if (element == null) return false;
if (marker == null) return false;
String markerHandleId = (String) marker.getAttribute(ATT_HANDLE_ID);
if (markerHandleId == null) return false;
IJavaElement markerElement = JavaCore.create(markerHandleId);
while (true) {
if (element.equals(markerElement)) return true; // external elements may still be equal with different handleIDs.
// cycle through enclosing types in case marker is associated with a classfile (15568)
if (markerElement instanceof IClassFile) {
IType enclosingType = ((IClassFile) markerElement).getType().getDeclaringType();
if (enclosingType != null) {
markerElement = enclosingType.getClassFile(); // retry with immediate enclosing classfile
continue ;
}
}
break;
}
return false;
}
|
| ||||
/**
* Returns whether the given marker delta references the given Java element.
* Used for markers deltas, which denote a Java element rather than a resource.
*
* @param element the element
* @param markerDelta the marker delta
* @return <code>true</code> if the marker delta references the element
* @exception CoreException if the <code>IMarkerDelta.getAttribute</code> on the marker delta fails
*/
public static boolean isReferencedBy(IJavaElement element, IMarkerDelta markerDelta) throws CoreException {
// only match units or classfiles
if (element instanceof IMember) {
IMember member = (IMember) element;
if (member.isBinary()) {
element = member.getClassFile();
}
else {
element = member.getCompilationUnit();
}
}
if (element == null) return false;
if (markerDelta == null) return false;
String markerDeltarHandleId = (String) markerDelta.getAttribute(ATT_HANDLE_ID);
if (markerDeltarHandleId == null) return false;
IJavaElement markerElement = JavaCore.create(markerDeltarHandleId);
while (true) {
if (element.equals(markerElement)) return true; // external elements may still be equal with different handleIDs.
// cycle through enclosing types in case marker is associated with a classfile (15568)
if (markerElement instanceof IClassFile) {
IType enclosingType = ((IClassFile) markerElement).getType().getDeclaringType();
if (enclosingType != null) {
markerElement = enclosingType.getClassFile(); // retry with immediate enclosing classfile
continue ;
}
}
break;
}
return false;
}
|
| |||
/**
* Returns whether the given marker references the given Java element.
* Used for markers, which denote a Java element rather than a resource.
*
* @param element the element
* @param marker the marker
* @return <code>true</code> if the marker references the element, false otherwise
* @exception CoreException if the <code>IMarker.getAttribute</code> on the marker fails
*/
/**
* Returns whether the given marker delta references the given Java element.
* Used for markers deltas, which denote a Java element rather than a resource.
*
* @param element the element
* @param markerDelta the marker delta
* @return <code>true</code> if the marker delta references the element
* @exception CoreException if the <code>IMarkerDelta.getAttribute</code> on the marker delta fails
*/
public static boolean isReferencedBy(IJavaElement element, [[#variable8f5f5860]] [[#variable8f5f57e0]]) throws CoreException {
// only match units or classfiles
if (element instanceof IMember) {
IMember member = (IMember) element;
if (member.isBinary()) {
element = member.getClassFile();
}
else {
element = member.getCompilationUnit();
}
}
if (element == null)
return false;
if ( [[#variable8f5f57e0]]== null)
return false;
String [[#variable8f5f5780]]= (String) [[#variable8f5f57e0]].getAttribute(ATT_HANDLE_ID);
if ( [[#variable8f5f5780]]== null)
return false;
IJavaElement markerElement = JavaCore.create( [[#variable8f5f5780]]);
while (true) {
if (element.equals(markerElement))
return true; // external elements may still be equal with different handleIDs.
// cycle through enclosing types in case marker is associated with a classfile (15568)
if (markerElement instanceof IClassFile) {
IType enclosingType = ((IClassFile) markerElement).getType().getDeclaringType();
if (enclosingType != null) {
markerElement = enclosingType.getClassFile(); // retry with immediate enclosing classfile
continue ;
}
}
break;
}
return false;
}
|
| CloneAbstraction |
| Parameter Index | Clone Instance | Parameter Name | Value |
|---|---|---|---|
| 1 | 1 | [[#8f5f5860]] | IMarker |
| 1 | 2 | [[#8f5f5860]] | IMarkerDelta |
| 2 | 1 | [[#8f5f57e0]] | marker |
| 2 | 2 | [[#8f5f57e0]] | markerDelta |
| 3 | 1 | [[#8f5f5780]] | markerHandleId |
| 3 | 2 | [[#8f5f5780]] | markerDeltarHandleId |