IObjectTreeAPI objectTreeAPI; if(_activeActiveSessionWindow instanceof SessionInternalFrame) { objectTreeAPI = ((SessionInternalFrame)_activeActiveSessionWindow).getObjectTreeAPI(); } else if(_activeActiveSessionWindow instanceof ObjectTreeInternalFrame) { objectTreeAPI = ((ObjectTreeInternalFrame)_activeActiveSessionWindow).getObjectTreeAPI(); } else { throw new IllegalStateException("ObjectTreeApi can only be provided for SessionInternalFrame or ObjectTreeInternalFrame"); } return objectTreeAPI;
ISQLPanelAPI sqlPanelAPI; if(_activeActiveSessionWindow instanceof SessionInternalFrame) { sqlPanelAPI = ((SessionInternalFrame)_activeActiveSessionWindow).getSQLPanelAPI(); } else if(_activeActiveSessionWindow instanceof SQLInternalFrame) { sqlPanelAPI = ((SQLInternalFrame)_activeActiveSessionWindow).getSQLPanelAPI(); } else { throw new IllegalStateException("SQLPanelApi can only be provided for SessionInternalFrame or SQLInternalFrame"); } return sqlPanelAPI;
Clone fragments detected by clone detection tool
File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/session/Session.java File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/session/Session.java
Method name: IObjectTreeAPI getObjectTreeAPIOfActiveSessionWindow() Method name: ISQLPanelAPI getSQLPanelAPIOfActiveSessionWindow()
Number of AST nodes: 7 Number of AST nodes: 7
1
IObjectTreeAPI objectTreeAPI;
1
ISQLPanelAPI sqlPanelAPI;
2
      if(_activeActiveSessionWindow instanceof SessionInternalFrame)
2
      if(_activeActiveSessionWindow instanceof SessionInternalFrame)
3
      {
3
      {
4
         objectTreeAPI = ((SessionInternalFrame)_activeActiveSessionWindow).getObjectTreeAPI();
4
         sqlPanelAPI = ((SessionInternalFrame)_activeActiveSessionWindow).getSQLPanelAPI();
5
      }
5
      }
6
      else if(_activeActiveSessionWindow instanceof ObjectTreeInternalFrame)
6
      else if(_activeActiveSessionWindow instanceof SQLInternalFrame)
7
      {
7
      {
8
         objectTreeAPI = ((ObjectTreeInternalFrame)_activeActiveSessionWindow).getObjectTreeAPI();
8
         sqlPanelAPI = ((SQLInternalFrame)_activeActiveSessionWindow).getSQLPanelAPI();
9
      }
9
      }
10
      else
10
      else
11
      {
11
      {
12
         throw new IllegalStateException("ObjectTreeApi can only be provided for SessionInternalFrame or ObjectTreeInternalFrame");
12
         throw new IllegalStateException("SQLPanelApi can only be provided for SessionInternalFrame or SQLInternalFrame");
13
      }
13
      }
14
      return objectTreeAPI;
