Previous CloneSet | Next CloneSet | Back to Main Report |
Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
---|---|---|---|---|
37 | 2 | 5 | 0.958 | block |
Clone Abstraction | Parameter Bindings |
Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
---|---|---|---|
1 | 37 | 218 | plugins/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/UnusedCodeFix.java |
2 | 37 | 161 | 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, 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 } } } |
| ||||
{ 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 } } } |
| |||
{ 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 Index | Clone Instance | Parameter Name | Value |
---|---|---|---|
1 | 1 | [[#a126c440]] | rewrite |
1 | 2 | [[#a126c440]] | rewrite, rightHand |
2 | 1 | [[#a126c3c0]] | rightHand |
2 | 2 | [[#a126c3c0]] | assignParent |
3 | 1 | [[#a126c360]] | assignParent |
3 | 2 | [[#a126c360]] | group |
4 | 1 | [[#a126c2e0]] | null |
4 | 2 | [[#a126c2e0]] | group |
5 | 1 | [[#a126c240]] | 1 |
5 | 2 | [[#a126c240]] | fUnusedNames.length |