aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS1
-rw-r--r--build.xml7
-rw-r--r--doc/changelog.markdown9
-rw-r--r--src/core/lombok/Builder.java2
-rw-r--r--src/core/lombok/core/Version.java2
-rw-r--r--src/core/lombok/core/handlers/singulars.txt6
-rw-r--r--src/core/lombok/eclipse/handlers/HandleConstructor.java2
-rw-r--r--src/core/lombok/javac/apt/LombokFileObjects.java13
-rw-r--r--src/core/lombok/javac/handlers/HandleConstructor.java2
-rw-r--r--src/core/lombok/javac/handlers/JavacHandlerUtil.java17
-rw-r--r--test/core/src/lombok/RunTestsViaEcj.java2
-rw-r--r--test/core/src/lombok/core/TestSingulars.java20
-rw-r--r--test/transform/resource/after-delombok/ConstructorsWithAccessors.java33
-rw-r--r--test/transform/resource/after-delombok/EqualsAndHashCodeOfAndExclude.java (renamed from test/transform/resource/after-delombok/EqualsAndHashcodeOfExclude.java)0
-rw-r--r--test/transform/resource/after-ecj/ConstructorsWithAccessors.java29
-rw-r--r--test/transform/resource/after-ecj/EqualsAndHashCodeOfAndExclude.java (renamed from test/transform/resource/after-ecj/EqualsAndHashcodeOfExclude.java)2
-rw-r--r--test/transform/resource/before/ConstructorsWithAccessors.java8
-rw-r--r--test/transform/resource/before/EqualsAndHashCodeOfAndExclude.java (renamed from test/transform/resource/before/EqualsAndHashCodeOfExclude.java)2
-rw-r--r--website/resources/css/custom.css21
-rw-r--r--website/templates/features/_features.html4
20 files changed, 154 insertions, 28 deletions
diff --git a/AUTHORS b/AUTHORS
index 6a54b021..38ceadeb 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -7,6 +7,7 @@ Dave Brosius <dbrosius@mebigfatguy.com>
Dawid Rusin <dawidrusin90@gmail.com>
Enrique da Costa Cambio <enrique.dacostacambio@gmail.com>
Jappe van der Hel <jappe.vanderhel@gmail.com>
+Kevin Chirls <kchirls@users.noreply.github.com>
Liu DongMiao <liudongmiao@gmail.com>
Luan Nico <luannico27@gmail.com>
Maarten Mulders <mthmulders@users.noreply.github.com>
diff --git a/build.xml b/build.xml
index 13450e06..ad5cd731 100644
--- a/build.xml
+++ b/build.xml
@@ -28,7 +28,8 @@ the common tasks and can be called on to run the main aspects of all the sub-scr
<property name="build.compiler" value="javac1.6" />
<property name="ivy.retrieve.pattern" value="lib/[conf]/[organisation]-[artifact].[ext]" />
<available file="lib/ivyplusplus.jar" property="ivyplusplus.available" />
-
+ <available file="lib/openJDK6Environment/rt-openjdk6.jar" property="rt-openjdk6.available" />
+
<path id="build.path">
<fileset dir="lib/build">
<include name="*.jar" />
@@ -101,8 +102,8 @@ the common tasks and can be called on to run the main aspects of all the sub-scr
<ivy:resolve file="buildScripts/ivy.xml" refresh="true" conf="contrib, ecj7, ecj8" />
<ivy:retrieve />
</target>
-
- <target name="ensureBuildDeps" depends="config-ivy">
+
+ <target name="ensureBuildDeps" depends="config-ivy" unless="rt-openjdk6.available">
<mkdir dir="lib/openJDK6Environment" />
<get src="https://projectlombok.org/ivyrepo/langtools/rt-openjdk6.jar" dest="lib/openJDK6Environment/rt-openjdk6.jar" verbose="true" usetimestamp="true" />
<ivy:resolve file="buildScripts/ivy.xml" refresh="true" conf="build, javac7" />
diff --git a/doc/changelog.markdown b/doc/changelog.markdown
index 3b12ae2b..9c295478 100644
--- a/doc/changelog.markdown
+++ b/doc/changelog.markdown
@@ -1,8 +1,13 @@
Lombok Changelog
----------------
-### v1.16.17 "Edgy Guinea Pig"
-* v1.16.16 is the latest stable release of Project Lombok.
+### v1.16.19 "Edgy Guinea Pig"
+* v1.16.18 is the latest stable release of Project Lombok.
+
+### v1.16.18 (July 3rd, 2017)
+* PLATFORM: JDK9 support much improved since v1.16.6; [Issue #985](https://github.com/rzwitserloot/lombok/issues/985)
+* BUGFIX: Lombok now works with [Bazel](https://bazel.build/) and [Error Prone](https://error-prone.info/). [Issue #1290](https://github.com/rzwitserloot/lombok/issues/1290)
+* FEATURE: Lombok has a new [website](https://projectlombok.org/)! A few very minor changes to the code to be more consistent with it have been added, mostly to the javadoc.
### v1.16.16 "Dancing Elephant" (March 23rd, 2017)
* FEATURE: `@Builder.Default` lets you configure default values for your fields when using `@Builder`. See the [Builder feature page](https://projectlombok.org/features/Builder.html) for more information. [Issue #1201](https://github.com/rzwitserloot/lombok/issues/1201)
diff --git a/src/core/lombok/Builder.java b/src/core/lombok/Builder.java
index af3c3c06..a16717cc 100644
--- a/src/core/lombok/Builder.java
+++ b/src/core/lombok/Builder.java
@@ -48,7 +48,7 @@ import java.lang.annotation.Target;
* as the relevant class, unless a method has been annotated, in which case it'll be equal to the
* return type of that method.
* <p>
- * Complete documentation is found at <a href="https://projectlombok.org/features/experimental/Builder">the project lombok features page for &#64;Builder</a>.
+ * Complete documentation is found at <a href="https://projectlombok.org/features/Builder">the project lombok features page for &#64;Builder</a>.
* <br>
* <p>
* Before:
diff --git a/src/core/lombok/core/Version.java b/src/core/lombok/core/Version.java
index 035f5e8a..18c78b04 100644
--- a/src/core/lombok/core/Version.java
+++ b/src/core/lombok/core/Version.java
@@ -30,7 +30,7 @@ public class Version {
// ** CAREFUL ** - this class must always compile with 0 dependencies (it must not refer to any other sources or libraries).
// Note: In 'X.Y.Z', if Z is odd, its a snapshot build built from the repository, so many different 0.10.3 versions can exist, for example.
// Official builds always end in an even number. (Since 0.10.2).
- private static final String VERSION = "1.16.17";
+ private static final String VERSION = "1.16.19";
private static final String RELEASE_NAME = "Edgy Guinea Pig";
// private static final String RELEASE_NAME = "Dancing Elephant";
diff --git a/src/core/lombok/core/handlers/singulars.txt b/src/core/lombok/core/handlers/singulars.txt
index 9976c76c..d77308cb 100644
--- a/src/core/lombok/core/handlers/singulars.txt
+++ b/src/core/lombok/core/handlers/singulars.txt
@@ -19,7 +19,7 @@ Mice = mouse
Lice = louse
News = !
# We could add more detail (axemen, boatsmen, boogymen, cavemen, gentlemen, etc, but (A) there's stuff like 'cerumen', and (B) the 'men' ending is common in singulars and other languages.)
-# Therefore, the odds of a mistake are too high, so other than these 2 well known cases, so force the explicit singular.
+# Therefore, the odds of a mistake are too high, so other than these 2 well known cases, force the explicit singular.
Men = man
Women = woman
minutiae = minutia
@@ -48,7 +48,9 @@ hives = hive
-shes = sh
-lves = lf
-rves = rf
--ves = fe
+saves = save
+Leaves = leaf
+-ves = !
-ss = !
-us = !
-s =
diff --git a/src/core/lombok/eclipse/handlers/HandleConstructor.java b/src/core/lombok/eclipse/handlers/HandleConstructor.java
index 856f3611..3469e6bf 100644
--- a/src/core/lombok/eclipse/handlers/HandleConstructor.java
+++ b/src/core/lombok/eclipse/handlers/HandleConstructor.java
@@ -350,7 +350,7 @@ public class HandleConstructor {
Annotation[] nonNulls = findAnnotations(field, NON_NULL_PATTERN);
Annotation[] nullables = findAnnotations(field, NULLABLE_PATTERN);
if (nonNulls.length != 0) {
- Statement nullCheck = generateNullCheck(field, sourceNode);
+ Statement nullCheck = generateNullCheck(parameter, sourceNode);
if (nullCheck != null) nullChecks.add(nullCheck);
}
parameter.annotations = copyAnnotations(source, nonNulls, nullables);
diff --git a/src/core/lombok/javac/apt/LombokFileObjects.java b/src/core/lombok/javac/apt/LombokFileObjects.java
index 4edf7f6e..cb2036e9 100644
--- a/src/core/lombok/javac/apt/LombokFileObjects.java
+++ b/src/core/lombok/javac/apt/LombokFileObjects.java
@@ -22,6 +22,7 @@
package lombok.javac.apt;
+import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.net.URI;
import java.nio.file.Path;
@@ -111,6 +112,18 @@ final class LombokFileObjects {
catch (Exception e) {}
return Compiler.JAVAC7;
}
+ if (jfmClassName.equals("com.sun.tools.javac.api.ClientCodeWrapper$WrappedStandardJavaFileManager")) {
+ try {
+ Field wrappedField = Class.forName("com.sun.tools.javac.api.ClientCodeWrapper$WrappedJavaFileManager").getDeclaredField("clientJavaFileManager");
+ wrappedField.setAccessible(true);
+ JavaFileManager wrappedManager = (JavaFileManager)wrappedField.get(jfm);
+ Class<?> superType = Class.forName("com.sun.tools.javac.file.BaseFileManager");
+ if (superType.isInstance(wrappedManager)) {
+ return new Java9Compiler(wrappedManager);
+ }
+ }
+ catch (Exception e) {}
+ }
try {
if (Class.forName("com.sun.tools.javac.file.BaseFileObject") == null) throw new NullPointerException();
return Compiler.JAVAC7;
diff --git a/src/core/lombok/javac/handlers/HandleConstructor.java b/src/core/lombok/javac/handlers/HandleConstructor.java
index 56036963..929de3cd 100644
--- a/src/core/lombok/javac/handlers/HandleConstructor.java
+++ b/src/core/lombok/javac/handlers/HandleConstructor.java
@@ -289,7 +289,7 @@ public class HandleConstructor {
JCVariableDecl param = maker.VarDef(maker.Modifiers(flags, nonNulls.appendList(nullables)), fieldName, field.vartype, null);
params.append(param);
if (!nonNulls.isEmpty()) {
- JCStatement nullCheck = generateNullCheck(maker, fieldNode, source);
+ JCStatement nullCheck = generateNullCheck(maker, fieldNode, param, source);
if (nullCheck != null) nullChecks.append(nullCheck);
}
}
diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
index 1ec2939e..23206b43 100644
--- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java
+++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
@@ -1211,16 +1211,25 @@ public class JavacHandlerUtil {
}
/**
- * Generates a new statement that checks if the given variable is null, and if so, throws a specified exception with the
+ * Generates a new statement that checks if the given variable is null, and if so, throws a configured exception with the
* variable name as message.
- *
- * @param exName The name of the exception to throw; normally {@code java.lang.NullPointerException}.
*/
public static JCStatement generateNullCheck(JavacTreeMaker maker, JavacNode variable, JavacNode source) {
+ return generateNullCheck(maker, variable, (JCVariableDecl)variable.get(), source);
+ }
+
+ /**
+ * Generates a new statement that checks if the given variable is null, and if so, throws a configured exception with the
+ * variable name as message.
+ *
+ * This is a special case method reserved for use when the provided declaration differs from the
+ * variable's declaration, i.e. in a constructor or setter where the local parameter is named the same but with the prefix
+ * stripped as a result of @Accessors.prefix.
+ */
+ public static JCStatement generateNullCheck(JavacTreeMaker maker, JavacNode variable, JCVariableDecl varDecl, JavacNode source) {
NullCheckExceptionType exceptionType = source.getAst().readConfiguration(ConfigurationKeys.NON_NULL_EXCEPTION_TYPE);
if (exceptionType == null) exceptionType = NullCheckExceptionType.NULL_POINTER_EXCEPTION;
- JCVariableDecl varDecl = (JCVariableDecl) variable.get();
if (isPrimitive(varDecl.vartype)) return null;
Name fieldName = varDecl.name;
JCExpression exType = genTypeRef(variable, exceptionType.getExceptionType());
diff --git a/test/core/src/lombok/RunTestsViaEcj.java b/test/core/src/lombok/RunTestsViaEcj.java
index 3f2698bb..775e825c 100644
--- a/test/core/src/lombok/RunTestsViaEcj.java
+++ b/test/core/src/lombok/RunTestsViaEcj.java
@@ -137,7 +137,7 @@ public class RunTestsViaEcj extends AbstractRunTests {
i.remove();
}
}
- classpath.add("bin");
+ if (new File("bin").exists()) classpath.add("bin");
classpath.add("dist/lombok.jar");
classpath.add("lib/test/commons-logging-commons-logging.jar");
classpath.add("lib/test/org.slf4j-slf4j-api.jar");
diff --git a/test/core/src/lombok/core/TestSingulars.java b/test/core/src/lombok/core/TestSingulars.java
index 1134af08..4560615d 100644
--- a/test/core/src/lombok/core/TestSingulars.java
+++ b/test/core/src/lombok/core/TestSingulars.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 The Project Lombok Authors.
+ * Copyright (C) 2015-2017 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
@@ -22,31 +22,35 @@
package lombok.core;
import static lombok.core.handlers.Singulars.autoSingularize;
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.*;
import org.junit.Test;
public class TestSingulars {
@Test
public void testSingulars() {
- assertEquals(null, autoSingularize("axes"));
+ assertNull("axes", autoSingularize("axes"));
assertEquals("adjective", autoSingularize("adjectives"));
assertEquals("bus", autoSingularize("buses"));
assertEquals("octopus", autoSingularize("octopodes"));
- assertEquals(null, autoSingularize("octopi"));
+ assertNull("octopi", autoSingularize("octopi"));
assertEquals("elf", autoSingularize("elves"));
assertEquals("jack", autoSingularize("jacks"));
assertEquals("colloquy", autoSingularize("colloquies"));
- assertEquals(null, autoSingularize("series"));
+ assertNull("series", autoSingularize("series"));
assertEquals("man", autoSingularize("men"));
- assertEquals(null, autoSingularize("highwaymen"));
+ assertNull("highwaymen", autoSingularize("highwaymen"));
assertEquals("caveMan", autoSingularize("caveMen"));
- assertEquals(null, autoSingularize("jackss"));
- assertEquals(null, autoSingularize("virus"));
+ assertNull("jackss", autoSingularize("jackss"));
+ assertNull("virus", autoSingularize("virus"));
assertEquals("quiz", autoSingularize("quizzes"));
assertEquals("database", autoSingularize("databases"));
assertEquals("dataBase", autoSingularize("dataBases"));
assertEquals("Query", autoSingularize("Queries"));
assertEquals("Movie", autoSingularize("Movies"));
+ assertEquals("cafe", autoSingularize("cafes"));
+ assertNull("caves", autoSingularize("caves"));
+ assertEquals("leaf", autoSingularize("leaves"));
+ assertEquals("autosave", autoSingularize("autosaves"));
}
}
diff --git a/test/transform/resource/after-delombok/ConstructorsWithAccessors.java b/test/transform/resource/after-delombok/ConstructorsWithAccessors.java
index 43c0ea66..94ccde08 100644
--- a/test/transform/resource/after-delombok/ConstructorsWithAccessors.java
+++ b/test/transform/resource/after-delombok/ConstructorsWithAccessors.java
@@ -14,3 +14,36 @@ class ConstructorsWithAccessors {
this.__huh2 = _huh2;
}
}
+
+class ConstructorsWithAccessorsNonNull {
+ @lombok.NonNull
+ Integer plower;
+ @lombok.NonNull
+ Integer pUpper;
+ @lombok.NonNull
+ Integer _huh;
+ @lombok.NonNull
+ final Integer __huh2;
+
+ @java.beans.ConstructorProperties({"plower", "upper", "huh", "_huh2"})
+ @java.lang.SuppressWarnings("all")
+ @javax.annotation.Generated("lombok")
+ public ConstructorsWithAccessorsNonNull(@lombok.NonNull final Integer plower, @lombok.NonNull final Integer upper, @lombok.NonNull final Integer huh, @lombok.NonNull final Integer _huh2) {
+ if (plower == null) {
+ throw new java.lang.NullPointerException("plower");
+ }
+ if (upper == null) {
+ throw new java.lang.NullPointerException("upper");
+ }
+ if (huh == null) {
+ throw new java.lang.NullPointerException("huh");
+ }
+ if (_huh2 == null) {
+ throw new java.lang.NullPointerException("_huh2");
+ }
+ this.plower = plower;
+ this.pUpper = upper;
+ this._huh = huh;
+ this.__huh2 = _huh2;
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-delombok/EqualsAndHashcodeOfExclude.java b/test/transform/resource/after-delombok/EqualsAndHashCodeOfAndExclude.java
index 8b9888e9..8b9888e9 100644
--- a/test/transform/resource/after-delombok/EqualsAndHashcodeOfExclude.java
+++ b/test/transform/resource/after-delombok/EqualsAndHashCodeOfAndExclude.java
diff --git a/test/transform/resource/after-ecj/ConstructorsWithAccessors.java b/test/transform/resource/after-ecj/ConstructorsWithAccessors.java
index 7c691b42..0876a5e4 100644
--- a/test/transform/resource/after-ecj/ConstructorsWithAccessors.java
+++ b/test/transform/resource/after-ecj/ConstructorsWithAccessors.java
@@ -11,3 +11,32 @@
this.__huh2 = _huh2;
}
}
+@lombok.AllArgsConstructor @lombok.experimental.Accessors(prefix = {"p", "_"}) class ConstructorsWithAccessorsNonNull {
+ @lombok.NonNull Integer plower;
+ @lombok.NonNull Integer pUpper;
+ @lombok.NonNull Integer _huh;
+ final @lombok.NonNull Integer __huh2;
+ public @java.beans.ConstructorProperties({"plower", "upper", "huh", "_huh2"}) @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") ConstructorsWithAccessorsNonNull(final @lombok.NonNull Integer plower, final @lombok.NonNull Integer upper, final @lombok.NonNull Integer huh, final @lombok.NonNull Integer _huh2) {
+ super();
+ if ((plower == null))
+ {
+ throw new java.lang.NullPointerException("plower");
+ }
+ if ((upper == null))
+ {
+ throw new java.lang.NullPointerException("upper");
+ }
+ if ((huh == null))
+ {
+ throw new java.lang.NullPointerException("huh");
+ }
+ if ((_huh2 == null))
+ {
+ throw new java.lang.NullPointerException("_huh2");
+ }
+ this.plower = plower;
+ this.pUpper = upper;
+ this._huh = huh;
+ this.__huh2 = _huh2;
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/EqualsAndHashcodeOfExclude.java b/test/transform/resource/after-ecj/EqualsAndHashCodeOfAndExclude.java
index 283c5430..30de15cf 100644
--- a/test/transform/resource/after-ecj/EqualsAndHashcodeOfExclude.java
+++ b/test/transform/resource/after-ecj/EqualsAndHashCodeOfAndExclude.java
@@ -43,4 +43,4 @@ final @lombok.EqualsAndHashCode(exclude = {"y"}) class EqualsAndHashCodeExclude
result = ((result * PRIME) + this.x);
return result;
}
-} \ No newline at end of file
+}
diff --git a/test/transform/resource/before/ConstructorsWithAccessors.java b/test/transform/resource/before/ConstructorsWithAccessors.java
index e5d2939f..e67a47ce 100644
--- a/test/transform/resource/before/ConstructorsWithAccessors.java
+++ b/test/transform/resource/before/ConstructorsWithAccessors.java
@@ -4,3 +4,11 @@
int _huh;
int __huh2;
}
+
+@lombok.AllArgsConstructor @lombok.experimental.Accessors(prefix={"p", "_"}) class ConstructorsWithAccessorsNonNull {
+ @lombok.NonNull Integer plower;
+ @lombok.NonNull Integer pUpper;
+ @lombok.NonNull Integer _huh;
+ @lombok.NonNull final Integer __huh2;
+}
+
diff --git a/test/transform/resource/before/EqualsAndHashCodeOfExclude.java b/test/transform/resource/before/EqualsAndHashCodeOfAndExclude.java
index 0625ba52..b8ba21fb 100644
--- a/test/transform/resource/before/EqualsAndHashCodeOfExclude.java
+++ b/test/transform/resource/before/EqualsAndHashCodeOfAndExclude.java
@@ -8,4 +8,4 @@ final class EqualsAndHashCodeOf {
final class EqualsAndHashCodeExclude {
int x;
int y;
-} \ No newline at end of file
+}
diff --git a/website/resources/css/custom.css b/website/resources/css/custom.css
index ba4f56e8..ff31de04 100644
--- a/website/resources/css/custom.css
+++ b/website/resources/css/custom.css
@@ -133,6 +133,27 @@ h1, h2, h3 {
margin: 8px 16px 8px 16px;
}
+.snippet-col {
+ position: relative;
+ min-height: 1px;
+ padding-left: 15px;
+ padding-right: 15px;
+}
+
+@media (min-width: 769px) {
+ .snippet-col {
+ margin-left: -60px;
+ margin-right: -60px;
+ }
+}
+
+@media (min-width: 1000px) {
+ .snippet-col {
+ margin-left: -120px;
+ margin-right: -120px;
+ }
+}
+
a {
cursor: pointer;
}
diff --git a/website/templates/features/_features.html b/website/templates/features/_features.html
index c0c63a76..2e338834 100644
--- a/website/templates/features/_features.html
+++ b/website/templates/features/_features.html
@@ -30,13 +30,13 @@
<#macro snippets name>
<div class="row container-fluid">
- <div class="col-lg-6">
+ <div class="snippet-col first-snippet">
<h3>With Lombok</h3>
<div class="snippet">${usages.pre(name)?no_esc}</div>
</div>
<div class="sep"></div>
- <div class="col-lg-6">
+ <div class="snippet-col second-snippet">
<h3>Vanilla Java</h3>
<div class="snippet">${usages.post(name)?no_esc}</div>