CloneSet112


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
53230.953statement_sequence[5]
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
153406
plugins/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/StubUtility2.java
252494
plugins/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/StubUtility2.java
Clone Instance
1
Line Count
53
Source Line
406
Source File
plugins/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/StubUtility2.java

                String delimiter = StubUtility.getLineDelimiterUsed(unit);
                if ( !deferred) {

                        Block body = ast.newBlock();
                        decl.setBody(body);

                        String bodyStatement = ""; //$NON-NLS-1$
                        ITypeBinding declaringType = binding.getDeclaringClass();
                        if (Modifier.isAbstract(binding.getModifiers()) || declaringType.isAnnotation() || declaringType.isInterface()) {
                                Expression expression = ASTNodeFactory.newDefaultExpression(ast, decl.getReturnType2(), decl.getExtraDimensions());
                                if (expression != null) {
                                        ReturnStatement returnStatement = ast.newReturnStatement();
                                        returnStatement.setExpression(expression);
                                        bodyStatement = ASTNodes.asFormattedString(returnStatement, 0, delimiter);
                                }
                        }
                        else   {
                                SuperMethodInvocation invocation = ast.newSuperMethodInvocation();
                                invocation.setName(ast.newSimpleName(binding.getName()));
                                SingleVariableDeclaration varDecl = null;
                                for (Iterator iterator = parameters.iterator(); iterator.hasNext();) {
                                        varDecl = (SingleVariableDeclaration) iterator.next();
                                        invocation.arguments().add(ast.newSimpleName(varDecl.getName().getIdentifier()));
                                }
                                Expression expression = invocation;
                                Type returnType = decl.getReturnType2();
                                if (returnType != null && (returnType instanceof PrimitiveType) && ((PrimitiveType) returnType).getPrimitiveTypeCode().equals(PrimitiveType.VOID)) {
                                        bodyStatement = ASTNodes.asFormattedString(ast.newExpressionStatement(expression), 0, delimiter);
                                }
                                else   {
                                        ReturnStatement returnStatement = ast.newReturnStatement();
                                        returnStatement.setExpression(expression);
                                        bodyStatement = ASTNodes.asFormattedString(returnStatement, 0, delimiter);
                                }
                        }
                        String placeHolder = CodeGeneration.getMethodBodyContent(unit, type, binding.getName(), false, bodyStatement, delimiter);
                        if (placeHolder != null) {
                                ASTNode todoNode = rewrite.createStringPlaceholder(placeHolder, ASTNode.RETURN_STATEMENT);
                                body.statements().add(todoNode);
                        }
                }
                if (settings.createComments) {
                        String string = CodeGeneration.getMethodComment(unit, type, decl, binding, delimiter);
                        if (string != null) {
                                Javadoc javadoc = (Javadoc) rewrite.createStringPlaceholder(string, ASTNode.JAVADOC);
                                decl.setJavadoc(javadoc);
                        }
                }
                if (settings.overrideAnnotation && JavaModelUtil.is50OrHigher(unit.getJavaProject())) {
                        addOverrideAnnotation(rewrite, decl, binding);
                }

                return decl;


Clone Instance
2
Line Count
52
Source Line
494
Source File
plugins/org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/StubUtility2.java

                String delimiter = StubUtility.getLineDelimiterUsed(unit);
                if ( !deferred) {

                        Block body = ast.newBlock();
                        decl.setBody(body);

                        String bodyStatement = ""; //$NON-NLS-1$
                        ITypeBinding declaringType = binding.getDeclaringClass();
                        if (Modifier.isAbstract(binding.getModifiers()) || declaringType.isAnnotation() || declaringType.isInterface()) {
                                Expression expression = ASTNodeFactory.newDefaultExpression(ast, decl.getReturnType2(), decl.getExtraDimensions());
                                if (expression != null) {
                                        ReturnStatement returnStatement = ast.newReturnStatement();
                                        returnStatement.setExpression(expression);
                                        bodyStatement = ASTNodes.asFormattedString(returnStatement, 0, delimiter);
                                }
                        }
                        else   {
                                SuperMethodInvocation invocation = ast.newSuperMethodInvocation();
                                invocation.setName(ast.newSimpleName(binding.getName()));
                                SingleVariableDeclaration varDecl = null;
                                for (Iterator iterator = parameters.iterator(); iterator.hasNext();) {
                                        varDecl = (SingleVariableDeclaration) iterator.next();
                                        invocation.arguments().add(ast.newSimpleName(varDecl.getName().getIdentifier()));
                                }
                                Expression expression = invocation;
                                Type returnType = decl.getReturnType2();
                                if (returnType instanceof PrimitiveType && ((PrimitiveType) returnType).getPrimitiveTypeCode().equals(PrimitiveType.VOID)) {
                                        bodyStatement = ASTNodes.asFormattedString(ast.newExpressionStatement(expression), 0, delimiter);
                                }
                                else   {
                                        ReturnStatement returnStatement = ast.newReturnStatement();
                                        returnStatement.setExpression(expression);
                                        bodyStatement = ASTNodes.asFormattedString(returnStatement, 0, delimiter);
                                }
                        }
                        String placeHolder = CodeGeneration.getMethodBodyContent(unit, type, binding.getName(), false, bodyStatement, delimiter);
                        if (placeHolder != null) {
                                ASTNode todoNode = rewrite.createStringPlaceholder(placeHolder, ASTNode.RETURN_STATEMENT);
                                body.statements().add(todoNode);
                        }
                }
                if (settings != null && settings.createComments) {
                        String string = CodeGeneration.getMethodComment(unit, type, decl, binding, delimiter);
                        if (string != null) {
                                Javadoc javadoc = (Javadoc) rewrite.createStringPlaceholder(string, ASTNode.JAVADOC);
                                decl.setJavadoc(javadoc);
                        }
                }
                if (settings != null && settings.overrideAnnotation && JavaModelUtil.is50OrHigher(unit.getJavaProject())) {
                        addOverrideAnnotation(rewrite, decl, binding);
                }
                return decl;


