File preprocessDir = apt.getPreprocessDir(); if (preprocessDir != null) { cmd.createArgument().setValue("-s"); cmd.createArgument().setFile(preprocessDir); } // Process the processor options Vector options = apt.getOptions();
Path factoryPath = apt.getFactoryPath(); if (factoryPath != null) { cmd.createArgument().setValue("-factorypath"); cmd.createArgument().setPath(factoryPath); } File preprocessDir = apt.getPreprocessDir();
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/compilers/AptCompilerAdapter.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/compilers/AptCompilerAdapter.java
Method name: void setAptCommandlineSwitches(Apt, Commandline) Method name: void setAptCommandlineSwitches(Apt, Commandline)
Number of AST nodes: 5 Number of AST nodes: 5
1
File preprocessDir = apt.getPreprocessDir();
1
Path factoryPath = apt.getFactoryPath();
2
        if (preprocessDir != null) {
2
        if (factoryPath != null) {
3
            cmd.createArgument().setValue("-s");
3
            cmd.createArgument().setValue("-factorypath");
4
            cmd.createArgument().setFile(preprocessDir);
4
            cmd.createArgument().setPath(factoryPath);
5
        }
5
        }
6
        // Process the processor options
6
        
7
        Vector options = apt.getOptions();
7
File preprocessDir = apt.getPreprocessDir();
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.1
Clones locationClones are in the same method
Number of node comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                      
    7
    Path factoryPath = apt.getFactoryPath();
    11
    File preprocessDir = apt.getPreprocessDir();
    11
    File preprocessDir = apt.getPreprocessDir();
    12
    if (preprocessDir != null)
    12
    if (preprocessDir != null)
    8
    if (factoryPath != null)
    Differences
    Expression1Expression2Difference
    preprocessDirfactoryPathVARIABLE_NAME_MISMATCH
    java.io.Fileorg.apache.tools.ant.types.PathVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression preprocessDir cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.io.File of variable preprocessDir does not match with type org.apache.tools.ant.types.Path of variable factoryPath
    • Make classes java.io.File and org.apache.tools.ant.types.Path extend a common superclass
    8
    if (factoryPath != null)
    13
    cmd.createArgument().setValue("-s");
    13
    cmd.createArgument().setValue("-s");
    9
    cmd.createArgument().setValue("-factorypath");
    Differences
    Expression1Expression2Difference
    "-s""-factorypath"LITERAL_VALUE_MISMATCH
    9
    cmd.createArgument().setValue("-factorypath");
                                                                                                
    10
    cmd.createArgument().setPath(factoryPath);
    Preondition Violations
    Unmatched statement cmd.createArgument().setPath(factoryPath); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10
    cmd.createArgument().setPath(factoryPath);
    14
    cmd.createArgument().setFile(preprocessDir);
    14
    cmd.createArgument().setFile(preprocessDir);
    Preondition Violations
    Unmatched statement cmd.createArgument().setFile(preprocessDir); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                    
    15
    Vector options = apt.getOptions();
                                                                            
    Precondition Violations (4)
    Row Violation
    1Expression preprocessDir cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Type java.io.File of variable preprocessDir does not match with type org.apache.tools.ant.types.Path of variable factoryPath
    3Unmatched statement cmd.createArgument().setPath(factoryPath); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement cmd.createArgument().setFile(preprocessDir); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted