Previous CloneSet | Next CloneSet | Back to Main Report |
Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
---|---|---|---|---|
33 | 2 | 0 | 1.000 | class_body_declarations[2] |
Clone Abstraction | Parameter Bindings |
Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
---|---|---|---|
1 | 33 | 829 | plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlightings.java |
2 | 33 | 1122 | plugins/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/SemanticHighlightings.java |
| ||||
/** * Extracts the method binding from the token's simple name. The method * binding is either the token's binding (if the parent of token is a * method call or declaration) or the constructor binding of a class * instance creation if the node is the type name of a class instance * creation. * * @param token the token to extract the method binding from * @return the corresponding method binding, or <code>null</code> */ private IBinding getMethodBinding(SemanticToken token) { IBinding binding = null; // work around: https://bugs.eclipse.org/bugs/show_bug.cgi?id=62605 ASTNode node = token.getNode(); ASTNode parent = node.getParent(); while (isTypePath(node, parent)) { node = parent; parent = parent.getParent(); } if (parent != null && node.getLocationInParent() == ClassInstanceCreation.TYPE_PROPERTY) binding = ((ClassInstanceCreation) parent).resolveConstructorBinding(); else binding = token.getBinding(); return binding; } /** * Returns <code>true</code> if the given child/parent nodes are valid * sub nodes of a <code>Type</code> ASTNode. * @param child the child node * @param parent the parent node * @return <code>true</code> if the nodes may be the sub nodes of a type node, false otherwise */ private boolean isTypePath(ASTNode child, ASTNode parent) { if (parent instanceof Type) { StructuralPropertyDescriptor location = child.getLocationInParent(); return location == ParameterizedType.TYPE_PROPERTY || location == SimpleType.NAME_PROPERTY; } else if (parent instanceof QualifiedName) { StructuralPropertyDescriptor location = child.getLocationInParent(); return location == QualifiedName.NAME_PROPERTY; } return false; } |
| ||||
/** * Extracts the method binding from the token's simple name. The method * binding is either the token's binding (if the parent of token is a * method call or declaration) or the constructor binding of a class * instance creation if the node is the type name of a class instance * creation. * * @param token the token to extract the method binding from * @return the corresponding method binding, or <code>null</code> */ private IBinding getMethodBinding(SemanticToken token) { IBinding binding = null; // work around: https://bugs.eclipse.org/bugs/show_bug.cgi?id=62605 ASTNode node = token.getNode(); ASTNode parent = node.getParent(); while (isTypePath(node, parent)) { node = parent; parent = parent.getParent(); } if (parent != null && node.getLocationInParent() == ClassInstanceCreation.TYPE_PROPERTY) binding = ((ClassInstanceCreation) parent).resolveConstructorBinding(); else binding = token.getBinding(); return binding; } /** * Returns <code>true</code> if the given child/parent nodes are valid * sub nodes of a <code>Type</code> ASTNode. * @param child the child node * @param parent the parent node * @return <code>true</code> if the nodes may be the sub nodes of a type node, false otherwise */ private boolean isTypePath(ASTNode child, ASTNode parent) { if (parent instanceof Type) { StructuralPropertyDescriptor location = child.getLocationInParent(); return location == ParameterizedType.TYPE_PROPERTY || location == SimpleType.NAME_PROPERTY; } else if (parent instanceof QualifiedName) { StructuralPropertyDescriptor location = child.getLocationInParent(); return location == QualifiedName.NAME_PROPERTY; } return false; } |
| |||
/** * Extracts the method binding from the token's simple name. The method * binding is either the token's binding (if the parent of token is a * method call or declaration) or the constructor binding of a class * instance creation if the node is the type name of a class instance * creation. * * @param token the token to extract the method binding from * @return the corresponding method binding, or <code>null</code> */ private IBinding getMethodBinding(SemanticToken token) { IBinding binding = null; // work around: https://bugs.eclipse.org/bugs/show_bug.cgi?id=62605 ASTNode node = token.getNode(); ASTNode parent = node.getParent(); while (isTypePath(node, parent)) { node = parent; parent = parent.getParent(); } if (parent != null && node.getLocationInParent() == ClassInstanceCreation.TYPE_PROPERTY) binding = ((ClassInstanceCreation) parent).resolveConstructorBinding(); else binding = token.getBinding(); return binding; } /** * Returns <code>true</code> if the given child/parent nodes are valid * sub nodes of a <code>Type</code> ASTNode. * @param child the child node * @param parent the parent node * @return <code>true</code> if the nodes may be the sub nodes of a type node, false otherwise */ private boolean isTypePath(ASTNode child, ASTNode parent) { if (parent instanceof Type) { StructuralPropertyDescriptor location = child.getLocationInParent(); return location == ParameterizedType.TYPE_PROPERTY || location == SimpleType.NAME_PROPERTY; } else if (parent instanceof QualifiedName) { StructuralPropertyDescriptor location = child.getLocationInParent(); return location == QualifiedName.NAME_PROPERTY; } return false; } |
CloneAbstraction |
Parameter Index | Clone Instance | Parameter Name | Value |
---|---|---|---|
None |