aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--build.xml40
-rw-r--r--buildScripts/ivy.xml15
-rw-r--r--buildScripts/supporters.ant.xml57
-rw-r--r--buildScripts/website.ant.xml14
-rw-r--r--doc/changelog.markdown6
-rw-r--r--src/core/lombok/bytecode/ClassFileMetaData.java7
-rw-r--r--src/core/lombok/core/AnnotationProcessor.java19
-rw-r--r--src/core/lombok/core/LombokInternalAliasing.java3
-rw-r--r--src/core/lombok/core/configuration/AllowHelper.java6
-rw-r--r--src/core/lombok/core/handlers/HandlerUtil.java13
-rw-r--r--src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java53
-rw-r--r--src/core/lombok/eclipse/handlers/HandleBuilder.java5
-rw-r--r--src/core/lombok/eclipse/handlers/HandleBuilderDefault.java23
-rw-r--r--src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java61
-rw-r--r--src/core/lombok/eclipse/handlers/HandleVal.java14
-rw-r--r--src/core/lombok/eclipse/handlers/SetGeneratedByVisitor.java5
-rw-r--r--src/core/lombok/experimental/Builder.java149
-rw-r--r--src/core/lombok/experimental/Value.java62
-rw-r--r--src/core/lombok/experimental/var.java5
-rw-r--r--src/core/lombok/javac/JavacAST.java2
-rw-r--r--src/core/lombok/javac/apt/InterceptingJavaFileManager.java10
-rw-r--r--src/core/lombok/javac/apt/LombokProcessor.java30
-rw-r--r--src/core/lombok/javac/handlers/HandleBuilder.java8
-rw-r--r--src/core/lombok/javac/handlers/HandleBuilderDefault.java24
-rw-r--r--src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java21
-rw-r--r--src/core/lombok/javac/handlers/HandleVal.java12
-rw-r--r--src/core/lombok/javac/handlers/HandleValue.java9
-rw-r--r--src/core/lombok/javac/handlers/JavacHandlerUtil.java86
-rw-r--r--src/core/lombok/var.java35
-rw-r--r--src/core9/module-info.java38
-rw-r--r--src/delombok/lombok/delombok/DocCommentIntegrator.java4
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/PatchVal.java4
-rw-r--r--src/eclipseAgent/lombok/eclipse/agent/PatchValEclipse.java4
-rw-r--r--src/j9stubs/org/mapstruct/ap/spi/AstModifyingAnnotationProcessor.java48
-rw-r--r--src/launch/lombok/launch/AnnotationProcessor.java29
-rw-r--r--src/utils/lombok/javac/Javac.java27
-rw-r--r--test/transform/resource/after-delombok/BuilderChainAndFluent.java32
-rw-r--r--test/transform/resource/after-delombok/EqualsAndHashCodeWithGenericsOnInners.java28
-rw-r--r--test/transform/resource/after-delombok/JavadocGenerally.java3
-rw-r--r--test/transform/resource/after-delombok/ValueExperimental.java46
-rw-r--r--test/transform/resource/after-delombok/ValueExperimentalStarImport.java25
-rw-r--r--test/transform/resource/after-delombok/VarWarning.java6
-rw-r--r--test/transform/resource/after-ecj/BuilderChainAndFluent.java25
-rw-r--r--test/transform/resource/after-ecj/BuilderComplex.java2
-rw-r--r--test/transform/resource/after-ecj/EqualsAndHashCodeWithGenericsOnInners.java32
-rw-r--r--test/transform/resource/after-ecj/ValueExperimental.java39
-rw-r--r--test/transform/resource/after-ecj/ValueExperimentalStarImport.java20
-rw-r--r--test/transform/resource/after-ecj/VarComplex.java2
-rw-r--r--test/transform/resource/after-ecj/VarInFor.java2
-rw-r--r--test/transform/resource/after-ecj/VarInForOld.java2
-rw-r--r--test/transform/resource/after-ecj/VarNullInit.java2
-rw-r--r--test/transform/resource/after-ecj/VarWarning.java10
-rw-r--r--test/transform/resource/before/BuilderChainAndFluent.java4
-rw-r--r--test/transform/resource/before/BuilderComplex.java2
-rw-r--r--test/transform/resource/before/EqualsAndHashCodeWithGenericsOnInners.java6
-rw-r--r--test/transform/resource/before/JavadocGenerally.java3
-rw-r--r--test/transform/resource/before/ValueExperimental.java9
-rw-r--r--test/transform/resource/before/ValueExperimentalStarImport.java5
-rw-r--r--test/transform/resource/before/VarComplex.java3
-rw-r--r--test/transform/resource/before/VarInFor.java3
-rw-r--r--test/transform/resource/before/VarInForOld.java3
-rw-r--r--test/transform/resource/before/VarInForOldMulti.java10
-rw-r--r--test/transform/resource/before/VarModifier.java1
-rw-r--r--test/transform/resource/before/VarNullInit.java3
-rw-r--r--test/transform/resource/before/VarWarning.java3
-rw-r--r--test/transform/resource/messages-delombok/VarInForOldMulti.java.messages1
-rw-r--r--test/transform/resource/messages-delombok/VarNullInit.java.messages2
-rw-r--r--test/transform/resource/messages-delombok/VarWarning.java.messages2
-rw-r--r--test/transform/resource/messages-ecj/BuilderComplex.java.messages1
-rw-r--r--test/transform/resource/messages-ecj/ValInTryWithResources.java.messages1
-rw-r--r--test/transform/resource/messages-ecj/ValueExperimental.java.messages1
-rw-r--r--test/transform/resource/messages-ecj/VarInForOldMulti.java.messages1
-rw-r--r--test/transform/resource/messages-ecj/VarModifier.java.messages3
-rw-r--r--test/transform/resource/messages-ecj/VarNullInit.java.messages2
-rw-r--r--test/transform/resource/messages-ecj/VarWarning.java.messages2
-rw-r--r--website/extra/htaccess10
-rw-r--r--website/resources/W8BEN_lombok.pdfbin0 -> 60743 bytes
-rw-r--r--website/resources/css/custom.css100
-rw-r--r--website/resources/files/supporters.json13
-rw-r--r--website/resources/img/spinner.gifbin0 -> 828 bytes
-rw-r--r--website/resources/js/main.js2
-rw-r--r--website/resources/js/order-license.js231
-rw-r--r--website/resources/js/supporters.js221
-rw-r--r--website/templates/_scaffold.html18
-rw-r--r--website/templates/contributing.html5
-rw-r--r--website/templates/features/index.html4
-rw-r--r--website/templates/features/var.html (renamed from website/templates/features/experimental/var.html)22
-rw-r--r--website/templates/main.html13
-rw-r--r--website/templates/order-license-info.html31
-rw-r--r--website/templates/order-license.html151
-rw-r--r--website/templates/setup/intellij.html2
-rw-r--r--website/templates/setup/javac.html12
-rw-r--r--website/templates/setup/vscode.html18
-rw-r--r--website/templates/supporters.html10
95 files changed, 1556 insertions, 605 deletions
diff --git a/.gitignore b/.gitignore
index b05ce2c6..49316515 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,4 +19,5 @@
/junit*.properties
/eclipse.location
/.apt_generated/
-/out \ No newline at end of file
+/out
+/website/lombokSupporters
diff --git a/build.xml b/build.xml
index 633d7922..645114a7 100644
--- a/build.xml
+++ b/build.xml
@@ -1,5 +1,5 @@
<!--
- Copyright (C) 2010-2017 The Project Lombok Authors.
+ Copyright (C) 2010-2018 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
@@ -118,6 +118,11 @@ the common tasks and can be called on to run the main aspects of all the sub-scr
<ivy:retrieve />
</target>
+ <target name="ensureSupportersDeps" depends="config-ivy">
+ <ivy:resolve file="buildScripts/ivy.xml" refresh="true" conf="supporters" />
+ <ivy:retrieve />
+ </target>
+
<target name="version" depends="ensure-ipp" description="Shows the version number." unless="lombok.version">
<mkdir dir="build/lombok" />
<ivy:compile destdir="build/lombok" source="1.5" target="1.5" ecj="true" nowarn="true">
@@ -174,6 +179,7 @@ the common tasks and can be called on to run the main aspects of all the sub-scr
<ivy:compile destdir="build/lombok-utils" source="1.6" target="1.6">
<compilerarg value="-Xbootclasspath/p:build/stubs${path.separator}lib/openJDK6Environment/rt-openjdk6.jar" />
+ <compilerarg value="-Xlint:-options" />
<src path="src/utils" />
<include name="lombok/javac/**" />
<classpath location="build/lombok-utils" />
@@ -195,17 +201,17 @@ the common tasks and can be called on to run the main aspects of all the sub-scr
</lineContainsRegExp>
</filterchain>
</copy>
-
+
<ivy:compile destdir="build/lombok" source="1.4" target="1.4" ecj="true" nowarn="true" includeSystemBootclasspath="true">
<bootclasspath location="build/stubs" />
<src path="build/transformedSources" />
</ivy:compile>
-
+
<ivy:compile destdir="build/lombok/Class50" source="1.4" target="1.6" ecj="true" nowarn="true" includeSystemBootclasspath="true">
<bootclasspath location="build/stubs" />
<src path="build/transformedSources" />
</ivy:compile>
-
+
<ivy:compile destdir="build/lombok" source="1.5" target="1.5" ecj="true" nowarn="true" includeSystemBootclasspath="true">
<bootclasspath location="build/stubs" />
<src path="src/launch" />
@@ -218,6 +224,15 @@ the common tasks and can be called on to run the main aspects of all the sub-scr
<classpath refid="build.path" />
</ivy:compile>
+ <ivy:compile destdir="build/lombok" source="1.9" target="1.9">
+ <compilerarg value="-Xlint:none" />
+ <!-- The above is because javac9 warns about 'service interface provided but not exported or used', probably because lombok uses SPI internally, and uses the 'old' classpath discovery system for it. We're fine with this, hence, ignore this warning. -->
+ <src path="src/core9" />
+ <src path="src/j9stubs" />
+ <!-- This includes org.mapstruct.ap.spi.AstModifyingAnnotationProcessor; putting this on the classpath doesn't work (needs to be internal or a module) so we just add it and then delete the class file for convenience. -->
+ </ivy:compile>
+ <delete file="build/lombok/org/mapstruct/ap/spi/AstModifyingAnnotationProcessor.class" />
+
<ivy:compile destdir="build/lombok/Class50" source="1.5" target="1.6" ecj="true" nowarn="true" includeSystemBootclasspath="true">
<bootclasspath location="build/stubs" />
<src path="src/eclipseAgent" />
@@ -228,6 +243,7 @@ the common tasks and can be called on to run the main aspects of all the sub-scr
<ivy:compile destdir="build/lombok" source="1.6" target="1.6">
<compilerarg value="-Xbootclasspath/p:build/stubs${path.separator}lib/openJDK6Environment/rt-openjdk6.jar" />
+ <compilerarg value="-Xlint:-options" />
<src path="src/core" />
<src path="src/delombok" />
<include name="lombok/javac/**" />
@@ -281,6 +297,7 @@ lombok.launch.AnnotationProcessorHider$ClaimingProcessor</echo>
<fileset dir="." includes="AUTHORS" />
<fileset dir="." includes="release-timestamp.txt" />
<fileset dir="build/lombok">
+ <include name="module-info.class" />
<include name="lombok/*.class" />
<include name="lombok/experimental/**" />
<include name="lombok/extern/**" />
@@ -291,6 +308,7 @@ lombok.launch.AnnotationProcessorHider$ClaimingProcessor</echo>
<mappedresources>
<fileset dir="build/lombok">
<exclude name="com/sun/tools/javac/**" />
+ <exclude name="module-info.class" />
<exclude name="lombok/*.class" />
<exclude name="lombok/javac/apt/Processor.class" />
<exclude name="lombok/experimental/**" />
@@ -876,7 +894,17 @@ You can also create your own by writing a 'testenvironment.properties' file. The
</ant>
</target>
- <target name="website-only-publish" depends="config-ssh, clean"
+ <target name="website-supporters" depends="ensureSupportersDeps, website-only" description="Updates the supporters repo and adds it to the website build.">
+ <ant antfile="buildScripts/supporters.ant.xml" target="deployToWebsiteBuild" inheritAll="false" />
+ </target>
+
+ <target name="website-supporters-fast" depends="website-only" description="Updates the supporters repo and adds it to the website build.">
+ <ant antfile="buildScripts/supporters.ant.xml" target="deployToWebsiteBuild" inheritAll="false">
+ <property name="noUpdateRepo" value="true" />
+ </ant>
+ </target>
+
+ <target name="website-only-publish" depends="config-ssh, clean, ensureSupportersDeps"
description="Prepares the website (using lombok version current 'live') for distribution and then publishes it to projectlombok.org.">
<ant antfile="buildScripts/website.ant.xml" target="website-only-publish" inheritAll="false">
<property name="ssh.username" value="${ssh.username}" />
@@ -884,7 +912,7 @@ You can also create your own by writing a 'testenvironment.properties' file. The
</ant>
</target>
- <target name="website-publish" depends="config-ssh, clean, version"
+ <target name="website-publish" depends="config-ssh, clean, version, ensureSupportersDeps"
description="Prepares the website for distribution and then publishes it to projectlombok.org.">
<ant antfile="buildScripts/website.ant.xml" target="website-publish" inheritAll="false">
<property name="lombok.version" value="${lombok.version}" />
diff --git a/buildScripts/ivy.xml b/buildScripts/ivy.xml
index 81f50f4c..a27c909e 100644
--- a/buildScripts/ivy.xml
+++ b/buildScripts/ivy.xml
@@ -14,6 +14,7 @@
<conf name="ecj9" />
<conf name="javac6" />
<conf name="javac7" />
+ <conf name="supporters" />
</configurations>
<dependencies>
<dependency org="org.projectlombok" name="lombok.patcher" rev="0.24" conf="buildBase->default; runtime->default" />
@@ -22,10 +23,10 @@
<dependency org="junit" name="junit" rev="4.8.2" conf="test->default; contrib->sources" />
<dependency org="log4j" name="log4j" rev="1.2.16" conf="test->default; contrib->sources" />
<dependency org="org.apache.logging.log4j" name="log4j-api" rev="2.0-beta4" conf="test->default; contrib->sources" />
- <dependency org="commons-logging" name="commons-logging" rev="1.1.1" conf="test->default; contrib->sources"/>
- <dependency org="org.slf4j" name="slf4j-api" rev="1.6.1" conf="test->default; contrib->sources"/>
- <dependency org="org.slf4j" name="slf4j-ext" rev="1.6.1" conf="test->default; contrib->sources"/>
- <dependency org="org.jboss.logging" name="jboss-logging" rev="3.3.0.Final" conf="test->default; contrib->sources"/>
+ <dependency org="commons-logging" name="commons-logging" rev="1.1.1" conf="test->default; contrib->sources" />
+ <dependency org="org.slf4j" name="slf4j-api" rev="1.6.1" conf="test->default; contrib->sources" />
+ <dependency org="org.slf4j" name="slf4j-ext" rev="1.6.1" conf="test->default; contrib->sources" />
+ <dependency org="org.jboss.logging" name="jboss-logging" rev="3.3.0.Final" conf="test->default; contrib->sources" />
<dependency org="com.google.guava" name="guava" rev="18.0" conf="test->default; contrib->sources" />
<dependency org="com.google.code.findbugs" name="findbugs" rev="3.0.0" conf="test->master" />
@@ -56,5 +57,11 @@
<dependency org="org.eclipse.custom" name="osgi" rev="3.9.0" conf="eclipseBuild->default; contrib->sources" />
<dependency org="org.eclipse.custom" name="core.resources" rev="3.8.100" conf="eclipseBuild->default; contrib->sources" />
<dependency org="org.eclipse.custom" name="core.jobs" rev="3.5.300" conf="eclipseBuild->default; contrib->sources" />
+
+ <dependency org="org.eclipse.jgit" name="org.eclipse.jgit.ant" rev="4.11.0.201803080745-r" conf="supporters->default" />
+ <dependency org="org.eclipse.jgit" name="org.eclipse.jgit" rev="4.11.0.201803080745-r" conf="supporters->default" />
+ <dependency org="com.jcraft" name="jsch" rev="0.1.54" conf="supporters->default" />
+ <dependency org="com.rimerosolutions.ant" name="ant-git-tasks" rev="1.3.2" conf="supporters->default" />
+ <dependency org="org.slf4j" name="slf4j-simple" rev="1.6.1" conf="supporters->default" />
</dependencies>
</ivy-module>
diff --git a/buildScripts/supporters.ant.xml b/buildScripts/supporters.ant.xml
new file mode 100644
index 00000000..d1d3fedc
--- /dev/null
+++ b/buildScripts/supporters.ant.xml
@@ -0,0 +1,57 @@
+<!--
+ Copyright (C) 2010-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
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+-->
+<project name="lombok-supporters" default="updateRepo" basedir=".." xmlns:ivy="antlib:com.zwitserloot.ivyplusplus" xmlns:git="antlib:com.rimerosolutions.ant.git">
+ <description>
+This buildfile is part of projectlombok.org. It is responsible for updating/maintaining the separate git repository
+containing the status of lombok's supporters.
+ </description>
+
+ <path id="supporters.path">
+ <fileset dir="lib/supporters">
+ <include name="*.jar" />
+ </fileset>
+ </path>
+
+ <taskdef uri="antlib:com.rimerosolutions.ant.git" resource="com/rimerosolutions/ant/git/jgit-ant-lib.xml" classpathref="supporters.path" />
+
+ <target name="checkIfRepoExists">
+ <available file="website/lombokSupporters/.git/HEAD" property="supportersrepo.exists" />
+ </target>
+
+ <target name="initRepo" depends="checkIfRepoExists" unless="supportersrepo.exists">
+ <git:git directory="website/lombokSupporters">
+ <git:clone uri="escudo2:/data/git/lombokSupporters.git" />
+ </git:git>
+ </target>
+
+ <target name="updateRepo" depends="initRepo" unless="noUpdateRepo">
+ <git:git directory="website/lombokSupporters">
+ <git:pull />
+ </git:git>
+ </target>
+
+ <target name="deployToWebsiteBuild" depends="updateRepo">
+ <copy todir="build/website/files" overwrite="true" failonerror="false" quiet="true">
+ <fileset dir="website/lombokSupporters" />
+ </copy>
+ </target>
+</project>
diff --git a/buildScripts/website.ant.xml b/buildScripts/website.ant.xml
index 36b3a193..5c996fc6 100644
--- a/buildScripts/website.ant.xml
+++ b/buildScripts/website.ant.xml
@@ -37,13 +37,17 @@ such as applying the templates to produce the website, converting the changelog
<delete dir="build/website" quiet="true" />
</target>
- <target name="website-only" description="Prepares the website for distribution using the lombok version currently 'live'." depends="-fetch-version-from-site, -show-version, -ensure-version, -website-main, -delete-edge-page, -website-only-dist" />
+ <target name="website-only" description="Prepares the website for distribution using the lombok version currently 'live'." depends="-fetch-version-from-site, -show-version, -ensure-version, -website-main, -delete-edge-page" />
<target name="-delete-edge-page">
<delete file="build/website/download-edge.html" />
</target>
- <target name="website" description="Prepares the website for distribution" depends="javadoc, -website-main, -website-dist" />
+ <target name="website" description="Prepares the website for distribution" depends="javadoc, -website-main" />
+
+ <target name="website-supporters" description="Updates website supporters store and adds it to the website build.">
+ <ant antfile="buildScripts/supporters.ant.xml" target="deployToWebsiteBuild" inheritAll="false" />
+ </target>
<target name="-fetch-version-from-site" depends="-compile-webclasses">
<fail if="lombok.version">lombok.version already set.</fail>
@@ -80,6 +84,8 @@ such as applying the templates to produce the website, converting the changelog
<target name="-compile-webclasses">
<mkdir dir="build/webclasses" />
<javac includeDestClasses="false" includeantruntime="false" destdir="build/webclasses" debug="on" source="1.8" target="1.8">
+ <compilerarg value="-proc:none" />
+ <compilerarg value="-Xlint:-options" />
<classpath refid="build.path" />
<src path="src/website" />
</javac>
@@ -132,8 +138,8 @@ such as applying the templates to produce the website, converting the changelog
</tar>
</target>
- <target name="website-publish" depends="website, -send-site-to-remote" />
- <target name="website-only-publish" depends="website-only, -send-site-to-remote" />
+ <target name="website-publish" depends="website, website-supporters, -website-dist, -send-site-to-remote" />
+ <target name="website-only-publish" depends="website-only, website-supporters, -website-only-dist, -send-site-to-remote" />
<target name="-send-site-to-remote" depends="-requires-ssh">
<ivy:scpUpload
from="dist/website.tar.bz2"
diff --git a/doc/changelog.markdown b/doc/changelog.markdown
index 7172b166..9e84afb8 100644
--- a/doc/changelog.markdown
+++ b/doc/changelog.markdown
@@ -3,7 +3,11 @@ Lombok Changelog
### v1.16.21 "Edgy Guinea Pig"
* v1.16.20 is the latest stable release of Project Lombok.
-* Potential fix for Netbeans < 9. [Issue #1555](https://github.com/rzwitserloot/lombok/issues/1555)
+* PLATFORM: Fix for using lombok together with JDK9's new `module-info.java` feature. [Issue #985](https://github.com/rzwitserloot/lombok/issues/985)
+* PLATFORM: Some initial work on supporting JDK10.
+* BUGFIX: Potential fix for Netbeans < 9. [Issue #1555](https://github.com/rzwitserloot/lombok/issues/1555)
+* PROMOTION: `var` has been promoted from experimental to the main package with no changes. The 'old' experimental one is still around but is deprecated, and is an alias for the new main package one. [var documentation](https://projectlombok.org/features/var.html).
+* OLD-CRUFT: `lombok.experimental.Builder` and `lombok.experimental.Value` are deprecated remnants of when these features were still in experimental. They are now removed entirely. If your project is dependent on an older version of lombok which still has those; fret not, lombok still processes these annotations. It just no longer includes them in the jar.
### v1.16.20 (January 9th, 2018)
* PLATFORM: Better support for jdk9 in the new IntelliJ, Netbeans and for Gradle.
diff --git a/src/core/lombok/bytecode/ClassFileMetaData.java b/src/core/lombok/bytecode/ClassFileMetaData.java
index 68b8bb7d..0dc6a6c8 100644
--- a/src/core/lombok/bytecode/ClassFileMetaData.java
+++ b/src/core/lombok/bytecode/ClassFileMetaData.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 The Project Lombok Authors.
+ * Copyright (C) 2010-2018 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
@@ -44,6 +44,9 @@ public class ClassFileMetaData {
private static final byte METHOD_HANDLE = 15;
private static final byte METHOD_TYPE = 16;
private static final byte INVOKE_DYNAMIC = 18;
+ // New in java9: support for modules
+ private static final byte MODULE = 19;
+ private static final byte PACKAGE = 20;
private static final int NOT_FOUND = -1;
private static final int START_OF_CONSTANT_POOL = 8;
@@ -79,6 +82,8 @@ public class ClassFileMetaData {
case CLASS:
case STRING:
case METHOD_TYPE:
+ case MODULE:
+ case PACKAGE:
position += 2;
break;
case METHOD_HANDLE:
diff --git a/src/core/lombok/core/AnnotationProcessor.java b/src/core/lombok/core/AnnotationProcessor.java
index 5531ad8e..5b4ef393 100644
--- a/src/core/lombok/core/AnnotationProcessor.java
+++ b/src/core/lombok/core/AnnotationProcessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2014 The Project Lombok Authors.
+ * Copyright (C) 2009-2018 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
@@ -40,6 +40,7 @@ import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.Element;
+import javax.lang.model.element.Name;
import javax.lang.model.element.TypeElement;
import javax.tools.Diagnostic.Kind;
@@ -163,7 +164,21 @@ public class AnnotationProcessor extends AbstractProcessor {
for (ProcessorDescriptor proc : active) proc.process(annotations, roundEnv);
- return false;
+ boolean onlyLombok = true;
+ boolean zeroElems = true;
+ for (TypeElement elem : annotations) {
+ zeroElems = false;
+ Name n = elem.getQualifiedName();
+ if (n.length() > 7 && n.subSequence(0, 7).toString().equals("lombok.")) continue;
+ onlyLombok = false;
+ }
+
+ // Normally we rely on the claiming processor to claim away all lombok annotations.
+ // One of the many Java9 oversights is that this 'process' API has not been fixed to address the point that 'files I want to look at' and 'annotations I want to claim' must be one and the same,
+ // and yet in java9 you can no longer have 2 providers for the same service, thus, if you go by module path, lombok no longer loads the ClaimingProcessor.
+ // This doesn't do as good a job, but it'll have to do. The only way to go from here, I think, is either 2 modules, or use reflection hackery to add ClaimingProcessor during our init.
+
+ return onlyLombok && !zeroElems;
}
/**
diff --git a/src/core/lombok/core/LombokInternalAliasing.java b/src/core/lombok/core/LombokInternalAliasing.java
index 08764a5c..3dc1bfa2 100644
--- a/src/core/lombok/core/LombokInternalAliasing.java
+++ b/src/core/lombok/core/LombokInternalAliasing.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013-2014 The Project Lombok Authors.
+ * Copyright (C) 2013-2018 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
@@ -51,6 +51,7 @@ public class LombokInternalAliasing {
Map<String, String> m2 = new HashMap<String, String>();
m2.put("lombok.experimental.Value", "lombok.Value");
m2.put("lombok.experimental.Builder", "lombok.Builder");
+ m2.put("lombok.experimental.var", "lombok.var");
m2.put("lombok.Delegate", "lombok.experimental.Delegate");
ALIASES = Collections.unmodifiableMap(m2);
}
diff --git a/src/core/lombok/core/configuration/AllowHelper.java b/src/core/lombok/core/configuration/AllowHelper.java
index 3873b055..1146ccde 100644
--- a/src/core/lombok/core/configuration/AllowHelper.java
+++ b/src/core/lombok/core/configuration/AllowHelper.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 The Project Lombok Authors.
+ * Copyright (C) 2018 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
@@ -24,10 +24,8 @@ package lombok.core.configuration;
import java.util.Collection;
import java.util.Collections;
-import lombok.ConfigurationKeys;
-
public final class AllowHelper {
- private final static Collection<? extends ConfigurationKey<?>> ALLOWABLE = Collections.singleton(ConfigurationKeys.VAR_FLAG_USAGE);
+ private final static Collection<? extends ConfigurationKey<?>> ALLOWABLE = Collections.emptySet();
private AllowHelper() {
// Prevent instantiation
diff --git a/src/core/lombok/core/handlers/HandlerUtil.java b/src/core/lombok/core/handlers/HandlerUtil.java
index f4705e5b..6b516904 100644
--- a/src/core/lombok/core/handlers/HandlerUtil.java
+++ b/src/core/lombok/core/handlers/HandlerUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013-2017 The Project Lombok Authors.
+ * Copyright (C) 2013-2018 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
@@ -171,11 +171,12 @@ public class HandlerUtil {
}
@SuppressWarnings({"all", "unchecked", "deprecation"})
- public static final List<Class<? extends java.lang.annotation.Annotation>> INVALID_ON_BUILDERS = Collections.unmodifiableList(
- Arrays.<Class<? extends java.lang.annotation.Annotation>>asList(
- Getter.class, Setter.class, Wither.class, ToString.class, EqualsAndHashCode.class,
- RequiredArgsConstructor.class, AllArgsConstructor.class, NoArgsConstructor.class,
- Data.class, Value.class, lombok.experimental.Value.class, FieldDefaults.class));
+ public static final List<String> INVALID_ON_BUILDERS = Collections.unmodifiableList(
+ Arrays.<String>asList(
+ Getter.class.getName(), Setter.class.getName(), Wither.class.getName(),
+ ToString.class.getName(), EqualsAndHashCode.class.getName(),
+ RequiredArgsConstructor.class.getName(), AllArgsConstructor.class.getName(), NoArgsConstructor.class.getName(),
+ Data.class.getName(), Value.class.getName(), "lombok.experimental.Value", FieldDefaults.class.getName()));
/**
* Given the name of a field, return the 'base name' of that field. For example, {@code fFoobar} becomes {@code foobar} if {@code f} is in the prefix list.
diff --git a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
index f49fff7f..e36e80bc 100644
--- a/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
+++ b/src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2017 The Project Lombok Authors.
+ * Copyright (C) 2009-2018 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
@@ -197,17 +197,36 @@ public class EclipseHandlerUtil {
TypeResolver resolver = new TypeResolver(node.getImportList());
return resolver.typeMatches(node, type.getName(), typeName);
+ }
+
+ /**
+ * Checks if the given TypeReference node is likely to be a reference to the provided class.
+ *
+ * @param type An actual type. This method checks if {@code typeNode} is likely to be a reference to this type.
+ * @param node A Lombok AST node. Any node in the appropriate compilation unit will do (used to get access to import statements).
+ * @param typeRef A type reference to check.
+ */
+ public static boolean typeMatches(String type, EclipseNode node, TypeReference typeRef) {
+ if (typeRef == null || typeRef.getTypeName() == null || typeRef.getTypeName().length == 0) return false;
+ String lastPartA = new String(typeRef.getTypeName()[typeRef.getTypeName().length -1]);
+ int lastIndex = type.lastIndexOf('.');
+ String lastPartB = lastIndex == -1 ? type : type.substring(lastIndex + 1);
+ if (!lastPartA.equals(lastPartB)) return false;
+ String typeName = toQualifiedName(typeRef.getTypeName());
+ TypeResolver resolver = new TypeResolver(node.getImportList());
+ return resolver.typeMatches(node, type, typeName);
}
public static void sanityCheckForMethodGeneratingAnnotationsOnBuilderClass(EclipseNode typeNode, EclipseNode errorNode) {
List<String> disallowed = null;
for (EclipseNode child : typeNode.down()) {
if (child.getKind() != Kind.ANNOTATION) continue;
- for (Class<? extends java.lang.annotation.Annotation> annType : INVALID_ON_BUILDERS) {
+ for (String annType : INVALID_ON_BUILDERS) {
if (annotationTypeMatches(annType, child)) {
if (disallowed == null) disallowed = new ArrayList<String>();
- disallowed.add(annType.getSimpleName());
+ int lastIndex = annType.lastIndexOf('.');
+ disallowed.add(lastIndex == -1 ? annType : annType.substring(lastIndex + 1));
}
}
}
@@ -444,6 +463,24 @@ public class EclipseHandlerUtil {
}
}
+ public static boolean hasAnnotation(String type, EclipseNode node) {
+ if (node == null) return false;
+ if (type == null) return false;
+ switch (node.getKind()) {
+ case ARGUMENT:
+ case FIELD:
+ case LOCAL:
+ case TYPE:
+ case METHOD:
+ for (EclipseNode child : node.down()) {
+ if (annotationTypeMatches(type, child)) return true;
+ }
+ // intentional fallthrough
+ default:
+ return false;
+ }
+ }
+
public static EclipseNode findAnnotation(Class<? extends java.lang.annotation.Annotation> type, EclipseNode node) {
if (node == null) return null;
if (type == null) return null;
@@ -472,6 +509,16 @@ public class EclipseHandlerUtil {
return typeMatches(type, node, ((Annotation) node.get()).type);
}
+ /**
+ * Checks if the provided annotation type is likely to be the intended type for the given annotation node.
+ *
+ * This is a guess, but a decent one.
+ */
+ public static boolean annotationTypeMatches(String type, EclipseNode node) {
+ if (node.getKind() != Kind.ANNOTATION) return false;
+ return typeMatches(type, node, ((Annotation) node.get()).type);
+ }
+
public static TypeReference cloneSelfType(EclipseNode context) {
return cloneSelfType(context, null);
}
diff --git a/src/core/lombok/eclipse/handlers/HandleBuilder.java b/src/core/lombok/eclipse/handlers/HandleBuilder.java
index 12b8f6bc..dd862393 100644
--- a/src/core/lombok/eclipse/handlers/HandleBuilder.java
+++ b/src/core/lombok/eclipse/handlers/HandleBuilder.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013-2017 The Project Lombok Authors.
+ * Copyright (C) 2013-2018 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
@@ -185,8 +185,7 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
TypeDeclaration td = (TypeDeclaration) tdParent.get();
List<EclipseNode> allFields = new ArrayList<EclipseNode>();
- @SuppressWarnings("deprecation")
- boolean valuePresent = (hasAnnotation(lombok.Value.class, parent) || hasAnnotation(lombok.experimental.Value.class, parent));
+ boolean valuePresent = (hasAnnotation(lombok.Value.class, parent) || hasAnnotation("lombok.experimental.Value", parent));
for (EclipseNode fieldNode : HandleConstructor.findAllFields(tdParent, true)) {
FieldDeclaration fd = (FieldDeclaration) fieldNode.get();
EclipseNode isDefault = findAnnotation(Builder.Default.class, fieldNode);
diff --git a/src/core/lombok/eclipse/handlers/HandleBuilderDefault.java b/src/core/lombok/eclipse/handlers/HandleBuilderDefault.java
index da184d0b..be2b986d 100644
--- a/src/core/lombok/eclipse/handlers/HandleBuilderDefault.java
+++ b/src/core/lombok/eclipse/handlers/HandleBuilderDefault.java
@@ -1,3 +1,24 @@
+/*
+ * Copyright (C) 2017-2018 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
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
package lombok.eclipse.handlers;
import static lombok.eclipse.handlers.EclipseHandlerUtil.*;
@@ -18,7 +39,7 @@ public class HandleBuilderDefault extends EclipseAnnotationHandler<Builder.Defau
EclipseNode annotatedField = annotationNode.up();
if (annotatedField.getKind() != Kind.FIELD) return;
EclipseNode classWithAnnotatedField = annotatedField.up();
- if (!hasAnnotation(Builder.class, classWithAnnotatedField)) {
+ if (!hasAnnotation(Builder.class, classWithAnnotatedField) && !hasAnnotation("lombok.experimental.Builder", classWithAnnotatedField)) {
annotationNode.addWarning("@Builder.Default requires @Builder on the class for it to mean anything.");
}
}
diff --git a/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java b/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java
index 0d0f51db..75339f7c 100644
--- a/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java
+++ b/src/core/lombok/eclipse/handlers/HandleEqualsAndHashCode.java
@@ -475,47 +475,62 @@ public class HandleEqualsAndHashCode extends EclipseAnnotationHandler<EqualsAndH
public TypeReference createTypeReference(EclipseNode type, long p, ASTNode source, boolean addWildcards) {
int pS = source.sourceStart; int pE = source.sourceEnd;
List<String> list = new ArrayList<String>();
+ List<Integer> genericsCount = addWildcards ? new ArrayList<Integer>() : null;
+
list.add(type.getName());
+ if (addWildcards) genericsCount.add(arraySizeOf(((TypeDeclaration) type.get()).typeParameters));
+ boolean staticContext = (((TypeDeclaration) type.get()).modifiers & Modifier.STATIC) != 0;
EclipseNode tNode = type.up();
+
while (tNode != null && tNode.getKind() == Kind.TYPE) {
list.add(tNode.getName());
+ if (addWildcards) genericsCount.add(staticContext ? 0 : arraySizeOf(((TypeDeclaration) tNode.get()).typeParameters));
+ if (!staticContext) staticContext = (((TypeDeclaration) tNode.get()).modifiers & Modifier.STATIC) != 0;
tNode = tNode.up();
}
Collections.reverse(list);
-
- TypeDeclaration typeDecl = (TypeDeclaration) type.get();
- int typeParamCount = typeDecl.typeParameters == null ? 0 : typeDecl.typeParameters.length;
- if (typeParamCount == 0) addWildcards = false;
- TypeReference[] typeArgs = null;
- if (addWildcards) {
- typeArgs = new TypeReference[typeParamCount];
- for (int i = 0; i < typeParamCount; i++) {
- typeArgs[i] = new Wildcard(Wildcard.UNBOUND);
- typeArgs[i].sourceStart = pS; typeArgs[i].sourceEnd = pE;
- setGeneratedBy(typeArgs[i], source);
- }
- }
+ if (addWildcards) Collections.reverse(genericsCount);
if (list.size() == 1) {
- if (addWildcards) {
- return new ParameterizedSingleTypeReference(list.get(0).toCharArray(), typeArgs, 0, p);
- } else {
+ if (!addWildcards || genericsCount.get(0) == 0) {
return new SingleTypeReference(list.get(0).toCharArray(), p);
+ } else {
+ return new ParameterizedSingleTypeReference(list.get(0).toCharArray(), wildcardify(pS, pE, source, genericsCount.get(0)), 0, p);
}
}
+
+ if (addWildcards) {
+ addWildcards = false;
+ for (int i : genericsCount) if (i > 0) addWildcards = true;
+ }
+
long[] ps = new long[list.size()];
char[][] tokens = new char[list.size()][];
for (int i = 0; i < list.size(); i++) {
ps[i] = p;
tokens[i] = list.get(i).toCharArray();
}
- if (addWildcards) {
- TypeReference[][] typeArgs2 = new TypeReference[tokens.length][];
- typeArgs2[typeArgs2.length - 1] = typeArgs;
- return new ParameterizedQualifiedTypeReference(tokens, typeArgs2, 0, ps);
- } else {
- return new QualifiedTypeReference(tokens, ps);
+
+ if (!addWildcards) return new QualifiedTypeReference(tokens, ps);
+ TypeReference[][] typeArgs2 = new TypeReference[tokens.length][];
+ for (int i = 0; i < tokens.length; i++) typeArgs2[i] = wildcardify(pS, pE, source, genericsCount.get(i));
+ return new ParameterizedQualifiedTypeReference(tokens, typeArgs2, 0, ps);
+ }
+
+ private TypeReference[] wildcardify(int pS, int pE, ASTNode source, int count) {
+ if (count == 0) return null;
+ TypeReference[] typeArgs = new TypeReference[count];
+ for (int i = 0; i < count; i++) {
+ typeArgs[i] = new Wildcard(Wildcard.UNBOUND);
+ typeArgs[i].sourceStart = pS; typeArgs[i].sourceEnd = pE;
+ setGeneratedBy(typeArgs[i], source);
}
+
+ return typeArgs;
+ }
+
+ private int arraySizeOf(Object[] arr) {
+ return arr == null ? 0 : arr.length;
}
public MethodDeclaration createEquals(EclipseNode type, Collection<EclipseNode> fields, boolean callSuper, ASTNode source, FieldAccess fieldAccess, boolean needsCanEqual, List<Annotation> onParam) {
@@ -683,7 +698,7 @@ public class HandleEqualsAndHashCode extends EclipseAnnotationHandler<EqualsAndH
} else /* objects */ {
/* final java.lang.Object this$fieldName = this.fieldName; */
/* final java.lang.Object other$fieldName = other.fieldName; */
- /* if (this$fieldName == null ? other$fieldName != null : !this$fieldName.equals(other$fieldName)) return false;; */
+ /* if (this$fieldName == null ? other$fieldName != null : !this$fieldName.equals(other$fieldName)) return false; */
char[] thisDollarFieldName = ("this$" + field.getName()).toCharArray();
char[] otherDollarFieldName = ("other$" + field.getName()).toCharArray();
diff --git a/src/core/lombok/eclipse/handlers/HandleVal.java b/src/core/lombok/eclipse/handlers/HandleVal.java
index d8901067..3742ac00 100644
--- a/src/core/lombok/eclipse/handlers/HandleVal.java
+++ b/src/core/lombok/eclipse/handlers/HandleVal.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2016 The Project Lombok Authors.
+ * Copyright (C) 2010-2018 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
@@ -25,13 +25,14 @@ import static lombok.core.handlers.HandlerUtil.handleFlagUsage;
import static lombok.eclipse.handlers.EclipseHandlerUtil.typeMatches;
import lombok.ConfigurationKeys;
import lombok.val;
+import lombok.var;
import lombok.core.HandlerPriority;
import lombok.eclipse.DeferUntilPostDiet;
import lombok.eclipse.EclipseASTAdapter;
import lombok.eclipse.EclipseASTVisitor;
import lombok.eclipse.EclipseNode;
-import lombok.experimental.var;
+import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.ArrayInitializer;
import org.eclipse.jdt.internal.compiler.ast.ForStatement;
import org.eclipse.jdt.internal.compiler.ast.ForeachStatement;
@@ -74,11 +75,18 @@ public class HandleVal extends EclipseASTAdapter {
return;
}
- if (isVal && localNode.directUp().get() instanceof ForStatement) {
+ ASTNode parentRaw = localNode.directUp().get();
+
+ if (isVal && parentRaw instanceof ForStatement) {
localNode.addError("'val' is not allowed in old-style for loops");
return;
}
+ if (parentRaw instanceof ForStatement && ((ForStatement) parentRaw).initializations != null && ((ForStatement) parentRaw).initializations.length > 1) {
+ localNode.addError("'var' is not allowed in old-style for loops if there is more than 1 initializer");
+ return;
+ }
+
if (local.initialization != null && local.initialization.getClass().getName().equals("org.eclipse.jdt.internal.compiler.ast.LambdaExpression")) {
localNode.addError("'" + annotation + "' is not allowed with lambda expressions.");
return;
diff --git a/src/core/lombok/eclipse/handlers/SetGeneratedByVisitor.java b/src/core/lombok/eclipse/handlers/SetGeneratedByVisitor.java
index b42761f4..89964914 100644
--- a/src/core/lombok/eclipse/handlers/SetGeneratedByVisitor.java
+++ b/src/core/lombok/eclipse/handlers/SetGeneratedByVisitor.java
@@ -369,11 +369,6 @@ public final class SetGeneratedByVisitor extends ASTVisitor {
return super.visit(node, scope);
}
- @Override public boolean visit(ArrayInitializer node, ClassScope scope) {
- fixPositions(setGeneratedBy(node, source));
- return super.visit(node, scope);
- }
-
@Override public boolean visit(ArrayQualifiedTypeReference node, BlockScope scope) {
fixPositions(setGeneratedBy(node, source));
return super.visit(node, scope);
diff --git a/src/core/lombok/experimental/Builder.java b/src/core/lombok/experimental/Builder.java
deleted file mode 100644
index 7b364bff..00000000
--- a/src/core/lombok/experimental/Builder.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright (C) 2013-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
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package lombok.experimental;
-
-import static java.lang.annotation.ElementType.*;
-import static java.lang.annotation.RetentionPolicy.*;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * The builder annotation creates a so-called 'builder' aspect to the class that is annotated or the class
- * that contains a member which is annotated with {@code @Builder}.
- * <p>
- * If a member is annotated, it must be either a constructor or a method. If a class is annotated,
- * then a private constructor is generated with all fields as arguments
- * (as if {@code @AllArgsConstructor(AccessLevel.PRIVATE)} is present
- * on the class), and it is as if this constructor has been annotated with {@code @Builder} instead.
- * <p>
- * The effect of {@code @Builder} is that an inner class is generated named <code><strong>T</strong>Builder</code>,
- * with a private constructor. Instances of <code><strong>T</strong>Builder</code> are made with the
- * method named {@code builder()} which is also generated for you in the class itself (not in the builder class).
- * <p>
- * The <code><strong>T</strong>Builder</code> class contains 1 method for each parameter of the annotated
- * constructor / method (each field, when annotating a class), which returns the builder itself.
- * The builder also has a <code>build()</code> method which returns a completed instance of the original type,
- * created by passing all parameters as set via the various other methods in the builder to the constructor
- * or method that was annotated with {@code @Builder}. The return type of this method will be the same
- * 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/Builder">the project lombok features page for &#64;Builder</a>.
- * <br>
- * <p>
- * Before:
- *
- * <pre>
- * &#064;Builder
- * class Example {
- * private int foo;
- * private final String bar;
- * }
- * </pre>
- *
- * After:
- *
- * <pre>
- * class Example&lt;T&gt; {
- * private T foo;
- * private final String bar;
- *
- * private Example(T foo, String bar) {
- * this.foo = foo;
- * this.bar = bar;
- * }
- *
- * public static &lt;T&gt; ExampleBuilder&lt;T&gt; builder() {
- * return new ExampleBuilder&lt;T&gt;();
- * }
- *
- * public static class ExampleBuilder&lt;T&gt; {
- * private T foo;
- * private String bar;
- *
- * private ExampleBuilder() {}
- *
- * public ExampleBuilder foo(T foo) {
- * this.foo = foo;
- * return this;
- * }
- *
- * public ExampleBuilder bar(String bar) {
- * this.bar = bar;
- * return this;
- * }
- *
- * &#064;java.lang.Override public String toString() {
- * return "ExampleBuilder(foo = " + foo + ", bar = " + bar + ")";
- * }
- *
- * public Example build() {
- * return new Example(foo, bar);
- * }
- * }
- * }
- * </pre>
- *
- * @deprecated {@link lombok.Builder} has been promoted to the main package, so use that one instead.
- */
-@Target({TYPE, METHOD, CONSTRUCTOR})
-@Retention(SOURCE)
-@Deprecated
-public @interface Builder {
- /** @return Name of the method that creates a new builder instance. Default: {@code builder}. */
- String builderMethodName() default "builder";
-
- /** @return Name of the method in the builder class that creates an instance of your {@code @Builder}-annotated class. */
- String buildMethodName() default "build";
-
- /**
- * Name of the builder class.
- *
- * Default for {@code @Builder} on types and constructors: {@code (TypeName)Builder}.
- * <p>
- * Default for {@code @Builder} on methods: {@code (ReturnTypeName)Builder}.
- *
- * @return Name of the builder class that will be generated (or if it already exists, will be filled with builder elements).
- */
- String builderClassName() default "";
-
- /**
- * Normally the builder's 'set' methods are fluent, meaning, they have the same name as the field. Set this
- * to {@code false} to name the setter method for field {@code someField}: {@code setSomeField}.
- * <p>
- * <strong>Default: true</strong>
- *
- * @return Whether to generate fluent methods (just {@code fieldName()} instead of {@code setFieldName()}).
- */
- boolean fluent() default true;
-
- /**
- * Normally the builder's 'set' methods are chaining, meaning, they return the builder so that you can chain
- * calls to set methods. Set this to {@code false} to have these 'set' methods return {@code void} instead.
- * <p>
- * <strong>Default: true</strong>
- *
- * @return Whether to generate chaining methods (each build call returns itself instead of returning {@code void}).
- */
- boolean chain() default true;
-}
diff --git a/src/core/lombok/experimental/Value.java b/src/core/lombok/experimental/Value.java
deleted file mode 100644
index 06dbee13..00000000
--- a/src/core/lombok/experimental/Value.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2012-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
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package lombok.experimental;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Generates a lot of code which fits with a class that is a representation of an immutable entity.
- * <p>
- * Equivalent to {@code @Getter @FieldDefaults(makeFinal=true, level=AccessLevel.PRIVATE) @RequiredArgsConstructor @ToString @EqualsAndHashCode}.
- * <p>
- * Complete documentation is found at <a href="https://projectlombok.org/features/Value">the project lombok features page for &#64;Value</a>.
- *
- * @see lombok.Getter
- * @see Wither
- * @see lombok.RequiredArgsConstructor
- * @see lombok.ToString
- * @see lombok.EqualsAndHashCode
- * @see lombok.Data
- * @deprecated {@link lombok.Value} has been promoted to the main package, so use that one instead.
- */
-@Target(ElementType.TYPE)
-@Retention(RetentionPolicy.SOURCE)
-@Deprecated
-public @interface Value {
- /**
- * If you specify a static constructor name, then the generated constructor will be private, and
- * instead a static factory method is created that other classes can use to create instances.
- * We suggest the name: "of", like so:
- *
- * <pre>
- * public @Data(staticConstructor = "of") class Point { final int x, y; }
- * </pre>
- *
- * Default: No static constructor, instead the normal constructor is public.
- *
- * @return Name of static 'constructor' method to generate (blank = generate a normal constructor).
- */
- String staticConstructor() default "";
-}
diff --git a/src/core/lombok/experimental/var.java b/src/core/lombok/experimental/var.java
index d8de8b19..71cc141a 100644
--- a/src/core/lombok/experimental/var.java
+++ b/src/core/lombok/experimental/var.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2013 The Project Lombok Authors.
+ * Copyright (C) 2010-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
@@ -23,6 +23,9 @@ package lombok.experimental;
/**
* like val but not final
+ *
+ * @deprecated {@code var} has been promoted to the main package; use {@link lombok.var} instead.
*/
+@Deprecated
public @interface var {
}
diff --git a/src/core/lombok/javac/JavacAST.java b/src/core/lombok/javac/JavacAST.java
index af812498..45679fd3 100644
--- a/src/core/lombok/javac/JavacAST.java
+++ b/src/core/lombok/javac/JavacAST.java
@@ -125,6 +125,8 @@ public class JavacAST extends AST<JavacAST, JavacNode, JCTree> {
String nm = Source.instance(context).name();
int underscoreIdx = nm.indexOf('_');
if (underscoreIdx > -1) return Integer.parseInt(nm.substring(underscoreIdx + 1));
+ // assume java9+
+ return Integer.parseInt(nm);
} catch (Exception ignore) {}
return 6;
}
diff --git a/src/core/lombok/javac/apt/InterceptingJavaFileManager.java b/src/core/lombok/javac/apt/InterceptingJavaFileManager.java
index 303bdc2f..9b58d111 100644
--- a/src/core/lombok/javac/apt/InterceptingJavaFileManager.java
+++ b/src/core/lombok/javac/apt/InterceptingJavaFileManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2011 The Project Lombok Authors.
+ * Copyright (C) 2010-2018 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,14 +42,14 @@ final class InterceptingJavaFileManager extends ForwardingJavaFileManager<JavaFi
}
@Override public JavaFileObject getJavaFileForOutput(Location location, String className, final Kind kind, FileObject sibling) throws IOException {
- if (className.startsWith("lombok.dummy.ForceNewRound")) {
+ if (className.contains("lombok.dummy.ForceNewRound")) {
final String name = className.replace(".", "/") + kind.extension;
return LombokFileObjects.createEmpty(compiler, name, kind);
}
+
JavaFileObject fileObject = fileManager.getJavaFileForOutput(location, className, kind, sibling);
- if (kind != Kind.CLASS) {
- return fileObject;
- }
+ if (kind != Kind.CLASS) return fileObject;
+
return LombokFileObjects.createIntercepting(compiler, fileObject, className, diagnostics);
}
} \ No newline at end of file
diff --git a/src/core/lombok/javac/apt/LombokProcessor.java b/src/core/lombok/javac/apt/LombokProcessor.java
index 5c7e47ee..9c0a2dfa 100644
--- a/src/core/lombok/javac/apt/LombokProcessor.java
+++ b/src/core/lombok/javac/apt/LombokProcessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2017 The Project Lombok Authors.
+ * Copyright (C) 2009-2018 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
@@ -301,7 +301,10 @@ public class LombokProcessor extends AbstractProcessor {
// Step 1: Take all CUs which aren't already in the map. Give them the first priority level.
+ String randomModuleName = null;
+
for (Element element : roundEnv.getRootElements()) {
+ if (randomModuleName == null) randomModuleName = getModuleNameFor(element);
JCCompilationUnit unit = toUnit(element);
if (unit == null) continue;
if (roots.containsKey(unit)) continue;
@@ -344,20 +347,22 @@ public class LombokProcessor extends AbstractProcessor {
if (newLevels.isEmpty()) return false;
newLevels.retainAll(priorityLevelsRequiringResolutionReset);
- if (!newLevels.isEmpty()){
+ if (!newLevels.isEmpty()) {
// Force a new round to reset resolution. The next round will cause this method (process) to be called again.
- forceNewRound((JavacFiler) processingEnv.getFiler());
+ forceNewRound(randomModuleName, (JavacFiler) processingEnv.getFiler());
return false;
}
- // None of the new levels need resolution, so just keep going.
+ // None of the new levels need resolution, so just keep going.
}
}
private int dummyCount = 0;
- private void forceNewRound(JavacFiler filer) {
+ private void forceNewRound(String randomModuleName, JavacFiler filer) {
if (!filer.newFiles()) {
try {
- JavaFileObject dummy = filer.createSourceFile("lombok.dummy.ForceNewRound" + (dummyCount++));
+ String name = "lombok.dummy.ForceNewRound" + (dummyCount++);
+ if (randomModuleName != null) name = randomModuleName + "/" + name;
+ JavaFileObject dummy = filer.createSourceFile(name);
Writer w = dummy.openWriter();
w.close();
} catch (Exception e) {
@@ -368,6 +373,19 @@ public class LombokProcessor extends AbstractProcessor {
}
}
+ private String getModuleNameFor(Element element) {
+ while (element != null) {
+ if (element.getKind().name().equals("MODULE")) {
+ String n = element.getSimpleName().toString().trim();
+ return n.isEmpty() ? null : n;
+ }
+ Element n = element.getEnclosingElement();
+ if (n == element) return null;
+ element = n;
+ }
+ return null;
+ }
+
private JCCompilationUnit toUnit(Element element) {
TreePath path = trees == null ? null : trees.getPath(element);
if (path == null) return null;
diff --git a/src/core/lombok/javac/handlers/HandleBuilder.java b/src/core/lombok/javac/handlers/HandleBuilder.java
index d5a342e4..0631f12a 100644
--- a/src/core/lombok/javac/handlers/HandleBuilder.java
+++ b/src/core/lombok/javac/handlers/HandleBuilder.java
@@ -21,7 +21,6 @@
*/
package lombok.javac.handlers;
-import java.lang.annotation.Annotation;
import java.util.ArrayList;
import javax.lang.model.element.Modifier;
@@ -119,9 +118,7 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
if (!checkName("builderClassName", builderClassName, annotationNode)) return;
}
- @SuppressWarnings("deprecation")
- Class<? extends Annotation> oldExperimentalBuilder = lombok.experimental.Builder.class;
- deleteAnnotationIfNeccessary(annotationNode, Builder.class, oldExperimentalBuilder);
+ deleteAnnotationIfNeccessary(annotationNode, Builder.class, "lombok.experimental.Builder");
JavacNode parent = annotationNode.up();
@@ -140,8 +137,7 @@ public class HandleBuilder extends JavacAnnotationHandler<Builder> {
tdParent = parent;
JCClassDecl td = (JCClassDecl) tdParent.get();
ListBuffer<JavacNode> allFields = new ListBuffer<JavacNode>();
- @SuppressWarnings("deprecation")
- boolean valuePresent = (hasAnnotation(lombok.Value.class, parent) || hasAnnotation(lombok.experimental.Value.class, parent));
+ boolean valuePresent = (hasAnnotation(lombok.Value.class, parent) || hasAnnotation("lombok.experimental.Value", parent));
for (JavacNode fieldNode : HandleConstructor.findAllFields(tdParent, true)) {
JCVariableDecl fd = (JCVariableDecl) fieldNode.get();
JavacNode isDefault = findAnnotation(Builder.Default.class, fieldNode, true);
diff --git a/src/core/lombok/javac/handlers/HandleBuilderDefault.java b/src/core/lombok/javac/handlers/HandleBuilderDefault.java
index 733aea5a..4c4ba0e8 100644
--- a/src/core/lombok/javac/handlers/HandleBuilderDefault.java
+++ b/src/core/lombok/javac/handlers/HandleBuilderDefault.java
@@ -1,3 +1,24 @@
+/*
+ * Copyright (C) 2017-2018 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
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
package lombok.javac.handlers;
import static lombok.javac.handlers.JavacHandlerUtil.*;
@@ -16,12 +37,11 @@ import lombok.javac.JavacNode;
@ProviderFor(JavacAnnotationHandler.class)
@HandlerPriority(-1025) //HandleBuilder's level, minus one.
public class HandleBuilderDefault extends JavacAnnotationHandler<Builder.Default> {
- @SuppressWarnings("deprecation")
@Override public void handle(AnnotationValues<Builder.Default> annotation, JCAnnotation ast, JavacNode annotationNode) {
JavacNode annotatedField = annotationNode.up();
if (annotatedField.getKind() != Kind.FIELD) return;
JavacNode classWithAnnotatedField = annotatedField.up();
- if (!hasAnnotation(Builder.class, classWithAnnotatedField) && !hasAnnotation(lombok.experimental.Builder.class, classWithAnnotatedField)) {
+ if (!hasAnnotation(Builder.class, classWithAnnotatedField) && !hasAnnotation("lombok.experimental.Builder", classWithAnnotatedField)) {
annotationNode.addWarning("@Builder.Default requires @Builder on the class for it to mean anything.");
deleteAnnotationIfNeccessary(annotationNode, Builder.Default.class);
}
diff --git a/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java b/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java
index da2db909..d8bfd154 100644
--- a/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java
+++ b/src/core/lombok/javac/handlers/HandleEqualsAndHashCode.java
@@ -371,31 +371,44 @@ public class HandleEqualsAndHashCode extends JavacAnnotationHandler<EqualsAndHas
public JCExpression createTypeReference(JavacNode type, boolean addWildcards) {
java.util.List<String> list = new ArrayList<String>();
+ java.util.List<Integer> genericsCount = addWildcards ? new ArrayList<Integer>() : null;
+
list.add(type.getName());
+ if (addWildcards) genericsCount.add(((JCClassDecl) type.get()).typarams.size());
+ boolean staticContext = (((JCClassDecl) type.get()).getModifiers().flags & Flags.STATIC) != 0;
JavacNode tNode = type.up();
+
while (tNode != null && tNode.getKind() == Kind.TYPE) {
list.add(tNode.getName());
+ if (addWildcards) genericsCount.add(staticContext ? 0 : ((JCClassDecl) tNode.get()).typarams.size());
+ if (!staticContext) staticContext = (((JCClassDecl) tNode.get()).getModifiers().flags & Flags.STATIC) != 0;
tNode = tNode.up();
}
Collections.reverse(list);
- JCClassDecl typeDecl = (JCClassDecl) type.get();
+ if (addWildcards) Collections.reverse(genericsCount);
JavacTreeMaker maker = type.getTreeMaker();
JCExpression chain = maker.Ident(type.toName(list.get(0)));
+ if (addWildcards) chain = wildcardify(maker, chain, genericsCount.get(0));
for (int i = 1; i < list.size(); i++) {
chain = maker.Select(chain, type.toName(list.get(i)));
+ if (addWildcards) chain = wildcardify(maker, chain, genericsCount.get(i));
}
- if (!addWildcards || typeDecl.typarams.length() == 0) return chain;
+ return chain;
+ }
+
+ private JCExpression wildcardify(JavacTreeMaker maker, JCExpression expr, int count) {
+ if (count == 0) return expr;
ListBuffer<JCExpression> wildcards = new ListBuffer<JCExpression>();
- for (int i = 0 ; i < typeDecl.typarams.length() ; i++) {
+ for (int i = 0 ; i < count ; i++) {
wildcards.append(maker.Wildcard(maker.TypeBoundKind(BoundKind.UNBOUND), null));
}
- return maker.TypeApply(chain, wildcards.toList());
+ return maker.TypeApply(expr, wildcards.toList());
}
public JCMethodDecl createEquals(JavacNode typeNode, List<JavacNode> fields, boolean callSuper, FieldAccess fieldAccess, boolean needsCanEqual, JCTree source, List<JCAnnotation> onParam) {
diff --git a/src/core/lombok/javac/handlers/HandleVal.java b/src/core/lombok/javac/handlers/HandleVal.java
index f0f6eb2a..14130bc4 100644
--- a/src/core/lombok/javac/handlers/HandleVal.java
+++ b/src/core/lombok/javac/handlers/HandleVal.java
@@ -26,7 +26,7 @@ import static lombok.javac.handlers.JavacHandlerUtil.*;
import lombok.ConfigurationKeys;
import lombok.val;
import lombok.core.HandlerPriority;
-import lombok.experimental.var;
+import lombok.var;
import lombok.javac.JavacASTAdapter;
import lombok.javac.JavacASTVisitor;
import lombok.javac.JavacNode;
@@ -54,10 +54,10 @@ import com.sun.tools.javac.util.List;
public class HandleVal extends JavacASTAdapter {
private static boolean eq(String typeTreeToString, String key) {
- return (typeTreeToString.equals(key) || typeTreeToString.equals("lombok." + key));
+ return typeTreeToString.equals(key) || typeTreeToString.equals("lombok." + key) || typeTreeToString.equals("lombok.experimental." + key);
}
- @Override
+ @SuppressWarnings("deprecation") @Override
public void visitLocal(JavacNode localNode, JCVariableDecl local) {
JCTree typeTree = local.vartype;
if (typeTree == null) return;
@@ -77,6 +77,11 @@ public class HandleVal extends JavacASTAdapter {
return;
}
+ if (parentRaw instanceof JCForLoop && ((JCForLoop) parentRaw).getInitializer().size() > 1) {
+ localNode.addError("'var' is not allowed in old-style for loops if there is more than 1 initializer");
+ return;
+ }
+
JCExpression rhsOfEnhancedForLoop = null;
if (local.init == null) {
if (parentRaw instanceof JCEnhancedForLoop) {
@@ -98,6 +103,7 @@ public class HandleVal extends JavacASTAdapter {
if (localNode.shouldDeleteLombokAnnotations()) {
JavacHandlerUtil.deleteImportFromCompilationUnit(localNode, val.class.getName());
+ JavacHandlerUtil.deleteImportFromCompilationUnit(localNode, lombok.experimental.var.class.getName());
JavacHandlerUtil.deleteImportFromCompilationUnit(localNode, var.class.getName());
}
diff --git a/src/core/lombok/javac/handlers/HandleValue.java b/src/core/lombok/javac/handlers/HandleValue.java
index 90f6a98d..3961085c 100644
--- a/src/core/lombok/javac/handlers/HandleValue.java
+++ b/src/core/lombok/javac/handlers/HandleValue.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012-2014 The Project Lombok Authors.
+ * Copyright (C) 2012-2018 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
@@ -24,8 +24,6 @@ package lombok.javac.handlers;
import static lombok.core.handlers.HandlerUtil.*;
import static lombok.javac.handlers.JavacHandlerUtil.*;
-import java.lang.annotation.Annotation;
-
import lombok.AccessLevel;
import lombok.ConfigurationKeys;
import lombok.core.AnnotationValues;
@@ -50,12 +48,9 @@ import com.sun.tools.javac.tree.JCTree.JCModifiers;
@HandlerPriority(-512) //-2^9; to ensure @EqualsAndHashCode and such pick up on this handler making the class final and messing with the fields' access levels, run earlier.
public class HandleValue extends JavacAnnotationHandler<Value> {
@Override public void handle(AnnotationValues<Value> annotation, JCAnnotation ast, JavacNode annotationNode) {
- @SuppressWarnings("deprecation")
- Class<? extends Annotation> oldExperimentalValue = lombok.experimental.Value.class;
-
handleFlagUsage(annotationNode, ConfigurationKeys.VALUE_FLAG_USAGE, "@Value");
- deleteAnnotationIfNeccessary(annotationNode, Value.class, oldExperimentalValue);
+ deleteAnnotationIfNeccessary(annotationNode, Value.class, "lombok.experimental.Value");
JavacNode typeNode = annotationNode.up();
boolean notAClass = !isClass(typeNode);
diff --git a/src/core/lombok/javac/handlers/JavacHandlerUtil.java b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
index 956ab446..584c78c5 100644
--- a/src/core/lombok/javac/handlers/JavacHandlerUtil.java
+++ b/src/core/lombok/javac/handlers/JavacHandlerUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2017 The Project Lombok Authors.
+ * Copyright (C) 2009-2018 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
@@ -162,6 +162,10 @@ public class JavacHandlerUtil {
return node;
}
+ public static boolean hasAnnotation(String type, JavacNode node) {
+ return hasAnnotation(type, node, false);
+ }
+
public static boolean hasAnnotation(Class<? extends Annotation> type, JavacNode node) {
return hasAnnotation(type, node, false);
}
@@ -191,6 +195,27 @@ public class JavacHandlerUtil {
}
}
+ private static boolean hasAnnotation(String type, JavacNode node, boolean delete) {
+ if (node == null) return false;
+ if (type == null) return false;
+ switch (node.getKind()) {
+ case ARGUMENT:
+ case FIELD:
+ case LOCAL:
+ case TYPE:
+ case METHOD:
+ for (JavacNode child : node.down()) {
+ if (annotationTypeMatches(type, child)) {
+ if (delete) deleteAnnotationIfNeccessary(child, type);
+ return true;
+ }
+ }
+ // intentional fallthrough
+ default:
+ return false;
+ }
+ }
+
static JavacNode findAnnotation(Class<? extends Annotation> type, JavacNode node, boolean delete) {
if (node == null) return null;
if (type == null) return null;
@@ -224,6 +249,17 @@ public class JavacHandlerUtil {
}
/**
+ * Checks if the Annotation AST Node provided is likely to be an instance of the provided annotation type.
+ *
+ * @param type An actual annotation type, such as {@code lombok.Getter.class}.
+ * @param node A Lombok AST node representing an annotation in source code.
+ */
+ public static boolean annotationTypeMatches(String type, JavacNode node) {
+ if (node.getKind() != Kind.ANNOTATION) return false;
+ return typeMatches(type, node, ((JCAnnotation)node.get()).annotationType);
+ }
+
+ /**
* Checks if the given TypeReference node is likely to be a reference to the provided class.
*
* @param type An actual type. This method checks if {@code typeNode} is likely to be a reference to this type.
@@ -231,10 +267,21 @@ public class JavacHandlerUtil {
* @param typeNode A type reference to check.
*/
public static boolean typeMatches(Class<?> type, JavacNode node, JCTree typeNode) {
+ return typeMatches(type.getName(), node, typeNode);
+ }
+
+ /**
+ * Checks if the given TypeReference node is likely to be a reference to the provided class.
+ *
+ * @param type An actual type. This method checks if {@code typeNode} is likely to be a reference to this type.
+ * @param node A Lombok AST node. Any node in the appropriate compilation unit will do (used to get access to import statements).
+ * @param typeNode A type reference to check.
+ */
+ public static boolean typeMatches(String type, JavacNode node, JCTree typeNode) {
String typeName = typeNode.toString();
TypeResolver resolver = new TypeResolver(node.getImportList());
- return resolver.typeMatches(node, type.getName(), typeName);
+ return resolver.typeMatches(node, type, typeName);
}
/**
@@ -346,8 +393,7 @@ public class JavacHandlerUtil {
* then removes any import statement that imports this exact annotation (not star imports).
* Only does this if the DeleteLombokAnnotations class is in the context.
*/
- @SuppressWarnings("unchecked")
- public static void deleteAnnotationIfNeccessary(JavacNode annotation, Class<? extends Annotation> annotationType) {
+ public static void deleteAnnotationIfNeccessary(JavacNode annotation, String annotationType) {
deleteAnnotationIfNeccessary0(annotation, annotationType);
}
@@ -356,12 +402,29 @@ public class JavacHandlerUtil {
* then removes any import statement that imports this exact annotation (not star imports).
* Only does this if the DeleteLombokAnnotations class is in the context.
*/
- @SuppressWarnings("unchecked")
+ public static void deleteAnnotationIfNeccessary(JavacNode annotation, Class<? extends Annotation> annotationType) {
+ deleteAnnotationIfNeccessary0(annotation, annotationType.getName());
+ }
+
+ /**
+ * Removes the annotation from javac's AST (it remains in lombok's AST),
+ * then removes any import statement that imports this exact annotation (not star imports).
+ * Only does this if the DeleteLombokAnnotations class is in the context.
+ */
public static void deleteAnnotationIfNeccessary(JavacNode annotation, Class<? extends Annotation> annotationType1, Class<? extends Annotation> annotationType2) {
- deleteAnnotationIfNeccessary0(annotation, annotationType1, annotationType2);
+ deleteAnnotationIfNeccessary0(annotation, annotationType1.getName(), annotationType2.getName());
+ }
+
+ /**
+ * Removes the annotation from javac's AST (it remains in lombok's AST),
+ * then removes any import statement that imports this exact annotation (not star imports).
+ * Only does this if the DeleteLombokAnnotations class is in the context.
+ */
+ public static void deleteAnnotationIfNeccessary(JavacNode annotation, Class<? extends Annotation> annotationType1, String annotationType2) {
+ deleteAnnotationIfNeccessary0(annotation, annotationType1.getName(), annotationType2);
}
- private static void deleteAnnotationIfNeccessary0(JavacNode annotation, Class<? extends Annotation>... annotationTypes) {
+ private static void deleteAnnotationIfNeccessary0(JavacNode annotation, String... annotationTypes) {
if (inNetbeansEditor(annotation)) return;
if (!annotation.shouldDeleteLombokAnnotations()) return;
JavacNode parentNode = annotation.directUp();
@@ -390,8 +453,8 @@ public class JavacHandlerUtil {
}
parentNode.getAst().setChanged();
- for (Class<?> annotationType : annotationTypes) {
- deleteImportFromCompilationUnit(annotation, annotationType.getName());
+ for (String annotationType : annotationTypes) {
+ deleteImportFromCompilationUnit(annotation, annotationType);
}
}
@@ -1405,9 +1468,10 @@ public class JavacHandlerUtil {
public static void sanityCheckForMethodGeneratingAnnotationsOnBuilderClass(JavacNode typeNode, JavacNode errorNode) {
List<String> disallowed = List.nil();
for (JavacNode child : typeNode.down()) {
- for (Class<? extends java.lang.annotation.Annotation> annType : INVALID_ON_BUILDERS) {
+ for (String annType : INVALID_ON_BUILDERS) {
if (annotationTypeMatches(annType, child)) {
- disallowed = disallowed.append(annType.getSimpleName());
+ int lastIndex = annType.lastIndexOf('.');
+ disallowed = disallowed.append(lastIndex == -1 ? annType : annType.substring(lastIndex + 1));
}
}
}
diff --git a/src/core/lombok/var.java b/src/core/lombok/var.java
new file mode 100644
index 00000000..63a70213
--- /dev/null
+++ b/src/core/lombok/var.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2010-2018 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
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package lombok;
+
+/**
+ * Use {@code var} as the type of any local variable declaration (even in a {@code for} statement), and the type will be inferred from the initializing expression
+ * (any further assignments to the variable are not involved in this type inference).
+ * <p>
+ * For example: {@code var x = 10.0;} will infer {@code double}, and {@code var y = new ArrayList<String>();} will infer {@code ArrayList<String>}.
+ * <p>
+ * Note that this is an annotation type because {@code var x = 10;} will be desugared to {@code @var int x = 10;}
+ * <p>
+ * Complete documentation is found at <a href="https://projectlombok.org/features/var">the project lombok features page for &#64;var</a>.
+ */
+public @interface var {
+}
diff --git a/src/core9/module-info.java b/src/core9/module-info.java
new file mode 100644
index 00000000..87f819e2
--- /dev/null
+++ b/src/core9/module-info.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2018 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
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+module lombok {
+ requires java.compiler;
+ requires java.instrument;
+ requires jdk.unsupported;
+
+ exports lombok;
+ exports lombok.experimental;
+ exports lombok.extern.apachecommons;
+ exports lombok.extern.java;
+ exports lombok.extern.jbosslog;
+ exports lombok.extern.log4j;
+ exports lombok.extern.slf4j;
+
+ provides javax.annotation.processing.Processor with lombok.launch.AnnotationProcessorHider.AnnotationProcessor;
+ provides org.mapstruct.ap.spi.AstModifyingAnnotationProcessor with lombok.launch.AnnotationProcessorHider.AstModificationNotifier;
+}
+
diff --git a/src/delombok/lombok/delombok/DocCommentIntegrator.java b/src/delombok/lombok/delombok/DocCommentIntegrator.java
index c3b07f32..bab0abd8 100644
--- a/src/delombok/lombok/delombok/DocCommentIntegrator.java
+++ b/src/delombok/lombok/delombok/DocCommentIntegrator.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2010 The Project Lombok Authors.
+ * Copyright (C) 2009-2018 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
@@ -74,7 +74,7 @@ public class DocCommentIntegrator {
return out;
}
- private static final Pattern CONTENT_STRIPPER = Pattern.compile("^(?:\\s*\\*)?[ \\t]*(.*?)$", Pattern.MULTILINE);
+ private static final Pattern CONTENT_STRIPPER = Pattern.compile("^(?:\\s*\\*)?(.*?)$", Pattern.MULTILINE);
@SuppressWarnings("unchecked") private boolean attach(JCCompilationUnit top, final JCTree node, CommentInfo cmt) {
String docCommentContent = cmt.content;
if (docCommentContent.startsWith("/**")) docCommentContent = docCommentContent.substring(3);
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java b/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java
index e4dd7b26..3da37869 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2011 The Project Lombok Authors.
+ * Copyright (C) 2010-2018 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
@@ -212,7 +212,7 @@ public class PatchVal {
}
private static boolean isVar(LocalDeclaration local, BlockScope scope) {
- return is(local.type, scope, "lombok.experimental.var");
+ return is(local.type, scope, "lombok.experimental.var") || is(local.type, scope, "lombok.var");
}
private static boolean isVal(LocalDeclaration local, BlockScope scope) {
diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchValEclipse.java b/src/eclipseAgent/lombok/eclipse/agent/PatchValEclipse.java
index 505eb767..46237dcf 100644
--- a/src/eclipseAgent/lombok/eclipse/agent/PatchValEclipse.java
+++ b/src/eclipseAgent/lombok/eclipse/agent/PatchValEclipse.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010-2011 The Project Lombok Authors.
+ * Copyright (C) 2010-2018 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
@@ -103,7 +103,7 @@ public class PatchValEclipse {
}
private static boolean couldBeVar(TypeReference type) {
- return PatchVal.couldBe("lombok.experimental.var", type);
+ return PatchVal.couldBe("lombok.experimental.var", type) || PatchVal.couldBe("lombok.var", type);
}
public static void addFinalAndValAnnotationToSingleVariableDeclaration(Object converter, SingleVariableDeclaration out, LocalDeclaration in) {
diff --git a/src/j9stubs/org/mapstruct/ap/spi/AstModifyingAnnotationProcessor.java b/src/j9stubs/org/mapstruct/ap/spi/AstModifyingAnnotationProcessor.java
new file mode 100644
index 00000000..ffb99030
--- /dev/null
+++ b/src/j9stubs/org/mapstruct/ap/spi/AstModifyingAnnotationProcessor.java
@@ -0,0 +1,48 @@
+/**
+ * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/)
+ * and/or other contributors as indicated by the @authors tag. See the
+ * copyright.txt file in the distribution for a full listing of all
+ * contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.mapstruct.ap.spi;
+
+import javax.lang.model.type.TypeMirror;
+
+/**
+ * A contract to be implemented by other annotation processors which - against the design philosophy of JSR 269 - alter
+ * the types under compilation.
+ * <p>
+ * This contract will be queried by MapStruct when examining types referenced by mappers to be generated, most notably
+ * the source and target types of mapping methods. If at least one AST-modifying processor announces further changes to
+ * such type, the generation of the affected mapper(s) will be deferred to a future round in the annnotation processing
+ * cycle.
+ * <p>
+ * Implementations are discovered via the service loader, i.e. a JAR providing an AST-modifying processor needs to
+ * declare its implementation in a file {@code META-INF/services/org.mapstruct.ap.spi.AstModifyingAnnotationProcessor}.
+ *
+ * @author Gunnar Morling
+ */
+//@org.mapstruct.util.Experimental
+public interface AstModifyingAnnotationProcessor {
+
+ /**
+ * Whether the specified type has been fully processed by this processor or not (i.e. this processor will amend the
+ * given type's structure after this invocation).
+ *
+ * @param type The type of interest
+ * @return {@code true} if this processor has fully processed the given type, {@code false} otherwise.
+ */
+ boolean isTypeComplete(TypeMirror type);
+} \ No newline at end of file
diff --git a/src/launch/lombok/launch/AnnotationProcessor.java b/src/launch/lombok/launch/AnnotationProcessor.java
index 05c900ab..c4f922b9 100644
--- a/src/launch/lombok/launch/AnnotationProcessor.java
+++ b/src/launch/lombok/launch/AnnotationProcessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014-2017 The Project Lombok Authors.
+ * Copyright (C) 2014-2018 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
@@ -21,6 +21,7 @@
*/
package lombok.launch;
+import java.lang.reflect.Field;
import java.util.Set;
import javax.annotation.processing.AbstractProcessor;
@@ -37,6 +38,8 @@ import javax.lang.model.type.TypeMirror;
import org.mapstruct.ap.spi.AstModifyingAnnotationProcessor;
+import sun.misc.Unsafe;
+
class AnnotationProcessorHider {
public static class AstModificationNotifier implements AstModifyingAnnotationProcessor {
@Override public boolean isTypeComplete(TypeMirror type) {
@@ -65,11 +68,33 @@ class AnnotationProcessorHider {
}
@Override public void init(ProcessingEnvironment processingEnv) {
+ disableJava9SillyWarning();
AstModificationNotifierData.lombokInvoked = true;
instance.init(processingEnv);
super.init(processingEnv);
}
+ // sunapi suppresses javac's warning about using Unsafe; 'all' suppresses eclipse's warning about the unspecified 'sunapi' key. Leave them both.
+ // Yes, javac's definition of the word 'all' is quite contrary to what the dictionary says it means. 'all' does NOT include 'sunapi' according to javac.
+ @SuppressWarnings({"sunapi", "all"})
+ private void disableJava9SillyWarning() {
+ // JVM9 complains about using reflection to access packages from a module that aren't exported. This makes no sense; the whole point of reflection
+ // is to get past such issues. The only comment from the jigsaw team lead on this was some unspecified mumbling about security which makes no sense,
+ // as the SecurityManager is invoked to check such things. Therefore this warning is a bug, so we shall patch java to fix it.
+
+ try {
+ Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
+ theUnsafe.setAccessible(true);
+ Unsafe u = (Unsafe) theUnsafe.get(null);
+
+ Class<?> cls = Class.forName("jdk.internal.module.IllegalAccessLogger");
+ Field logger = cls.getDeclaredField("logger");
+ u.putObjectVolatile(cls, u.staticFieldOffset(logger), null);
+ } catch (Throwable t) {
+ // We shall ignore it; the effect of this code failing is that the user gets to see a warning they remove with various --add-opens magic.
+ }
+ }
+
@Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
return instance.process(annotations, roundEnv);
}
@@ -82,7 +107,7 @@ class AnnotationProcessorHider {
ClassLoader cl = Main.createShadowClassLoader();
try {
Class<?> mc = cl.loadClass("lombok.core.AnnotationProcessor");
- return (AbstractProcessor) mc.newInstance();
+ return (AbstractProcessor) mc.getDeclaredConstructor().newInstance();
} catch (Throwable t) {
if (t instanceof Error) throw (Error) t;
if (t instanceof RuntimeException) throw (RuntimeException) t;
diff --git a/src/utils/lombok/javac/Javac.java b/src/utils/lombok/javac/Javac.java
index 6f99463b..9ff4d22f 100644
--- a/src/utils/lombok/javac/Javac.java
+++ b/src/utils/lombok/javac/Javac.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2015 The Project Lombok Authors.
+ * Copyright (C) 2009-2018 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
@@ -63,8 +63,8 @@ public class Javac {
/** Matches any of the 8 primitive names, such as {@code boolean}. */
private static final Pattern PRIMITIVE_TYPE_NAME_PATTERN = Pattern.compile("^(boolean|byte|short|int|long|float|double|char)$");
- private static final Pattern VERSION_PARSER = Pattern.compile("^(\\d{1,6})\\.(\\d{1,6}).*$");
- private static final Pattern SOURCE_PARSER = Pattern.compile("^JDK(\\d{1,6})_(\\d{1,6}).*$");
+ private static final Pattern VERSION_PARSER = Pattern.compile("^(\\d{1,6})\\.?(\\d{1,6})?.*$");
+ private static final Pattern SOURCE_PARSER = Pattern.compile("^JDK(\\d{1,6})_?(\\d{1,6})?.*$");
private static final AtomicInteger compilerVersion = new AtomicInteger(-1);
@@ -79,11 +79,11 @@ public class Javac {
Matcher m = VERSION_PARSER.matcher(JavaCompiler.version());
if (m.matches()) {
int major = Integer.parseInt(m.group(1));
- int minor = Integer.parseInt(m.group(2));
if (major == 1) {
- compilerVersion.set(minor);
- return minor;
+ int minor = Integer.parseInt(m.group(2));
+ return setVersion(minor);
}
+ if (major >= 9) return setVersion(major);
}
}
@@ -92,16 +92,19 @@ public class Javac {
Matcher m = SOURCE_PARSER.matcher(name);
if (m.matches()) {
int major = Integer.parseInt(m.group(1));
- int minor = Integer.parseInt(m.group(2));
if (major == 1) {
- compilerVersion.set(minor);
- return minor;
+ int minor = Integer.parseInt(m.group(2));
+ return setVersion(minor);
}
+ if (major >= 9) return setVersion(major);
}
}
-
- compilerVersion.set(6);
- return 6;
+ return setVersion(6);
+ }
+
+ private static int setVersion(int version) {
+ compilerVersion.set(version);
+ return version;
}
private static final Class<?> DOCCOMMENTTABLE_CLASS;
diff --git a/test/transform/resource/after-delombok/BuilderChainAndFluent.java b/test/transform/resource/after-delombok/BuilderChainAndFluent.java
deleted file mode 100644
index f9833be6..00000000
--- a/test/transform/resource/after-delombok/BuilderChainAndFluent.java
+++ /dev/null
@@ -1,32 +0,0 @@
-class BuilderChainAndFluent {
- private final int yes;
- @java.lang.SuppressWarnings("all")
- BuilderChainAndFluent(final int yes) {
- this.yes = yes;
- }
- @java.lang.SuppressWarnings("all")
- public static class BuilderChainAndFluentBuilder {
- @java.lang.SuppressWarnings("all")
- private int yes;
- @java.lang.SuppressWarnings("all")
- BuilderChainAndFluentBuilder() {
- }
- @java.lang.SuppressWarnings("all")
- public void setYes(final int yes) {
- this.yes = yes;
- }
- @java.lang.SuppressWarnings("all")
- public BuilderChainAndFluent build() {
- return new BuilderChainAndFluent(yes);
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "BuilderChainAndFluent.BuilderChainAndFluentBuilder(yes=" + this.yes + ")";
- }
- }
- @java.lang.SuppressWarnings("all")
- public static BuilderChainAndFluentBuilder builder() {
- return new BuilderChainAndFluentBuilder();
- }
-}
diff --git a/test/transform/resource/after-delombok/EqualsAndHashCodeWithGenericsOnInners.java b/test/transform/resource/after-delombok/EqualsAndHashCodeWithGenericsOnInners.java
new file mode 100644
index 00000000..501d45a1
--- /dev/null
+++ b/test/transform/resource/after-delombok/EqualsAndHashCodeWithGenericsOnInners.java
@@ -0,0 +1,28 @@
+public class EqualsAndHashCodeWithGenericsOnInners<A> {
+ class Inner<B> {
+ int x;
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public boolean equals(final java.lang.Object o) {
+ if (o == this) return true;
+ if (!(o instanceof EqualsAndHashCodeWithGenericsOnInners.Inner)) return false;
+ final EqualsAndHashCodeWithGenericsOnInners<?>.Inner<?> other = (EqualsAndHashCodeWithGenericsOnInners<?>.Inner<?>) o;
+ if (!other.canEqual((java.lang.Object) this)) return false;
+ if (this.x != other.x) return false;
+ return true;
+ }
+ @java.lang.SuppressWarnings("all")
+ protected boolean canEqual(final java.lang.Object other) {
+ return other instanceof EqualsAndHashCodeWithGenericsOnInners.Inner;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ result = result * PRIME + this.x;
+ return result;
+ }
+ }
+}
+
diff --git a/test/transform/resource/after-delombok/JavadocGenerally.java b/test/transform/resource/after-delombok/JavadocGenerally.java
index 729cdce3..ec9483bc 100644
--- a/test/transform/resource/after-delombok/JavadocGenerally.java
+++ b/test/transform/resource/after-delombok/JavadocGenerally.java
@@ -9,6 +9,9 @@ package testPackage;
class JavadocGenerally {
/**
* Doc on field
+ * <pre>
+ * // code
+ * </pre>
*/
private int someField;
/**
diff --git a/test/transform/resource/after-delombok/ValueExperimental.java b/test/transform/resource/after-delombok/ValueExperimental.java
deleted file mode 100644
index 5846a2d8..00000000
--- a/test/transform/resource/after-delombok/ValueExperimental.java
+++ /dev/null
@@ -1,46 +0,0 @@
-final class ValueExperimental1 {
- @java.lang.SuppressWarnings("all")
- public ValueExperimental1() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public boolean equals(final java.lang.Object o) {
- if (o == this) return true;
- if (!(o instanceof ValueExperimental1)) return false;
- return true;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public int hashCode() {
- int result = 1;
- return result;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "ValueExperimental1()";
- }
-}
-final class ValueExperimental2 {
- @java.lang.SuppressWarnings("all")
- public ValueExperimental2() {
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public boolean equals(final java.lang.Object o) {
- if (o == this) return true;
- if (!(o instanceof ValueExperimental2)) return false;
- return true;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public int hashCode() {
- int result = 1;
- return result;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "ValueExperimental2()";
- }
-}
diff --git a/test/transform/resource/after-delombok/ValueExperimentalStarImport.java b/test/transform/resource/after-delombok/ValueExperimentalStarImport.java
deleted file mode 100644
index cb755b47..00000000
--- a/test/transform/resource/after-delombok/ValueExperimentalStarImport.java
+++ /dev/null
@@ -1,25 +0,0 @@
-import lombok.experimental.*;
-final class ValueExperimentalStarImport {
- @java.lang.SuppressWarnings("all")
- public ValueExperimentalStarImport() {
-
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public boolean equals(final java.lang.Object o) {
- if (o == this) return true;
- if (!(o instanceof ValueExperimentalStarImport)) return false;
- return true;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public int hashCode() {
- int result = 1;
- return result;
- }
- @java.lang.Override
- @java.lang.SuppressWarnings("all")
- public java.lang.String toString() {
- return "ValueExperimentalStarImport()";
- }
-}
diff --git a/test/transform/resource/after-delombok/VarWarning.java b/test/transform/resource/after-delombok/VarWarning.java
new file mode 100644
index 00000000..a333c87c
--- /dev/null
+++ b/test/transform/resource/after-delombok/VarWarning.java
@@ -0,0 +1,6 @@
+public class VarWarning {
+ public void isOkay() {
+ java.lang.String x = "Warning";
+ x.toLowerCase();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/BuilderChainAndFluent.java b/test/transform/resource/after-ecj/BuilderChainAndFluent.java
deleted file mode 100644
index f789f535..00000000
--- a/test/transform/resource/after-ecj/BuilderChainAndFluent.java
+++ /dev/null
@@ -1,25 +0,0 @@
-@lombok.experimental.Builder(fluent = false,chain = false) class BuilderChainAndFluent {
- public static @java.lang.SuppressWarnings("all") class BuilderChainAndFluentBuilder {
- private @java.lang.SuppressWarnings("all") int yes;
- @java.lang.SuppressWarnings("all") BuilderChainAndFluentBuilder() {
- super();
- }
- public @java.lang.SuppressWarnings("all") void setYes(final int yes) {
- this.yes = yes;
- }
- public @java.lang.SuppressWarnings("all") BuilderChainAndFluent build() {
- return new BuilderChainAndFluent(yes);
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return (("BuilderChainAndFluent.BuilderChainAndFluentBuilder(yes=" + this.yes) + ")");
- }
- }
- private final int yes;
- @java.lang.SuppressWarnings("all") BuilderChainAndFluent(final int yes) {
- super();
- this.yes = yes;
- }
- public static @java.lang.SuppressWarnings("all") BuilderChainAndFluentBuilder builder() {
- return new BuilderChainAndFluentBuilder();
- }
-}
diff --git a/test/transform/resource/after-ecj/BuilderComplex.java b/test/transform/resource/after-ecj/BuilderComplex.java
index 8f520ae5..93d70fe9 100644
--- a/test/transform/resource/after-ecj/BuilderComplex.java
+++ b/test/transform/resource/after-ecj/BuilderComplex.java
@@ -1,5 +1,5 @@
import java.util.List;
-import lombok.experimental.Builder;
+import lombok.Builder;
class BuilderComplex {
public static @java.lang.SuppressWarnings("all") class VoidBuilder<T extends Number> {
private @java.lang.SuppressWarnings("all") T number;
diff --git a/test/transform/resource/after-ecj/EqualsAndHashCodeWithGenericsOnInners.java b/test/transform/resource/after-ecj/EqualsAndHashCodeWithGenericsOnInners.java
new file mode 100644
index 00000000..164d0f15
--- /dev/null
+++ b/test/transform/resource/after-ecj/EqualsAndHashCodeWithGenericsOnInners.java
@@ -0,0 +1,32 @@
+public class EqualsAndHashCodeWithGenericsOnInners<A> {
+ @lombok.EqualsAndHashCode class Inner<B> {
+ int x;
+ Inner() {
+ super();
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
+ if ((o == this))
+ return true;
+ if ((! (o instanceof EqualsAndHashCodeWithGenericsOnInners.Inner)))
+ return false;
+ final EqualsAndHashCodeWithGenericsOnInners<?>.Inner<?> other = (EqualsAndHashCodeWithGenericsOnInners<?>.Inner<?>) o;
+ if ((! other.canEqual((java.lang.Object) this)))
+ return false;
+ if ((this.x != other.x))
+ return false;
+ return true;
+ }
+ protected @java.lang.SuppressWarnings("all") boolean canEqual(final java.lang.Object other) {
+ return (other instanceof EqualsAndHashCodeWithGenericsOnInners.Inner);
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ result = ((result * PRIME) + this.x);
+ return result;
+ }
+ }
+ public EqualsAndHashCodeWithGenericsOnInners() {
+ super();
+ }
+}
diff --git a/test/transform/resource/after-ecj/ValueExperimental.java b/test/transform/resource/after-ecj/ValueExperimental.java
deleted file mode 100644
index dd13574a..00000000
--- a/test/transform/resource/after-ecj/ValueExperimental.java
+++ /dev/null
@@ -1,39 +0,0 @@
-import lombok.experimental.Value;
-final @Value class ValueExperimental1 {
- public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
- if ((o == this))
- return true;
- if ((! (o instanceof ValueExperimental1)))
- return false;
- return true;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
- int result = 1;
- return result;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return "ValueExperimental1()";
- }
- public @java.lang.SuppressWarnings("all") ValueExperimental1() {
- super();
- }
-}
-final @lombok.experimental.Value class ValueExperimental2 {
- public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
- if ((o == this))
- return true;
- if ((! (o instanceof ValueExperimental2)))
- return false;
- return true;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
- int result = 1;
- return result;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return "ValueExperimental2()";
- }
- public @java.lang.SuppressWarnings("all") ValueExperimental2() {
- super();
- }
-} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/ValueExperimentalStarImport.java b/test/transform/resource/after-ecj/ValueExperimentalStarImport.java
deleted file mode 100644
index b69e85d9..00000000
--- a/test/transform/resource/after-ecj/ValueExperimentalStarImport.java
+++ /dev/null
@@ -1,20 +0,0 @@
-import lombok.experimental.*;
-final @Value class ValueExperimentalStarImport {
- public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
- if ((o == this))
- return true;
- if ((! (o instanceof ValueExperimentalStarImport)))
- return false;
- return true;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
- int result = 1;
- return result;
- }
- public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
- return "ValueExperimentalStarImport()";
- }
- public @java.lang.SuppressWarnings("all") ValueExperimentalStarImport() {
- super();
- }
-}
diff --git a/test/transform/resource/after-ecj/VarComplex.java b/test/transform/resource/after-ecj/VarComplex.java
index 10c456eb..97a0a177 100644
--- a/test/transform/resource/after-ecj/VarComplex.java
+++ b/test/transform/resource/after-ecj/VarComplex.java
@@ -1,4 +1,4 @@
-import lombok.experimental.var;
+import lombok.var;
public class VarComplex {
private String field = "";
private static final int CONSTANT = 20;
diff --git a/test/transform/resource/after-ecj/VarInFor.java b/test/transform/resource/after-ecj/VarInFor.java
index 0192aaed..1799d9b7 100644
--- a/test/transform/resource/after-ecj/VarInFor.java
+++ b/test/transform/resource/after-ecj/VarInFor.java
@@ -1,4 +1,4 @@
-import lombok.experimental.var;
+import lombok.var;
public class VarInFor {
public VarInFor() {
super();
diff --git a/test/transform/resource/after-ecj/VarInForOld.java b/test/transform/resource/after-ecj/VarInForOld.java
index 98fedf03..065ea94d 100644
--- a/test/transform/resource/after-ecj/VarInForOld.java
+++ b/test/transform/resource/after-ecj/VarInForOld.java
@@ -1,4 +1,4 @@
-import lombok.experimental.var;
+import lombok.var;
public class VarInForOld {
public VarInForOld() {
super();
diff --git a/test/transform/resource/after-ecj/VarNullInit.java b/test/transform/resource/after-ecj/VarNullInit.java
index 3eb2d506..848744cc 100644
--- a/test/transform/resource/after-ecj/VarNullInit.java
+++ b/test/transform/resource/after-ecj/VarNullInit.java
@@ -1,4 +1,4 @@
-import lombok.experimental.var;
+import lombok.var;
public class VarNullInit {
public VarNullInit() {
super();
diff --git a/test/transform/resource/after-ecj/VarWarning.java b/test/transform/resource/after-ecj/VarWarning.java
new file mode 100644
index 00000000..4caf90f8
--- /dev/null
+++ b/test/transform/resource/after-ecj/VarWarning.java
@@ -0,0 +1,10 @@
+import lombok.var;
+public class VarWarning {
+ public VarWarning() {
+ super();
+ }
+ public void isOkay() {
+ @var java.lang.String x = "Warning";
+ x.toLowerCase();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/before/BuilderChainAndFluent.java b/test/transform/resource/before/BuilderChainAndFluent.java
deleted file mode 100644
index 4d08741b..00000000
--- a/test/transform/resource/before/BuilderChainAndFluent.java
+++ /dev/null
@@ -1,4 +0,0 @@
-@lombok.experimental.Builder(fluent = false, chain = false)
-class BuilderChainAndFluent {
- private final int yes;
-}
diff --git a/test/transform/resource/before/BuilderComplex.java b/test/transform/resource/before/BuilderComplex.java
index 590a2723..c13f5877 100644
--- a/test/transform/resource/before/BuilderComplex.java
+++ b/test/transform/resource/before/BuilderComplex.java
@@ -1,5 +1,5 @@
import java.util.List;
-import lombok.experimental.Builder;
+import lombok.Builder;
class BuilderComplex {
@Builder(buildMethodName = "execute")
diff --git a/test/transform/resource/before/EqualsAndHashCodeWithGenericsOnInners.java b/test/transform/resource/before/EqualsAndHashCodeWithGenericsOnInners.java
new file mode 100644
index 00000000..7af1d054
--- /dev/null
+++ b/test/transform/resource/before/EqualsAndHashCodeWithGenericsOnInners.java
@@ -0,0 +1,6 @@
+public class EqualsAndHashCodeWithGenericsOnInners<A> {
+ @lombok.EqualsAndHashCode class Inner<B> {
+ int x;
+ }
+}
+
diff --git a/test/transform/resource/before/JavadocGenerally.java b/test/transform/resource/before/JavadocGenerally.java
index e47de44d..1df93385 100644
--- a/test/transform/resource/before/JavadocGenerally.java
+++ b/test/transform/resource/before/JavadocGenerally.java
@@ -11,6 +11,9 @@ package testPackage;
class JavadocGenerally {
/**
* Doc on field
+ * <pre>
+ * // code
+ * </pre>
*/
private int someField;
diff --git a/test/transform/resource/before/ValueExperimental.java b/test/transform/resource/before/ValueExperimental.java
deleted file mode 100644
index 6bae26a0..00000000
--- a/test/transform/resource/before/ValueExperimental.java
+++ /dev/null
@@ -1,9 +0,0 @@
-import lombok.experimental.Value;
-
-@Value
-class ValueExperimental1 {
-}
-
-@lombok.experimental.Value
-class ValueExperimental2 {
-} \ No newline at end of file
diff --git a/test/transform/resource/before/ValueExperimentalStarImport.java b/test/transform/resource/before/ValueExperimentalStarImport.java
deleted file mode 100644
index 5f18cffe..00000000
--- a/test/transform/resource/before/ValueExperimentalStarImport.java
+++ /dev/null
@@ -1,5 +0,0 @@
-import lombok.experimental.*;
-
-@Value
-class ValueExperimentalStarImport {
-} \ No newline at end of file
diff --git a/test/transform/resource/before/VarComplex.java b/test/transform/resource/before/VarComplex.java
index bfaa8804..c93e177a 100644
--- a/test/transform/resource/before/VarComplex.java
+++ b/test/transform/resource/before/VarComplex.java
@@ -1,5 +1,4 @@
-//CONF: lombok.var.flagUsage = ALLOW
-import lombok.experimental.var;
+import lombok.var;
public class VarComplex {
private String field = "";
diff --git a/test/transform/resource/before/VarInFor.java b/test/transform/resource/before/VarInFor.java
index cc8c387e..7f7bb7a7 100644
--- a/test/transform/resource/before/VarInFor.java
+++ b/test/transform/resource/before/VarInFor.java
@@ -1,5 +1,4 @@
-//CONF: lombok.var.flagUsage = ALLOW
-import lombok.experimental.var;
+import lombok.var;
public class VarInFor {
public void enhancedFor() {
diff --git a/test/transform/resource/before/VarInForOld.java b/test/transform/resource/before/VarInForOld.java
index f90aba7f..99e83b57 100644
--- a/test/transform/resource/before/VarInForOld.java
+++ b/test/transform/resource/before/VarInForOld.java
@@ -1,5 +1,4 @@
-//CONF: lombok.var.flagUsage = ALLOW
-import lombok.experimental.var;
+import lombok.var;
public class VarInForOld {
public void oldFor() {
diff --git a/test/transform/resource/before/VarInForOldMulti.java b/test/transform/resource/before/VarInForOldMulti.java
new file mode 100644
index 00000000..e2ea9682
--- /dev/null
+++ b/test/transform/resource/before/VarInForOldMulti.java
@@ -0,0 +1,10 @@
+//skip compare contents
+import lombok.var;
+
+public class VarInForOldMulti {
+ public void oldForMulti() {
+ for (var i = 0, j = "Hey"; i < 100; ++i) {
+ System.out.println(i);
+ }
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/before/VarModifier.java b/test/transform/resource/before/VarModifier.java
index 7250c1c5..5c68caa7 100644
--- a/test/transform/resource/before/VarModifier.java
+++ b/test/transform/resource/before/VarModifier.java
@@ -1,4 +1,3 @@
-//CONF: lombok.var.flagUsage = ALLOW
import lombok.experimental.var;
public class VarModifier {
diff --git a/test/transform/resource/before/VarNullInit.java b/test/transform/resource/before/VarNullInit.java
index efdc9d9e..f9bb53a3 100644
--- a/test/transform/resource/before/VarNullInit.java
+++ b/test/transform/resource/before/VarNullInit.java
@@ -1,5 +1,4 @@
-//CONF: lombok.var.flagUsage = ALLOW
-import lombok.experimental.var;
+import lombok.var;
public class VarNullInit {
void method() {
diff --git a/test/transform/resource/before/VarWarning.java b/test/transform/resource/before/VarWarning.java
index 85559587..90464d30 100644
--- a/test/transform/resource/before/VarWarning.java
+++ b/test/transform/resource/before/VarWarning.java
@@ -1,6 +1,5 @@
//CONF: lombok.var.flagUsage = WARNING
-//skip compare contents
-import lombok.experimental.var;
+import lombok.var;
public class VarWarning {
public void isOkay() {
diff --git a/test/transform/resource/messages-delombok/VarInForOldMulti.java.messages b/test/transform/resource/messages-delombok/VarInForOldMulti.java.messages
new file mode 100644
index 00000000..f65fe823
--- /dev/null
+++ b/test/transform/resource/messages-delombok/VarInForOldMulti.java.messages
@@ -0,0 +1 @@
+6 'var' is not allowed in old-style for loops if there is more than 1 initializer
diff --git a/test/transform/resource/messages-delombok/VarNullInit.java.messages b/test/transform/resource/messages-delombok/VarNullInit.java.messages
index 190ab7c4..5a2a6ae1 100644
--- a/test/transform/resource/messages-delombok/VarNullInit.java.messages
+++ b/test/transform/resource/messages-delombok/VarNullInit.java.messages
@@ -1 +1 @@
-6 variable initializer is 'null' \ No newline at end of file
+5 variable initializer is 'null' \ No newline at end of file
diff --git a/test/transform/resource/messages-delombok/VarWarning.java.messages b/test/transform/resource/messages-delombok/VarWarning.java.messages
index 48c89581..886e98f4 100644
--- a/test/transform/resource/messages-delombok/VarWarning.java.messages
+++ b/test/transform/resource/messages-delombok/VarWarning.java.messages
@@ -1 +1 @@
-7 Use of var is flagged according to lombok configuration \ No newline at end of file
+6 Use of var is flagged according to lombok configuration \ No newline at end of file
diff --git a/test/transform/resource/messages-ecj/BuilderComplex.java.messages b/test/transform/resource/messages-ecj/BuilderComplex.java.messages
deleted file mode 100644
index 4856a80d..00000000
--- a/test/transform/resource/messages-ecj/BuilderComplex.java.messages
+++ /dev/null
@@ -1 +0,0 @@
-2 The type Builder is deprecated
diff --git a/test/transform/resource/messages-ecj/ValInTryWithResources.java.messages b/test/transform/resource/messages-ecj/ValInTryWithResources.java.messages
new file mode 100644
index 00000000..9d0d7a6e
--- /dev/null
+++ b/test/transform/resource/messages-ecj/ValInTryWithResources.java.messages
@@ -0,0 +1 @@
+OPTIONAL 8 Resource leak: 'i' is never closed
diff --git a/test/transform/resource/messages-ecj/ValueExperimental.java.messages b/test/transform/resource/messages-ecj/ValueExperimental.java.messages
deleted file mode 100644
index e454a878..00000000
--- a/test/transform/resource/messages-ecj/ValueExperimental.java.messages
+++ /dev/null
@@ -1 +0,0 @@
-1 The type Value is deprecated \ No newline at end of file
diff --git a/test/transform/resource/messages-ecj/VarInForOldMulti.java.messages b/test/transform/resource/messages-ecj/VarInForOldMulti.java.messages
new file mode 100644
index 00000000..0bfd6e65
--- /dev/null
+++ b/test/transform/resource/messages-ecj/VarInForOldMulti.java.messages
@@ -0,0 +1 @@
+6 'var' is not allowed in old-style for loops if there is more than 1 initializer \ No newline at end of file
diff --git a/test/transform/resource/messages-ecj/VarModifier.java.messages b/test/transform/resource/messages-ecj/VarModifier.java.messages
new file mode 100644
index 00000000..051d1ad7
--- /dev/null
+++ b/test/transform/resource/messages-ecj/VarModifier.java.messages
@@ -0,0 +1,3 @@
+1 The type var is deprecated
+7 The type var is deprecated
+8 The type var is deprecated
diff --git a/test/transform/resource/messages-ecj/VarNullInit.java.messages b/test/transform/resource/messages-ecj/VarNullInit.java.messages
index 190ab7c4..5a2a6ae1 100644
--- a/test/transform/resource/messages-ecj/VarNullInit.java.messages
+++ b/test/transform/resource/messages-ecj/VarNullInit.java.messages
@@ -1 +1 @@
-6 variable initializer is 'null' \ No newline at end of file
+5 variable initializer is 'null' \ No newline at end of file
diff --git a/test/transform/resource/messages-ecj/VarWarning.java.messages b/test/transform/resource/messages-ecj/VarWarning.java.messages
index 48c89581..25096b84 100644
--- a/test/transform/resource/messages-ecj/VarWarning.java.messages
+++ b/test/transform/resource/messages-ecj/VarWarning.java.messages
@@ -1 +1 @@
-7 Use of var is flagged according to lombok configuration \ No newline at end of file
+6 Use of var is flagged according to lombok configuration. \ No newline at end of file
diff --git a/website/extra/htaccess b/website/extra/htaccess
index fd18c145..db3393af 100644
--- a/website/extra/htaccess
+++ b/website/extra/htaccess
@@ -24,6 +24,12 @@ RewriteRule ^disable-checked-exceptions$ /disable-checked-exceptions.html [L,END
RewriteRule ^disable-checked-exceptions(\.html)?$ /disable-checked-exceptions [NC,R=301]
RewriteRule ^contributing$ /contributing.html [L,END]
RewriteRule ^contributing(\.html)?$ /contributing [NC,R=301]
+RewriteRule ^supporters$ /supporters.html [L,END]
+RewriteRule ^supporters(.html)?$ /supporters [NC,R=301]
+RewriteRule ^order-license-info$ /order-license-info.html [L,END]
+RewriteRule ^order-?license-?info(.html)?$ /order-license-info [NC,R=301]
+RewriteRule ^order-license$ /order-license.html [L,END]
+RewriteRule ^order-?license(.html)?$ /order-license [NC,R=301]
<#list setupPages as pg>
RewriteRule ^setup/${pg?no_esc}$ /setup/${pg?no_esc}.html [L,END]
@@ -39,6 +45,10 @@ RewriteRule ^features/${pg?no_esc}$ /features/${pg?no_esc}.html [L,END]
RewriteRule ^features/${pg?no_esc}(\.html)?$ /features/${pg?no_esc} [NC,R=301]
</#list>
+RewriteRule ^features/experimental/Builder(\.html)?$ /features/Builder [NC,R=301]
+RewriteRule ^features/experimental/Value(\.html)?$ /features/Value [NC,R=301]
+RewriteRule ^features/experimental/var(\.html)?$ /features/var [NC,R=301]
+
RewriteRule ^features/experimental/all$ /features/experimental/index.html [L,END]
RewriteRule ^features/experimental(/all)?$ /features/experimental/all [NC,R=301]
RewriteRule ^features/experimental/index(\.html)?$ /features/experimental/all [NC,R=301]
diff --git a/website/resources/W8BEN_lombok.pdf b/website/resources/W8BEN_lombok.pdf
new file mode 100644
index 00000000..b87bded8
--- /dev/null
+++ b/website/resources/W8BEN_lombok.pdf
Binary files differ
diff --git a/website/resources/css/custom.css b/website/resources/css/custom.css
index 795b155c..f81a3dd9 100644
--- a/website/resources/css/custom.css
+++ b/website/resources/css/custom.css
@@ -7,6 +7,101 @@
margin-bottom: 40px;
}
+.buttonLike {
+ cursor: pointer;
+ background: -webkit-linear-gradient(top, #FFFEF7, #CFCEC7);
+ background: -moz-linear-gradient(top, #FFFEF7, #CFCEC7);
+ background: -o-linear-gradient(#FFFEF7, #CFCEC7);
+ background: -ms-linear-gradient(#FFFEF7, #CFCEC7);
+ background: linear-gradient(top, #FFFEF7, #CFCEC7);
+ line-height: 1;
+ padding: 3px 10px;
+ border: 1px solid black;
+ position: relative;
+ overflow: visible;
+ color: black;
+ margin: 2px;
+ border-radius: 5px;
+ display: inline-block;
+ text-align: center;
+}
+
+.orderButton {
+ width: 280px;
+}
+
+.orderDetails {
+ font-style: italic;
+ font-size: 10px;
+ margin-top: 20px;
+}
+
+.formErr {
+ color: #FF7777;
+}
+
+.order-license #deleteCompanyLogo {
+ margin-top: 12px;
+}
+
+.formSubmitFail {
+ color: #FF6666;
+ font-size: 1.2em;
+ font-style: italic;
+}
+
+.order-license .btn-primary {
+ float: left;
+ margin-right: 20px;
+ background: -webkit-linear-gradient(#1725e0, #0923df 6%, #0b21ce);
+ background: -o-linear-gradient(#1725e0, #0923df 6%, #0b21ce);
+ background: -webkit-gradient(linear, left top, left bottom, from(#1725e0), color-stop(6%, #0923df), to(#0b21ce));
+ background: linear-gradient(#1725e0, #0923df 6%, #0b21ce);
+ background-repeat: no-repeat;
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff1725e0', endColorstr='#ff0b21ce', GradientType=0);
+ -webkit-filter: none;
+ filter: none;
+ border: 1px solid #091bac;
+}
+
+#onlyYearlyWarning {
+ font-size: 0.8em;
+ padding-left: 16px;
+}
+
+.deemphasize {
+ color: #AAAAAA;
+ font-size: 0.8em;
+ font-style: italic;
+}
+
+.supporterBar .introText {
+ margin-top: 16px;
+}
+
+.barItem {
+ margin: 16px;
+ max-width: 168px;
+}
+
+.barItem img {
+ width: 100%;
+}
+
+.supportItem, .barItem {
+ display: inline-block;
+}
+
+.supporters .supportItem {
+ margin: 6px 10px;
+}
+
+.supporterBar {
+ width: 100%;
+ margin-left: auto;
+ margin-right: auto;
+}
+
.errorBox {
border: 1px dashed #F44;
font-size: 1.2em;
@@ -30,11 +125,6 @@
height: 16px;
}
-.legalese {
- font-style: italic;
- font-size: 0.8em;
-}
-
#companyLogo {
margin-right: 8px;
}
diff --git a/website/resources/files/supporters.json b/website/resources/files/supporters.json
new file mode 100644
index 00000000..a895f95b
--- /dev/null
+++ b/website/resources/files/supporters.json
@@ -0,0 +1,13 @@
+{
+ "modWeight": {
+ "professional": 2.0,
+ "enterprise": 4.0,
+ "patron": 1.0
+ },
+ "professional": [
+ ],
+ "enterprise": [
+ ],
+ "patron": [
+ ]
+}
diff --git a/website/resources/img/spinner.gif b/website/resources/img/spinner.gif
new file mode 100644
index 00000000..f627b993
--- /dev/null
+++ b/website/resources/img/spinner.gif
Binary files differ
diff --git a/website/resources/js/main.js b/website/resources/js/main.js
index 3ad77958..f07da70d 100644
--- a/website/resources/js/main.js
+++ b/website/resources/js/main.js
@@ -37,7 +37,7 @@
if (self.data("clc")) return;
var href = self.attr("href");
self.data("clc", true);
- if (!href || href.substr(0, 4) === "http" || href === "/api/") return;
+ if (!href || href.substr(0, 4) === "http" || href === "/api/" || href === "/" || href === "/supporters" || href === "/order-license") return;
var ext = href.substr(href.length - 4, 4);
if (ext === ".xml" || ext === ".jar") return;
self.on("click", function(evt) {
diff --git a/website/resources/js/order-license.js b/website/resources/js/order-license.js
new file mode 100644
index 00000000..b2842456
--- /dev/null
+++ b/website/resources/js/order-license.js
@@ -0,0 +1,231 @@
+"use strict";
+
+(function() {
+ if (!String.prototype.trim) {
+ String.prototype.trim = function () {
+ return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
+ };
+ }
+
+ var imgDataUrl = null;
+
+ function updateLocationInfo() {
+ var locationType = $("input:radio[name='locationType']:checked").val();
+ $("#locationType_usa").toggle(locationType === "usa");
+ $("#locationType_eu").toggle(locationType === "eu");
+ $("#locationType_other").toggle(locationType === "other");
+ $("#paymentMethod_iban").toggle(locationType === "eu");
+ if ($("#paymentMethod_iban input").is(":checked") && locationType !== "eu") $("#paymentMethod_payoneer input").prop("checked", true);
+ if ($("#paymentMethod_intl input").is(":checked") && locationType === "eu") $("#paymentMethod_iban input").prop("checked", true);
+ $("#paymentMethod_intl").toggle(locationType !== "eu");
+ }
+
+ function updatePriceIndication() {
+ $("#onlyYearlyWarning").hide();
+ var x = getPriceIndication();
+ if (x === "") {
+ $("#costIndicator").text("").hide();
+ } else {
+ $("#costIndicator").text(x).show();
+ }
+ }
+
+ function getPriceIndication() {
+ try {
+ var seats = parseInt($("#seats").val());
+ if (isNaN(seats) || seats < 1) return "";
+ var licenseType = $("input:radio[name='licenseType']:checked").val();
+ var costPer;
+ if (licenseType === "enterprise") costPer = 5;
+ else if (licenseType === "professional") costPer = 2;
+ else return "";
+ var periodRaw = $("input:radio[name='paymentType']:checked").val();
+ if (periodRaw === "monthly") {
+ if (costPer*seats < 50) {
+ $("#onlyYearlyWarning").show();
+ return "Your license will cost €" + (costPer*seats*12) + ",- per year.";
+ }
+ return "Your license will cost €" + (costPer*seats) + ",- per month.";
+ }
+ return "Your license will cost €" + (costPer*seats*12) + ",- per year.";
+ } catch (e) {
+ return "";
+ }
+ }
+
+ function showError(elemName) {
+ var elem = $("#" + elemName + "Err");
+ elem.fadeIn();
+ $("#" + elemName).on("change keyup", function() {
+ elem.hide();
+ });
+ }
+
+ function applyLicense() {
+ var submitButton = $("#submit");
+ var spinner = $("<img>").attr("src", "/img/spinner.gif").attr("alt", "submitting").css("float", "left").css("margin-right", "20px");
+
+ submitButton.on("click", function(evt) {
+ evt.preventDefault();
+
+ var onSuccess = function() {
+ $("#orderHelp").hide();
+ var okMsg = $("<div>").addClass("formSubmitOk").html("Thank you for ordering a Project Lombok license! We'll send your bill via email. If you have any further questions please contact us at <a href=\"mailto:orders@projectlombok.org\"><code>orders@projectlombok.org</code></a>.");
+ spinner.replaceWith(okMsg);
+ };
+
+ var onFailure = function() {
+ $("#orderHelp").hide();
+ var errMsg = $("<div>").addClass("formSubmitFail").html("Our order form appears to be broken. Could you do us a favour and contact us at <a href=\"mailto:orders@projectlombok.org\"><code>orders@projectlombok.org</code></a>? Thank you!");
+ spinner.replaceWith(errMsg);
+ };
+
+ var data = {};
+ data.name = $("#companyName").val();
+ data.email = $("#email").val();
+ data.licenseType = $("input:radio[name='licenseType']:checked").val();
+ data.seats = parseInt($("#seats").val());
+ data.paymentType = $("input:radio[name='paymentType']:checked").val();
+ data.mentionMe = $("#mentionMe").prop("checked");
+ data.companyUrl = $("#companyUrl").val();
+ data.locationType = $("input:radio[name='locationType']:checked").val();
+ data.euVat = $("#euVat").val();
+ data.paymentMethod = $("input:radio[name='paymentMethod']:checked").val();
+
+ var formFail = false;
+
+ if (!data.paymentMethod) {
+ showError("paymentMethod");
+ formFail = true;
+ }
+
+ if (!data.euVat && data.locationType === 'eu') {
+ $("#euVat").focus();
+ showError("euVat");
+ formFail = true;
+ }
+
+ if (!data.locationType) {
+ showError("locationType");
+ formFail = true;
+ }
+
+ if (!data.seats || isNaN(data.seats) || data.seats < 1) {
+ $("#seats").focus();
+ showError("seats");
+ formFail = true;
+ }
+
+ if (!data.paymentType) {
+ showError("paymentType");
+ formFail = true;
+ }
+
+ if (data.email.indexOf('@') === -1) {
+ $("#email").focus();
+ showError("email");
+ formFail = true;
+ }
+
+ if (data.name.trim().length < 1) {
+ $("#companyName").focus();
+ showError("companyName");
+ formFail = true;
+ }
+
+ if (formFail) return;
+
+ var rnd = generateRandom();
+ var err = processImageUpload();
+ if (err) {
+ alert(err);
+ $("#logo")[0].value = null;
+ return;
+ }
+ if (imgDataUrl) data.logo = imgDataUrl;
+
+ submitButton.replaceWith(spinner);
+
+ $.ajax({
+ url: "/license-submit/" + rnd,
+ method: "PUT",
+ contentType: "application/json",
+ data: JSON.stringify(data),
+ processData: false,
+ success: onSuccess,
+ error: onFailure
+ });
+ });
+
+ $("#companyLogo").on("click", function(evt) {
+ evt.preventDefault();
+ $("#logo").click();
+ });
+
+ $("#deleteCompanyLogo").on("click", function(evt) {
+ evt.preventDefault();
+ $("#logo")[0].value = null;
+ $("#logoCnt").empty().hide();
+ $("#companyLogo").show();
+ $("#deleteCompanyLogo").hide();
+ });
+
+ $("#logo").on("change", function() {
+ var err = showImage();
+ if (err) {
+ alert(err);
+ $("#logo")[0].value = null;
+ } else {
+ $("#companyLogo").hide();
+ $("#deleteCompanyLogo").show();
+ }
+ });
+
+ $("#seats,.paymentType,.licenseType").on("change keyup", function() {
+ updatePriceIndication();
+ });
+ $(".locationType").on("change", function() {
+ updateLocationInfo();
+ });
+ }
+
+ function generateRandom() {
+ var buf = new Uint8Array(40);
+ window.crypto.getRandomValues(buf);
+ return btoa(String.fromCharCode.apply(null, buf)).replace(/\+/g, '_').replace(/\//gi, '-');
+ }
+
+ function showImage() {
+ $("#logoCnt").empty().hide();
+ try {
+ return processImageUpload(function(dataUrl) {
+ var img = $("<img />");
+ img.css({
+ "max-width": "500px",
+ "max-height": "300px"
+ });
+ $("#logoCnt").append(img).show();
+ img.attr("src", dataUrl);
+ });
+ } catch (e) {
+ if (console && console.log) console.log(e);
+ }
+ }
+
+ function processImageUpload(fnc) {
+ var f = $("#logo")[0].files[0];
+ if (!f) return;
+ if (f.size > 10000000) return "Logo too large; please give us a logo below 10MiB in size.";
+ var imageType = /^image\//;
+ if (!imageType.test(f.type)) return "Please upload an image, for example in PNG format.";
+ var reader = new FileReader();
+ reader.onload = function(e) {
+ imgDataUrl = e.target.result;
+ if (fnc) fnc(e.target.result);
+ };
+ reader.readAsDataURL(f);
+ return null;
+ }
+
+ $(applyLicense);
+})();
diff --git a/website/resources/js/supporters.js b/website/resources/js/supporters.js
new file mode 100644
index 00000000..11f77640
--- /dev/null
+++ b/website/resources/js/supporters.js
@@ -0,0 +1,221 @@
+"use strict";
+
+(function($) {
+ var supporters = {};
+ var weights = {};
+ var types = ["enterprise", "professional", "patron"];
+
+ function shuffle(array) {
+ var i = 0, j = 0, temp = null;
+ for (i = array.length - 1; i > 0; i -= 1) {
+ j = Math.floor(Math.random() * (i + 1));
+ temp = array[i];
+ array[i] = array[j];
+ array[j] = temp;
+ }
+ }
+
+ function pad(number) {
+ return number < 10 ? '0' + number : number;
+ }
+
+ function fromDate(d) {
+ return d.getUTCFullYear() + '-' + pad(d.getUTCMonth() + 1) + '-' + pad(d.getUTCDate());
+
+ }
+
+ function toDate(s) {
+ var x = /^(\d{4})-(\d{2})-(\d{2})$/.exec(s);
+ if (x) return new Date(parseInt(x[1]), parseInt(x[2]), parseInt(x[3]));
+ return null;
+ }
+
+ function Supporter(type, json) {
+ this.type = type;
+ this.name = json.name;
+ this.logo = json.logo;
+ this.url = json.url;
+ this.showName = json.showName;
+ this.start = json.range ? toDate(json.range[0]) : null;
+ this.end = json.range ? toDate(json.range[1]) : null;
+ this.weight = (!json.weight && json.weight !== 0.0) ? 1.0 : json.weight;
+ }
+
+ Supporter.prototype.inRange = function(d) {
+ return (!this.start || this.start <= d) && (!this.end || this.end > d);
+ };
+
+ Supporter.prototype.render = function() {
+ var d = $("<div />").addClass("supportItem").addClass(this.type);
+ var a = d;
+ if (this.url) {
+ a = $("<a />").attr("href", this.url).attr("rel", "noopener").attr("target", "_blank");
+ d.append(a);
+ }
+ var n = $("<span />").text(this.name);
+ a.append(n);
+
+ if (this.logo) {
+ a.addClass("logo");
+ var i = new Image();
+ var showName = this.showName;
+ i.onload = function() {
+ var w = i.width;
+ var h = i.height;
+ var wf = w / 162;
+ var hf = h / 80;
+ var f = hf > wf ? hf : wf;
+ var wt = Math.round(w / f);
+ var ht = Math.round(h / f);
+ i.width = wt;
+ i.height = ht;
+ var ji = $(i);
+ if (!showName) a.empty();
+ ji.css("width", wt + "px");
+ ji.css("height", ht + "px");
+ ji.attr("alt", n.text());
+ ji.attr("title", n.text());
+ a.prepend(ji);
+ };
+ i.src = 'files/' + this.logo;
+ }
+ return d;
+ }
+
+ function errorHandler(xhr, statusText, err) {
+ var errMsg = "Can't connect to projectlombok.org to fetch the list of licensees and supporters.";
+ if (console && console.log) {
+ console.log("AJAX error for loading list of supporters:");
+ console.log(err);
+ }
+ var errBox = $("<div />").addClass("errorBox").text(errMsg);
+ $(".supporters").text("").append(errBox);
+ }
+
+ function successHandler(data) {
+ $.each(types, function() {
+ var t = this;
+ supporters[t] = [];
+ if (data && data[t]) $.each(data[t], function() {
+ supporters[t].push(new Supporter(t, this));
+ });
+ });
+ weights = data.modWeight;
+ if (typeof weights !== 'object') weights = {};
+ updatePage();
+ }
+
+ function build() {
+ var spinner = $("<img />").attr("title", "loading").attr("src", "/img/spinner.gif").addClass("spinner");
+ $(".supporters").append(spinner);
+ $.ajax({
+ url: "/files/supporters.json",
+ dataType: "json",
+ cache: true,
+ error: errorHandler,
+ success: function(data) {
+ spinner.remove();
+ successHandler(data);
+ }
+ });
+ }
+
+ function applySupporters() {
+ build();
+ }
+
+ function updatePage() {
+ updateSupporters();
+ updateSupporterBar();
+ }
+
+ var supPerBar = 4;
+ function updateSupporterBar() {
+ var s = $(".supporterBar");
+ s.find(".introText").show();
+ s.append($("<div />").addClass("sbCnt"));
+ var sf = s.find(".supporterFooter").show();
+ s.append(sf);
+ s = s.find(".sbCnt");
+ var now = new Date();
+ var list = [];
+ $.each(types, function() {
+ var t = this;
+ $.each(supporters[t], function() {
+ if (this.inRange(now)) {
+ var w = weights[t] ? weights[t] : 1.0;
+ if (this.weight) w = w * this.weight;
+ for (var i = 0; i < w; i++) list.push(this);
+ }
+ });
+ });
+
+ shuffle(list);
+
+ var len = list.length;
+ var pos = 0;
+ var c = [], cd = [];
+ for (var i = 0; i < supPerBar; i++) {
+ c[i] = null;
+ cd[i] = $("<div />").addClass("barItem");
+ }
+
+ var upd = function() {
+ var nw = [], a = [], fo = $(), fi = $();
+ var sPos = pos;
+ for (var i = 0; i < supPerBar; i++) {
+ if (++pos === len) pos = 0;
+ var z = false;
+ for (var j = 0; j < i; j++) if (nw[j] === list[pos]) z = true;
+ if (z) i--;
+ else nw[i] = list[pos];
+ if (pos === sPos) break;
+ }
+ for (var i = 0; i < supPerBar; i++) a[i] = (nw[i] === c[i] || !nw[i]) ? null : nw[i].render(i + 1).hide();
+ for (var i = 0; i < supPerBar; i++) {
+ if (a[i]) {
+ fi = fi.add(a[i]);
+ fo = fo.add(cd[i].children());
+ if (cd[i].parent().length === 0) s.append(cd[i]);
+ cd[i].append(a[i]);
+ c[i] = nw[i];
+ }
+ }
+
+ if (fo.length === 0) fi.fadeIn();
+ else {
+ fo.fadeOut("normal", function() {
+ fi.fadeIn();
+ fo.remove();
+ });
+ }
+ };
+
+ setInterval(upd, 10000);
+ upd();
+ }
+
+ function updateSupporters() {
+ var s = $(".supporters");
+ s.empty();
+ var now = new Date();
+ $.each(types, function() {
+ var t = this;
+ var d = $("<div />").addClass("row");
+ var h = $("<h2 />").text(t);
+ d.append(h);
+ $.each(supporters[t], function() {
+ if (this.inRange(now)) d.append(this.render());
+ });
+ if (d.children().length > 1) s.append(d);
+ });
+ if (s.children().length < 1) {
+ var x = $("<div />").addClass("noSupportersBox").html(
+ "We don't have any supporters yet this month.<br /><a href=\"https://patreon.com/lombok\" rel=\"noopener\">Become a patron</a> " +
+ "or <a href=\"/order-license-info\">order a professional or enterprise license</a> today!");
+ s.append(x);
+ }
+ }
+
+ $(applySupporters);
+})($); \ No newline at end of file
diff --git a/website/templates/_scaffold.html b/website/templates/_scaffold.html
index c461423f..646f0247 100644
--- a/website/templates/_scaffold.html
+++ b/website/templates/_scaffold.html
@@ -22,7 +22,8 @@
"Netbeans": "netbeans",
"MyEclipse": "eclipse",
"Spring Tool Suite": "eclipse",
- "JBoss Developer Studio": "eclipse"
+ "JBoss Developer Studio": "eclipse",
+ "Visual Studio Code": "vscode"
},
"Platforms": {
"Android": "android",
@@ -92,14 +93,17 @@ ga('send', 'pageview');
<li><a href="/features/experimental/all">Experimental</a></li>
</ul>
</li>
- <li>
- <a href="https://groups.google.com/group/project-lombok" target="_blank">
- <span>Discuss/Help</span>
- </a>
+ <li class="dropdown">
+ <a class="dropdown-toggle pointer" data-toggle="dropdown">Community<span class="caret"></span></a>
+ <ul class="dropdown-menu" aria-labelledby="themes">
+ <li><a href="https://groups.google.com/group/project-lombok" rel="noopener">Discuss / Help</a></li>
+ <li><a href="https://github.com/rzwitserloot/lombok/issues" rel="noopener">Issues</a></li>
+ <li><a href="/contributing">Contribute</a></li>
+ </ul>
</li>
<li>
- <a href="/contributing">
- <span>Contribute</span>
+ <a href="/order-license-info">
+ <span>Order / Donate</span>
</a>
</li>
<li class="dropdown">
diff --git a/website/templates/contributing.html b/website/templates/contributing.html
index dde6e3ff..3a99c77a 100644
--- a/website/templates/contributing.html
+++ b/website/templates/contributing.html
@@ -3,6 +3,11 @@
<@main.scaffold>
<div class="page-header top5">
<div class="row text-center">
+ <@main.h1 title="Contributing to Project Lombok's development" />
+ </div><div class="row">
+ You can choose to <a href="/order-license-info">become a project lombok licensee or support us on patreon</a>.
+ </div>
+ <div class="row text-center">
<@main.h1 title="How to work on Project Lombok yourself" />
</div><div class="row">
Project Lombok is being developed via the <a href="https://github.com/rzwitserloot/lombok">lombok git repository on github</a>.
diff --git a/website/templates/features/index.html b/website/templates/features/index.html
index 73b5dce8..d077ab4d 100644
--- a/website/templates/features/index.html
+++ b/website/templates/features/index.html
@@ -12,6 +12,10 @@
Finally! Hassle-free final local variables.
</@main.feature>
+ <@main.feature title="var" href="var">
+ Mutably! Hassle-free local variables.
+ </@main.feature>
+
<@main.feature title="@NonNull" href="NonNull">
or: How I learned to stop worrying and love the NullPointerException.
</@main.feature>
diff --git a/website/templates/features/experimental/var.html b/website/templates/features/var.html
index fa35ac5e..60e24914 100644
--- a/website/templates/features/experimental/var.html
+++ b/website/templates/features/var.html
@@ -1,23 +1,13 @@
-<#import "../_features.html" as f>
+<#import "_features.html" as f>
-<@f.scaffold title="var" logline="Modifiable local variables with a type inferred by assigning value.">
+<@f.scaffold title="var" logline="Mutably! Hassle-free local variables.">
<@f.history>
- <p>
- <code>var</code> was introduced in lombok 1.16.12 as experimental feature.
- </p>
+ <p><ul>
+ <li><code>var</code> was promoted to the main package in lombok 2.0.0; given that <a href="http://openjdk.java.net/jeps/286">JEP 286</a> establishes expectations, and lombok's take on <code>var</code> follows these, we've decided to promote <code>var</code> eventhough the feature remains controversial.</li>
+ <li><code>var</code> was introduced in lombok 1.16.12 as experimental feature.</li>
+ </ul></p>
</@f.history>
- <@f.experimental>
- <ul>
- <li>
- This feature is very controversial.
- </li><li>
- There is <a href="http://openjdk.java.net/jeps/286">JEP 286</a> that should make <code>var</code> obsolete.
- </li>
- </ul>
- Current status: <em>uncertain</em> – Currently we feel this feature cannot move out of experimental status.
- </@f.experimental>
-
<@f.overview>
<p>
<code>var</code> works exactly like <a href="/features/val"><code>val</code></a>, except the local variable is <em>not</em> marked as <code>final</code>.
diff --git a/website/templates/main.html b/website/templates/main.html
index d52df167..25098758 100644
--- a/website/templates/main.html
+++ b/website/templates/main.html
@@ -28,8 +28,17 @@
<a href="http://jnb.ociweb.com/jnb/jnbJan2010.html">Show me a text and images based explanation and tutorial instead!</a>
</div>
</div>
- <div class="row supporterBar">
- </div>
+ </div>
+ <div class="row text-center">
+ <@main.h2 title="Upcoming presentations" />
+ <p>
+ We're talking to NL-JUG to give a presentation soon in the The Hague (The Netherlands) area.<br />
+ Want us to present at your JUG or conference? Feel free to contact us, via email (<code>info@</code>) or twitter: <a href="https://twitter.com/project_lombok">@project_lombok</a>.
+ </p>
+ </div>
+ <div class="row text-center supporterBar">
+ <h2 class="introText" hidden="hidden">Project Lombok is <a href="/supporters">powered by</a>:</h2>
+ <div class="supporterFooter" hidden="hidden"><a class="buttonLike" href="/order-license-info">I want to support Project Lombok too!</a></div>
</div>
</div>
</@main.scaffold>
diff --git a/website/templates/order-license-info.html b/website/templates/order-license-info.html
new file mode 100644
index 00000000..724e44f7
--- /dev/null
+++ b/website/templates/order-license-info.html
@@ -0,0 +1,31 @@
+<#import "/_scaffold.html" as main>
+
+<@main.scaffold>
+ <div class="page-header top5">
+ <div class="row text-center">
+ <h2>Order a professional or enterprise license</h2>
+ </div>
+ <div class="row">
+ <p>
+ Lombok is open source. We offer three licenses for using lombok. The standard license is free. Here you can order a professional or enterprise license.
+ </p><p>
+ <a class="buttonLike orderButton" href="/order-license">Order a professional or enterprise license</a><br />
+ <a class="buttonLike orderButton" href="https://www.patreon.com/lombok">For individuals: Become a patreon</a>
+ </p>
+ <div class="row text-center">
+ <h2>Benefits of becoming a licensee</h2>
+ </div>
+ <p>
+ Lombok is and will remain a free, open source product. However, we ask you to consider becoming a licensee. Licensees will be <a href="/supporters">listed</a> on the <code>projectlombok.org</code> website, we'll send you some stickers, and an official license. You'll be supporting the development of Project Lombok.
+ </p>
+ <div class="row text-center">
+ <h2>Small print</h2>
+ </div>
+ <p class="deemphasize">
+ As part of being a professional or enterprise licensee, we will put your name, a logo, and possibly a link on our ‘supporters and licensees’ page. We'll also put (at random) some supporters and licensees on our front page. You may of course opt out of this offer. We may, at our discretion, opt not to list you. If we elect not to do so, you will be notified at the email address you fill in on our form, and you are as always free to cancel your license at any time.
+ </p><p class="deemphasize">
+ Project Lombok is provided by the copyright holders and contributors “as is” and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed, even for professional and enterprise license holders. In no event shall the copyright holder or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
+ </p>
+ </div>
+ </div>
+</@main.scaffold>
diff --git a/website/templates/order-license.html b/website/templates/order-license.html
new file mode 100644
index 00000000..a364fc79
--- /dev/null
+++ b/website/templates/order-license.html
@@ -0,0 +1,151 @@
+<#import "/_scaffold.html" as main>
+
+<@main.scaffold load=["/js/order-license.js"]>
+ <div class="page-header top5 order-license">
+ <div class="row text-center">
+ <h2>Order a professional or enterprise license</h2>
+ </div>
+ <div class="row">
+ <form>
+ <fieldset class="form-group">
+ <legend>Basic information</legend>
+ <div class="form-group">
+ <label for="companyName">Company name</label>
+ <input type="text" class="form-control" aria-describedby="companyNameHelp" id="companyName" placeholder="license holder name" />
+ <div id="companyNameErr" class="formErr" hidden="hidden">Company name is a required field.</div>
+ <small id="companyNameHelp" class="form-text text-muted">If applying for an individual license, fill in your own name.</small>
+ </div>
+ <div class="form-group">
+ <label for="email">Email</label>
+ <input type="email" class="form-control" aria-describedby="emailHelp" id="email" placeholder="email of contact / holder" />
+ <div id="emailErr" class="formErr" hidden="hidden">Your email address is required; we will send the bill to this email address.</div>
+ <small id="emailHelp" class="form-text text-muted">We will never share this email with any third parties; we'll email you the invoice at this email address.</small>
+ </div>
+ </fieldset>
+ <fieldset class="form-group">
+ <legend>Type of license</legend>
+ <div class="form-group">
+ <div class="form-check">
+ <label class="form-check-label">
+ <input type="radio" class="form-check-input licenseType" name="licenseType" value="professional" checked="checked" />
+ Professional (€2,- per developer per month; ~ $2.50).
+ </label>
+ </div>
+ <div class="form-check">
+ <label class="form-check-label">
+ <input type="radio" class="form-check-input licenseType" name="licenseType" value="enterprise" />
+ Enterprise (€5,- per developer per month; ~ $6.10).
+ </label>
+ </div>
+ </div>
+ <div id="licenseTypeErr" class="formErr" hidden="hidden">License type is a required field.</div>
+ <div class="form-group">
+ <label for="seats"># of developers using lombok</label>
+ <input type="number" placeholder="# of developers" class="form-control" id="seats" />
+ <div id="seatsErr" class="formErr" hidden="hidden">We need to know the # of developers to determine the license price.</div>
+ </div>
+ </fieldset>
+ <fieldset class="form-group">
+ <legend>Payment</legend>
+ <div class="form-check">
+ <label class="form-check-label">
+ <input type="radio" class="form-check-input paymentType" name="paymentType" value="yearly" checked="checked" />
+ Yearly
+ </label>
+ </div>
+ <div class="form-check">
+ <label class="form-check-label">
+ <input type="radio" class="form-check-input paymentType" name="paymentType" value="monthly" />
+ Monthly<span id="onlyYearlyWarning" hidden="hidden" class="warning">The total license cost is sufficiently low that we'll bill you yearly.</span>
+ </label>
+ </div>
+ <div id="paymentTypeErr" class="formErr" hidden="hidden">Payment type is a required field.</div>
+ <div class="form-group" hidden="hidden" id="costIndicator">
+ </div>
+ </fieldset>
+ <fieldset class="form-group">
+ <legend>Mention</legend>
+ <div class="form-check">
+ <label class="form-check-label">
+ <input type="checkbox" class="form-check-input" id="mentionMe" name="mentionMe" checked="checked" />
+ Mention me on the <em>supporters / licensees</em> page.
+ </label>
+ </div>
+ <div class="form-group">
+ <label for="companyUrl">Company URL (optional)</label>
+ <input type="url" class="form-control" id="companyUrl" placeholder="URL of your company website" />
+ </div>
+ <div class="form-group">
+ <label for="logo">Company Logo (optional)</label>
+ <input type="file" style="display: none;" id="logo" name="logo" />
+ <button class="form-control" id="companyLogo">Upload a logo</button>
+ <div id="logoCnt" style="display: none;"></div>
+ <button class="form-control" id="deleteCompanyLogo" style="display: none;">Remove logo</button>
+ </div>
+ </fieldset>
+ <fieldset class="form-group">
+ <legend>Location and VAT</legend>
+ <div class="form-group">
+ <div class="form-check">
+ <label class="form-check-label">
+ <input type="radio" class="form-check-input locationType" name="locationType" value="eu" checked="checked" />
+ We are based in the Europe
+ </label>
+ </div>
+ <div class="form-check">
+ <label class="form-check-label">
+ <input type="radio" class="form-check-input locationType" name="locationType" value="usa" />
+ We are based in the USA
+ </label>
+ </div>
+ <div class="form-check">
+ <label class="form-check-label">
+ <input type="radio" class="form-check-input locationType" name="locationType" value="other" />
+ We are based elsewhere
+ </label>
+ </div>
+ <div id="locationTypeErr" class="formErr" hidden="hidden">Location (continent) is a required field.</div>
+ </div>
+ <div class="form-group" id="locationType_eu">
+ <label for="euVat">EU VAT number</label>
+ <input type="text" class="form-control" id="euVat" placeholder="EU VAT number" />
+ <div id="euVatErr" class="formErr" hidden="hidden">EU VAT is a required field. If you are an individual and you have no EU VAT number, consider giving us a <a href="https://www.patreon.com/lombok">patreon</a> donation.</div>
+ </div>
+ <div class="form-group" hidden="hidden" id="locationType_usa">
+ Please <a href="/W8BEN_lombok.pdf">download our W-8BEN form</a> for your tax records.
+ </div>
+ <div class="form-group" hidden="hidden" id="locationType_other">
+ Please make sure you fulfill any local tax obligations for buying software from other countries.
+ </div>
+ </fieldset>
+ <fieldset class="form-group">
+ <legend>Payment method</legend>
+ <div class="form-group">
+ <div class="form-check" id="paymentMethod_iban">
+ <label class="form-check-label">
+ <input type="radio" class="form-check-input" name="paymentMethod" value="iban" checked="checked" />
+ Pay via IBAN (european bank transfer)
+ </label>
+ </div>
+ <div class="form-check" hidden="hidden" id="paymentMethod_intl">
+ <label class="form-check-label">
+ <input type="radio" class="form-check-input" name="paymentMethod" value="intl" />
+ Pay via international bank transfer
+ </label>
+ </div>
+ <div class="form-check">
+ <label class="form-check-label" id="paymentMethod_payoneer">
+ <input type="radio" class="form-check-input" name="paymentMethod" value="payoneer" />
+ Pay with Payoneer
+ </label>
+ </div>
+ <div id="paymentMethodErr" class="formErr" hidden="hidden">Payment method is a required field.</div>
+ </div>
+ </fieldset>
+ <button type="submit" id="submit" class="btn btn-primary">Submit order</button>
+ <div id="orderHelp">If you run into issues with the order form, or you have any other questions, please send us an email at <a href="mailto:orders@projectlombok.org"><code>orders@projectlombok.org</code></a>. You can cancel your subscription at any time.</div>
+ <div class="orderDetails">Our EU VAT number: NL858105378B01</div>
+ </p>
+ </div>
+ </div>
+</@main.scaffold>
diff --git a/website/templates/setup/intellij.html b/website/templates/setup/intellij.html
index 989986e5..331a7bcd 100644
--- a/website/templates/setup/intellij.html
+++ b/website/templates/setup/intellij.html
@@ -5,7 +5,7 @@
<p>
The <a href="https://www.jetbrains.com/idea/">Jetbrains IntelliJ IDEA</a> editor is compatible with lombok.
</p><p>
- Add the <a href="https://plugins.jetbrains.com/plugin/6317">Lombok IntelliJ plugin</a> to add lombok support IntelliJ:
+ Add the <a href="https://plugins.jetbrains.com/plugin/6317">Lombok IntelliJ plugin</a> to add lombok support for IntelliJ:
<ul><li>
Go to <code>File &gt; Settings &gt; Plugins</code>
</li><li>
diff --git a/website/templates/setup/javac.html b/website/templates/setup/javac.html
index 9cc9a560..48b0ebcf 100644
--- a/website/templates/setup/javac.html
+++ b/website/templates/setup/javac.html
@@ -9,7 +9,17 @@
<@s.section title="JDK 9">
<p>
- Support for JDK9 is ongoing. You need to set up some configuration to make lombok play nice with jigsaw (the JDK9 module system). The <a href="https://github.com/rzwitserloot/lombok/issues/985">github issue about JDK9 support for Lombok</a> has the details on how to set it up.
+ Support for JDK9, if you haven't modularized your own projects yet (no <code>module-info.java</code> yet), is included in lombok starting with version 1.16.20. Just use lombok as normal: <code> javac -cp lombok.jar ...</code>
+ </p><p>
+ Support for JDK9 if you did modularize your own projects (you've written a <code>module-info.java</code> file) is available in the <a href="/download-edge">edge release</a>. To use it: <code>javac -cp lombok.jar -p lombok.jar ...</code><br />
+ Note that you will have to add lombok to your <code>module-info.java</code> file:<pre>
+module <em>myapp</em> {
+ requires static lombok;
+}</pre>
+ </p><p>
+ The 'static' part ensures that you won't need lombok to be present at runtime.
+ </p><p>
+ Feedback about JDK9 module-info support can be given at <a href="https://github.com/rzwitserloot/lombok/issues/985">github issue #985</a>.
</p>
</@s.section>
</@s.scaffold>
diff --git a/website/templates/setup/vscode.html b/website/templates/setup/vscode.html
new file mode 100644
index 00000000..bf9c3e58
--- /dev/null
+++ b/website/templates/setup/vscode.html
@@ -0,0 +1,18 @@
+<#import "_setup.html" as s>
+
+<@s.scaffold title="Microsoft Visual Studio Code">
+ <@s.introduction>
+ <p>
+ The <a href="https://code.visualstudio.com/">Microsoft Visual Studio Code</a> editor is compatible with lombok.
+ </p><p>
+ Add the <a href="https://marketplace.visualstudio.com/items?itemName=GabrielBB.vscode-lombok">vscode-lombok</a> plugin to your Visual Studio Code IDE to add lombok support.
+ <ul><li>
+ press <code>Ctrl + Shift + X</code> to open the extension manager.
+ </li><li>
+ Type <code>lombok</code> to find the plugin, and click <code>install</code>.
+ </li><li>
+ Reload VS Code when asked.
+ </li></ul>
+ </p>
+ </@s.introduction>
+</@s.scaffold>
diff --git a/website/templates/supporters.html b/website/templates/supporters.html
new file mode 100644
index 00000000..2003a23f
--- /dev/null
+++ b/website/templates/supporters.html
@@ -0,0 +1,10 @@
+<#import "/_scaffold.html" as main>
+
+<@main.scaffold load=["js/supporters.js"]>
+ <div class="page-header top5">
+ <div class="row text-center">
+ <h1>Project Lombok supporters</h1>
+ </div><div class="row supporters">
+ </div>
+ </div>
+</@main.scaffold>