test/tools/javac/diags/MessageFile.java
Print this page
*** 63,73 ****
insertAfter(l);
return l;
}
void insertAfter(Line l) {
- assert prev == null && next == null;
l.prev = this;
l.next = next;
if (next == null)
lastLine = l;
else
--- 63,72 ----
*** 80,90 ****
insertBefore(l);
return l;
}
void insertBefore(Line l) {
- assert prev == null && next == null;
l.prev = prev;
l.next = this;
if (prev == null)
firstLine = l;
else
--- 79,88 ----
*** 408,422 ****
Line firstLine;
Line lastLine;
Map<String, Message> messages = new TreeMap<String, Message>();
MessageFile(File file) throws IOException {
! Reader in = new FileReader(file);
! try {
read(in);
- } finally {
- in.close();
}
}
MessageFile(Reader in) throws IOException {
read(in);
--- 406,417 ----
Line firstLine;
Line lastLine;
Map<String, Message> messages = new TreeMap<String, Message>();
MessageFile(File file) throws IOException {
! try(Reader in = new FileReader(file)) {
read(in);
}
}
MessageFile(Reader in) throws IOException {
read(in);
*** 440,454 ****
}
}
}
void write(File file) throws IOException {
! Writer out = new FileWriter(file);
! try {
write(out);
- } finally {
- out.close();
}
}
void write(Writer out) throws IOException {
BufferedWriter bw = (out instanceof BufferedWriter)
--- 435,446 ----
}
}
}
void write(File file) throws IOException {
! try(Writer out = new FileWriter(file)) {
write(out);
}
}
void write(Writer out) throws IOException {
BufferedWriter bw = (out instanceof BufferedWriter)