Merge branch 'master' of github.com:rzwitserloot/lombok

This commit is contained in:
grootjans committed 2012-07-02 23:22:40 +02:00
commit c642f8a50c
13 files changed
+88 -11

No files matched your search

+2
View File
@@ -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)
+3 -3
View File
@@ -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.
+3 -3
View File
@@ -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.
@@ -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;
+2 -1
View File
@@ -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 {};
@@ -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();
}
@@ -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;
}
}
@@ -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");
@@ -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;
}
}
@@ -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
{
@@ -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;
}
@@ -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");
}
+1 -1
View File
@@ -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>