return new DefaultListCellRenderer() { public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); PlasticTheme theme = (PlasticTheme) value; label.setText(theme.getName()); return label; } };
super.getListCellRendererComponent(arg0, arg1, arg2, arg3, arg4); ColumbaHeader header = (ColumbaHeader) list.get(arg1); String subject = (String) header.get("columba.subject"); setText(subject); return this;
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/themes/plugin/PlasticLookAndFeelConfigPlugin.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/gui/config/template/HeaderCellRenderer.java
Method name: ListCellRenderer createThemeRenderer() Method name: Component getListCellRendererComponent(JList, Object, int, boolean, boolean)
Number of AST nodes: 1 Number of AST nodes: 5
1
return new DefaultListCellRenderer() {
2
                public Component getListCellRendererComponent(JList list,
3
                    Object value, int index, boolean isSelected,
4
                    boolean cellHasFocus) {
5
                    JLabel label = (JLabel) super.getListCellRendererComponent(list,
6
                            value, index, isSelected, cellHasFocus);
7
                    PlasticTheme theme = (PlasticTheme) value;
8
            
1
super.getListCellRendererComponent(arg0, arg1, arg2, arg3, arg4);
2
        ColumbaHeader header = (ColumbaHeader) list.get(arg1);
3
        String subject = (String) header.get("columba.subject");
9
        label.setText(theme.getName());
4
        setText(
10
      
5
subject);
11
              return label;
6
        return 
12
                }
13
            };
7
this;
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.0
Clones locationClones are in different classes
Number of node comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                    
    1
    super.getListCellRendererComponent(arg0, arg1, arg2, arg3, arg4);
                                                                                                                
    2
    ColumbaHeader header = (ColumbaHeader)list.get(arg1);
                                                                                                                    
    3
    String subject = (String)header.get("columba.subject");
                                            
    4
    setText(subject);
    Preondition Violations
    Unmatched statement setText(subject); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4
    setText(subject);
    1
    return new DefaultListCellRenderer() {...};
    1
    return new DefaultListCellRenderer() {...};
    5
    return this;
    Differences
    Expression1Expression2Difference
    org.columba.mail.gui.config.template.HeaderCellRendererSUBCLASS_TYPE_MISMATCH
    new DefaultListCellRenderer(){ public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus){ JLabel label=(JLabel)super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus); PlasticTheme theme=(PlasticTheme)value; label.setText(theme.getName()); return label; } } thisTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression new DefaultListCellRenderer(){ public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus){ JLabel label=(JLabel)super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus); PlasticTheme theme=(PlasticTheme)value; label.setText(theme.getName()); return label; } } cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Super method call return new DefaultListCellRenderer(){ public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus){ JLabel label=(JLabel)super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus); PlasticTheme theme=(PlasticTheme)value; label.setText(theme.getName()); return label; } } ; cannot be extracted from method
    5
    return this;
    Precondition Violations (4)
    Row Violation
    1Unmatched statement setText(subject); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Expression new DefaultListCellRenderer(){ public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus){ JLabel label=(JLabel)super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus); PlasticTheme theme=(PlasticTheme)value; label.setText(theme.getName()); return label; } } cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Super method call return new DefaultListCellRenderer(){ public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus){ JLabel label=(JLabel)super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus); PlasticTheme theme=(PlasticTheme)value; label.setText(theme.getName()); return label; } } ; cannot be extracted from method
    4The refactoring of the clones is infeasible, because classes org.columba.core.gui.themes.plugin.PlasticLookAndFeelConfigPlugin and org.columba.mail.gui.config.template.HeaderCellRenderer do not have a common superclass