synchronized (this) { if (this.operations == null) this.prepare(); if (this.context == null) this.context = new Context(); } Context con = null; synchronized (this.context) { con = this.context.inuse ? new Context() : this.context; con.reset(target, start, end, this.numberOfClosures); } if (match != null) { match.setNumberOfGroups(this.nofparen); match.setSource(target); } else if (this.hasBackReferences) { match = new Match(); match.setNumberOfGroups(this.nofparen); // Need not to call setSource() because // a caller can not access this match instance. } con.match = match;
synchronized (this) { if (this.operations == null) this.prepare(); if (this.context == null) this.context = new Context(); } Context con = null; synchronized (this.context) { con = this.context.inuse ? new Context() : this.context; con.reset(target, start, end, this.numberOfClosures); } if (match != null) { match.setNumberOfGroups(this.nofparen); match.setSource(target); } else if (this.hasBackReferences) { match = new Match(); match.setNumberOfGroups(this.nofparen); // Need not to call setSource() because // a caller can not access this match instance. } con.match = match;
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xml/type/internal/RegEx.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xml/type/internal/RegEx.java
Method name: boolean matches(char[], int, int, Match) Method name: boolean matches(String, int, int, Match)
Number of AST nodes: 16 Number of AST nodes: 16
1
synchronized (this) {
1
synchronized (this) {
2
              if (this.operations == null)
2
              if (this.operations == null)
3
                  this.prepare();
3
                  this.prepare();
4
              if (this.context == null)
4
              if (this.context == null)
5
                  this.context = new Context();
5
                  this.context = new Context();
6
          }
6
          }
7
          Context con = null;
7
          Context con = null;
8
          synchronized (this.context) {
8
          synchronized (this.context) {
9
              con = this.context.inuse ? new Context() : this.context;
9
              con = this.context.inuse ? new Context() : this.context;
10
              con.reset(target, start, end, this.numberOfClosures);
10
              con.reset(target, start, end, this.numberOfClosures);
11
          }
11
          }
12
          if (match != null) {
12
          if (match != null) {
13
              match.setNumberOfGroups(this.nofparen);
13
              match.setNumberOfGroups(this.nofparen);
14
              match.setSource(target);
14
              match.setSource(target);
15
          } else if (this.hasBackReferences) {
15
          } else if (this.hasBackReferences) {
16
              match = new Match();
16
              match = new Match();
17
              match.setNumberOfGroups(this.nofparen);
17
              match.setNumberOfGroups(this.nofparen);
18
              // Need not to call setSource() because
18
              // Need not to call setSource() because
19
              // a caller can not access this match instance.
19
              // a caller can not access this match instance.
20
          }
20
          }
21
          con.match = match;
21
          con.match = match;
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.8
Clones locationClones are declared in the same class
Number of node comparisons91
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements16
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)9.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    synchronized (this)
    1
    synchronized (this)
    2
    if (this.operations == null)
    2
    if (this.operations == null)
    3
    this.prepare();
    3
    this.prepare();
    4
    if (this.context == null)
    4
    if (this.context == null)
    5
    this.context = new Context();
    5
    this.context = new Context();
    6
    Context con = null;
    6
    Context con = null;
    7
    synchronized (this.context)
    7
    synchronized (this.context)
    8
    con = this.context.inuse ? new Context() : this.context;
    8
    con = this.context.inuse ? new Context() : this.context;
    9
    con.reset(target, start, end, this.numberOfClosures);
    9
    con.reset(target, start, end, this.numberOfClosures);
    9
    con.reset(target, start, end, this.numberOfClosures);
    Differences
    Expression1Expression2Difference
    char[]java.lang.StringVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type char[] of variable target does not match with type java.lang.String of variable target
    • Make classes char[] and java.lang.String extend a common superclass
    9
    con.reset(target, start, end, this.numberOfClosures);
    10
    if (match != null)
    10
    if (match != null)
    11
    match.setNumberOfGroups(this.nofparen);
    11
    match.setNumberOfGroups(this.nofparen);
    12
    match.setSource(target);
    12
    match.setSource(target);
    12
    match.setSource(target);
    Differences
    Expression1Expression2Difference
    char[]java.lang.StringVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type char[] of variable target does not match with type java.lang.String of variable target
    • Make classes char[] and java.lang.String extend a common superclass
    12
    match.setSource(target);
    13
    else if (this.hasBackReferences)
    13
    else if (this.hasBackReferences)
    14
    match = new Match();
    14
    match = new Match();
    15
    match.setNumberOfGroups(this.nofparen);
    15
    match.setNumberOfGroups(this.nofparen);
    16
    con.match = match;
    16
    con.match = match;
    Precondition Violations (2)
    Row Violation
    1Type char[] of variable target does not match with type java.lang.String of variable target
    2Type char[] of variable target does not match with type java.lang.String of variable target