FontDescriptor fontDescriptor = (FontDescriptor)object; try { result = fontDescriptor.createFont(display); } catch (DeviceResourceException exception) { EMFEditUIPlugin.INSTANCE.log(exception); }
ColorDescriptor colorDescriptor = (ColorDescriptor)object; try { result = colorDescriptor.createColor(display); } catch (DeviceResourceException exception) { EMFEditUIPlugin.INSTANCE.log(exception); }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/edit/ui/provider/ExtendedFontRegistry.java File path: /emf-2.4.1/src/org/eclipse/emf/edit/ui/provider/ExtendedColorRegistry.java
Method name: Font getFont(Font, Object) Method name: Color getColor(Color, Color, Object)
Number of AST nodes: 3 Number of AST nodes: 3
1
FontDescriptor fontDescriptor = (FontDescriptor)object;
1
ColorDescriptor colorDescriptor = (ColorDescriptor)object;
2
          try
2
          try
3
          {
3
          {
4
            result = fontDescriptor.createFont(display);
4
            result = colorDescriptor.createColor(display);
5
          }
5
          }
6
          catch (DeviceResourceException exception)
6
          catch (DeviceResourceException exception)
7
          {
7
          {
8
            EMFEditUIPlugin.INSTANCE.log(exception);
8
            EMFEditUIPlugin.INSTANCE.log(exception);
9
          }
9
          }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are in different classes
Number of node comparisons6
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    9
    FontDescriptor fontDescriptor = (FontDescriptor)object;
    9
    FontDescriptor fontDescriptor = (FontDescriptor)object;
    10
    ColorDescriptor colorDescriptor = (ColorDescriptor)object;
    Differences
    Expression1Expression2Difference
    org.eclipse.jface.resource.FontDescriptororg.eclipse.jface.resource.ColorDescriptorSUBCLASS_TYPE_MISMATCH
    fontDescriptorcolorDescriptorVARIABLE_NAME_MISMATCH
    org.eclipse.jface.resource.FontDescriptororg.eclipse.jface.resource.ColorDescriptorSUBCLASS_TYPE_MISMATCH
    org.eclipse.jface.resource.FontDescriptororg.eclipse.jface.resource.ColorDescriptorSUBCLASS_TYPE_MISMATCH
    10
    ColorDescriptor colorDescriptor = (ColorDescriptor)object;
    10
    try
    11
    try
    11
    result = fontDescriptor.createFont(display);
    11
    result = fontDescriptor.createFont(display);
    12
    result = colorDescriptor.createColor(display);
    Differences
    Expression1Expression2Difference
    org.eclipse.swt.graphics.Fontorg.eclipse.swt.graphics.ColorSUBCLASS_TYPE_MISMATCH
    createFontcreateColorMETHOD_INVOCATION_NAME_MISMATCH
    fontDescriptorcolorDescriptorVARIABLE_NAME_MISMATCH
    org.eclipse.jface.resource.FontDescriptororg.eclipse.jface.resource.ColorDescriptorSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression fontDescriptor.createFont(display) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression colorDescriptor.createColor(display) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12
    result = colorDescriptor.createColor(display);
    Precondition Violations (3)
    Row Violation
    1Expression fontDescriptor.createFont(display) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression colorDescriptor.createColor(display) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Clone fragment #1 returns variable result with type org.eclipse.swt.graphics.Font , while Clone fragment #2 returns variable result with type org.eclipse.swt.graphics.Color