Clone AbstractionParameter Count: 3Parameter Bindings

String delimiter = StubUtility.getLineDelimiterUsed(unit);
if ( !deferred) {
  Block body = ast.newBlock();
  decl.setBody(body);
  String bodyStatement = ""; //$NON-NLS-1$
  ITypeBinding declaringType = binding.getDeclaringClass();
  if (Modifier.isAbstract(binding.getModifiers()) || declaringType.isAnnotation() || declaringType.isInterface()) {
    Expression expression = ASTNodeFactory.newDefaultExpression(ast, decl.getReturnType2(), decl.getExtraDimensions());
    if (expression != null) {
      ReturnStatement returnStatement = ast.newReturnStatement();
      returnStatement.setExpression(expression);
      bodyStatement = ASTNodes.asFormattedString(returnStatement, 0, delimiter);
    }
  }
  else {
    SuperMethodInvocation invocation = ast.newSuperMethodInvocation();
    invocation.setName(ast.newSimpleName(binding.getName()));
    SingleVariableDeclaration varDecl = null;
    for (Iterator iterator = parameters.iterator(); iterator.hasNext();) {
      varDecl = (SingleVariableDeclaration) iterator.next();
      invocation.arguments().add(ast.newSimpleName(varDecl.getName().getIdentifier()));
    }
    Expression expression = invocation;
    Type returnType = decl.getReturnType2();
    if ( [[#variablea1603b40]]&& ((PrimitiveType) returnType).getPrimitiveTypeCode().equals(PrimitiveType.VOID)) {
      bodyStatement = ASTNodes.asFormattedString(ast.newExpressionStatement(expression), 0, delimiter);
    }
    else {
      ReturnStatement returnStatement = ast.newReturnStatement();
      returnStatement.setExpression(expression);
      bodyStatement = ASTNodes.asFormattedString(returnStatement, 0, delimiter);
    }
  }
  String placeHolder = CodeGeneration.getMethodBodyContent(unit, type, binding.getName(), false, bodyStatement, delimiter);
  if (placeHolder != null) {
    ASTNode todoNode = rewrite.createStringPlaceholder(placeHolder, ASTNode.RETURN_STATEMENT);
    body.statements().add(todoNode);
  }
}
if ( [[#variableb825f140]]) {
  String string = CodeGeneration.getMethodComment(unit, type, decl, binding, delimiter);
  if (string != null) {
    Javadoc javadoc = (Javadoc) rewrite.createStringPlaceholder(string, ASTNode.JAVADOC);
    decl.setJavadoc(javadoc);
  }
}
if ( [[#variablea3864b80]]&& JavaModelUtil.is50OrHigher(unit.getJavaProject())) {
  addOverrideAnnotation(rewrite, decl, binding);
}
return decl;
 

CloneAbstraction
Parameter Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#a1603b40]]
returnType != null && (returnType instanceof PrimitiveType) 
12[[#a1603b40]]
returnType instanceof PrimitiveType 
21[[#b825f140]]
settings.createComments 
22[[#b825f140]]
settings != null && settings.createComments 
31[[#a3864b80]]
settings.overrideAnnotation 
32[[#a3864b80]]
settings != null && settings.overrideAnnotation