CloneSet319


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
37250.958block
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
137218
plugins/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/UnusedCodeFix.java
237161
plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/RemoveDeclarationCorrectionProposal.java
Clone Instance
1
Line Count
37
Source Line
218
Source File
plugins/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/UnusedCodeFix.java

                                                                                                                     {
                        ASTNode parent = reference.getParent();
                        while (parent instanceof QualifiedName) {
                                parent = parent.getParent();
                        }
                        if (parent instanceof FieldAccess) {
                                parent = parent.getParent();
                        }

                        int nameParentType = parent.getNodeType();
                        if (nameParentType == ASTNode.ASSIGNMENT) {
                                Assignment assignment = (Assignment) parent;
                                Expression rightHand = assignment.getRightHandSide();

                                ASTNode assignParent = assignment.getParent();
                                if (assignParent.getNodeType() == ASTNode.EXPRESSION_STATEMENT && rightHand.getNodeType() != ASTNode.ASSIGNMENT) {
                                        removeVariableWithInitializer(rewrite, rightHand, assignParent, group);
                                }
                                else         {
                                        rewrite.replace(assignment, rewrite.createCopyTarget(rightHand), group);
                                }
                        }
                        else   if (nameParentType == ASTNode.SINGLE_VARIABLE_DECLARATION) {
                                rewrite.remove(parent, group);
                               }
                               else
                               if (nameParentType == ASTNode.VARIABLE_DECLARATION_FRAGMENT) {
                                VariableDeclarationFragment frag = (VariableDeclarationFragment) parent;
                                ASTNode varDecl = frag.getParent();
                                List fragments;
                                if (varDecl instanceof VariableDeclarationExpression) {
                                        fragments = ((VariableDeclarationExpression) varDecl).fragments();
                                }
                                else   if (varDecl instanceof FieldDeclaration) {
                                        fragments = ((FieldDeclaration) varDecl).fragments();
                                       }
                                       else {
                                        fragments = ((VariableDeclarationStatement) varDecl).fragments();
                                       }
                                if (fragments.size() == fUnusedNames.length) {
                                        rewrite.remove(varDecl, group);
                                }
                                else   {
                                        rewrite.remove(frag, group); // don't try to preserve
                                }
                               }
                                                                                                                     }


Clone Instance
2
Line Count
37
Source Line
161
Source File
plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/RemoveDeclarationCorrectionProposal.java

                                                                                        {
                ASTNode parent = reference.getParent();
                while (parent instanceof QualifiedName) {
                        parent = parent.getParent();
                }
                if (parent instanceof FieldAccess) {
                        parent = parent.getParent();
                }

                int nameParentType = parent.getNodeType();
                if (nameParentType == ASTNode.ASSIGNMENT) {
                        Assignment assignment = (Assignment) parent;
                        Expression rightHand = assignment.getRightHandSide();

                        ASTNode assignParent = assignment.getParent();
                        if (assignParent.getNodeType() == ASTNode.EXPRESSION_STATEMENT && rightHand.getNodeType() != ASTNode.ASSIGNMENT) {
                                removeVariableWithInitializer(rewrite, rightHand, assignParent);
                        }
                        else         {
                                rewrite.replace(assignment, rewrite.createCopyTarget(rightHand), null);
                        }
                }
                else   if (nameParentType == ASTNode.SINGLE_VARIABLE_DECLARATION) {
                        rewrite.remove(parent, null);
                       }
                       else
                       if (nameParentType == ASTNode.VARIABLE_DECLARATION_FRAGMENT) {
                        VariableDeclarationFragment frag = (VariableDeclarationFragment) parent;
                        ASTNode varDecl = frag.getParent();
                        List fragments;
                        if (varDecl instanceof VariableDeclarationExpression) {
                                fragments = ((VariableDeclarationExpression) varDecl).fragments();
                        }
                        else   if (varDecl instanceof FieldDeclaration) {
                                fragments = ((FieldDeclaration) varDecl).fragments();
                               }
                               else {
                                fragments = ((VariableDeclarationStatement) varDecl).fragments();
                               }
                        if (fragments.size() == 1) {
                                rewrite.remove(varDecl, null);
                        }
                        else   {
                                rewrite.remove(frag, null); // don't try to preserve
                        }
                       }
                                                                                        }


Clone AbstractionParameter Count: 5Parameter Bindings

{
  ASTNode parent = reference.getParent();
  while (parent instanceof QualifiedName) {
    parent = parent.getParent();
  }
  if (parent instanceof FieldAccess) {
    parent = parent.getParent();
  }
  int nameParentType = parent.getNodeType();
  if (nameParentType == ASTNode.ASSIGNMENT) {
    Assignment assignment = (Assignment) parent;
    Expression rightHand = assignment.getRightHandSide();
    ASTNode assignParent = assignment.getParent();
    if (assignParent.getNodeType() == ASTNode.EXPRESSION_STATEMENT && rightHand.getNodeType() != ASTNode.ASSIGNMENT) {
      removeVariableWithInitializer( [[#variablea126c440]],  [[#variablea126c3c0]],  [[#variablea126c360]]);
    }
    else {
      rewrite.replace(assignment, rewrite.createCopyTarget(rightHand),  [[#variablea126c2e0]]);
    }
  }
  else
    if (nameParentType == ASTNode.SINGLE_VARIABLE_DECLARATION) {
      rewrite.remove(parent,  [[#variablea126c2e0]]);
    }
    else
      if (nameParentType == ASTNode.VARIABLE_DECLARATION_FRAGMENT) {
        VariableDeclarationFragment frag = (VariableDeclarationFragment) parent;
        ASTNode varDecl = frag.getParent();
        List fragments;
        if (varDecl instanceof VariableDeclarationExpression) {
          fragments = ((VariableDeclarationExpression) varDecl).fragments();
        }
        else
          if (varDecl instanceof FieldDeclaration) {
            fragments = ((FieldDeclaration) varDecl).fragments();
          }
          else {
            fragments = ((VariableDeclarationStatement) varDecl).fragments();
          }
        if (fragments.size() == [[#variablea126c240]]) {
          rewrite.remove(varDecl,  [[#variablea126c2e0]]);
        }
        else {
          rewrite.remove(frag,  [[#variablea126c2e0]]); // don't try to preserve
        }
      }
}
 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#a126c440]]
rewrite 
12[[#a126c440]]
rewrite, rightHand 
21[[#a126c3c0]]
rightHand 
22[[#a126c3c0]]
assignParent 
31[[#a126c360]]
assignParent 
32[[#a126c360]]
group 
41[[#a126c2e0]]
null 
42[[#a126c2e0]]
group 
51[[#a126c240]]
1 
52[[#a126c240]]
fUnusedNames.length