diff options
author | Roel Spilker <r.spilker@gmail.com> | 2015-09-23 22:09:09 +0200 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2015-09-23 22:09:09 +0200 |
commit | 1bc73d770345f480cee9718618e936dd68499e23 (patch) | |
tree | 8560f78591866932d1ce06cf5eea71e6c8149259 /test/core/src | |
parent | 74bcdd9306026aa54c88be5286155324840511c7 (diff) | |
download | lombok-1bc73d770345f480cee9718618e936dd68499e23.tar.gz lombok-1bc73d770345f480cee9718618e936dd68499e23.tar.bz2 lombok-1bc73d770345f480cee9718618e936dd68499e23.zip |
Remove lombok annotation from source
Diffstat (limited to 'test/core/src')
-rw-r--r-- | test/core/src/lombok/LombokTestSource.java | 83 |
1 files changed, 52 insertions, 31 deletions
diff --git a/test/core/src/lombok/LombokTestSource.java b/test/core/src/lombok/LombokTestSource.java index c686bf19..1f3f5e1a 100644 --- a/test/core/src/lombok/LombokTestSource.java +++ b/test/core/src/lombok/LombokTestSource.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 The Project Lombok Authors. + * Copyright (C) 2014-2015 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -26,6 +26,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; +import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; @@ -207,19 +208,27 @@ public class LombokTestSource { List<String> directives = new ArrayList<String>(); { - @Cleanup val rawIn = new FileInputStream(file); - BufferedReader in = new BufferedReader(new InputStreamReader(rawIn, "UTF-8")); - for (String i = in.readLine(); i != null; i = in.readLine()) { - if (i.isEmpty()) continue; - - if (i.startsWith("//")) { - directives.add(i.substring(2)); - } else { - break; + InputStream rawIn = new FileInputStream(file); + try { + BufferedReader in = new BufferedReader(new InputStreamReader(rawIn, "UTF-8")); + try { + for (String i = in.readLine(); i != null; i = in.readLine()) { + if (i.isEmpty()) continue; + + if (i.startsWith("//")) { + directives.add(i.substring(2)); + } else { + break; + } + } + } + finally { + in.close(); } } - in.close(); - rawIn.close(); + finally { + rawIn.close(); + } } return new LombokTestSource(file, "", null, directives); @@ -235,25 +244,33 @@ public class LombokTestSource { File sourceFile = new File(sourceFolder, fileName); if (sourceFile.exists()) { - @Cleanup val rawIn = new FileInputStream(sourceFile); - BufferedReader in = new BufferedReader(new InputStreamReader(rawIn, encoding)); - for (String i = in.readLine(); i != null; i = in.readLine()) { - if (content != null) { - content.append(i).append("\n"); - continue; + InputStream rawIn = new FileInputStream(sourceFile); + try { + BufferedReader in = new BufferedReader(new InputStreamReader(rawIn, encoding)); + try { + for (String i = in.readLine(); i != null; i = in.readLine()) { + if (content != null) { + content.append(i).append("\n"); + continue; + } + + if (i.isEmpty()) continue; + + if (i.startsWith("//")) { + directives.add(i.substring(2)); + } else { + content = new StringBuilder(); + content.append(i).append("\n"); + } + } } - - if (i.isEmpty()) continue; - - if (i.startsWith("//")) { - directives.add(i.substring(2)); - } else { - content = new StringBuilder(); - content.append(i).append("\n"); + finally { + in.close(); } } - in.close(); - rawIn.close(); + finally { + rawIn.close(); + } } if (content == null) content = new StringBuilder(); @@ -262,9 +279,13 @@ public class LombokTestSource { if (messagesFolder != null) { File messagesFile = new File(messagesFolder, fileName + ".messages"); try { - @Cleanup val rawIn = new FileInputStream(messagesFile); - messages = CompilerMessageMatcher.readAll(rawIn); - rawIn.close(); + InputStream rawIn = new FileInputStream(messagesFile); + try { + messages = CompilerMessageMatcher.readAll(rawIn); + } + finally { + rawIn.close(); + } } catch (FileNotFoundException e) { messages = null; } |