14
      return sqlPanelAPI;
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.7
Clones locationClones are declared in the same class
Number of node comparisons24
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)9.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                            
    1
    ISQLPanelAPI sqlPanelAPI;
    1
    IObjectTreeAPI objectTreeAPI;
                                                                    
    2
    if (_activeActiveSessionWindow instanceof SessionInternalFrame)
    2
    if (_activeActiveSessionWindow instanceof SessionInternalFrame)
                                                                                                                                                                          
    3
    sqlPanelAPI = ((SessionInternalFrame)_activeActiveSessionWindow).getSQLPanelAPI();
    Preondition Violations
    Unmatched statement sqlPanelAPI=((SessionInternalFrame)_activeActiveSessionWindow).getSQLPanelAPI(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3
    sqlPanelAPI = ((SessionInternalFrame)_activeActiveSessionWindow).getSQLPanelAPI();
    3
    objectTreeAPI = ((SessionInternalFrame)_activeActiveSessionWindow).getObjectTreeAPI();
    3
    objectTreeAPI = ((SessionInternalFrame)_activeActiveSessionWindow).getObjectTreeAPI();
    Preondition Violations
    Unmatched statement objectTreeAPI=((SessionInternalFrame)_activeActiveSessionWindow).getObjectTreeAPI(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                                                                  
    4
    else if (_activeActiveSessionWindow instanceof ObjectTreeInternalFrame)
    4
    else if (_activeActiveSessionWindow instanceof ObjectTreeInternalFrame)
    4
    else if (_activeActiveSessionWindow instanceof SQLInternalFrame)
    Differences
    Expression1Expression2Difference
    net.sourceforge.squirrel_sql.client.gui.session.ObjectTreeInternalFramenet.sourceforge.squirrel_sql.client.gui.session.SQLInternalFrameSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression _activeActiveSessionWindow instanceof ObjectTreeInternalFrame cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression _activeActiveSessionWindow instanceof SQLInternalFrame cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    else if (_activeActiveSessionWindow instanceof SQLInternalFrame)
                                                                                                                                                                  
    5
    sqlPanelAPI = ((SQLInternalFrame)_activeActiveSessionWindow).getSQLPanelAPI();
    Preondition Violations
    Unmatched statement sqlPanelAPI=((SQLInternalFrame)_activeActiveSessionWindow).getSQLPanelAPI(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5
    sqlPanelAPI = ((SQLInternalFrame)_activeActiveSessionWindow).getSQLPanelAPI();
    5
    objectTreeAPI = ((ObjectTreeInternalFrame)_activeActiveSessionWindow).getObjectTreeAPI();
    5
    objectTreeAPI = ((ObjectTreeInternalFrame)_activeActiveSessionWindow).getObjectTreeAPI();
    Preondition Violations
    Unmatched statement objectTreeAPI=((ObjectTreeInternalFrame)_activeActiveSessionWindow).getObjectTreeAPI(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                                                                        
    else
    else
    6
    throw new IllegalStateException("ObjectTreeApi can only be provided for SessionInternalFrame or ObjectTreeInternalFrame");
    6
    throw new IllegalStateException("ObjectTreeApi can only be provided for SessionInternalFrame or ObjectTreeInternalFrame");
    6
    throw new IllegalStateException("SQLPanelApi can only be provided for SessionInternalFrame or SQLInternalFrame");
    Differences
    Expression1Expression2Difference
    "ObjectTreeApi can only be provided for SessionInternalFrame or ObjectTreeInternalFrame""SQLPanelApi can only be provided for SessionInternalFrame or SQLInternalFrame"LITERAL_VALUE_MISMATCH
    6
    throw new IllegalStateException("SQLPanelApi can only be provided for SessionInternalFrame or SQLInternalFrame");
                                                
    7
    return sqlPanelAPI;
    Preondition Violations
    Unmatched return sqlPanelAPI;
    7
    return sqlPanelAPI;
    7
    return objectTreeAPI;
    7
    return objectTreeAPI;
    Preondition Violations
    Unmatched return objectTreeAPI;
                                                    
    Precondition Violations (8)
    Row Violation
    1Unmatched statement sqlPanelAPI=((SessionInternalFrame)_activeActiveSessionWindow).getSQLPanelAPI(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement objectTreeAPI=((SessionInternalFrame)_activeActiveSessionWindow).getObjectTreeAPI(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Expression _activeActiveSessionWindow instanceof ObjectTreeInternalFrame cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression _activeActiveSessionWindow instanceof SQLInternalFrame cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Unmatched statement sqlPanelAPI=((SQLInternalFrame)_activeActiveSessionWindow).getSQLPanelAPI(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6Unmatched statement objectTreeAPI=((ObjectTreeInternalFrame)_activeActiveSessionWindow).getObjectTreeAPI(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    7Unmatched return sqlPanelAPI;
    8Unmatched return objectTreeAPI;