diff options
-rw-r--r-- | doc/changelog.markdown | 2 | ||||
-rw-r--r-- | src/core/lombok/Getter.java | 6 | ||||
-rw-r--r-- | src/core/lombok/Setter.java | 6 | ||||
-rw-r--r-- | src/core/lombok/eclipse/handlers/HandleConstructor.java | 2 | ||||
-rw-r--r-- | src/core/lombok/experimental/Accessors.java | 3 | ||||
-rw-r--r-- | src/installer/lombok/installer/eclipse/EclipseLocation.java | 4 | ||||
-rw-r--r-- | test/transform/resource/after-delombok/GetterEnum.java | 18 | ||||
-rw-r--r-- | test/transform/resource/after-delombok/SneakyThrowsPlain.java | 9 | ||||
-rw-r--r-- | test/transform/resource/after-ecj/GetterEnum.java | 21 | ||||
-rw-r--r-- | test/transform/resource/after-ecj/SneakyThrowsPlain.java | 10 | ||||
-rw-r--r-- | test/transform/resource/before/GetterEnum.java | 11 | ||||
-rw-r--r-- | test/transform/resource/before/SneakyThrowsPlain.java | 5 | ||||
-rw-r--r-- | website/features/GetterSetter.html | 2 |
13 files changed, 88 insertions, 11 deletions
diff --git a/doc/changelog.markdown b/doc/changelog.markdown index 7e335751..2aafefc0 100644 --- a/doc/changelog.markdown +++ b/doc/changelog.markdown @@ -5,9 +5,11 @@ Lombok Changelog * FEATURE: {Experimental} `@ExtensionMethod` is now available to add extensions to any type in the form of static methods that take as first parameter an object of that type. [Documentation on @ExtensionMethod](http://projectlombok.org/features/experimental/ExtensionMethod.html) * ENHANCEMENT: Small performance enhancements in `equals` and `hashCode`. [Issue #366](http://code.google.com/p/projectlombok/issues/detail?id=366) +* BUGFIX: Eclipse would display and error message regarding an invalid super constructor in the wrong location. [Issue #336](http://code.google.com/p/projectlombok/issues/detail?id=336) * 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/src/core/lombok/Getter.java b/src/core/lombok/Getter.java index c812d824..86e14b93 100644 --- a/src/core/lombok/Getter.java +++ b/src/core/lombok/Getter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2010 The Project Lombok Authors. + * Copyright (C) 2009-2012 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 @@ -45,8 +45,8 @@ import java.lang.annotation.Target; * Note that fields of type {@code boolean} (but not {@code java.lang.Boolean}) will result in an * {@code isFoo} name instead of {@code getFoo}. * <p> - * If any method named {@code getFoo}/{@code isFoo} exists, regardless of return type or parameters, no method is generated, - * and instead a compiler warning is emitted. + * If any method named {@code getFoo}/{@code isFoo} (case insensitive) exists, regardless of return type or parameters, + * no method is generated, and instead a compiler warning is emitted. * <p> * This annotation can also be applied to a class, in which case it'll be as if all non-static fields that don't already have * a {@code @Getter} annotation have the annotation. diff --git a/src/core/lombok/Setter.java b/src/core/lombok/Setter.java index ed4c146c..a7318259 100644 --- a/src/core/lombok/Setter.java +++ b/src/core/lombok/Setter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2010 The Project Lombok Authors. + * Copyright (C) 2009-2012 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 @@ -42,8 +42,8 @@ import java.lang.annotation.Target; * } * </pre> * - * If any method named {@code setFoo} exists, regardless of return type or parameters, no method is generated, - * and instead a compiler warning is emitted. + * If any method named {@code setFoo} (case insensitive) exists, regardless of return type or parameters, + * no method is generated, and instead a compiler warning is emitted. * <p> * This annotation can also be applied to a class, in which case it'll be as if all non-static fields that don't already have * a {@code Setter} annotation have the annotation. diff --git a/src/core/lombok/eclipse/handlers/HandleConstructor.java b/src/core/lombok/eclipse/handlers/HandleConstructor.java index 5731769a..eec41577 100644 --- a/src/core/lombok/eclipse/handlers/HandleConstructor.java +++ b/src/core/lombok/eclipse/handlers/HandleConstructor.java @@ -228,6 +228,8 @@ public class HandleConstructor { constructor.selector = ((TypeDeclaration)type.get()).name; constructor.constructorCall = new ExplicitConstructorCall(ExplicitConstructorCall.ImplicitSuper); setGeneratedBy(constructor.constructorCall, source); + constructor.constructorCall.sourceStart = source.sourceStart; + constructor.constructorCall.sourceEnd = source.sourceEnd; constructor.thrownExceptions = null; constructor.typeParameters = null; constructor.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG; diff --git a/src/core/lombok/experimental/Accessors.java b/src/core/lombok/experimental/Accessors.java index 5b454273..b925e746 100644 --- a/src/core/lombok/experimental/Accessors.java +++ b/src/core/lombok/experimental/Accessors.java @@ -49,7 +49,8 @@ public @interface Accessors { /** * If present, only fields with any of the stated prefixes are given the getter/setter treatment. - * Note that a prefix only counts if the next character is NOT a lowercase character. If multiple fields + * Note that a prefix only counts if the next character is NOT a lowercase character or the last + * letter of the prefix is not a letter (for instance an underscore). If multiple fields * all turn into the same name when the prefix is stripped, an error will be generated. */ String[] prefix() default {}; diff --git a/src/installer/lombok/installer/eclipse/EclipseLocation.java b/src/installer/lombok/installer/eclipse/EclipseLocation.java index ebc661b8..bf44d1e8 100644 --- a/src/installer/lombok/installer/eclipse/EclipseLocation.java +++ b/src/installer/lombok/installer/eclipse/EclipseLocation.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2010 The Project Lombok Authors. + * Copyright (C) 2009-2012 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 @@ -327,8 +327,8 @@ public class EclipseLocation extends IdeLocation { } newContents.append(line).append(OS_NEWLINE); - br.close(); } + br.close(); } finally { fis.close(); } diff --git a/test/transform/resource/after-delombok/GetterEnum.java b/test/transform/resource/after-delombok/GetterEnum.java new file mode 100644 index 00000000..3c6e6e0c --- /dev/null +++ b/test/transform/resource/after-delombok/GetterEnum.java @@ -0,0 +1,18 @@ +enum GetterEnum { + ONE(1, "One"); + private final int id; + private final String name; + @java.lang.SuppressWarnings("all") + private GetterEnum(final int id, final String name) { + this.id = id; + this.name = name; + } + @java.lang.SuppressWarnings("all") + public int getId() { + return this.id; + } + @java.lang.SuppressWarnings("all") + public String getName() { + return this.name; + } +}
\ No newline at end of file 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/GetterEnum.java b/test/transform/resource/after-ecj/GetterEnum.java new file mode 100644 index 00000000..3536a6e8 --- /dev/null +++ b/test/transform/resource/after-ecj/GetterEnum.java @@ -0,0 +1,21 @@ +import lombok.AccessLevel; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +@RequiredArgsConstructor(access = AccessLevel.PRIVATE) enum GetterEnum { + ONE(1, "One"), + private final @Getter int id; + private final @Getter String name; + <clinit>() { + } + private @java.lang.SuppressWarnings("all") GetterEnum(final int id, final String name) { + super(); + this.id = id; + this.name = name; + } + public @java.lang.SuppressWarnings("all") int getId() { + return this.id; + } + public @java.lang.SuppressWarnings("all") String getName() { + return this.name; + } +}
\ No newline at end of file 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/GetterEnum.java b/test/transform/resource/before/GetterEnum.java new file mode 100644 index 00000000..994581f2 --- /dev/null +++ b/test/transform/resource/before/GetterEnum.java @@ -0,0 +1,11 @@ +import lombok.AccessLevel; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor(access=AccessLevel.PRIVATE) +enum GetterEnum { + ONE(1, "One") + ; + @Getter private final int id; + @Getter private final String name; +} 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"); } diff --git a/website/features/GetterSetter.html b/website/features/GetterSetter.html index b1ae5f24..0a576ea6 100644 --- a/website/features/GetterSetter.html +++ b/website/features/GetterSetter.html @@ -48,7 +48,7 @@ For generating the method names, the first character of the field, if it is a lowercase character, is title-cased, otherwise, it is left unmodified. Then, get/set/is is prefixed. </p><p> - No method is generated if any method already exists with the same name and same parameter count. For example, <code>getFoo()</code> + No method is generated if any method already exists with the same name (case insensitive) and same parameter count. For example, <code>getFoo()</code> will not be generated if there's already a method <code>getFoo(String... x)</code> even though it is technically possible to make the method. This caveat exists to prevent confusion. If the generation of a method is skipped for this reason, a warning is emitted instead. Varargs count as 0 to N parameters. </p><p> |