aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2015-01-20 22:37:46 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2015-01-20 22:37:46 +0100
commitf153f1cda304d56f9b20cd5e39adf83e74067045 (patch)
tree332bb85125a3134a15ba132f9fbfa3ef182b4e7f /src/core
parent19de8fbe4743afc58df39555602c67e46fc2e016 (diff)
parent296d1c2ed8a6aa29fb2a1ce7f16ea9e39b49d7d5 (diff)
downloadlombok-f153f1cda304d56f9b20cd5e39adf83e74067045.tar.gz
lombok-f153f1cda304d56f9b20cd5e39adf83e74067045.tar.bz2
lombok-f153f1cda304d56f9b20cd5e39adf83e74067045.zip
Merge the @Singular feature and the fix for ecj and the shadowloader.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/lombok/bytecode/PostCompilerApp.java22
-rw-r--r--src/core/lombok/core/Main.java2
2 files changed, 15 insertions, 9 deletions
diff --git a/src/core/lombok/bytecode/PostCompilerApp.java b/src/core/lombok/bytecode/PostCompilerApp.java
index d2c3157c..5f49bd81 100644
--- a/src/core/lombok/bytecode/PostCompilerApp.java
+++ b/src/core/lombok/bytecode/PostCompilerApp.java
@@ -98,7 +98,7 @@ public class PostCompilerApp extends LombokApp {
byte[] original = readFile(file);
byte[] clone = original.clone();
byte[] transformed = PostCompiler.applyTransformations(clone, file.toString(), DiagnosticsReceiver.CONSOLE);
- if (clone != transformed && !Arrays.equals(clone, transformed)) {
+ if (clone != transformed && !Arrays.equals(original, transformed)) {
filesTouched++;
if (args.verbose) System.out.println("Rewriting " + file.getAbsolutePath());
writeFile(file, transformed);
@@ -138,18 +138,24 @@ public class PostCompilerApp extends LombokApp {
byte[] buffer = new byte[1024];
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
FileInputStream fileInputStream = new FileInputStream(file);
- while (true) {
- int read = fileInputStream.read(buffer);
- if (read == -1) break;
- bytes.write(buffer, 0, read);
+ try {
+ while (true) {
+ int read = fileInputStream.read(buffer);
+ if (read == -1) break;
+ bytes.write(buffer, 0, read);
+ }
+ } finally {
+ fileInputStream.close();
}
- fileInputStream.close();
return bytes.toByteArray();
}
static void writeFile(File file, byte[] transformed) throws IOException {
FileOutputStream out = new FileOutputStream(file);
- out.write(transformed);
- out.close();
+ try {
+ out.write(transformed);
+ } finally {
+ out.close();
+ }
}
}
diff --git a/src/core/lombok/core/Main.java b/src/core/lombok/core/Main.java
index 0856d3b3..dc613b0d 100644
--- a/src/core/lombok/core/Main.java
+++ b/src/core/lombok/core/Main.java
@@ -143,7 +143,7 @@ public class Main {
out.println("------------------------------");
}
out.println("projectlombok.org " + Version.getFullVersion());
- out.println("Copyright (C) 2009-2012 The Project Lombok Authors.");
+ out.println("Copyright (C) 2009-2015 The Project Lombok Authors.");
out.println("Run 'lombok license' to see the lombok license agreement.");
out.println();
out.println("Run lombok without any parameters to start the graphical installer.");