Bookmark[] ret = new Bookmark[BOOKMARKS.length]; for (int i = 0; i < BOOKMARKS.length; i++) { ret[i] = new Bookmark(BOOKMARKS[i][0],BOOKMARKS[i][1],BOOKMARKS[i][2]); } return ret;
String[] result = new String[tableInfos.length]; for (int i = 0; i < result.length; i++) { result[i] = tableInfos[i].getSimpleName(); } return result;
Clone fragments detected by clone detection tool
File path: /sql12/plugins/sqlbookmark/src/net/sourceforge/squirrel_sql/plugins/sqlbookmark/DefaultBookmarksFactory.java File path: /sql12/plugins/refactoring/src/net/sourceforge/squirrel_sql/plugins/refactoring/gui/DropTableDialog.java
Method name: Bookmark[] getDefaultBookmarks() Method name: String[] getSimpleNames(ITableInfo[])
Number of AST nodes: 4 Number of AST nodes: 4
1
Bookmark[] ret = new Bookmark[BOOKMARKS.length];
1
String[] result = new String[tableInfos.length];
2
      for (int i = 0; i < BOOKMARKS.length; i++)
2
        for (int i = 0; i < result.length; i++) {
3
      {
3
    
4
         ret[i] = new Bookmark(BOOKMARKS[i][0],BOOKMARKS[i][1],BOOKMARKS[i][2]);
4
        result[i] = tableInfos[i].getSimpleName();
5
      }
5
      
6
  }
6
      return ret;
7
        return result;
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 comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)1.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                      
    1
    String[] result = new String[tableInfos.length];
    1
    Bookmark[] ret = new Bookmark[BOOKMARKS.length];
                                                                                                      
    2
    for (int i = 0; i < BOOKMARKS.length; i++)
    2
    for (int i = 0; i < BOOKMARKS.length; i++)
    2
    for (int i = 0; i < result.length; i++)
    Differences
    Expression1Expression2Difference
    BOOKMARKSresultVARIABLE_NAME_MISMATCH
    java.lang.String[][]java.lang.String[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable BOOKMARKS.length does not match with type int of variable result.length
    • Make classes java.lang.String[][] and java.lang.String[] extend a common superclass
    2
    for (int i = 0; i < result.length; i++)
                                                                                          
    3
    result[i] = tableInfos[i].getSimpleName();
    Preondition Violations
    Unmatched statement result[i]=tableInfos[i].getSimpleName(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    result[i] = tableInfos[i].getSimpleName();
    3
    ret[i] = new Bookmark(BOOKMARKS[i][0], BOOKMARKS[i][1], BOOKMARKS[i][2]);
    3
    ret[i] = new Bookmark(BOOKMARKS[i][0], BOOKMARKS[i][1], BOOKMARKS[i][2]);
    Preondition Violations
    Unmatched statement ret[i]=new Bookmark(BOOKMARKS[i][0],BOOKMARKS[i][1],BOOKMARKS[i][2]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                    
                                      
    4
    return result;
    Preondition Violations
    Unmatched return result;
    4
    return result;
    4
    return ret;
    4
    return ret;
    Preondition Violations
    Unmatched return ret;
                                
    Precondition Violations (6)
    Row Violation
    1Type int of variable BOOKMARKS.length does not match with type int of variable result.length
    2Unmatched statement result[i]=tableInfos[i].getSimpleName(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement ret[i]=new Bookmark(BOOKMARKS[i][0],BOOKMARKS[i][1],BOOKMARKS[i][2]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return result;
    5Unmatched return ret;
    6The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero