Source:
<code>public Collection<FileAnnotation> parse(Reader reader) throws IOException { <START> ArrayList<FileAnnotation> warnings = new ArrayList<FileAnnotation>(); <END> BufferedReader br = new BufferedReader(reader); String line; States state = START; String message = "", file = "", category = ""; int lineNo = 0; while ((line = br.readLine()) != null) { line = line.replaceAll((char)27 + "\\[.*" + (char)27 + "\\[0m", ""); switch (state) { case START: if (line.startsWith("[INFO] Showing AJC message detail for messages of types")) { state = PARSING; } break; case PARSING: if (line.startsWith("[WARNING] ")) { state = PARSED_WARNING; message = line.replaceAll("\\[WARNING\\] ", ""); if (message.contains("is deprecated") || message.contains("overrides a deprecated")) { category = RegexpParser.DEPRECATION; } else if (message.contains("adviceDidNotMatch")) { category = AjcParser.ADVICE; } } break; case PARSED_WARNING: if (line.startsWith("\t")) { state = PARSED_FILE; int idx = line.lastIndexOf(":"); if (idx != -1) { file = line.substring(0, idx); try { lineNo = Integer.parseInt(line.substring(idx + 1)); } catch (NumberFormatException ignored) { } catch (IndexOutOfBoundsException ignored) { } } } if ("".equals(line)) { if (!"".equals(message.trim())) { warnings.add(new Warning(file.trim(), lineNo, getGroup(), category, message.trim())); } message = ""; file = ""; category = ""; lineNo = 0; state = PARSING; } break; case PARSED_FILE: default: if ("".equals(line)) { if (!"".equals(message.trim())) { warnings.add(new Warning(file.trim(), lineNo, getGroup(), category, message.trim())); } message = ""; file = ""; category = ""; lineNo = 0; state = PARSING; } } } return warnings; }</code><technical_language>List<> left side</technical_language>

Target:
public Collection<FileAnnotation> parse(Reader reader) throws IOException { List<FileAnnotation> warnings = new ArrayList<FileAnnotation>(); BufferedReader br = new BufferedReader(reader); String line; States state = States.START; String message = "", file = "", category = ""; int lineNo = 0; while ((line = br.readLine()) != null) { line = line.replaceAll((char)27 + "\\[.*" + (char)27 + "\\[0m", ""); switch (state) { case START: if (line.startsWith("[INFO] Showing AJC message detail for messages of types")) { state = States.PARSING; } break; case PARSING: if (line.startsWith("[WARNING] ")) { state = States.PARSED_WARNING; message = line.replaceAll("\\[WARNING\\] ", ""); if (message.contains("is deprecated") || message.contains("overrides a deprecated")) { category = RegexpParser.DEPRECATION; } else if (message.contains("adviceDidNotMatch")) { category = AjcParser.ADVICE; } } break; case PARSED_WARNING: if (line.startsWith("\t")) { state = States.PARSED_FILE; int idx = line.lastIndexOf(":"); if (idx != -1) { file = line.substring(0, idx); try { lineNo = convertLineNumber(line.substring(idx + 1)); } catch (IndexOutOfBoundsException ignored) { } } } if ("".equals(line)) { if (!"".equals(message.trim())) { warnings.add(new Warning(file.trim(), lineNo, getGroup(), category, message.trim())); } message = ""; file = ""; category = ""; lineNo = 0; state = States.PARSING; } break; case PARSED_FILE: default: if ("".equals(line)) { if (!"".equals(message.trim())) { warnings.add(new Warning(file.trim(), lineNo, getGroup(), category, message.trim())); } message = ""; file = ""; category = ""; lineNo = 0; state = States.PARSING; } } } return warnings; }