diff options
26 files changed, 336 insertions, 56 deletions
@@ -1,4 +1,4 @@ -Copyright (C) 2009-2020 The Project Lombok Authors. +Copyright (C) 2009-2021 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 @@ -17,3 +17,88 @@ 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. + +============================================================================== +Licenses for included components: + +org.ow2.asm:asm +org.ow2.asm:asm-analysis +org.ow2.asm:asm-commons +org.ow2.asm:asm-tree +org.ow2.asm:asm-util +ASM: a very small and fast Java bytecode manipulation framework + Copyright (c) 2000-2011 INRIA, France Telecom + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the copyright holders nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE 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. IN NO EVENT SHALL THE COPYRIGHT OWNER 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. + +------------------------------------------------------------------------------ +rzwitserloot/com.zwitserloot.cmdreader + + Copyright © 2010 Reinier Zwitserloot. + + 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. + +------------------------------------------------------------------------------ + +rzwitserloot/lombok.patcher + + Copyright (C) 2009-2021 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. + +------------------------------------------------------------------------------
\ No newline at end of file diff --git a/doc/changelog.markdown b/doc/changelog.markdown index 506f46d7..3c25e3fa 100644 --- a/doc/changelog.markdown +++ b/doc/changelog.markdown @@ -1,12 +1,16 @@ Lombok Changelog ---------------- -### v1.18.19 "Edgy Guinea Pig" -* PLATFORM: JDK16 support added. [Issue #2681](https://github.com/mplushnikov/lombok-intellij-plugin/issues/2681). +### v1.18.21 "Edgy Guinea Pig" +* There is no edge release at the moment; 1.18.20 is the most recent version. + +### v1.18.20 (April 2nd, 2021) +* PLATFORM: JDK16 support added. [Issue #2681](https://github.com/rzwitserloot/lombok/issues/2681). * PLATFORM: All lombok features updated to act in a sane fashion with JDK16's _record_ feature. In particular, you can annotate record components with `@NonNull` to have lombok add null checks to your compact constructor (which will be created if need be). * BUGFIX: Trying to use a lambda expression as parameter to an `@ExtensionMethod` did not work. [Issue #2741](https://github.com/rzwitserloot/lombok/issues/2741). (by __@Rawi01__). * BUGFIX: `@SuperBuilder` with an existing constructor caused issues in eclipse. [Issue #2704](https://github.com/rzwitserloot/lombok/issues/2704). (by [@JanRieke](https://github.com/rzwitserloot/lombok/pull/2770)). * BUGFIX: Using `@SuperBuilder` with a handwritten builder class caused issues. [Issue #2701](https://github.com/rzwitserloot/lombok/issues/2701). (by [@JanRieke](https://github.com/rzwitserloot/lombok/pull/2772)). +* BUGFIX: Lombok interacts properly with the new save actions in eclipse 2021-03. * POTENTIAL BUGFIX: lombok + errorprone could cause `IllegalArgumentException` if using the `MissingSummary` bug pattern. [Issue #2730](https://github.com/rzwitserloot/lombok/issues/2730). ### v1.18.18 (January 28th, 2021) diff --git a/docker/ant/Dockerfile b/docker/ant/Dockerfile index c38c6541..df41e8f1 100644 --- a/docker/ant/Dockerfile +++ b/docker/ant/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:18.04 as downloader +FROM ubuntu:20.04 as downloader ARG jdk=16 ADD provision/jdk/java-${jdk}.sh provision/jdk/java-${jdk}.sh @@ -7,11 +7,11 @@ RUN provision/jdk/java-${jdk}.sh ARG lombokjar=lombok.jar ADD https://projectlombok.org/downloads/${lombokjar} /lombok.jar -ARG ant=1.10.7 +ARG ant=1.10.9 ADD provision/ant/ant-${ant}.sh provision/ant/ant-${ant}.sh RUN provision/ant/ant-${ant}.sh -FROM ubuntu:18.04 +FROM ubuntu:20.04 COPY --from=downloader /usr/local/apache-ant/ /usr/local/apache-ant/ COPY --from=downloader /opt/jdk/ /opt/jdk/ diff --git a/docker/ant/readme.md b/docker/ant/readme.md index cfe90774..9f146ff0 100644 --- a/docker/ant/readme.md +++ b/docker/ant/readme.md @@ -2,11 +2,12 @@ [_(general configuration and options)_](../readme.md) -### `ARG ant=1.10.7` +### `ARG ant=1.10.9` The ant version to be used. Supported values: -- `1.10.7` (default) +- `1.10.9` (default) +- `1.10.7` - `1.10.6` - `1.10.1` diff --git a/docker/gradle/Dockerfile b/docker/gradle/Dockerfile index de85ca6f..a607f928 100644 --- a/docker/gradle/Dockerfile +++ b/docker/gradle/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:18.04 as downloader
+FROM ubuntu:20.04 as downloader
ARG jdk=16
ADD provision/jdk/java-${jdk}.sh provision/jdk/java-${jdk}.sh
@@ -7,11 +7,11 @@ RUN provision/jdk/java-${jdk}.sh ARG lombokjar=lombok.jar
ADD https://projectlombok.org/downloads/${lombokjar} /lombok.jar
-ARG gradle=6.2.2
+ARG gradle=6.8.3
ADD provision/gradle/gradle-${gradle}.sh provision/gradle/gradle-${gradle}.sh
RUN provision/gradle/gradle-${gradle}.sh
-FROM ubuntu:18.04
+FROM ubuntu:20.04
COPY --from=downloader /opt/gradle/ /opt/gradle/
COPY --from=downloader /opt/jdk/ /opt/jdk/
diff --git a/docker/gradle/readme.md b/docker/gradle/readme.md index 71a7da8e..360dcf56 100644 --- a/docker/gradle/readme.md +++ b/docker/gradle/readme.md @@ -6,7 +6,8 @@ The gradle version to be used. Supported values: -- `6.2.2` (default) +- `6.8.3` (default) +- `6.2.2` - `6.0.1` - `5.6` - `5.1.1` @@ -19,21 +20,21 @@ The gradle version to be used. Supported values: (To be executed from the `<lombokhome>/docker` directory) ``` -docker build -t lombok-gradle-jdk13 -f gradle/Dockerfile . +docker build -t lombok-gradle-jdk16 -f gradle/Dockerfile . -docker build -t lombok-gradle-jdk13 --build-arg lombokjar=lombok-1.16.20.jar -f gradle/Dockerfile . +docker build -t lombok-gradle-jdk16 --build-arg lombokjar=lombok-1.18.20.jar -f gradle/Dockerfile . ``` ## Example run commands: ``` -docker run -it lombok-gradle-jdk13 +docker run -it lombok-gradle-jdk16 -docker run --rm -it -v /<lombokhome>/dist/lombok.jar:/workspace/classpath/lombok.jar lombok-gradle-jdk13 +docker run --rm -it -v /<lombokhome>/dist/lombok.jar:/workspace/classpath/lombok.jar lombok-gradle-jdk16 ``` ## Example container commands: ``` gradle assemble -```cd ... +``` diff --git a/docker/maven/Dockerfile b/docker/maven/Dockerfile index 7d30dbf3..74efbdc1 100644 --- a/docker/maven/Dockerfile +++ b/docker/maven/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:18.04 as downloader
+FROM ubuntu:20.04 as downloader
ARG jdk=16
ADD provision/jdk/java-${jdk}.sh provision/jdk/java-${jdk}.sh
@@ -7,11 +7,11 @@ RUN provision/jdk/java-${jdk}.sh ARG lombokjar=lombok.jar
ADD https://projectlombok.org/downloads/${lombokjar} /lombok.jar
-ARG maven=3.6.1
+ARG maven=3.6.3
ADD provision/maven/maven-${maven}.sh provision/maven/maven-${maven}.sh
RUN provision/maven/maven-${maven}.sh
-FROM ubuntu:18.04
+FROM ubuntu:20.04
COPY --from=downloader /usr/local/apache-maven/ /usr/local/apache-maven/
COPY --from=downloader /opt/jdk/ /opt/jdk/
diff --git a/docker/maven/files/jdk-16/classpath/pom.xml b/docker/maven/files/jdk-16/classpath/pom.xml new file mode 100644 index 00000000..dd833235 --- /dev/null +++ b/docker/maven/files/jdk-16/classpath/pom.xml @@ -0,0 +1,53 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>com.example</groupId> + <artifactId>lombok-jdk-${env.JDK_VERSION}</artifactId> + <version>1.0-SNAPSHOT</version> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <java.version>16</java.version> + </properties> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.0</version> + <configuration> + <source>${java.version}</source> + <target>${java.version}</target> + <showDeprecation>true</showDeprecation> + <showWarnings>true</showWarnings> + <fork>true</fork> + <compilerargs> + <arg>-Werror</arg> + <arg>-Xlint:all</arg> + <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg> + <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg> + <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg> + <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg> + <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg> + <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg> + <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg> + <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg> + <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg> + </compilerargs> + </configuration> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <version>1.2.3</version> + <scope>system</scope> + <systemPath>/workspace/classpath/lombok.jar</systemPath> + </dependency> + </dependencies> + +</project>
\ No newline at end of file diff --git a/docker/maven/files/jdk-16/modules/pom.xml b/docker/maven/files/jdk-16/modules/pom.xml new file mode 100644 index 00000000..7fa84859 --- /dev/null +++ b/docker/maven/files/jdk-16/modules/pom.xml @@ -0,0 +1,60 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>com.example</groupId> + <artifactId>lombok-jdk-${env.JDK_VERSION}</artifactId> + <version>1.0-SNAPSHOT</version> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <java.version>16</java.version> + </properties> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.0</version> + <configuration> + <source>${java.version}</source> + <target>${java.version}</target> + <showDeprecation>true</showDeprecation> + <showWarnings>true</showWarnings> + <fork>true</fork> + <compilerargs> + <arg>-Werror</arg> + <arg>-Xlint:all</arg> + <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg> + <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg> + <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg> + <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg> + <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg> + <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg> + <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg> + <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg> + <arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg> + </compilerargs> + <annotationProcessorPaths> + <path> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <version>1.18.10</version> + </path> + </annotationProcessorPaths> + </configuration> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <version>1.2.3</version> + <scope>system</scope> + <systemPath>/workspace/modules/lombok.jar</systemPath> + </dependency> + </dependencies> + +</project>
\ No newline at end of file diff --git a/docker/maven/readme.md b/docker/maven/readme.md index 9ca76985..5f0d196c 100644 --- a/docker/maven/readme.md +++ b/docker/maven/readme.md @@ -2,11 +2,12 @@ [_(general configuration and options)_](../readme.md) -### `ARG maven=3.6.1` +### `ARG maven=3.6.3` The maven version to be used. Supported values: -- `3.6.1` (default) +- `3.6.3` (default) +- `3.6.1` - `3.6.0` - `3.5.0` @@ -15,21 +16,22 @@ The maven version to be used. Supported values: (To be executed from the `<lombokhome>/docker` directory) ``` -docker build -t lombok-maven-jdk13 -f maven/Dockerfile . +docker build -t lombok-maven-jdk16 -f maven/Dockerfile . -docker build -t lombok-maven-jdk13 --build-arg lombokjar=lombok-1.16.20.jar -f maven/Dockerfile . +docker build -t lombok-maven-jdk16 --build-arg lombokjar=lombok-1.18.20.jar -f maven/Dockerfile . ``` ## Example run commands: ``` -docker run -it lombok-maven-jdk13 +docker run -it lombok-maven-jdk16 -docker run --rm -it -v /<lombokhome>/dist/lombok.jar:/workspace/lombok.jar lombok-maven-jdk13 +docker run --rm -it -v /<lombokhome>/dist/lombok.jar:/workspace/lombok.jar lombok-maven-jdk16 ``` ## Example container commands: ``` +cd classpath mvn compile ``` diff --git a/docker/provision/ant/ant-1.10.9.sh b/docker/provision/ant/ant-1.10.9.sh new file mode 100644 index 00000000..2959e46d --- /dev/null +++ b/docker/provision/ant/ant-1.10.9.sh @@ -0,0 +1,4 @@ +apt-get update && apt-get install -y wget +wget https://archive.apache.org/dist/ant/binaries/apache-ant-1.10.9-bin.tar.gz -O ant.tar.gz +mkdir /usr/local/apache-ant/ && tar xvf ant.tar.gz -C /usr/local/apache-ant/ +mv /usr/local/apache-ant/apache-ant-1.10.9 /usr/local/apache-ant/apache-ant
\ No newline at end of file diff --git a/docker/provision/gradle/gradle-6.8.3.sh b/docker/provision/gradle/gradle-6.8.3.sh new file mode 100644 index 00000000..62ab0f62 --- /dev/null +++ b/docker/provision/gradle/gradle-6.8.3.sh @@ -0,0 +1,4 @@ +apt-get update && apt-get install -y wget unzip +wget https://services.gradle.org/distributions/gradle-6.8.3-bin.zip -O gradle.zip +mkdir /opt/gradle && unzip -d /opt/gradle gradle.zip +mv /opt/gradle/gradle-6.8.3 /opt/gradle/gradle diff --git a/docker/provision/maven/maven-3.6.3.sh b/docker/provision/maven/maven-3.6.3.sh new file mode 100644 index 00000000..95ddff7f --- /dev/null +++ b/docker/provision/maven/maven-3.6.3.sh @@ -0,0 +1,4 @@ +apt-get update && apt-get install -y wget +wget https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.tar.gz -O maven.tar.gz +mkdir /usr/local/apache-maven/ && tar xvf maven.tar.gz -C /usr/local/apache-maven/ +mv /usr/local/apache-maven/apache-maven-3.6.3 /usr/local/apache-maven/apache-maven diff --git a/src/core/lombok/core/Main.java b/src/core/lombok/core/Main.java index 2c9d1dcb..7be9e2ea 100644 --- a/src/core/lombok/core/Main.java +++ b/src/core/lombok/core/Main.java @@ -145,7 +145,7 @@ public class Main { out.println("------------------------------"); } out.println("projectlombok.org " + Version.getFullVersion()); - out.println("Copyright (C) 2009-2018 The Project Lombok Authors."); + out.println("Copyright (C) 2009-2021 The Project Lombok Authors."); out.println("Run 'lombok license' to see the lombok license agreement."); out.println(); out.println("Run lombok without any parameters to start the graphical installer."); diff --git a/src/core/lombok/core/Version.java b/src/core/lombok/core/Version.java index af0941bb..eb8ed6e7 100644 --- a/src/core/lombok/core/Version.java +++ b/src/core/lombok/core/Version.java @@ -30,7 +30,7 @@ public class Version { // ** CAREFUL ** - this class must always compile with 0 dependencies (it must not refer to any other sources or libraries). // Note: In 'X.Y.Z', if Z is odd, its a snapshot build built from the repository, so many different 0.10.3 versions can exist, for example. // Official builds always end in an even number. (Since 0.10.2). - private static final String VERSION = "1.18.19"; + private static final String VERSION = "1.18.21"; private static final String RELEASE_NAME = "Edgy Guinea Pig"; // private static final String RELEASE_NAME = "Envious Ferret"; diff --git a/src/core/lombok/javac/handlers/HandleVal.java b/src/core/lombok/javac/handlers/HandleVal.java index 7a524ca3..0ed831ab 100644 --- a/src/core/lombok/javac/handlers/HandleVal.java +++ b/src/core/lombok/javac/handlers/HandleVal.java @@ -58,7 +58,7 @@ public class HandleVal extends JavacASTAdapter { } @SuppressWarnings("deprecation") @Override - public void visitLocal(JavacNode localNode, JCVariableDecl local) { + public void endVisitLocal(JavacNode localNode, JCVariableDecl local) { JCTree typeTree = local.vartype; if (typeTree == null) return; String typeTreeToString = typeTree.toString(); diff --git a/src/delombok/lombok/delombok/PrettyPrinter.java b/src/delombok/lombok/delombok/PrettyPrinter.java index c46a3298..bcf3f431 100644 --- a/src/delombok/lombok/delombok/PrettyPrinter.java +++ b/src/delombok/lombok/delombok/PrettyPrinter.java @@ -531,6 +531,9 @@ public class PrettyPrinter extends JCTree.Visitor { print(tree.typarams, ", "); print(">"); } + + if (isRecord) printRecordConstructor(tree.defs); + JCTree extendsClause = getExtendsClause(tree); if (extendsClause != null) { print(" extends "); @@ -542,8 +545,6 @@ public class PrettyPrinter extends JCTree.Visitor { print(tree.implementing, ", "); } - if (isRecord) printRecordConstructor(tree.defs); - println(" {"); indent++; printClassMembers(tree.defs, isEnum, isInterface); diff --git a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java index ce26c892..0a11cd7a 100644 --- a/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java +++ b/src/eclipseAgent/lombok/eclipse/agent/EclipsePatcher.java @@ -208,28 +208,9 @@ public class EclipsePatcher implements AgentLauncher.AgentLaunchable { private static void patchDisableLombokForCodeCleanup(ScriptManager sm) { sm.addScriptIfWitness(OSGI_TYPES, ScriptBuilder.exitEarly() - .target(new MethodTarget("org.eclipse.jdt.internal.corext.fix.ControlStatementsFix$ControlStatementFinder", "visit", "boolean", "org.eclipse.jdt.core.dom.DoStatement")) - .target(new MethodTarget("org.eclipse.jdt.internal.corext.fix.ControlStatementsFix$ControlStatementFinder", "visit", "boolean", "org.eclipse.jdt.core.dom.EnhancedForStatement")) - .target(new MethodTarget("org.eclipse.jdt.internal.corext.fix.ControlStatementsFix$ControlStatementFinder", "visit", "boolean", "org.eclipse.jdt.core.dom.ForStatement")) - .target(new MethodTarget("org.eclipse.jdt.internal.corext.fix.ControlStatementsFix$ControlStatementFinder", "visit", "boolean", "org.eclipse.jdt.core.dom.IfStatement")) - .target(new MethodTarget("org.eclipse.jdt.internal.corext.fix.ControlStatementsFix$ControlStatementFinder", "visit", "boolean", "org.eclipse.jdt.core.dom.WhileStatement")) - .target(new MethodTarget("org.eclipse.jdt.internal.corext.fix.CodeStyleFix$ThisQualifierVisitor", "visit", "boolean", "org.eclipse.jdt.core.dom.MethodInvocation")) - .target(new MethodTarget("org.eclipse.jdt.internal.corext.fix.CodeStyleFix$ThisQualifierVisitor", "visit", "boolean", "org.eclipse.jdt.core.dom.FieldAccess")) - .target(new MethodTarget("org.eclipse.jdt.internal.corext.fix.CodeStyleFix$CodeStyleVisitor", "visit", "boolean", "org.eclipse.jdt.core.dom.MethodInvocation")) - .target(new MethodTarget("org.eclipse.jdt.internal.corext.fix.CodeStyleFix$CodeStyleVisitor", "visit", "boolean", "org.eclipse.jdt.core.dom.TypeDeclaration")) - .target(new MethodTarget("org.eclipse.jdt.internal.corext.fix.CodeStyleFix$CodeStyleVisitor", "visit", "boolean", "org.eclipse.jdt.core.dom.QualifiedName")) - .target(new MethodTarget("org.eclipse.jdt.internal.corext.fix.CodeStyleFix$CodeStyleVisitor", "visit", "boolean", "org.eclipse.jdt.core.dom.SimpleName")) - // since JDT 3.20 - .target(new MethodTarget("org.eclipse.jdt.internal.corext.fix.CodeStyleFixCore$ThisQualifierVisitor", "visit", "boolean", "org.eclipse.jdt.core.dom.MethodInvocation")) - .target(new MethodTarget("org.eclipse.jdt.internal.corext.fix.CodeStyleFixCore$ThisQualifierVisitor", "visit", "boolean", "org.eclipse.jdt.core.dom.FieldAccess")) - .target(new MethodTarget("org.eclipse.jdt.internal.corext.fix.CodeStyleFixCore$CodeStyleVisitor", "visit", "boolean", "org.eclipse.jdt.core.dom.MethodInvocation")) - .target(new MethodTarget("org.eclipse.jdt.internal.corext.fix.CodeStyleFixCore$CodeStyleVisitor", "visit", "boolean", "org.eclipse.jdt.core.dom.TypeDeclaration")) - .target(new MethodTarget("org.eclipse.jdt.internal.corext.fix.CodeStyleFixCore$CodeStyleVisitor", "visit", "boolean", "org.eclipse.jdt.core.dom.QualifiedName")) - .target(new MethodTarget("org.eclipse.jdt.internal.corext.fix.CodeStyleFixCore$CodeStyleVisitor", "visit", "boolean", "org.eclipse.jdt.core.dom.SimpleName")) - // if a generated node has children we can just ignore them as well; - .decisionMethod(new Hook("lombok.launch.PatchFixesHider$PatchFixes", "isGenerated", "boolean", "org.eclipse.jdt.core.dom.ASTNode")) - .request(StackRequest.PARAM1) - .valueMethod(new Hook("lombok.launch.PatchFixesHider$PatchFixes", "returnFalse", "boolean", "java.lang.Object")) + .target(new MethodTarget("org.eclipse.jdt.core.dom.ASTNode", "accept", "void", "org.eclipse.jdt.core.dom.ASTVisitor")) + .decisionMethod(new Hook("lombok.launch.PatchFixesHider$PatchFixes", "isRefactoringVisitorAndGenerated", "boolean", "org.eclipse.jdt.core.dom.ASTNode", "org.eclipse.jdt.core.dom.ASTVisitor")) + .request(StackRequest.THIS, StackRequest.PARAM1) .build()); } @@ -365,6 +346,7 @@ public class EclipsePatcher implements AgentLauncher.AgentLaunchable { sm.addScriptIfWitness(OSGI_TYPES, ScriptBuilder.exitEarly() .target(new MethodTarget("org.eclipse.jdt.internal.corext.refactoring.rename.TempOccurrenceAnalyzer", "visit", "boolean", "org.eclipse.jdt.core.dom.SimpleName")) .target(new MethodTarget("org.eclipse.jdt.internal.corext.refactoring.rename.RenameAnalyzeUtil$ProblemNodeFinder$NameNodeVisitor", "visit", "boolean", "org.eclipse.jdt.core.dom.SimpleName")) + .target(new MethodTarget("org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeParameterProcessor$RenameTypeParameterVisitor", "visit", "boolean", "org.eclipse.jdt.core.dom.SimpleName")) .decisionMethod(new Hook("lombok.launch.PatchFixesHider$PatchFixes", "isGenerated", "boolean", "org.eclipse.jdt.core.dom.ASTNode")) .valueMethod(new Hook("lombok.launch.PatchFixesHider$PatchFixes", "returnTrue", "boolean", "java.lang.Object")) .request(StackRequest.PARAM1) @@ -586,6 +568,7 @@ public class EclipsePatcher implements AgentLauncher.AgentLaunchable { /* Set generated flag for QualifiedNames */ sm.addScriptIfWitness(OSGI_TYPES, ScriptBuilder.wrapMethodCall() .target(new MethodTarget("org.eclipse.jdt.core.dom.ASTConverter", "setQualifiedNameNameAndSourceRanges", "org.eclipse.jdt.core.dom.QualifiedName", "char[][]", "long[]", "int", "org.eclipse.jdt.internal.compiler.ast.ASTNode")) + .target(new MethodTarget("org.eclipse.jdt.core.dom.ASTConverter", "setQualifiedNameNameAndSourceRanges", "org.eclipse.jdt.core.dom.QualifiedName", "char[][]", "long[]", "int", "org.eclipse.jdt.internal.compiler.ast.TypeReference")) .methodToWrap(new Hook("org.eclipse.jdt.core.dom.SimpleName", "<init>", "void", "org.eclipse.jdt.core.dom.AST")) .requestExtra(StackRequest.PARAM4) .wrapMethod(new Hook("lombok.launch.PatchFixesHider$PatchFixes", "setIsGeneratedFlagForName", "void", @@ -594,6 +577,7 @@ public class EclipsePatcher implements AgentLauncher.AgentLaunchable { sm.addScriptIfWitness(OSGI_TYPES, ScriptBuilder.wrapMethodCall() .target(new MethodTarget("org.eclipse.jdt.core.dom.ASTConverter", "setQualifiedNameNameAndSourceRanges", "org.eclipse.jdt.core.dom.QualifiedName", "char[][]", "long[]", "int", "org.eclipse.jdt.internal.compiler.ast.ASTNode")) + .target(new MethodTarget("org.eclipse.jdt.core.dom.ASTConverter", "setQualifiedNameNameAndSourceRanges", "org.eclipse.jdt.core.dom.QualifiedName", "char[][]", "long[]", "int", "org.eclipse.jdt.internal.compiler.ast.TypeReference")) .methodToWrap(new Hook("org.eclipse.jdt.core.dom.QualifiedName", "<init>", "void", "org.eclipse.jdt.core.dom.AST")) .requestExtra(StackRequest.PARAM4) .wrapMethod(new Hook("lombok.launch.PatchFixesHider$PatchFixes", "setIsGeneratedFlagForName", "void", diff --git a/src/eclipseAgent/lombok/launch/PatchFixesHider.java b/src/eclipseAgent/lombok/launch/PatchFixesHider.java index 02df3f5f..bee30922 100755 --- a/src/eclipseAgent/lombok/launch/PatchFixesHider.java +++ b/src/eclipseAgent/lombok/launch/PatchFixesHider.java @@ -413,7 +413,25 @@ final class PatchFixesHider { } return result; } - + + public static boolean isRefactoringVisitorAndGenerated(org.eclipse.jdt.core.dom.ASTNode node, org.eclipse.jdt.core.dom.ASTVisitor visitor) { + if (visitor == null) return false; + + String className = visitor.getClass().getName(); + if (!(className.startsWith("org.eclipse.jdt.internal.corext.fix") || className.startsWith("org.eclipse.jdt.internal.ui.fix"))) return false; + + boolean result = false; + try { + result = ((Boolean)node.getClass().getField("$isGenerated").get(node)).booleanValue(); + if (!result && node.getParent() != null && node.getParent() instanceof org.eclipse.jdt.core.dom.QualifiedName) { + result = isGenerated(node.getParent()); + } + } catch (Exception e) { + // better to assume it isn't generated + } + return result; + } + public static boolean isListRewriteOnGeneratedNode(org.eclipse.jdt.core.dom.rewrite.ListRewrite rewrite) { return isGenerated(rewrite.getParent()); } diff --git a/src/support/lombok/website/WebsiteMaker.java b/src/support/lombok/website/WebsiteMaker.java index d786e605..ea472a19 100644 --- a/src/support/lombok/website/WebsiteMaker.java +++ b/src/support/lombok/website/WebsiteMaker.java @@ -1,3 +1,24 @@ +/* + * Copyright (C) 2021 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.website; import java.io.BufferedReader; @@ -72,7 +93,7 @@ public class WebsiteMaker { private static void printAllVersions(Domain domain) throws Exception { List<List<String>> versions = readAllVersions(domain); for (List<String> v : versions) { - System.out.println(" <a href=\"" + v.get(0) + "\">" + v.get(1) + "</a>"); + System.out.println(" <a href=\"" + v.get(1) + "\">" + v.get(0) + "</a>"); } } diff --git a/test/pretty/resource/after/Record.java b/test/pretty/resource/after/Record.java new file mode 100644 index 00000000..c19658af --- /dev/null +++ b/test/pretty/resource/after/Record.java @@ -0,0 +1,3 @@ +public record Record<T>(T field) implements Cloneable { + +}
\ No newline at end of file diff --git a/test/pretty/resource/before/Record.java b/test/pretty/resource/before/Record.java new file mode 100644 index 00000000..f4eee30d --- /dev/null +++ b/test/pretty/resource/before/Record.java @@ -0,0 +1,4 @@ +// version 14: +public record Record<T>(T field) implements Cloneable { + +}
\ No newline at end of file diff --git a/test/transform/resource/after-delombok/ValInLambda.java b/test/transform/resource/after-delombok/ValInLambda.java index 861fb9da..b48461fe 100644 --- a/test/transform/resource/after-delombok/ValInLambda.java +++ b/test/transform/resource/after-delombok/ValInLambda.java @@ -1,4 +1,7 @@ // version 8: +import java.util.function.Function; +import java.util.function.Supplier; + class ValInLambda { Runnable foo = (Runnable) () -> { final int i = 1; @@ -24,4 +27,12 @@ class ValInLambda { } : System.out::println; }; } + + public void inParameter() { + final java.util.function.Function<java.util.function.Supplier<java.lang.String>, java.lang.String> foo = (Function<Supplier<String>, String>) s -> s.get(); + final java.lang.String foo2 = foo.apply(() -> { + final java.lang.String bar = ""; + return bar; + }); + } } diff --git a/test/transform/resource/after-ecj/ValInLambda.java b/test/transform/resource/after-ecj/ValInLambda.java index 0fac61e9..1f56ee3f 100644 --- a/test/transform/resource/after-ecj/ValInLambda.java +++ b/test/transform/resource/after-ecj/ValInLambda.java @@ -1,3 +1,5 @@ +import java.util.function.Function; +import java.util.function.Supplier; import lombok.val; class ValInLambda { Runnable foo = (Runnable) () -> { @@ -24,4 +26,11 @@ class ValInLambda { } : System.out::println); }; } + public void inParameter() { + final @val java.util.function.Function<java.util.function.Supplier<java.lang.String>, java.lang.String> foo = (Function<Supplier<String>, String>) (<no type> s) -> s.get(); + final @val java.lang.String foo2 = foo.apply(() -> { + final @val java.lang.String bar = ""; + return bar; +}); + } } diff --git a/test/transform/resource/before/ValInLambda.java b/test/transform/resource/before/ValInLambda.java index a5364f8e..6750d045 100644 --- a/test/transform/resource/before/ValInLambda.java +++ b/test/transform/resource/before/ValInLambda.java @@ -1,5 +1,8 @@ // version 8: +import java.util.function.Function; +import java.util.function.Supplier; + import lombok.val; class ValInLambda { @@ -25,4 +28,12 @@ class ValInLambda { lombok.val fooInner = (System.currentTimeMillis() > 0) ? (Runnable)()-> {} : System.out::println; }; } + + public void inParameter() { + val foo = (Function<Supplier<String>, String>) s -> s.get(); + val foo2 = foo.apply(() -> { + val bar = ""; + return bar; + }); + } } diff --git a/website/templates/all-versions.html b/website/templates/all-versions.html index db48f664..dee1aef8 100644 --- a/website/templates/all-versions.html +++ b/website/templates/all-versions.html @@ -13,7 +13,7 @@ <#list linksToVersions as lnk> <div class="row"> <icon class="fa fa-download"></icon> - <a class="oldVersion" href="${lnk[0]}">${lnk[1]}</a> + <a class="oldVersion" href="${lnk[1]}">${lnk[0]}</a> </div> </#list> <div class="row"> |