diff options
author | Roel Spilker <r.spilker@gmail.com> | 2012-06-25 22:37:05 +0200 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2012-06-25 22:37:05 +0200 |
commit | 8e24e2e123bda37820aa9c2b944b6df4b3756186 (patch) | |
tree | 498f5407e54e0cf2272943057e8beaac57a37ca7 | |
parent | 960761a29877510d6e59945656edb87a912f631d (diff) | |
download | lombok-8e24e2e123bda37820aa9c2b944b6df4b3756186.tar.gz lombok-8e24e2e123bda37820aa9c2b944b6df4b3756186.tar.bz2 lombok-8e24e2e123bda37820aa9c2b944b6df4b3756186.zip |
Added tests for this() call in SneakyThrows (issue 381)
-rw-r--r-- | doc/changelog.markdown | 1 | ||||
-rw-r--r-- | test/transform/resource/after-delombok/SneakyThrowsPlain.java | 9 | ||||
-rw-r--r-- | test/transform/resource/after-ecj/SneakyThrowsPlain.java | 10 | ||||
-rw-r--r-- | test/transform/resource/before/SneakyThrowsPlain.java | 5 |
4 files changed, 24 insertions, 1 deletions
diff --git a/doc/changelog.markdown b/doc/changelog.markdown index 7e335751..a97bcc75 100644 --- a/doc/changelog.markdown +++ b/doc/changelog.markdown @@ -8,6 +8,7 @@ any type in the form of static methods that take as first parameter an object of * BUGFIX: Eclipse refactor script 'rename method arguments' should work more often with lombok-affected methods. * BUGFIX: Using `val` in an enhanced for loop did not work if the iterable was a raw type. * BUGFIX: Using `@Getter(lazy=true)` when the data type is boolean, int, array, or some other type that requires special treatment for hashCode/equals, now works properly with `@Data`, `@EqualsHashCode` and `@ToString`. [Issue #376](http://code.google.com/p/projectlombok/issues/detail?id=376) +* BUGFIX: `SneakyThrows` in constructor should not wrap this/super call in try-block [Issue #381](http://code.google.com/p/projectlombok/issues/detail?id=381) * FEATURE: ONGOING: Fix for using lombok together with gwt-designer. ### v0.11.0 (March 26th, 2012) diff --git a/test/transform/resource/after-delombok/SneakyThrowsPlain.java b/test/transform/resource/after-delombok/SneakyThrowsPlain.java index 93f734f8..5c0890b5 100644 --- a/test/transform/resource/after-delombok/SneakyThrowsPlain.java +++ b/test/transform/resource/after-delombok/SneakyThrowsPlain.java @@ -7,6 +7,14 @@ class SneakyThrowsPlain { throw lombok.Lombok.sneakyThrow($ex); } } + SneakyThrowsPlain(int x) { + this(); + try { + System.out.println("constructor2"); + } catch (final java.lang.Throwable $ex) { + throw lombok.Lombok.sneakyThrow($ex); + } + } public void test() { try { System.out.println("test1"); @@ -14,7 +22,6 @@ class SneakyThrowsPlain { throw lombok.Lombok.sneakyThrow($ex); } } - public void test2() { try { System.out.println("test2"); diff --git a/test/transform/resource/after-ecj/SneakyThrowsPlain.java b/test/transform/resource/after-ecj/SneakyThrowsPlain.java index 56016b5a..1b45dc5a 100644 --- a/test/transform/resource/after-ecj/SneakyThrowsPlain.java +++ b/test/transform/resource/after-ecj/SneakyThrowsPlain.java @@ -10,6 +10,16 @@ class SneakyThrowsPlain { throw lombok.Lombok.sneakyThrow($ex); } } + @lombok.SneakyThrows SneakyThrowsPlain(int x) { + this(); + try + { + System.out.println("constructor2"); + } + catch (final java.lang.Throwable $ex) { + throw lombok.Lombok.sneakyThrow($ex); + } + } public @lombok.SneakyThrows void test() { try { diff --git a/test/transform/resource/before/SneakyThrowsPlain.java b/test/transform/resource/before/SneakyThrowsPlain.java index 261e1b53..871086b7 100644 --- a/test/transform/resource/before/SneakyThrowsPlain.java +++ b/test/transform/resource/before/SneakyThrowsPlain.java @@ -5,6 +5,11 @@ class SneakyThrowsPlain { System.out.println("constructor"); } + @lombok.SneakyThrows SneakyThrowsPlain(int x) { + this(); + System.out.println("constructor2"); + } + @lombok.SneakyThrows public void test() { System.out.println("test1"); } |