hoseindoost / decojer

Automatically exported from code.google.com/p/decojer
0 stars 0 forks source link

guava CharMatcher loop break outs #14

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago

10.08.2013 21:23:41 org.decojer.cavaj.transformers.TrCfg2JavaControlFlowStmts 
log
WARNUNG: 
com.google.common.base.CharMatcher.replaceFrom(Ljava/lang/CharSequence;Ljava/lan
g/CharSequence;)Ljava/lang/String;: Struct leave in BB 3 without regular follow 
encounter:
--- Loop ---
Head: BB 4
Members: 
Last: BB 4
Type: ENDLESS

  public String removeFrom(CharSequence sequence) {
    String string = sequence.toString();
    int pos = indexIn(string);
    if (pos == -1) {
      return string;
    }

    char[] chars = string.toCharArray();
    int spread = 1;

    // This unusual loop comes from extensive benchmarking
    OUT: while (true) {
      pos++;
      while (true) {
        if (pos == chars.length) {
          break OUT;
        }
        if (matches(chars[pos])) {
          break;
        }
        chars[pos - spread] = chars[pos];
        pos++;
      }
      spread++;
    }
    return new String(chars, 0, pos - spread);
  }

Original issue reported on code.google.com by andrePan...@gmail.com on 10 Aug 2013 at 7:25

GoogleCodeExporter commented 8 years ago
skip for later

Original comment by andrePan...@gmail.com on 3 Sep 2014 at 1:34