int cOptions = RE.MATCH_NORMAL; if (RegexpUtil.hasFlag(options, MATCH_CASE_INSENSITIVE)) { cOptions |= RE.MATCH_CASEINDEPENDENT; } if (RegexpUtil.hasFlag(options, MATCH_MULTILINE)) { cOptions |= RE.MATCH_MULTILINE; } if (RegexpUtil.hasFlag(options, MATCH_SINGLELINE)) { cOptions |= RE.MATCH_SINGLELINE; } return cOptions;
int cOptions = Pattern.UNIX_LINES; if (RegexpUtil.hasFlag(options, MATCH_CASE_INSENSITIVE)) { cOptions |= Pattern.CASE_INSENSITIVE; } if (RegexpUtil.hasFlag(options, MATCH_MULTILINE)) { cOptions |= Pattern.MULTILINE; } if (RegexpUtil.hasFlag(options, MATCH_SINGLELINE)) { cOptions |= Pattern.DOTALL; } return cOptions;
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/regexp/JakartaRegexpMatcher.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcher.java
Method name: int getCompilerOptions(int) Method name: int getCompilerOptions(int)
Number of AST nodes: 8 Number of AST nodes: 8
1
int cOptions = RE.MATCH_NORMAL;
1
int cOptions = Pattern.UNIX_LINES;
2
        if (RegexpUtil.hasFlag(options, MATCH_CASE_INSENSITIVE)) {
2
        if (RegexpUtil.hasFlag(options, MATCH_CASE_INSENSITIVE)) {
3
            cOptions |= RE.MATCH_CASEINDEPENDENT;
3
            cOptions |= Pattern.CASE_INSENSITIVE;
4
        }
4
        }
5
        if (RegexpUtil.hasFlag(options, MATCH_MULTILINE)) {
5
        if (RegexpUtil.hasFlag(options, MATCH_MULTILINE)) {
6
            cOptions |= RE.MATCH_MULTILINE;
6
            cOptions |= Pattern.MULTILINE;
7
        }
7
        }
8
        if (RegexpUtil.hasFlag(options, MATCH_SINGLELINE)) {
8
        if (RegexpUtil.hasFlag(options, MATCH_SINGLELINE)) {
9
            cOptions |= RE.MATCH_SINGLELINE;
9
            cOptions |= Pattern.DOTALL;
10
        }
10
        }
11
        return cOptions;
11
        return cOptions;
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)1.1
Clones locationClones are in different classes
Number of node comparisons31
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    int cOptions = RE.MATCH_NORMAL;
    1
    int cOptions = RE.MATCH_NORMAL;
    1
    int cOptions = Pattern.UNIX_LINES;
    Differences
    Expression1Expression2Difference
    org.apache.regexp.REjava.util.regex.PatternVARIABLE_TYPE_MISMATCH
    MATCH_NORMALUNIX_LINESVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type org.apache.regexp.RE of variable RE does not match with type java.util.regex.Pattern of variable Pattern
    • Make classes org.apache.regexp.RE and java.util.regex.Pattern extend a common superclass
    1
    int cOptions = Pattern.UNIX_LINES;
    2
    if (RegexpUtil.hasFlag(options, MATCH_CASE_INSENSITIVE))
    2
    if (RegexpUtil.hasFlag(options, MATCH_CASE_INSENSITIVE))
    3
    cOptions |= RE.MATCH_CASEINDEPENDENT;
    3
    cOptions |= RE.MATCH_CASEINDEPENDENT;
    3
    cOptions |= Pattern.CASE_INSENSITIVE;
    Differences
    Expression1Expression2Difference
    org.apache.regexp.REjava.util.regex.PatternVARIABLE_TYPE_MISMATCH
    MATCH_CASEINDEPENDENTCASE_INSENSITIVEVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type org.apache.regexp.RE of variable RE does not match with type java.util.regex.Pattern of variable Pattern
    • Make classes org.apache.regexp.RE and java.util.regex.Pattern extend a common superclass
    3
    cOptions |= Pattern.CASE_INSENSITIVE;
    4
    if (RegexpUtil.hasFlag(options, MATCH_MULTILINE))
    4
    if (RegexpUtil.hasFlag(options, MATCH_MULTILINE))
    5
    cOptions |= RE.MATCH_MULTILINE;
    5
    cOptions |= RE.MATCH_MULTILINE;
    5
    cOptions |= Pattern.MULTILINE;
    Differences
    Expression1Expression2Difference
    org.apache.regexp.REjava.util.regex.PatternVARIABLE_TYPE_MISMATCH
    MATCH_MULTILINEMULTILINEVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type org.apache.regexp.RE of variable RE does not match with type java.util.regex.Pattern of variable Pattern
    • Make classes org.apache.regexp.RE and java.util.regex.Pattern extend a common superclass
    5
    cOptions |= Pattern.MULTILINE;
    6
    if (RegexpUtil.hasFlag(options, MATCH_SINGLELINE))
    6
    if (RegexpUtil.hasFlag(options, MATCH_SINGLELINE))
    7
    cOptions |= RE.MATCH_SINGLELINE;
    7
    cOptions |= RE.MATCH_SINGLELINE;
    7
    cOptions |= Pattern.DOTALL;
    Differences
    Expression1Expression2Difference
    org.apache.regexp.REjava.util.regex.PatternVARIABLE_TYPE_MISMATCH
    MATCH_SINGLELINEDOTALLVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type org.apache.regexp.RE of variable RE does not match with type java.util.regex.Pattern of variable Pattern
    • Make classes org.apache.regexp.RE and java.util.regex.Pattern extend a common superclass
    7
    cOptions |= Pattern.DOTALL;
    8
    return cOptions;
    8
    return cOptions;
    Precondition Violations (4)
    Row Violation
    1Type org.apache.regexp.RE of variable RE does not match with type java.util.regex.Pattern of variable Pattern
    2Type org.apache.regexp.RE of variable RE does not match with type java.util.regex.Pattern of variable Pattern
    3Type org.apache.regexp.RE of variable RE does not match with type java.util.regex.Pattern of variable Pattern
    4Type org.apache.regexp.RE of variable RE does not match with type java.util.regex.Pattern of variable Pattern