for(int i = 0; i < paths.length; i++) { String path = (String)paths[i]; Buffer buffer = jEdit.getBuffer(path); jEdit._closeBuffer(view,buffer); bufferModel.removeElement(path); }
for(int i = 0; i < dockables.length; i++) { String name = dockables[i]; JMenuItem item = new JMenuItem(getDockableTitle(name)); item.setActionCommand(name); item.addActionListener(listener); popup.add(item); }
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/gui/CloseDialog.java File path: /jEdit-4.2/src/org/gjt/sp/jedit/gui/DockableWindowManager.java
Method name: void actionPerformed(ActionEvent) Method name: JPopupMenu createPopupMenu(DockableWindowContainer, String, boolean)
Number of AST nodes: 5 Number of AST nodes: 6
1
for(int i = 0; i < paths.length; i++)
1
for(int i = 0; i < dockables.length; i++)
2
				{
2
			{
3
					String path = (String)paths[i];
3
				String 
4
					Buffer buffer = jEdit.getBuffer(path);
5
					jEdit._closeBuffer(view,buff
4
name = dockables[i];
5
				JMenuItem item = new JMenuItem(getDockableTitle(name));
6
				item.setActionCommand(name);
6
er);
7
				item.addActionListener(listener);
7
					bufferModel.removeElement(path);
8
				popup.add(item);
8
				}
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.3
Clones locationClones are in different classes
Number of node comparisons31
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)1.6
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    26
    for (int i = 0; i < paths.length; i++)
    26
    for (int i = 0; i < paths.length; i++)
    5
    for (int i = 0; i < dockables.length; i++)
    Differences
    Expression1Expression2Difference
    pathsdockablesVARIABLE_NAME_MISMATCH
    java.lang.Object[]java.lang.String[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Object[] of variable paths does not match with type java.lang.String[] of variable dockables
    • Make classes java.lang.Object[] and java.lang.String[] extend a common superclass
    5
    for (int i = 0; i < dockables.length; i++)
    27
    String path = (String)paths[i];
    27
    String path = (String)paths[i];
    6
    String name = dockables[i];
    Differences
    Expression1Expression2Difference
    pathnameVARIABLE_NAME_MISMATCH
    (String)paths[i]dockables[i]TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression (String)paths[i] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dockables[i] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    String name = dockables[i];
                                                                                                                    
    7
    JMenuItem item = new JMenuItem(getDockableTitle(name));
    Preondition Violations
    Unmatched statement JMenuItem item=new JMenuItem(getDockableTitle(name)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    JMenuItem item = new JMenuItem(getDockableTitle(name));
                                                                  
    8
    item.setActionCommand(name);
    Preondition Violations
    Unmatched statement item.setActionCommand(name); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8
    item.setActionCommand(name);
                                                                            
    9
    item.addActionListener(listener);
    Preondition Violations
    Unmatched statement item.addActionListener(listener); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9
    item.addActionListener(listener);
                                            
    10
    popup.add(item);
    28
    Buffer buffer = jEdit.getBuffer(path);
    28
    Buffer buffer = jEdit.getBuffer(path);
    Preondition Violations
    Unmatched statement Buffer buffer=jEdit.getBuffer(path); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                    
    29
    jEdit._closeBuffer(view, buffer);
    29
    jEdit._closeBuffer(view, buffer);
    Preondition Violations
    Unmatched statement jEdit._closeBuffer(view,buffer); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                            
    30
    bufferModel.removeElement(path);
    30
    bufferModel.removeElement(path);
    Preondition Violations
    Unmatched statement bufferModel.removeElement(path); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                            
    Precondition Violations (9)
    Row Violation
    1Type java.lang.Object[] of variable paths does not match with type java.lang.String[] of variable dockables
    2Expression (String)paths[i] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression dockables[i] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Unmatched statement JMenuItem item=new JMenuItem(getDockableTitle(name)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement item.setActionCommand(name); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement item.addActionListener(listener); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement Buffer buffer=jEdit.getBuffer(path); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement jEdit._closeBuffer(view,buffer); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9Unmatched statement bufferModel.removeElement(path); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted