Merge remote-tracking branch 'origin/master' into jacksonizedAccessors

This commit is contained in:
Jan Rieke committed 2024-10-28 13:08:18 +01:00
commit 9214dcd4a9
726 files changed
+6852 -3470

No files matched your search

-1
View File
@@ -1,4 +1,3 @@
custom: https://projectlombok.org/order-license-info
patreon: lombok
tidelift: maven/org.projectlombok:lombok
github: projectlombok
+7 -5
View File
@@ -41,10 +41,10 @@ jobs:
runs-on: ubuntu-latest
needs: build
env:
EA_JDK: 22
EA_JDK: 23
strategy:
matrix:
jdk: [11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]
jdk: [11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
goal: [javacCurrent]
include:
- jdk: 11
@@ -107,12 +107,16 @@ jobs:
- eclipse-202309
- eclipse-202312
- eclipse-202403
- eclipse-202406
- eclipse-202409
- eclipse-I-build
- eclipse-oxygen-full
- eclipse-2022-03-full
- eclipse-2023-09-full
- eclipse-2023-12-full
- eclipse-2024-03-full
- eclipse-2024-06-full
- eclipse-2024-09-full
- eclipse-I-build-full
- ecj11
- ecj14
@@ -164,14 +168,12 @@ jobs:
needs: build
strategy:
matrix:
jdk: [8, 11, 17, 21, 22]
jdk: [8, 11, 17, 21, 23]
tool:
- {name: "maven", cmd: "mvn compile"}
- {name: "gradle", cmd: "gradle assemble"}
- {name: "ant", cmd: "ant dist"}
- {name: "bazel", cmd: "bazel build //:ProjectRunner"}
exclude:
- {tool: {name: "gradle", cmd: "gradle assemble"}, jdk: 22}
fail-fast: false
env:
IMAGE_NAME: lombok-${{ matrix.tool.name }}-jdk${{ matrix.jdk }}
+1
View File
@@ -1,6 +1,7 @@
Lombok contributors in alphabetical order:
Adam Juraszek <juriad@gmail.com>
Aleksandar Kanchev <136312841+kanchev1@users.noreply.github.com>
Aleksandr Zhelezniak <lekan1992@gmail.com>
Amine Touzani <ttzn.dev@gmail.com>
Andre Brait <andrebrait@gmail.com>
+7 -1
View File
@@ -1,6 +1,12 @@
# Project Lombok
Project Lombok is a java library that automatically plugs into your editor and build tools, spicing up your java.
<sub>Sponsored Content</sub>
> [![Sponsor logo Fern](https://projectlombok.org/files/logos/fern.png)](https://form.typeform.com/to/bShdJw7z)
> Offer API docs that look as good as Stripe's using our sponsor [Fern](https://form.typeform.com/to/bShdJw7z). Request a [preview of your docs](https://form.typeform.com/to/bShdJw7z) on Fern.
<br/>
**Project Lombok** is a java library that automatically plugs into your editor and build tools, spicing up your java.
Never write another getter or equals method again, with one annotation your class has a fully featured builder, automate your logging variables, and much more.
See [LICENSE] for the Project Lombok license.
@@ -0,0 +1,14 @@
<ivy-module version="2.0">
<info organisation="org.projectlombok" module="lombok.patcher" revision="0.52" publication="20240920010000">
<license name="MIT License" url="https://www.opensource.org/licenses/mit-license.php" />
<ivyauthor name="rzwitserloot" url="https://github.com/rzwitserloot" />
<ivyauthor name="rspilker" url="https://github.com/rspilker" />
<description homepage="https://projectlombok.org/" />
</info>
<configurations>
<conf name="default" />
</configurations>
<publications>
<artifact conf="default" url="https://projectlombok.org/downloads/lombok.patcher-0.52.jar" />
</publications>
</ivy-module>
+30 -2
View File
@@ -34,12 +34,14 @@
<conf name="eclipse-202309" />
<conf name="eclipse-202312" />
<conf name="eclipse-202403" />
<conf name="eclipse-202406" />
<conf name="eclipse-202409" />
<conf name="mapstruct" />
</configurations>
<dependencies>
<dependency org="org.projectlombok" name="lombok.patcher" rev="0.50" conf="build,stripe->default" />
<dependency org="org.projectlombok" name="lombok.patcher" rev="0.52" conf="build,stripe->default" />
<dependency org="zwitserloot.com" name="cmdreader" rev="1.2" conf="build,stripe->runtime" />
<dependency org="org.apache.ant" name="ant" rev="1.10.5" conf="build->default" />
<dependency org="org.apache.ant" name="ant-junit" rev="1.10.5" conf="build->default" />
@@ -147,7 +149,7 @@
<dependency org="org.eclipse.platform" name="org.eclipse.core.jobs" rev="3.15.100" conf="eclipse-202312->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.osgi" rev="3.18.600" conf="eclipse-202312->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.text" rev="3.13.100" conf="eclipse-202312->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.core.runtime" rev="3.31.0" conf="eclipse-202403->default" transitive="false" />
<dependency org="org.eclipse.jdt" name="org.eclipse.jdt.core" rev="3.37.0" conf="eclipse-202403->default" transitive="false" />
<dependency org="org.eclipse.jdt" name="org.eclipse.jdt.ui" rev="3.32.0" conf="eclipse-202403->default" transitive="false" />
@@ -161,6 +163,32 @@
<dependency org="org.eclipse.platform" name="org.eclipse.osgi" rev="3.19.0" conf="eclipse-202403->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.text" rev="3.14.0" conf="eclipse-202403->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.core.runtime" rev="3.31.100" conf="eclipse-202406->default" transitive="false" />
<dependency org="org.eclipse.jdt" name="org.eclipse.jdt.core" rev="3.38.0" conf="eclipse-202406->default" transitive="false" />
<dependency org="org.eclipse.jdt" name="org.eclipse.jdt.ui" rev="3.32.100" conf="eclipse-202406->default" transitive="false" />
<dependency org="org.eclipse.jdt" name="ecj" rev="3.38.0" conf="eclipse-202406->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.equinox.common" rev="3.19.100" conf="eclipse-202406->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.equinox.registry" rev="3.12.100" conf="eclipse-202406->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.equinox.app" rev="1.7.100" conf="eclipse-202406->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.core.resources" rev="3.20.200" conf="eclipse-202406->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.core.contenttype" rev="3.9.400" conf="eclipse-202406->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.core.jobs" rev="3.15.300" conf="eclipse-202406->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.osgi" rev="3.20.0" conf="eclipse-202406->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.text" rev="3.14.100" conf="eclipse-202406->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.core.runtime" rev="3.31.100" conf="eclipse-202409->default" transitive="false" />
<dependency org="org.eclipse.jdt" name="org.eclipse.jdt.core" rev="3.39.0" conf="eclipse-202409->default" transitive="false" />
<dependency org="org.eclipse.jdt" name="org.eclipse.jdt.ui" rev="3.33.0" conf="eclipse-202409->default" transitive="false" />
<dependency org="org.eclipse.jdt" name="ecj" rev="3.39.0" conf="eclipse-202409->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.equinox.common" rev="3.19.100" conf="eclipse-202409->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.equinox.registry" rev="3.12.100" conf="eclipse-202409->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.equinox.app" rev="1.7.200" conf="eclipse-202409->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.core.resources" rev="3.21.0" conf="eclipse-202409->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.core.contenttype" rev="3.9.500" conf="eclipse-202409->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.core.jobs" rev="3.15.400" conf="eclipse-202409->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.osgi" rev="3.21.0" conf="eclipse-202409->default" transitive="false" />
<dependency org="org.eclipse.platform" name="org.eclipse.text" rev="3.14.100" conf="eclipse-202409->default" transitive="false" />
<!-- integration with other libraries -->
<dependency org="org.mapstruct" name="mapstruct-processor" rev="1.3.1.Final" conf="mapstruct->default" transitive="false" />
</dependencies>
+8
View File
@@ -176,6 +176,14 @@ This buildfile is part of projectlombok.org. It sets up the build itself.
<fetchdep.eclipse.osgi name="2024-03" version="4.31" />
</target>
<target name="deps.eclipse.2024-06" depends="deps.rtstubs18, compile.support">
<fetchdep.eclipse.osgi name="2024-06" version="4.32" />
</target>
<target name="deps.eclipse.2024-09" depends="deps.rtstubs18, compile.support">
<fetchdep.eclipse.osgi name="2024-09" version="4.33" />
</target>
<target name="deps.eclipse.integration" depends="deps.rtstubs18, compile.support">
<fetchdep.eclipse.osgi name="I-build" version="I-builds" />
</target>
+26 -4
View File
@@ -148,10 +148,14 @@ This buildfile is part of projectlombok.org. It takes care of compiling and runn
<test.javacX version="17" />
</target>
<target name="test.javac21" depends="test.compile, test.formatter.compile" description="runs the tests on your default VM, using javac21 as underlying compiler">
<test.javacX version="21" />
</target>
<!-- For non-LTS versions, feel free to aggressively update these to the current non-LTS openjdk version, and delete them once they roll out of the 6 month window. -->
<target name="test.javac20" depends="test.compile, test.formatter.compile" description="runs the tests on your default VM, using javac20 as underlying compiler">
<test.javacX version="20" />
<target name="test.javac23" depends="test.compile, test.formatter.compile" description="runs the tests on your default VM, using javac23 as underlying compiler">
<test.javacX version="23" />
</target>
<target name="test.javacCurrent" depends="test.compile, test.formatter.compile" description="runs the tests on your default VM, using its javac as underlying compiler">
@@ -228,6 +232,16 @@ This buildfile is part of projectlombok.org. It takes care of compiling and runn
<test.eclipse-X version="202403" />
</target>
<target name="test.eclipse-202406" depends="test.compile, test.formatter.compile" description="runs the tests on your default VM, testing the 2024-06 release of eclipse">
<fetchdep.eclipse version="202406" />
<test.eclipse-X version="202406" />
</target>
<target name="test.eclipse-202409" depends="test.compile, test.formatter.compile" description="runs the tests on your default VM, testing the 2024-09 release of eclipse">
<fetchdep.eclipse version="202409" />
<test.eclipse-X version="202409" />
</target>
<target name="test.eclipse-I-build" depends="test.compile, test.formatter.compile, deps.rtstubs18, compile.support" description="runs the tests on your default VM, testing the latest integration build of eclipse">
<fetchdep.eclipse.updatesite name="I-build" version="I-builds" target="lib/" resolveDependencies="false">
<bundles>
@@ -300,10 +314,18 @@ This buildfile is part of projectlombok.org. It takes care of compiling and runn
<test.eclipse-X-full version="2023-12" />
</target>
<target name="test.eclipse-2024-03-full" depends="test.eclipse.compile, test.formatter.compile, deps.eclipse.2024-03" description="runs the full eclipse tests on your default VM, testing the 2024-04 release of eclipse">
<target name="test.eclipse-2024-03-full" depends="test.eclipse.compile, test.formatter.compile, deps.eclipse.2024-03" description="runs the full eclipse tests on your default VM, testing the 2024-03 release of eclipse">
<test.eclipse-X-full version="2024-03" />
</target>
<target name="test.eclipse-2024-06-full" depends="test.eclipse.compile, test.formatter.compile, deps.eclipse.2024-06" description="runs the full eclipse tests on your default VM, testing the 2024-06 release of eclipse">
<test.eclipse-X-full version="2024-06" />
</target>
<target name="test.eclipse-2024-09-full" depends="test.eclipse.compile, test.formatter.compile, deps.eclipse.2024-09" description="runs the full eclipse tests on your default VM, testing the 2024-09 release of eclipse">
<test.eclipse-X-full version="2024-09" />
</target>
<target name="test.eclipse-I-build-full" depends="test.eclipse.compile, test.formatter.compile, deps.eclipse.integration" description="runs the full eclipse tests on your default VM, testing the latest integration build of eclipse">
<test.eclipse-X-full version="I-build" />
</target>
@@ -350,5 +372,5 @@ This buildfile is part of projectlombok.org. It takes care of compiling and runn
</target>
<target name="test" depends="test.javacCurrent, test.eclipse-202212" description="runs the tests against the default JVM, javac, and eclipse" />
<target name="test.broad" depends="test.javac8, test.javac17, test.javac20, test.eclipse-oxygen, test.eclipse-202212, test.eclipse-202006-jdk8" description="runs the tests against the default JVM, javac, and eclipse" />
<target name="test.broad" depends="test.javac8, test.javac17, test.javac21, test.javac23, test.eclipse-oxygen, test.eclipse-202212, test.eclipse-202006-jdk8" description="runs the tests against the default JVM, javac, and eclipse" />
</project>
+10 -2
View File
@@ -1,8 +1,16 @@
Lombok Changelog
----------------
### v1.18.33 "Edgy Guinea Pig"
* We recently released v1.18.32; there is no edge release since then.
### v1.18.35 "Edgy Guinea Pig"
* PLATFORM: JDK23 support added.
* BUGFIX: Eclipse projects using the `com.pro-crafting.tools:jasperreports-maven-plugin` will now compile.
### v1.18.34 (June 28th, 2024)
* PLATFORM: Added support for Eclipse 2024-06; you'd get some `NoSuchMethodError` traces in your logs if using `@Builder` or `@Singular` prior to this fix. [Issue #3638](https://github.com/projectlombok/lombok/issues/3638).
* IMPROBABLE BREAKING CHANGE: Lombok now adds `@lombok.Generated` by default to methods and types it generates. This may result in accidentally increasing your test coverage percentage. [Issue #3667](https://github.com/projectlombok/lombok/issues/3667).
* IMPROBABLE BREAKING CHANGE: When `lombok.config` contains `lombok.onX.flagUsage = WARNING`, from now on warnings will actually be generated if onX is used.[Issue #2848](https://github.com/projectlombok/lombok/issues/2848)
* BUGFIX: When `@SuperBuilder` was used on a type with an generic array type, it would error `wrong number of type arguments`. [Issue #3694](https://github.com/projectlombok/lombok/issues/3694).
* FEATURE: Lombok generates javadoc for you for most of the methods it adds; with this release, javadoc is also added to generated constructors. [Issue #933](https://github.com/projectlombok/lombok/issues/933).
### v1.18.32 (March 20th, 2024)
* PLATFORM: Initial JDK22 support added.
@@ -20,6 +20,7 @@
<compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED"/>
<compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED"/>
<compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"/>
<compilerarg value="-proc:full"/>
</javac>
</target>
@@ -20,6 +20,7 @@
<compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED"/>
<compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED"/>
<compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"/>
<compilerarg value="-proc:full"/>
</javac>
</target>
+3 -3
View File
@@ -7,9 +7,9 @@ RUN provision/jdk/java-${jdk}.sh
ARG lombokjar=lombok.jar
ADD https://projectlombok.org/downloads/${lombokjar} /lombok.jar
ARG gradle=8.5
ADD provision/gradle/gradle-${gradle}.sh provision/gradle/gradle-${gradle}.sh
RUN provision/gradle/gradle-${gradle}.sh
ARG gradle=8.10.2
ADD provision/gradle/gradle.sh provision/gradle/gradle.sh
RUN provision/gradle/gradle.sh ${gradle}
FROM ubuntu:22.04
@@ -7,7 +7,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>22</java.version>
<java.version>23</java.version>
</properties>
<build>
@@ -22,6 +22,7 @@
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<fork>true</fork>
<proc>full</proc>
<compilerargs>
<arg>-Werror</arg>
<arg>-Xlint:all</arg>
@@ -7,7 +7,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>22</java.version>
<java.version>23</java.version>
</properties>
<build>
-4
View File
@@ -1,4 +0,0 @@
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
-4
View File
@@ -1,4 +0,0 @@
apt-get update && apt-get install -y wget unzip
wget https://services.gradle.org/distributions/gradle-7.6.1-bin.zip -O gradle.zip
mkdir /opt/gradle && unzip -d /opt/gradle gradle.zip
mv /opt/gradle/gradle-7.6.1 /opt/gradle/gradle
-4
View File
@@ -1,4 +0,0 @@
apt-get update && apt-get install -y wget unzip
wget https://services.gradle.org/distributions/gradle-8.3-bin.zip -O gradle.zip
mkdir /opt/gradle && unzip -d /opt/gradle gradle.zip
mv /opt/gradle/gradle-8.3 /opt/gradle/gradle
@@ -1,4 +1,4 @@
apt-get update && apt-get install -y wget unzip
wget https://github.com/gradle/gradle-distributions/releases/download/v8.5.0/gradle-8.5-bin.zip -O gradle.zip
wget https://github.com/gradle/gradle-distributions/releases/download/v$1/gradle-$1-bin.zip -O gradle.zip
mkdir /opt/gradle && unzip -d /opt/gradle gradle.zip
mv /opt/gradle/gradle-8.5 /opt/gradle/gradle
mv /opt/gradle/gradle-$1 /opt/gradle/gradle
-4
View File
@@ -1,4 +0,0 @@
apt-get update && apt-get install -y wget
wget https://download.java.net/java/GA/jdk22/830ec9fcccef480bb3e73fb7ecafe059/36/GPL/openjdk-22_linux-x64_bin.tar.gz -O jdk.tar.gz
tar -xzf jdk.tar.gz -C /opt/
mv /opt/jdk-22 /opt/jdk
+4
View File
@@ -0,0 +1,4 @@
apt-get update && apt-get install -y wget
wget https://download.java.net/java/GA/jdk23/3c5b90190c68498b986a97f276efd28a/37/GPL/openjdk-23_linux-x64_bin.tar.gz -O jdk.tar.gz
tar -xzf jdk.tar.gz -C /opt/
mv /opt/jdk-23 /opt/jdk
@@ -1,34 +1,29 @@
package lombok.mapstruct;
import java.lang.reflect.Field;
import javax.lang.model.type.TypeMirror;
import org.mapstruct.ap.spi.AstModifyingAnnotationProcessor;
import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.type.TypeMirror;
import java.util.List;
/**
* Report to MapStruct that a type is completed when there aren't any Lombok annotations left on it. Lombok annotations
* are removed whenever a class is processed. This way, annotations which require multiple rounds to process are also
* correctly handled, and MapStruct processing will be delayed until Lombok completely finishes processing required types.
*/
class NotifierHider {
public static class AstModificationNotifier implements AstModifyingAnnotationProcessor {
private static Field lombokInvoked;
@Override public boolean isTypeComplete(TypeMirror type) {
@Override
public boolean isTypeComplete(TypeMirror typeMirror) {
if (System.getProperty("lombok.disable") != null) return true;
return isLombokInvoked();
}
private static boolean isLombokInvoked() {
if (lombokInvoked != null) {
try {
return lombokInvoked.getBoolean(null);
} catch (Exception e) {}
return true;
List<? extends AnnotationMirror> annotationMirrors = typeMirror.getAnnotationMirrors();
if (annotationMirrors == null || annotationMirrors.isEmpty()) return true;
for (AnnotationMirror annotationMirror : annotationMirrors) {
String annotationName = String.valueOf(annotationMirror);
if (annotationName.startsWith("@lombok.")) return false;
}
try {
Class<?> data = Class.forName("lombok.launch.AnnotationProcessorHider$AstModificationNotifierData");
lombokInvoked = data.getField("lombokInvoked");
return lombokInvoked.getBoolean(null);
} catch (Exception e) {}
return true;
}
}
+1 -1
View File
@@ -87,7 +87,7 @@ public class ConfigurationKeys {
*
* If {@code true}, lombok generates {@code @lombok.Generated} on all fields, methods, and types that are generated.
*/
public static final ConfigurationKey<Boolean> ADD_LOMBOK_GENERATED_ANNOTATIONS = new ConfigurationKey<Boolean>("lombok.addLombokGeneratedAnnotation", "Generate @lombok.Generated on all generated code (default: false).") {};
public static final ConfigurationKey<Boolean> ADD_LOMBOK_GENERATED_ANNOTATIONS = new ConfigurationKey<Boolean>("lombok.addLombokGeneratedAnnotation", "Generate @lombok.Generated on all generated code (default: true).") {};
/**
* lombok configuration: {@code lombok.extern.findbugs.addSuppressFBWarnings} = {@code true} | {@code false}.
+2 -1
View File
@@ -28,7 +28,8 @@ import java.lang.annotation.Target;
/**
* Generates getters for all fields, a useful toString method, and hashCode and equals implementations that check
* all non-transient fields. Will also generate setters for all non-final fields, as well as a constructor.
* all non-transient fields. Will also generate setters for all non-final fields, as well as a constructor
* (except that no constructor will be generated if any explicitly written constructors already exist).
* <p>
* Equivalent to {@code @Getter @Setter @RequiredArgsConstructor @ToString @EqualsAndHashCode}.
* <p>
+6 -6
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015-2016 The Project Lombok Authors.
* Copyright (C) 2015-2024 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
@@ -27,14 +27,14 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Lombok will eventually automatically add this annotation to all generated constructors, methods, fields, and types.
* Lombok automatically adds this annotation to all generated constructors, methods, fields, and types.
*
* You can mark the presence of this annotation as 'ignore it' for all code style and bug finding tools.
* <p>
* NB: As of v1.16.2 which introduces this annotation, lombok doesn't actually add this annotation; we're setting
* it up so that lombok jars in widespread use start having this, which will make it easier to actually apply it
* later on. By adding {@code lombok.addLombokGeneratedAnnotation = true} to {@code lombok.config} you can already
* get this behavior.
* NB: As of v1.18.34, lombok adds this annotation by default; before then you had to add a lombok config key.
* <p>
* If you want to opt out (not recommended), you can add {@code lombok.addLombokGeneratedAnnotation = false} to
* {@code lombok.config}.
*/
@Target({ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.FIELD, ElementType.TYPE})
@Retention(RetentionPolicy.CLASS)
+2 -2
View File
@@ -27,10 +27,10 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* &#64;SneakyThrow will avoid javac's insistence that you either catch or throw onward any checked exceptions that
* &#64;SneakyThrows will avoid javac's insistence that you either catch or throw onward any checked exceptions that
* statements in your method body declare they generate.
* <p>
* &#64;SneakyThrow does not silently swallow, wrap into RuntimeException, or otherwise modify any exceptions of the listed
* &#64;SneakyThrows does not silently swallow, wrap into RuntimeException, or otherwise modify any exceptions of the listed
* checked exception types. The JVM does not check for the consistency of the checked exception system; javac does,
* and this annotation lets you opt out of its mechanism.
* <p>
+2 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2022 The Project Lombok Authors.
* Copyright (C) 2009-2024 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
@@ -182,6 +182,7 @@ public class AnnotationValues<A extends Annotation> {
"I can't make sense of this annotation value. Try using a fully qualified literal.", idx);
}
out.add((String) result);
idx++;
}
return Collections.unmodifiableList(out);
+1 -1
View File
@@ -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.33";
private static final String VERSION = "1.18.35";
private static final String RELEASE_NAME = "Edgy Guinea Pig";
// private static final String RELEASE_NAME = "Envious Ferret";
+28 -5
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2013-2022 The Project Lombok Authors.
* Copyright (C) 2013-2024 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
@@ -923,9 +923,13 @@ public class HandlerUtil {
}
}
public static String stripLinesWithTagFromJavadoc(String javadoc, JavadocTag tag) {
public static String stripLinesWithTagFromJavadoc(String javadoc, JavadocTag... tags) {
if (javadoc == null || javadoc.isEmpty()) return javadoc;
return tag.pattern.matcher(javadoc).replaceAll("").trim();
String result = javadoc;
for (JavadocTag tag : tags) {
result = tag.pattern.matcher(result).replaceAll("").trim();
}
return result;
}
public static String stripSectionsFromJavadoc(String javadoc) {
@@ -981,17 +985,36 @@ public class HandlerUtil {
public static String addJavadocLine(String in, String line) {
if (in == null) return line;
if (in.endsWith("\n")) return in + line + "\n";
if (in.endsWith("\n")) return in + line;
return in + "\n" + line;
}
public static String getParamJavadoc(String methodComment, String param) {
if (methodComment == null || methodComment.isEmpty()) return methodComment;
Pattern pattern = Pattern.compile("@param " + param + " (\\S|\\s)+?(?=^ ?@)", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE);
Pattern pattern = Pattern.compile("@param " + param + " (\\S|\\s)+?(?=^ ?@|\\z)", Pattern.MULTILINE | Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(methodComment);
if (matcher.find()) {
return matcher.group();
}
return null;
}
public static String getConstructorJavadocHeader(String typeName) {
return "Creates a new {@code " + typeName + "} instance.\n\n";
}
public static String getConstructorParameterJavadoc(String paramName, String fieldJavadoc) {
String fieldBaseJavadoc = stripSectionsFromJavadoc(fieldJavadoc);
String paramJavadoc = getParamJavadoc(fieldBaseJavadoc, paramName);
if (paramJavadoc != null) {
return paramJavadoc;
}
String javadocWithoutTags = stripLinesWithTagFromJavadoc(fieldBaseJavadoc, JavadocTag.PARAM, JavadocTag.RETURN);
if (javadocWithoutTags != null) {
return "@param " + paramName + " " + javadocWithoutTags;
}
return null;
}
}
@@ -38,6 +38,8 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
@@ -2105,7 +2107,7 @@ public class EclipseHandlerUtil {
if (Boolean.TRUE.equals(node.getAst().readConfiguration(ConfigurationKeys.ADD_JAKARTA_GENERATED_ANNOTATIONS))) {
result = addAnnotation(source, result, JAKARTA_ANNOTATION_GENERATED, new StringLiteral(LOMBOK, 0, 0, 0));
}
if (Boolean.TRUE.equals(node.getAst().readConfiguration(ConfigurationKeys.ADD_LOMBOK_GENERATED_ANNOTATIONS))) {
if (!Boolean.FALSE.equals(node.getAst().readConfiguration(ConfigurationKeys.ADD_LOMBOK_GENERATED_ANNOTATIONS))) {
result = addAnnotation(source, result, LOMBOK_GENERATED);
}
return result;
@@ -2804,32 +2806,51 @@ public class EclipseHandlerUtil {
return annotations;
}
private static final Pattern JAVADOC_PATTERN = Pattern.compile("^\\s*\\/\\*\\*((?:\\S|\\s)*?)\\*\\/", Pattern.MULTILINE);
private static final Pattern LEADING_ASTERISKS_PATTERN = Pattern.compile("(?m)^\\s*\\* ?");
public static String getDocComment(EclipseNode eclipseNode) {
if (eclipseNode.getAst().getSource() == null) return null;
int start = -1;
int end = -1;
final ASTNode node = eclipseNode.get();
if (node instanceof FieldDeclaration) {
FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
char[] rawContent = CharOperation.subarray(eclipseNode.getAst().getSource(), fieldDeclaration.declarationSourceStart, fieldDeclaration.declarationSourceEnd);
start = fieldDeclaration.declarationSourceStart;
end = fieldDeclaration.declarationSourceEnd;
} else if (node instanceof AbstractMethodDeclaration) {
AbstractMethodDeclaration abstractMethodDeclaration = (AbstractMethodDeclaration) node;
start = abstractMethodDeclaration.declarationSourceStart;
end = abstractMethodDeclaration.declarationSourceEnd;
}
if (start != -1 && end != -1) {
char[] rawContent = CharOperation.subarray(eclipseNode.getAst().getSource(), start, end);
String rawContentString = new String(rawContent);
int startIndex = rawContentString.indexOf("/**");
int endIndex = rawContentString.indexOf("*/");
if (startIndex != -1 && endIndex != -1) {
Matcher javadocMatcher = JAVADOC_PATTERN.matcher(rawContentString);
if (javadocMatcher.find()) {
String javadoc = javadocMatcher.group(1);
/* Remove all leading asterisks */
return rawContentString.substring(startIndex + 3, endIndex).replaceAll("(?m)^\\s*\\* ?", "").trim();
return LEADING_ASTERISKS_PATTERN.matcher(javadoc).replaceAll("").trim();
}
}
return null;
}
public static void setDocComment(EclipseNode typeNode, EclipseNode eclipseNode, String doc) {
setDocComment((CompilationUnitDeclaration) eclipseNode.top().get(), (TypeDeclaration) typeNode.get(), eclipseNode.get(), doc);
}
public static void setDocComment(CompilationUnitDeclaration cud, EclipseNode eclipseNode, String doc) {
setDocComment(cud, (TypeDeclaration) upToTypeNode(eclipseNode).get(), eclipseNode.get(), doc);
}
public static void setDocComment(CompilationUnitDeclaration cud, TypeDeclaration type, ASTNode node, String doc) {
if (doc == null) return;
ICompilationUnit compilationUnit = cud.compilationResult.compilationUnit;
if (compilationUnit == null) return;
if (compilationUnit.getClass().equals(COMPILATION_UNIT)) {
try {
compilationUnit = (ICompilationUnit) Permit.invoke(COMPILATION_UNIT_ORIGINAL_FROM_CLONE, compilationUnit);
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2013-2021 The Project Lombok Authors.
* Copyright (C) 2013-2024 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
@@ -1053,7 +1053,7 @@ public class HandleBuilder extends EclipseAnnotationHandler<Builder> {
MethodDeclaration setter = HandleSetter.createSetter(td, deprecate, fieldNode, setterName, bfd.name, bfd.nameOfSetFlag, job.oldChain, toEclipseModifier(job.accessInners),
job.sourceNode, methodAnnsList, bfd.annotations != null ? Arrays.asList(copyAnnotations(source, bfd.annotations)) : Collections.<Annotation>emptyList());
if (job.sourceNode.up().getKind() == Kind.METHOD) {
copyJavadocFromParam(bfd.originalFieldNode.up(), setter, td, bfd.name.toString());
copyJavadocFromParam(bfd.originalFieldNode.up(), setter, td, new String(bfd.name));
} else {
copyJavadoc(bfd.originalFieldNode, setter, td, CopyJavadoc.SETTER, true);
}
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2021 The Project Lombok Authors.
* Copyright (C) 2010-2024 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -22,7 +22,7 @@
package lombok.eclipse.handlers;
import static lombok.core.handlers.HandlerUtil.*;
import static lombok.eclipse.Eclipse.*;
import static lombok.eclipse.Eclipse.ECLIPSE_DO_NOT_TOUCH_FLAG;
import static lombok.eclipse.handlers.EclipseHandlerUtil.*;
import java.lang.reflect.Modifier;
@@ -101,6 +101,9 @@ public class HandleConstructor {
boolean force = ann.force();
List<Annotation> onConstructor = unboxAndRemoveAnnotationParameter(ast, "onConstructor", "@NoArgsConstructor(onConstructor", annotationNode);
if (!onConstructor.isEmpty()) {
handleFlagUsage(annotationNode, ConfigurationKeys.ON_X_FLAG_USAGE, "@NoArgsConstructor(onConstructor=...)");
}
handleConstructor.generateConstructor(typeNode, level, Collections.<EclipseNode>emptyList(), force, staticName, SkipIfConstructorExists.NO, onConstructor, annotationNode);
}
@@ -125,6 +128,9 @@ public class HandleConstructor {
}
List<Annotation> onConstructor = unboxAndRemoveAnnotationParameter(ast, "onConstructor", "@RequiredArgsConstructor(onConstructor", annotationNode);
if (!onConstructor.isEmpty()) {
handleFlagUsage(annotationNode, ConfigurationKeys.ON_X_FLAG_USAGE, "@RequiredArgsConstructor(onConstructor=...)");
}
handleConstructor.generateConstructor(
typeNode, level, findRequiredFields(typeNode), false, staticName, SkipIfConstructorExists.NO,
@@ -132,6 +138,36 @@ public class HandleConstructor {
}
}
@Provides
public static class HandleAllArgsConstructor extends EclipseAnnotationHandler<AllArgsConstructor> {
private static final String NAME = AllArgsConstructor.class.getSimpleName();
private HandleConstructor handleConstructor = new HandleConstructor();
@Override public void handle(AnnotationValues<AllArgsConstructor> annotation, Annotation ast, EclipseNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.ALL_ARGS_CONSTRUCTOR_FLAG_USAGE, "@AllArgsConstructor", ConfigurationKeys.ANY_CONSTRUCTOR_FLAG_USAGE, "any @xArgsConstructor");
EclipseNode typeNode = annotationNode.up();
if (!checkLegality(typeNode, annotationNode, NAME)) return;
AllArgsConstructor ann = annotation.getInstance();
AccessLevel level = ann.access();
if (level == AccessLevel.NONE) return;
String staticName = ann.staticName();
if (annotation.isExplicit("suppressConstructorProperties")) {
annotationNode.addError("This deprecated feature is no longer supported. Remove it; you can create a lombok.config file with 'lombok.anyConstructor.suppressConstructorProperties = true'.");
}
List<Annotation> onConstructor = unboxAndRemoveAnnotationParameter(ast, "onConstructor", "@AllArgsConstructor(onConstructor", annotationNode);
if (!onConstructor.isEmpty()) {
handleFlagUsage(annotationNode, ConfigurationKeys.ON_X_FLAG_USAGE, "@AllArgsConstructor(onConstructor=...)");
}
handleConstructor.generateConstructor(
typeNode, level, findAllFields(typeNode), false, staticName, SkipIfConstructorExists.NO,
onConstructor, annotationNode);
}
}
private static List<EclipseNode> findRequiredFields(EclipseNode typeNode) {
return findFields(typeNode, true);
}
@@ -167,33 +203,6 @@ public class HandleConstructor {
return fields;
}
@Provides
public static class HandleAllArgsConstructor extends EclipseAnnotationHandler<AllArgsConstructor> {
private static final String NAME = AllArgsConstructor.class.getSimpleName();
private HandleConstructor handleConstructor = new HandleConstructor();
@Override public void handle(AnnotationValues<AllArgsConstructor> annotation, Annotation ast, EclipseNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.ALL_ARGS_CONSTRUCTOR_FLAG_USAGE, "@AllArgsConstructor", ConfigurationKeys.ANY_CONSTRUCTOR_FLAG_USAGE, "any @xArgsConstructor");
EclipseNode typeNode = annotationNode.up();
if (!checkLegality(typeNode, annotationNode, NAME)) return;
AllArgsConstructor ann = annotation.getInstance();
AccessLevel level = ann.access();
if (level == AccessLevel.NONE) return;
String staticName = ann.staticName();
if (annotation.isExplicit("suppressConstructorProperties")) {
annotationNode.addError("This deprecated feature is no longer supported. Remove it; you can create a lombok.config file with 'lombok.anyConstructor.suppressConstructorProperties = true'.");
}
List<Annotation> onConstructor = unboxAndRemoveAnnotationParameter(ast, "onConstructor", "@AllArgsConstructor(onConstructor", annotationNode);
handleConstructor.generateConstructor(
typeNode, level, findAllFields(typeNode), false, staticName, SkipIfConstructorExists.NO,
onConstructor, annotationNode);
}
}
static boolean checkLegality(EclipseNode typeNode, EclipseNode errorNode, String name) {
if (!isClassOrEnum(typeNode)) {
errorNode.addError(name + " is only supported on a class or an enum.");
@@ -277,7 +286,8 @@ public class HandleConstructor {
ConstructorDeclaration constr = createConstructor(
staticConstrRequired ? AccessLevel.PRIVATE : level, typeNode, fieldsToParam, forceDefaults,
sourceNode, onConstructor);
injectMethod(typeNode, constr);
EclipseNode constructorNode = injectMethod(typeNode, constr);
generateConstructorJavadoc(typeNode, constructorNode, fieldsToParam);
}
generateStaticConstructor(staticConstrRequired, typeNode, staticName, level, fieldsToParam, source);
}
@@ -285,7 +295,8 @@ public class HandleConstructor {
private void generateStaticConstructor(boolean staticConstrRequired, EclipseNode typeNode, String staticName, AccessLevel level, Collection<EclipseNode> fields, ASTNode source) {
if (staticConstrRequired) {
MethodDeclaration staticConstr = createStaticConstructor(level, staticName, typeNode, fields, source);
injectMethod(typeNode, staticConstr);
EclipseNode constructorNode = injectMethod(typeNode, staticConstr);
generateConstructorJavadoc(typeNode, constructorNode, fields);
}
}
@@ -575,4 +586,29 @@ public class HandleConstructor {
constructor.traverse(new SetGeneratedByVisitor(source), typeDecl.scope);
return constructor;
}
private void generateConstructorJavadoc(EclipseNode typeNode, EclipseNode constructorNode, Collection<EclipseNode> fields) {
try {
if (fields.isEmpty()) return;
String constructorJavadoc = getConstructorJavadocHeader(typeNode.getName());
boolean fieldDescriptionAdded = false;
for (EclipseNode fieldNode : fields) {
String paramName = String.valueOf(removePrefixFromField(fieldNode));
String fieldJavadoc = getDocComment(fieldNode);
String paramJavadoc = getConstructorParameterJavadoc(paramName, fieldJavadoc);
if (paramJavadoc == null) {
paramJavadoc = "@param " + paramName;
} else {
fieldDescriptionAdded = true;
}
constructorJavadoc = addJavadocLine(constructorJavadoc, paramJavadoc);
}
if (fieldDescriptionAdded) {
setDocComment(typeNode, constructorNode, constructorJavadoc);
}
} catch (Exception ignore) {}
}
}
@@ -149,6 +149,9 @@ public class HandleGetter extends EclipseAnnotationHandler<Getter> {
if (node == null) return;
List<Annotation> onMethod = unboxAndRemoveAnnotationParameter(ast, "onMethod", "@Getter(onMethod", annotationNode);
if (!onMethod.isEmpty()) {
handleFlagUsage(annotationNode, ConfigurationKeys.ON_X_FLAG_USAGE, "@Getter(onMethod=...)");
}
switch (node.getKind()) {
case FIELD:
@@ -1,3 +1,24 @@
/*
* Copyright (C) 2024 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.
*/
/* Copyright (C) 2021-2023 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -117,7 +138,7 @@ public final class HandleLockedUtil {
lockAlloc.type = setGeneratedBy(new QualifiedTypeReference(lockImplClass, new long[] { 0, 0, 0, 0, 0 }), source);
fieldDecl.type = setGeneratedBy(new QualifiedTypeReference(lockTypeClass, new long[] { 0, 0, 0, 0, 0 }), source);
fieldDecl.initialization = lockAlloc;
injectField(annotationNode.up().up(), fieldDecl);
injectFieldAndMarkGenerated(annotationNode.up().up(), fieldDecl);
}
return lockName;
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2021 The Project Lombok Authors.
* Copyright (C) 2010-2024 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
@@ -109,9 +109,7 @@ public class HandleLog {
ClassLiteralAccess loggingType = selfType(owner, source);
FieldDeclaration fieldDeclaration = createField(framework, source, loggingType, logFieldName.getName(), useStatic, loggerTopic);
fieldDeclaration.traverse(new SetGeneratedByVisitor(source), typeDecl.staticInitializerScope);
// TODO temporary workaround for issue 290. https://github.com/projectlombok/lombok/issues/290
// injectFieldSuppressWarnings(owner, fieldDeclaration);
injectField(owner, fieldDeclaration);
injectFieldAndMarkGenerated(owner, fieldDeclaration);
owner.rebuild();
break;
default:
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2022 The Project Lombok Authors.
* Copyright (C) 2009-2024 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
@@ -120,7 +120,13 @@ public class HandleSetter extends EclipseAnnotationHandler<Setter> {
if (level == AccessLevel.NONE || node == null) return;
List<Annotation> onMethod = unboxAndRemoveAnnotationParameter(ast, "onMethod", "@Setter(onMethod", annotationNode);
if (!onMethod.isEmpty()) {
handleFlagUsage(annotationNode, ConfigurationKeys.ON_X_FLAG_USAGE, "@Setter(onMethod=...)");
}
List<Annotation> onParam = unboxAndRemoveAnnotationParameter(ast, "onParam", "@Setter(onParam", annotationNode);
if (!onParam.isEmpty()) {
handleFlagUsage(annotationNode, ConfigurationKeys.ON_X_FLAG_USAGE, "@Setter(onParam=...)");
}
switch (node.getKind()) {
case FIELD:
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 The Project Lombok Authors.
* Copyright (C) 2021-2024 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
@@ -70,8 +70,10 @@ public class HandleStandardException extends EclipseAnnotationHandler<StandardEx
if (hasConstructor(typeNode) != MemberExistsResult.NOT_EXISTS) return;
int pS = source.get().sourceStart, pE = source.get().sourceEnd;
Expression messageArgument = new CastExpression(new NullLiteral(pS, pE), generateQualifiedTypeRef(source.get(), TypeConstants.JAVA_LANG_STRING));
Expression causeArgument = new CastExpression(new NullLiteral(pS, pE), generateQualifiedTypeRef(source.get(), TypeConstants.JAVA_LANG_THROWABLE));
ExplicitConstructorCall explicitCall = new ExplicitConstructorCall(ExplicitConstructorCall.This);
explicitCall.arguments = new Expression[] {new NullLiteral(pS, pE), new NullLiteral(pS, pE)};
explicitCall.arguments = new Expression[] {messageArgument, causeArgument};
ConstructorDeclaration constructor = createConstructor(level, typeNode, false, false, source, explicitCall, null);
injectMethod(typeNode, constructor);
}
@@ -81,8 +83,10 @@ public class HandleStandardException extends EclipseAnnotationHandler<StandardEx
int pS = source.get().sourceStart, pE = source.get().sourceEnd;
long p = (long) pS << 32 | pE;
Expression messageArgument = new SingleNameReference(MESSAGE, p);
Expression causeArgument = new CastExpression(new NullLiteral(pS, pE), generateQualifiedTypeRef(source.get(), TypeConstants.JAVA_LANG_THROWABLE));
ExplicitConstructorCall explicitCall = new ExplicitConstructorCall(ExplicitConstructorCall.This);
explicitCall.arguments = new Expression[] {new SingleNameReference(MESSAGE, p), new NullLiteral(pS, pE)};
explicitCall.arguments = new Expression[] {messageArgument, causeArgument};
ConstructorDeclaration constructor = createConstructor(level, typeNode, true, false, source, explicitCall, null);
injectMethod(typeNode, constructor);
}
@@ -129,9 +129,7 @@ public class HandleSynchronized extends EclipseAnnotationHandler<Synchronized> {
fieldDecl.type = new QualifiedTypeReference(TypeConstants.JAVA_LANG_OBJECT, new long[] { 0, 0, 0 });
setGeneratedBy(fieldDecl.type, source);
fieldDecl.initialization = arrayAlloc;
// TODO temporary workaround for issue 290. https://github.com/projectlombok/lombok/issues/290
// injectFieldSuppressWarnings(annotationNode.up().up(), fieldDecl);
injectField(annotationNode.up().up(), fieldDecl);
injectFieldAndMarkGenerated(annotationNode.up().up(), fieldDecl);
}
return lockName;
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2021 The Project Lombok Authors.
* Copyright (C) 2010-2024 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
@@ -30,6 +30,7 @@ import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.JCTree.JCAnnotation;
import com.sun.tools.javac.tree.JCTree.JCBlock;
import com.sun.tools.javac.tree.JCTree.JCClassDecl;
import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
import com.sun.tools.javac.tree.JCTree.JCExpression;
import com.sun.tools.javac.tree.JCTree.JCFieldAccess;
import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
@@ -73,6 +74,9 @@ public class HandleConstructor {
JavacNode typeNode = annotationNode.up();
if (!checkLegality(typeNode, annotationNode, NAME)) return;
List<JCAnnotation> onConstructor = unboxAndRemoveAnnotationParameter(ast, "onConstructor", "@NoArgsConstructor(onConstructor", annotationNode);
if (!onConstructor.isEmpty()) {
handleFlagUsage(annotationNode, ConfigurationKeys.ON_X_FLAG_USAGE, "@NoArgsConstructor(onConstructor=...)");
}
NoArgsConstructor ann = annotation.getInstance();
AccessLevel level = ann.access();
if (level == AccessLevel.NONE) return;
@@ -95,6 +99,9 @@ public class HandleConstructor {
JavacNode typeNode = annotationNode.up();
if (!checkLegality(typeNode, annotationNode, NAME)) return;
List<JCAnnotation> onConstructor = unboxAndRemoveAnnotationParameter(ast, "onConstructor", "@RequiredArgsConstructor(onConstructor", annotationNode);
if (!onConstructor.isEmpty()) {
handleFlagUsage(annotationNode, ConfigurationKeys.ON_X_FLAG_USAGE, "@RequiredArgsConstructor(onConstructor=...)");
}
RequiredArgsConstructor ann = annotation.getInstance();
AccessLevel level = ann.access();
if (level == AccessLevel.NONE) return;
@@ -107,6 +114,33 @@ public class HandleConstructor {
}
}
@Provides
public static class HandleAllArgsConstructor extends JavacAnnotationHandler<AllArgsConstructor> {
private static final String NAME = AllArgsConstructor.class.getSimpleName();
private HandleConstructor handleConstructor = new HandleConstructor();
@Override public void handle(AnnotationValues<AllArgsConstructor> annotation, JCAnnotation ast, JavacNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.ALL_ARGS_CONSTRUCTOR_FLAG_USAGE, "@AllArgsConstructor", ConfigurationKeys.ANY_CONSTRUCTOR_FLAG_USAGE, "any @xArgsConstructor");
deleteAnnotationIfNeccessary(annotationNode, AllArgsConstructor.class);
deleteImportFromCompilationUnit(annotationNode, "lombok.AccessLevel");
JavacNode typeNode = annotationNode.up();
if (!checkLegality(typeNode, annotationNode, NAME)) return;
List<JCAnnotation> onConstructor = unboxAndRemoveAnnotationParameter(ast, "onConstructor", "@AllArgsConstructor(onConstructor", annotationNode);
if (!onConstructor.isEmpty()) {
handleFlagUsage(annotationNode, ConfigurationKeys.ON_X_FLAG_USAGE, "@AllArgsConstructor(onConstructor=...)");
}
AllArgsConstructor ann = annotation.getInstance();
AccessLevel level = ann.access();
if (level == AccessLevel.NONE) return;
String staticName = ann.staticName();
if (annotation.isExplicit("suppressConstructorProperties")) {
annotationNode.addError("This deprecated feature is no longer supported. Remove it; you can create a lombok.config file with 'lombok.anyConstructor.suppressConstructorProperties = true'.");
}
handleConstructor.generateConstructor(typeNode, level, onConstructor, findAllFields(typeNode), false, staticName, SkipIfConstructorExists.NO, annotationNode);
}
}
public static List<JavacNode> findRequiredFields(JavacNode typeNode) {
return findFields(typeNode, true);
}
@@ -132,30 +166,6 @@ public class HandleConstructor {
return fields.toList();
}
@Provides
public static class HandleAllArgsConstructor extends JavacAnnotationHandler<AllArgsConstructor> {
private static final String NAME = AllArgsConstructor.class.getSimpleName();
private HandleConstructor handleConstructor = new HandleConstructor();
@Override public void handle(AnnotationValues<AllArgsConstructor> annotation, JCAnnotation ast, JavacNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.ALL_ARGS_CONSTRUCTOR_FLAG_USAGE, "@AllArgsConstructor", ConfigurationKeys.ANY_CONSTRUCTOR_FLAG_USAGE, "any @xArgsConstructor");
deleteAnnotationIfNeccessary(annotationNode, AllArgsConstructor.class);
deleteImportFromCompilationUnit(annotationNode, "lombok.AccessLevel");
JavacNode typeNode = annotationNode.up();
if (!checkLegality(typeNode, annotationNode, NAME)) return;
List<JCAnnotation> onConstructor = unboxAndRemoveAnnotationParameter(ast, "onConstructor", "@AllArgsConstructor(onConstructor", annotationNode);
AllArgsConstructor ann = annotation.getInstance();
AccessLevel level = ann.access();
if (level == AccessLevel.NONE) return;
String staticName = ann.staticName();
if (annotation.isExplicit("suppressConstructorProperties")) {
annotationNode.addError("This deprecated feature is no longer supported. Remove it; you can create a lombok.config file with 'lombok.anyConstructor.suppressConstructorProperties = true'.");
}
handleConstructor.generateConstructor(typeNode, level, onConstructor, findAllFields(typeNode), false, staticName, SkipIfConstructorExists.NO, annotationNode);
}
}
public static List<JavacNode> findAllFields(JavacNode typeNode) {
return findAllFields(typeNode, false);
}
@@ -242,6 +252,7 @@ public class HandleConstructor {
if (!(skipIfConstructorExists != SkipIfConstructorExists.NO && constructorExists(typeNode) != MemberExistsResult.NOT_EXISTS)) {
JCMethodDecl constr = createConstructor(staticConstrRequired ? AccessLevel.PRIVATE : level, onConstructor, typeNode, fields, allToDefault, source);
generateConstructorJavadoc(constr, typeNode, fields);
injectMethod(typeNode, constr);
}
generateStaticConstructor(staticConstrRequired, typeNode, staticName, level, allToDefault, fields, source);
@@ -250,6 +261,7 @@ public class HandleConstructor {
private void generateStaticConstructor(boolean staticConstrRequired, JavacNode typeNode, String staticName, AccessLevel level, boolean allToDefault, List<JavacNode> fields, JavacNode source) {
if (staticConstrRequired) {
JCMethodDecl staticConstr = createStaticConstructor(staticName, level, typeNode, allToDefault ? List.<JavacNode>nil() : fields, source);
generateConstructorJavadoc(staticConstr, typeNode, fields);
injectMethod(typeNode, staticConstr);
}
}
@@ -465,4 +477,28 @@ public class HandleConstructor {
createRelevantNonNullAnnotation(typeNode, methodDef);
return recursiveSetGeneratedBy(methodDef, source);
}
private void generateConstructorJavadoc(JCMethodDecl constructor, JavacNode typeNode, List<JavacNode> fields) {
if (fields.isEmpty()) return;
JCCompilationUnit cu = ((JCCompilationUnit) typeNode.top().get());
String constructorJavadoc = getConstructorJavadocHeader(typeNode.getName());
boolean fieldDescriptionAdded = false;
for (JavacNode fieldNode : fields) {
String paramName = removePrefixFromField(fieldNode).toString();
String fieldJavadoc = getDocComment(cu, fieldNode.get());
String paramJavadoc = getConstructorParameterJavadoc(paramName, fieldJavadoc);
if (paramJavadoc == null) {
paramJavadoc = "@param " + paramName;
} else {
fieldDescriptionAdded = true;
}
constructorJavadoc = addJavadocLine(constructorJavadoc, paramJavadoc);
}
if (fieldDescriptionAdded) {
setDocComment(cu, constructor, constructorJavadoc);
}
}
}
@@ -147,6 +147,9 @@ public class HandleGetter extends JavacAnnotationHandler<Getter> {
if (node == null) return;
List<JCAnnotation> onMethod = unboxAndRemoveAnnotationParameter(ast, "onMethod", "@Getter(onMethod", annotationNode);
if (!onMethod.isEmpty()) {
handleFlagUsage(annotationNode, ConfigurationKeys.ON_X_FLAG_USAGE, "@Getter(onMethod=...)");
}
switch (node.getKind()) {
case FIELD:
@@ -218,7 +221,7 @@ public class HandleGetter extends JavacAnnotationHandler<Getter> {
long access = toJavacModifier(level) | (fieldDecl.mods.flags & Flags.STATIC);
injectMethod(fieldNode.up(), createGetter(access, fieldNode, fieldNode.getTreeMaker(), source, lazy, onMethod));
injectMethod(fieldNode.up(), source, createGetter(access, fieldNode, fieldNode.getTreeMaker(), source, lazy, onMethod));
}
public JCMethodDecl createGetter(long access, JavacNode field, JavacTreeMaker treeMaker, JavacNode source, boolean lazy, List<JCAnnotation> onMethod) {
@@ -131,7 +131,7 @@ public class HandleLog {
typeNode.toName(logFieldName), loggerType, factoryMethodCall), source);
if (isRecord(typeNode) && Javac.getJavaCompilerVersion() < 16) {
// This is a workaround for https://bugs.openjdk.java.net/browse/JDK-8243057
// This is a workaround for https://bugs.openjdk.java.net/browse/JDK-8243057 - note that the workaround is only for static fields in records, but our infra _requires_ `static` for logs in records (think about it).
injectField(typeNode, fieldDecl);
} else {
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2022 The Project Lombok Authors.
* Copyright (C) 2009-2024 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
@@ -126,7 +126,13 @@ public class HandleSetter extends JavacAnnotationHandler<Setter> {
if (level == AccessLevel.NONE || node == null) return;
List<JCAnnotation> onMethod = unboxAndRemoveAnnotationParameter(ast, "onMethod", "@Setter(onMethod", annotationNode);
if (!onMethod.isEmpty()) {
handleFlagUsage(annotationNode, ConfigurationKeys.ON_X_FLAG_USAGE, "@Setter(onMethod=...)");
}
List<JCAnnotation> onParam = unboxAndRemoveAnnotationParameter(ast, "onParam", "@Setter(onParam", annotationNode);
if (!onParam.isEmpty()) {
handleFlagUsage(annotationNode, ConfigurationKeys.ON_X_FLAG_USAGE, "@Setter(onParam=...)");
}
switch (node.getKind()) {
case FIELD:
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2021 The Project Lombok Authors.
* Copyright (C) 2021-2024 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
@@ -81,7 +81,9 @@ public class HandleStandardException extends JavacAnnotationHandler<StandardExce
if (hasConstructor(typeNode) != MemberExistsResult.NOT_EXISTS) return;
JavacTreeMaker maker = typeNode.getTreeMaker();
List<JCExpression> args = List.<JCExpression>of(maker.Literal(CTC_BOT, null), maker.Literal(CTC_BOT, null));
JCExpression stringArgument = maker.TypeCast(genJavaLangTypeRef(typeNode, "String"), maker.Literal(CTC_BOT, null));
JCExpression throwableArgument = maker.TypeCast(genJavaLangTypeRef(typeNode, "Throwable"), maker.Literal(CTC_BOT, null));
List<JCExpression> args = List.<JCExpression>of(stringArgument, throwableArgument);
JCStatement thisCall = maker.Exec(maker.Apply(List.<JCExpression>nil(), maker.Ident(typeNode.toName("this")), args));
JCMethodDecl constr = createConstructor(level, typeNode, false, false, source, List.of(thisCall));
injectMethod(typeNode, constr);
@@ -91,7 +93,9 @@ public class HandleStandardException extends JavacAnnotationHandler<StandardExce
if (hasConstructor(typeNode, String.class) != MemberExistsResult.NOT_EXISTS) return;
JavacTreeMaker maker = typeNode.getTreeMaker();
List<JCExpression> args = List.<JCExpression>of(maker.Ident(typeNode.toName("message")), maker.Literal(CTC_BOT, null));
JCExpression stringArgument = maker.Ident(typeNode.toName("message"));
JCExpression throwableArgument = maker.TypeCast(genJavaLangTypeRef(typeNode, "Throwable"), maker.Literal(CTC_BOT, null));
List<JCExpression> args = List.<JCExpression>of(stringArgument, throwableArgument);
JCStatement thisCall = maker.Exec(maker.Apply(List.<JCExpression>nil(), maker.Ident(typeNode.toName("this")), args));
JCMethodDecl constr = createConstructor(level, typeNode, true, false, source, List.of(thisCall));
injectMethod(typeNode, constr);
@@ -36,6 +36,7 @@ import com.sun.tools.javac.code.BoundKind;
import com.sun.tools.javac.code.Flags;
import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.JCTree.JCAnnotation;
import com.sun.tools.javac.tree.JCTree.JCArrayTypeTree;
import com.sun.tools.javac.tree.JCTree.JCAssign;
import com.sun.tools.javac.tree.JCTree.JCBlock;
import com.sun.tools.javac.tree.JCTree.JCClassDecl;
@@ -63,9 +64,9 @@ import lombok.ConfigurationKeys;
import lombok.Singular;
import lombok.ToString;
import lombok.core.AST.Kind;
import lombok.core.configuration.CheckerFrameworkVersion;
import lombok.core.AnnotationValues;
import lombok.core.HandlerPriority;
import lombok.core.configuration.CheckerFrameworkVersion;
import lombok.core.handlers.HandlerUtil;
import lombok.core.handlers.HandlerUtil.FieldAccess;
import lombok.core.handlers.InclusionExclusionUtils.Included;
@@ -78,6 +79,7 @@ import lombok.javac.JavacTreeMaker;
import lombok.javac.handlers.HandleBuilder.BuilderFieldData;
import lombok.javac.handlers.HandleBuilder.BuilderJob;
import lombok.javac.handlers.JavacHandlerUtil.CopyJavadoc;
import lombok.javac.handlers.JavacHandlerUtil.JCAnnotatedTypeReflect;
import lombok.javac.handlers.JavacHandlerUtil.MemberExistsResult;
import lombok.javac.handlers.JavacSingularsRecipes.ExpressionMaker;
import lombok.javac.handlers.JavacSingularsRecipes.JavacSingularizer;
@@ -1101,15 +1103,17 @@ public class HandleSuperBuilder extends JavacAnnotationHandler<SuperBuilder> {
ListBuffer<JCExpression> typeParamsForBuilderParameter = new ListBuffer<JCExpression>();
for (JCTree typeParam : typeParams) {
if (typeParam instanceof JCTypeParameter) {
typeParamsForBuilderParameter.append(maker.Ident(((JCTypeParameter)typeParam).getName()));
typeParamsForBuilderParameter.append(maker.Ident(((JCTypeParameter) typeParam).getName()));
} else if (typeParam instanceof JCIdent) {
typeParamsForBuilderParameter.append(maker.Ident(((JCIdent)typeParam).getName()));
typeParamsForBuilderParameter.append(maker.Ident(((JCIdent) typeParam).getName()));
} else if (typeParam instanceof JCFieldAccess) {
typeParamsForBuilderParameter.append(copySelect(maker, (JCFieldAccess) typeParam));
} else if (typeParam instanceof JCTypeApply) {
typeParamsForBuilderParameter.append(cloneType(maker, (JCTypeApply)typeParam, source));
typeParamsForBuilderParameter.append(cloneType(maker, (JCTypeApply) typeParam, source));
} else if (typeParam instanceof JCArrayTypeTree) {
typeParamsForBuilderParameter.append(cloneType(maker, (JCArrayTypeTree) typeParam, source));
} else if (JCAnnotatedTypeReflect.is(typeParam)) {
typeParamsForBuilderParameter.append(cloneType(maker, (JCExpression)typeParam, source));
typeParamsForBuilderParameter.append(cloneType(maker, (JCExpression) typeParam, source));
}
}
return typeParamsForBuilderParameter;
@@ -1369,6 +1369,21 @@ public class JavacHandlerUtil {
* Also takes care of updating the JavacAST.
*/
public static void injectMethod(JavacNode typeNode, JCMethodDecl method) {
JavacNode source = typeNode.getNodeFor(getGeneratedBy(method));
injectMethod(typeNode, source, method);
}
/**
* Adds the given new method declaration to the provided type AST Node.
* Can also inject constructors.
*
* Also takes care of updating the JavacAST.
*
* Ordinarily the 'source' is determined automatically. In rare cases generally involving combinations between
* annotations, some of which require re-attribution such as {@code @Delegate}, that doesn't work. This method
* exists if you explicitly have the source.
*/
public static void injectMethod(JavacNode typeNode, JavacNode source, JCMethodDecl method) {
JCClassDecl type = (JCClassDecl) typeNode.get();
if (method.getName().contentEquals("<init>")) {
@@ -1389,7 +1404,7 @@ public class JavacHandlerUtil {
}
addSuppressWarningsAll(method.mods, typeNode, typeNode.getNodeFor(getGeneratedBy(method)), typeNode.getContext());
addGenerated(method.mods, typeNode, typeNode.getNodeFor(getGeneratedBy(method)), typeNode.getContext());
addGenerated(method.mods, typeNode, source, typeNode.getContext());
type.defs = type.defs.append(method);
EnterReflect.memberEnter(method, typeNode);
@@ -1527,7 +1542,7 @@ public class JavacHandlerUtil {
if (Boolean.TRUE.equals(node.getAst().readConfiguration(ConfigurationKeys.ADD_JAKARTA_GENERATED_ANNOTATIONS))) {
addAnnotation(mods, node, source, "jakarta.annotation.Generated", node.getTreeMaker().Literal("lombok"));
}
if (Boolean.TRUE.equals(node.getAst().readConfiguration(ConfigurationKeys.ADD_LOMBOK_GENERATED_ANNOTATIONS))) {
if (!Boolean.FALSE.equals(node.getAst().readConfiguration(ConfigurationKeys.ADD_LOMBOK_GENERATED_ANNOTATIONS))) {
addAnnotation(mods, node, source, "lombok.Generated", null);
}
}
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2018 The Project Lombok Authors.
* Copyright (C) 2009-2024 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -22,16 +22,13 @@
package lombok.delombok;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.NavigableMap;
import java.util.TreeMap;
import java.util.regex.Pattern;
import lombok.javac.CommentInfo;
import lombok.javac.Javac;
import lombok.javac.PackageName;
import lombok.javac.handlers.JavacHandlerUtil;
import com.sun.tools.javac.parser.Tokens.Comment;
import com.sun.tools.javac.tree.DocCommentTable;
import com.sun.tools.javac.tree.JCTree;
@@ -39,6 +36,11 @@ import com.sun.tools.javac.tree.JCTree.JCClassDecl;
import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
import com.sun.tools.javac.tree.TreeScanner;
import lombok.javac.CommentInfo;
import lombok.javac.Javac;
import lombok.javac.handlers.JavacHandlerUtil;
public class DocCommentIntegrator {
/**
@@ -49,18 +51,21 @@ public class DocCommentIntegrator {
CommentInfo lastExcisedComment = null;
JCTree lastNode = null;
NavigableMap<Integer, JCTree> positionMap = buildNodePositionMap(unit);
for (CommentInfo cmt : comments) {
if (!cmt.isJavadoc()) {
out.add(cmt);
continue;
}
JCTree node = findJavadocableNodeOnOrAfter(unit, cmt.endPos);
if (node == null) {
Entry<Integer, JCTree> entry = positionMap.ceilingEntry(cmt.endPos);
if (entry == null) {
out.add(cmt);
continue;
}
JCTree node = entry.getValue();
if (node == lastNode) {
out.add(lastExcisedComment);
}
@@ -73,6 +78,28 @@ public class DocCommentIntegrator {
}
return out;
}
private NavigableMap<Integer, JCTree> buildNodePositionMap(JCCompilationUnit unit) {
final NavigableMap<Integer, JCTree> positionMap = new TreeMap<Integer, JCTree>();
unit.accept(new TreeScanner() {
@Override
public void visitClassDef(JCClassDecl tree) {
positionMap.put(tree.pos, tree);
super.visitClassDef(tree);
}
@Override
public void visitMethodDef(JCMethodDecl tree) {
positionMap.put(tree.pos, tree);
super.visitMethodDef(tree);
}
@Override
public void visitVarDef(JCVariableDecl tree) {
positionMap.put(tree.pos, tree);
super.visitVarDef(tree);
}
});
return positionMap;
}
private static final Pattern CONTENT_STRIPPER = Pattern.compile("^(?:\\s*\\*)?(.*?)$", Pattern.MULTILINE);
@SuppressWarnings("unchecked") private boolean attach(JCCompilationUnit top, final JCTree node, CommentInfo cmt) {
@@ -110,7 +137,7 @@ public class DocCommentIntegrator {
}
@Override public CommentStyle getStyle() {
return CommentStyle.JAVADOC;
return (CommentStyle) Javac.getCommentStyle();
}
@Override public boolean isDeprecated() {
@@ -119,32 +146,4 @@ public class DocCommentIntegrator {
});
}
}
private JCTree findJavadocableNodeOnOrAfter(JCCompilationUnit unit, int endPos) {
JCTree pid = PackageName.getPackageNode(unit);
if (pid != null && endPos <= pid.pos) return null;
Iterator<JCTree> it = unit.defs.iterator();
while (it.hasNext()) {
JCTree node = it.next();
if (node.pos < endPos) {
if (node instanceof JCClassDecl) {
com.sun.tools.javac.util.List<JCTree> defs = ((JCClassDecl) node).defs;
if (!defs.isEmpty()) while (!defs.tail.isEmpty()) defs = defs.tail;
if (defs.head != null && defs.head.pos >= endPos) {
// The associated node is IN this class declaration, so, replace the iterator.
// There's no point looking beyond this member in the current iteration 'context'
// so we don't need to save the old ref. Just start over inside this type declaration.
it = ((JCClassDecl) node).defs.iterator();
}
}
continue;
}
if (node instanceof JCMethodDecl || node instanceof JCClassDecl || node instanceof JCVariableDecl) return node;
return null;
}
return null;
}
}
@@ -63,6 +63,7 @@ public class EclipsePatcher implements AgentLauncher.AgentLaunchable {
if (loader.getClass().getName().startsWith("org.sonar.classloader.")) return false; // Relevant to bug #2351
if (loader.toString().contains("com.alexnederlof:jasperreports-plugin")) return false; //Relevant to bug #1036
if (loader.toString().contains("com.pro-crafting.tools:jasperreports-plugin")) return false; //Relevant to bug #1036
if (loader.toString().contains("com.pro-crafting.tools:jasperreports-maven-plugin")) return false; //Relevant to bug #1036
}
if (!(loader instanceof URLClassLoader)) return true;
ClassLoader parent = loader.getParent();
@@ -874,6 +875,14 @@ public class EclipsePatcher implements AgentLauncher.AgentLaunchable {
.target(new MethodTarget(SOURCE_TYPE_CONVERTER_SIG, "convertAnnotations", ANNOTATION_SIG + "[]", I_ANNOTATABLE_SIG))
.wrapMethod(new Hook("lombok.launch.PatchFixesHider$PatchFixes", "convertAnnotations", ANNOTATION_SIG + "[]", ANNOTATION_SIG + "[]", I_ANNOTATABLE_SIG))
.request(StackRequest.PARAM1, StackRequest.RETURN_VALUE).build());
sm.addScriptIfWitness(OSGI_TYPES, ScriptBuilder.exitEarly()
.target(new MethodTarget(SOURCE_TYPE_CONVERTER_SIG, "parseMemberValue", "org.eclipse.jdt.internal.compiler.ast.Expression", "char[]"))
.decisionMethod(new Hook("lombok.launch.PatchFixesHider$PatchFixes", "isEmpty", "boolean", "char[]"))
.valueMethod(new Hook("lombok.launch.PatchFixesHider$PatchFixes", "returnNullExpression", "org.eclipse.jdt.internal.compiler.ast.Expression", "java.lang.Object"))
.request(StackRequest.PARAM1)
.transplant()
.build());
}
private static void patchEclipseDebugPatches(ScriptManager sm) {
@@ -892,6 +892,14 @@ final class PatchFixesHider {
return replace;
}
public static boolean isEmpty(char[] array) {
return array.length == 0;
}
public static Expression returnNullExpression(Object arg0) {
return null;
}
public static String getRealNodeSource(String original, org.eclipse.jdt.internal.compiler.ast.ASTNode node) {
if (!isGenerated(node)) return original;
@@ -39,10 +39,6 @@ import sun.misc.Unsafe;
class AnnotationProcessorHider {
public static class AstModificationNotifierData {
public volatile static boolean lombokInvoked = false;
}
public static class AnnotationProcessor extends AbstractProcessor {
private final AbstractProcessor instance = createWrappedInstance();
@@ -60,7 +56,6 @@ class AnnotationProcessorHider {
@Override public void init(ProcessingEnvironment processingEnv) {
disableJava9SillyWarning();
AstModificationNotifierData.lombokInvoked = true;
instance.init(processingEnv);
super.init(processingEnv);
}
@@ -36,6 +36,9 @@ import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
/**
* Download eclipse bundles.
@@ -63,16 +66,17 @@ public class DownloadEclipseDependencies {
String pluginSource = updateSite.getResolvedUrl() + "/plugins/";
for (String artifact : artifacts) {
try {
downloadFile(artifact, pluginSource, pluginTarget);
} catch (Exception e) {
}
// Download artifact
downloadFile(artifact, pluginSource, pluginTarget);
// Download artifact source
int index = artifact.lastIndexOf("_");
String source = artifact.substring(0, index) + ".source" + artifact.substring(index);
try {
downloadFile(source, pluginSource, pluginTarget);
} catch (Exception e) {
// It's just the source; sometimes these aren't present (specifically, `org.eclipse.swt` doesn't currently appear to have the sources, at least not using the `_sources` naming scheme). Don't fail, just skip them.
System.out.println("[failed]");
}
}
@@ -87,24 +91,40 @@ public class DownloadEclipseDependencies {
return;
}
System.out.print("Downloading '" + filename + "'... ");
InputStream in = null;
OutputStream out = null;
try {
in = getStreamForUrl(repositoryUrl + filename);
out = new FileOutputStream(targetFile);
copy(in, out);
copyZipButStripSignatures(in, out);
System.out.println("[done]");
} catch (IOException e) {
System.out.println("[error]");
} finally {
if (in != null) try {
in.close();
} catch (Exception ignore) {
try {
if (in != null) in.close();
} finally {
if (out != null) out.close();
}
if (out != null) out.close();
}
}
private static void copyZipButStripSignatures(InputStream rawIn, OutputStream rawOut) throws IOException {
ZipInputStream in = null;
ZipOutputStream out = null;
in = new ZipInputStream(rawIn);
out = new ZipOutputStream(rawOut);
ZipEntry zipEntry;
while ((zipEntry = in.getNextEntry()) != null) {
if (zipEntry.getName().matches("META-INF/.*\\.(SF|RSA)")) continue;
out.putNextEntry(zipEntry);
copy(in, out);
}
out.close(); // zip streams buffer.
}
private static void copy(InputStream from, OutputStream to) throws IOException {
byte[] b = new byte[4096];
while (true) {
@@ -118,8 +138,7 @@ public class DownloadEclipseDependencies {
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
connection.setRequestProperty("User-Agent", "lombok");
connection.setRequestProperty("Accept", "*/*");
InputStream in = new BufferedInputStream(connection.getInputStream());
return in;
return new BufferedInputStream(connection.getInputStream());
}
private static void writeEclipseLibrary(String target, String eclipseVersion) throws IOException {
+44 -15
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2021 The Project Lombok Authors.
* Copyright (C) 2009-2024 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.eclipse;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
@@ -279,22 +280,50 @@ public class Eclipse {
}
}
private static boolean caseStatementInit = false;
private static Field caseStatementConstantExpressions = null;
private static final Field CASE_STATEMENT_CONSTANT_EXPRESSIONS = Permit.permissiveGetField(CaseStatement.class, "constantExpressions");
private static final Constructor<CaseStatement> CASE_STATEMENT_CONSTRUCTOR_SINGLE;
private static final Constructor<CaseStatement> CASE_STATEMENT_CONSTRUCTOR_ARRAY;
private static final Expression[] EMPTY_EXPRESSIONS;
static {
Constructor<CaseStatement> constructorSingle = null, constructorArray = null;
Expression[] emptyExpressions = new Expression[0];
try {
constructorSingle = Permit.getConstructor(CaseStatement.class, Expression.class, int.class, int.class);
} catch (NoSuchMethodException ignore) {
}
try {
constructorArray = Permit.getConstructor(CaseStatement.class, Expression[].class, int.class, int.class);
} catch (NoSuchMethodException ignore) {
}
try {
emptyExpressions = Permit.get(Permit.permissiveGetField(Expression.class, "NO_EXPRESSIONS"), null);
} catch (Throwable ignore) {
}
CASE_STATEMENT_CONSTRUCTOR_SINGLE = constructorSingle;
CASE_STATEMENT_CONSTRUCTOR_ARRAY = constructorArray;
EMPTY_EXPRESSIONS = emptyExpressions;
}
public static CaseStatement createCaseStatement(Expression expr) {
CaseStatement stat = new CaseStatement(expr, 0, 0);
if (expr == null) return stat;
if (!caseStatementInit) {
try {
caseStatementConstantExpressions = Permit.getField(CaseStatement.class, "constantExpressions");
caseStatementConstantExpressions.setAccessible(true);
} catch (NoSuchFieldException ignore) {}
caseStatementInit = true;
final CaseStatement stat;
if (CASE_STATEMENT_CONSTRUCTOR_SINGLE != null) {
stat = Permit.newInstanceSneaky(CASE_STATEMENT_CONSTRUCTOR_SINGLE, expr, 0, 0);
if (stat != null && expr != null && CASE_STATEMENT_CONSTANT_EXPRESSIONS != null) {
try {
Permit.set(CASE_STATEMENT_CONSTANT_EXPRESSIONS, stat, new Expression[] {expr});
} catch (IllegalAccessException ignore) {
}
}
} else {
Expression[] expressions = EMPTY_EXPRESSIONS;
if (expr != null) {
expressions = new Expression[] {expr};
}
stat = Permit.newInstanceSneaky(CASE_STATEMENT_CONSTRUCTOR_ARRAY, expressions, 0, 0);
}
if (caseStatementConstantExpressions != null) try {
caseStatementConstantExpressions.set(stat, new Expression[] {expr});
} catch (IllegalArgumentException ignore) {
} catch (IllegalAccessException ignore) {}
return stat;
}
}
+16 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2019 The Project Lombok Authors.
* Copyright (C) 2009-2024 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
@@ -43,6 +43,7 @@ import com.sun.tools.javac.code.Symtab;
import com.sun.tools.javac.code.Type;
import com.sun.tools.javac.main.JavaCompiler;
import com.sun.tools.javac.parser.Tokens.Comment;
import com.sun.tools.javac.parser.Tokens.Comment.CommentStyle;
import com.sun.tools.javac.tree.DocCommentTable;
import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.JCTree.JCAnnotation;
@@ -330,6 +331,10 @@ public class Javac {
}
}
public static Object getCommentStyle() {
return JavadocOps_8.COMMENT_STYLE;
}
private static class JavadocOps_8 {
static String getJavadoc(Object dc, JCTree node) {
DocCommentTable dct = (DocCommentTable) dc;
@@ -350,6 +355,15 @@ public class Javac {
dct.putComment(node, newCmt);
}
private static final CommentStyle COMMENT_STYLE = getCommentStyle();
private static CommentStyle getCommentStyle() {
try {
return CommentStyle.valueOf("JAVADOC");
} catch (IllegalArgumentException e) {
return CommentStyle.valueOf("JAVADOC_BLOCK");
}
}
private static Comment createJavadocComment(final String text, final JCTree field) {
return new Comment() {
@Override public String getText() {
@@ -361,7 +375,7 @@ public class Javac {
}
@Override public CommentStyle getStyle() {
return CommentStyle.JAVADOC;
return COMMENT_STYLE;
}
@Override public boolean isDeprecated() {
@@ -24,7 +24,6 @@ package lombok.bytecode;
import static org.junit.Assert.*;
import java.io.File;
import java.io.IOException;
import lombok.core.DiagnosticsReceiver;
import lombok.core.PostCompiler;
+74 -52
View File
@@ -25,10 +25,12 @@ import static org.junit.Assert.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
@@ -49,13 +51,7 @@ import lombok.transform.TestLombokFilesIdempotent;
import lombok.transform.TestSourceFiles;
public abstract class AbstractRunTests {
private final File dumpActualFilesHere;
public AbstractRunTests() {
this.dumpActualFilesHere = findPlaceToDumpActualFiles();
}
public final FileTester createTester(final DirectoryRunner.TestParams params, final File file, String platform, int version) throws IOException {
public final FileTester createTester(final DirectoryRunner.TestParams params, final File file, String platform, int version, final boolean copyToSource) throws IOException {
ConfigurationKeysLoader.LoaderLoader.loadAllConfigurationKeys();
AssertionError directiveFailure = null;
LombokTestSource sourceDirectives = null;
@@ -107,7 +103,7 @@ public abstract class AbstractRunTests {
if (params.expectChanges() && !forceUnchanged && !changed) result.addMessage(new CompilerMessage(-1, -1, true, "not flagged modified"));
if (!params.expectChanges() && changed) result.addMessage(new CompilerMessage(-1, -1, true, "unexpected modification"));
compare(file.getName(), expected, result, params.printErrors(), sourceDirectives_.isSkipCompareContent() || expected.isSkipCompareContent());
compare(file.getName(), expected, result, params.printErrors(), sourceDirectives_.isSkipCompareContent() || expected.isSkipCompareContent(), copyToSource);
}
};
}
@@ -131,20 +127,34 @@ public abstract class AbstractRunTests {
return result.toString();
}
private static File findPlaceToDumpActualFiles() {
String location = System.getProperty("lombok.tests.dump_actual_files");
if (location != null) {
File dumpActualFilesHere = new File(location);
dumpActualFilesHere.mkdirs();
return dumpActualFilesHere;
}
return null;
}
private static void dumpToFile(File file, String content) throws IOException {
List<String> directives = new ArrayList<String>();
if (file.exists()) {
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"));
try {
while (true) {
String line = br.readLine();
if (line == null) break;
if (line.startsWith("//")) directives.add(line);
else if (!line.isEmpty()) break;
}
} finally {
br.close();
}
}
FileOutputStream fos = new FileOutputStream(file);
try {
fos.write(content.getBytes("UTF-8"));
for (String directive : directives) fos.write((directive + "\n").getBytes("UTF-8"));
boolean atStart = true;
for (String line : content.split("(\\r?\\n)")) {
if (line.isEmpty()) continue;
if (atStart && line.startsWith("//")) continue;
atStart = false;
fos.write((line + "\n").getBytes("UTF-8"));
}
} finally {
fos.close();
}
@@ -152,6 +162,7 @@ public abstract class AbstractRunTests {
private static void dumpToFile(File file, Collection<CompilerMessage> content) throws IOException {
FileOutputStream fos = new FileOutputStream(file);
System.err.println(">>> DUMPING ERR MSG: " + file.getAbsolutePath());
try {
for (CompilerMessage message : content) {
fos.write(CompilerMessageMatcher.asCompilerMessageMatcher(message).toString().getBytes("UTF-8"));
@@ -162,56 +173,67 @@ public abstract class AbstractRunTests {
}
}
private void compare(String name, LombokTestSource expected, TransformationResult result, boolean printErrors, boolean skipCompareContent) throws Throwable {
private void compare(String name, LombokTestSource expected, TransformationResult result, boolean printErrors, boolean skipCompareContent, boolean copyToSource) throws Throwable {
String actualFile = result.getOutput();
LinkedHashSet<CompilerMessage> actualMessages = result.getMessages();
if (!skipCompareContent) try {
compareContent(name, expected.getContent(), actualFile);
} catch (Throwable e) {
if (printErrors) {
System.out.println("***** " + name + " *****");
System.out.println(e.getMessage());
System.out.println("**** Expected ******");
System.out.println(expected.getContent());
System.out.println("**** Actual ******");
System.out.println(actualFile);
if (actualMessages != null && !actualMessages.isEmpty()) {
System.out.println("**** Actual Errors *****");
for (CompilerMessage actualMessage : actualMessages) {
System.out.println(actualMessage);
if (copyToSource) {
dumpToFile(expected.getSourceFile(), actualFile);
System.out.println("UPDATED: " + expected.getSourceFile());
} else {
if (printErrors) {
System.out.println("***** " + name + " *****");
System.out.println(e.getMessage());
System.out.println("**** Expected ******");
System.out.println(expected.getContent());
System.out.println("**** Actual ******");
System.out.println(actualFile);
if (actualMessages != null && !actualMessages.isEmpty()) {
System.out.println("**** Actual Errors *****");
for (CompilerMessage actualMessage : actualMessages) {
System.out.println(actualMessage);
}
}
System.out.println("*******************");
}
System.out.println("*******************");
throw e;
}
if (dumpActualFilesHere != null) {
dumpToFile(new File(dumpActualFilesHere, name), actualFile);
}
throw e;
}
try {
compareMessages(name, expected.getMessages(), actualMessages);
} catch (Throwable e) {
if (printErrors) {
System.out.println("***** " + name + " *****");
System.out.println(e.getMessage());
System.out.println("**** Expected ******");
for (CompilerMessageMatcher expectedMessage : expected.getMessages()) {
System.out.println(expectedMessage);
if (copyToSource) {
if (actualMessages.isEmpty()) {
if (expected.getMessagesFile().exists()) {
expected.getMessagesFile().delete();
System.out.println("DELETED: " + expected.getMessagesFile());
}
} else {
dumpToFile(expected.getMessagesFile(), actualMessages);
System.out.println("UPDATED: " + expected.getMessagesFile());
}
System.out.println("**** Actual ******");
for (CompilerMessage actualMessage : actualMessages) {
System.out.println(actualMessage);
} else {
if (printErrors) {
System.out.println("***** " + name + " *****");
System.out.println(e.getMessage());
System.out.println("**** Expected ******");
for (CompilerMessageMatcher expectedMessage : expected.getMessages()) {
System.out.println(expectedMessage);
}
System.out.println("**** Actual ******");
for (CompilerMessage actualMessage : actualMessages) {
System.out.println(actualMessage);
}
System.out.println("**** Actual File ******");
System.out.println(lineNumber(actualFile));
System.out.println("*******************");
}
System.out.println("**** Actual File ******");
System.out.println(lineNumber(actualFile));
System.out.println("*******************");
throw e;
}
if (dumpActualFilesHere != null) {
dumpToFile(new File(dumpActualFilesHere, name + ".messages"), actualMessages);
}
throw e;
}
}
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2012-2013 The Project Lombok Authors.
* Copyright (C) 2012-2024 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
@@ -36,6 +36,7 @@ import lombok.javac.CapturingDiagnosticListener.CompilerMessage;
public class CompilerMessageMatcher {
/** Line Number (starting at 1) */
private final List<Integer> lineNumbers = new ArrayList<Integer>();
private final List<Long> positions = new ArrayList<Long>();
private final List<List<String>> messages = new ArrayList<List<String>>();
private boolean optional;
@@ -48,6 +49,7 @@ public class CompilerMessageMatcher {
public static CompilerMessageMatcher asCompilerMessageMatcher(CompilerMessage message) {
CompilerMessageMatcher cmm = new CompilerMessageMatcher();
cmm.lineNumbers.add((int) message.getLine());
cmm.positions.add(message.getPosition());
cmm.messages.add(Arrays.asList(message.getMessage().split("\\s+")));
return cmm;
}
@@ -55,7 +57,9 @@ public class CompilerMessageMatcher {
@Override public String toString() {
StringBuilder out = new StringBuilder();
for (int i = 0; i < lineNumbers.size(); i++) {
out.append(lineNumbers.get(i)).append(" ");
out.append(lineNumbers.get(i));
if (positions.get(i) != null) out.append(":").append(positions.get(i));
out.append(" ");
for (String part : messages.get(i)) out.append(part).append(" ");
if (out.length() > 0) out.setLength(out.length() - 1);
out.append(" |||| ");
@@ -67,8 +71,8 @@ public class CompilerMessageMatcher {
public boolean matches(CompilerMessage message) {
outer:
for (int i = 0; i < lineNumbers.size(); i++) {
//Allow an off-by-1 in line numbers; when running tests that sometimes happens for as yet unknown reasons.
if (message.getLine() != lineNumbers.get(i) && message.getLine() -1 != lineNumbers.get(i)) continue;
if (message.getLine() != lineNumbers.get(i)) continue;
if (positions.get(i) != null && !positions.get(i).equals(message.getPosition())) continue;
for (String token : messages.get(i)) {
if (!message.getMessage().contains(token)) continue outer;
}
@@ -88,7 +92,7 @@ public class CompilerMessageMatcher {
return out;
}
private static final Pattern PATTERN = Pattern.compile("^(-?\\d+) (.*)$");
private static final Pattern PATTERN = Pattern.compile("^(-?\\d+)(?::(\\d+))? (.*)$");
private static CompilerMessageMatcher read(String line) {
line = line.trim();
@@ -108,7 +112,8 @@ public class CompilerMessageMatcher {
Matcher m = PATTERN.matcher(part);
if (!m.matches()) throw new IllegalArgumentException("Typo in test file: " + line);
cmm.lineNumbers.add(Integer.parseInt(m.group(1)));
cmm.messages.add(Arrays.asList(m.group(2).split("\\s+")));
cmm.positions.add(m.group(2) != null ? Long.parseLong(m.group(2)) : null);
cmm.messages.add(Arrays.asList(m.group(3).split("\\s+")));
}
return cmm;
+10 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2009-2021 The Project Lombok Authors.
* Copyright (C) 2009-2024 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,6 +42,13 @@ public class DirectoryRunner extends Runner {
private static final List<String> DEBUG_FOCUS_ON_FILE = Arrays.asList(
);
/*
* If this is set to true, you are decreeing that all tests pass, and that any test that dares to say it does not, means the test is wrong and not lombok: The framework will <strong>update</strong> the 'target' so that it now passes.
* This is, naturally, an exceedingly dangerous tool. The general way to use it is: First ensure all tests pass, then, do some minor refactor that massively impacts the tests, then, enable this, run the tests, then turn this off again,
* then, thoroughly review your commit diff.
*/
private static final boolean ITS_ALL_GOOD = false;
public enum Compiler {
DELOMBOK {
@Override public int getVersion() {
@@ -181,10 +188,10 @@ public class DirectoryRunner extends Runner {
File file = new File(params.getBeforeDirectory(), fileName);
switch (params.getCompiler()) {
case DELOMBOK:
return new RunTestsViaDelombok().createTester(params, file, "javac", params.getVersion());
return new RunTestsViaDelombok().createTester(params, file, "javac", params.getVersion(), ITS_ALL_GOOD);
case ECJ:
String platform = RunTestsViaEcj.eclipseAvailable() ? "eclipse" : "ecj";
return new RunTestsViaEcj().createTester(params, file, platform, params.getVersion());
return new RunTestsViaEcj().createTester(params, file, platform, params.getVersion(), ITS_ALL_GOOD);
default:
case JAVAC:
throw new UnsupportedOperationException();
+19 -11
View File
@@ -50,7 +50,8 @@ import lombok.core.configuration.ConfigurationSource;
import lombok.core.configuration.SingleConfigurationSource;
public class LombokTestSource {
private final File file;
private final File sourceFile;
private final File messagesFile;
private final String content;
private final LombokImmutableList<CompilerMessageMatcher> messages;
private final Map<String, String> formatPreferences;
@@ -86,8 +87,12 @@ public class LombokTestSource {
return version >= versionLowerLimit && version <= versionUpperLimit;
}
public File getFile() {
return file;
public File getSourceFile() {
return sourceFile;
}
public File getMessagesFile() {
return messagesFile;
}
public String getContent() {
@@ -169,8 +174,9 @@ public class LombokTestSource {
private static final Pattern ISSUE_REF_PATTERN = Pattern.compile("^\\s*issue #?\\d+(:?\\s+.*)?$", Pattern.CASE_INSENSITIVE);
private static final Pattern VERIFY_DIET_PATTERN = Pattern.compile("^\\s*eclipse:\\s*verify[- ]?diet\\s*(?:[-:].*)?$", Pattern.CASE_INSENSITIVE);
private LombokTestSource(File file, String content, List<CompilerMessageMatcher> messages, List<String> directives) {
this.file = file;
private LombokTestSource(File sourceFile, File messagesFile, String content, List<CompilerMessageMatcher> messages, List<String> directives) {
this.sourceFile = sourceFile;
this.messagesFile = messagesFile;
this.content = content;
this.messages = messages == null ? LombokImmutableList.<CompilerMessageMatcher>of() : LombokImmutableList.copyOf(messages);
@@ -227,7 +233,7 @@ public class LombokTestSource {
if (lc.startsWith("version ")) {
int[] limits = parseVersionLimit(lc.substring(7).trim());
if (limits == null) {
Assert.fail("Directive line \"" + directive + "\" in '" + file.getAbsolutePath() + "' invalid: version must be followed by a single integer.");
Assert.fail("Directive line \"" + directive + "\" in '" + sourceFile.getAbsolutePath() + "' invalid: version must be followed by a single integer.");
throw new RuntimeException();
}
versionLower = limits[0];
@@ -258,7 +264,7 @@ public class LombokTestSource {
if (lc.startsWith("issue ")) continue;
Assert.fail("Directive line \"" + directive + "\" in '" + file.getAbsolutePath() + "' invalid: unrecognized directive.");
Assert.fail("Directive line \"" + directive + "\" in '" + sourceFile.getAbsolutePath() + "' invalid: unrecognized directive.");
throw new RuntimeException();
}
this.specifiedEncoding = encoding;
@@ -276,7 +282,7 @@ public class LombokTestSource {
Assert.fail("Problem on directive line: " + problem + " at conf line #" + lineNumber + " (" + line + ")");
}
};
final ConfigurationFile configurationFile = ConfigurationFile.fromCharSequence(file.getAbsoluteFile().getPath(), conf, ConfigurationFile.getLastModifiedOrMissing(file));
final ConfigurationFile configurationFile = ConfigurationFile.fromCharSequence(sourceFile.getAbsoluteFile().getPath(), conf, ConfigurationFile.getLastModifiedOrMissing(sourceFile));
final ConfigurationSource source = SingleConfigurationSource.parse(configurationFile, new ConfigurationParser(reporter));
ConfigurationFileToSource sourceFinder = new ConfigurationFileToSource() {
@Override public ConfigurationSource parsed(ConfigurationFile fileLocation) {
@@ -315,7 +321,7 @@ public class LombokTestSource {
}
}
return new LombokTestSource(file, "", null, directives);
return new LombokTestSource(file, null, "", null, directives);
}
public static LombokTestSource read(File sourceFolder, File messagesFolder, String fileName) throws IOException {
@@ -360,8 +366,9 @@ public class LombokTestSource {
if (content == null) content = new StringBuilder();
List<CompilerMessageMatcher> messages = null;
File messagesFile = null;
if (messagesFolder != null) {
File messagesFile = new File(messagesFolder, fileName + ".messages");
messagesFile = new File(messagesFolder, fileName + ".messages");
try {
InputStream rawIn = new FileInputStream(messagesFile);
try {
@@ -372,10 +379,11 @@ public class LombokTestSource {
}
} catch (FileNotFoundException e) {
messages = null;
messagesFile = null;
}
}
LombokTestSource source = new LombokTestSource(sourceFile, content.toString(), messages, directives);
LombokTestSource source = new LombokTestSource(sourceFile, messagesFile, content.toString(), messages, directives);
String specifiedEncoding = source.getSpecifiedEncoding();
// The source file has an 'encoding' header to test encoding issues. Of course, reading the encoding header
+1 -1
View File
@@ -79,7 +79,6 @@ public class RunTestsViaEcj extends AbstractRunTests {
options.targetJDK = ecjCompilerVersionConstant;
options.docCommentSupport = false;
options.parseLiteralExpressionsAsConstants = true;
options.inlineJsrBytecode = true;
options.reportUnusedDeclaredThrownExceptionExemptExceptionAndThrowable = false;
options.reportUnusedDeclaredThrownExceptionIncludeDocCommentReference = false;
options.reportUnusedDeclaredThrownExceptionWhenOverriding = false;
@@ -96,6 +95,7 @@ public class RunTestsViaEcj extends AbstractRunTests {
warnings.put(CompilerOptions.OPTION_ReportNonStaticAccessToStatic, "warning");
warnings.put("org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures", "ignore");
warnings.put(CompilerOptions.OPTION_Source, (ecjCompilerVersion < 9 ? "1." : "") + ecjCompilerVersion);
warnings.put(CompilerOptions.OPTION_TargetPlatform, (ecjCompilerVersion < 9 ? "1." : "") + ecjCompilerVersion);
warnings.put("org.eclipse.jdt.core.compiler.codegen.useStringConcatFactory", "disabled");
options.set(warnings);
return options;
@@ -0,0 +1,14 @@
package pkg;
import lombok.Builder;
@Builder
public class BuilderJavadoc {
/**
* Javadoc
*
* @param test ABC
* @return test
*/
private String test;
}
@@ -0,0 +1,7 @@
package pkg;
public class Usage {
public void test() {
BuilderJavadoc.builder().test("test").build();
}
}
@@ -0,0 +1,9 @@
package pkg;
import lombok.Synchronized;
public class ClassWithSynchronized {
@Synchronized
public void test() {
}
}
@@ -0,0 +1,10 @@
package pkg;
public class Usage {
private ClassWithSynchronized test;
// Prevent "The value of the field Usage.test is not used"
public void test() {
test.test();
}
}
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 The Project Lombok Authors.
* Copyright (C) 2022-2024 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,8 @@ package lombok.eclipse.cleanup;
import static lombok.eclipse.RefactoringUtils.performRefactoring;
import java.lang.reflect.Constructor;
import java.util.Map;
import java.util.Map.Entry;
import org.eclipse.jdt.core.ICompilationUnit;
@@ -30,8 +32,8 @@ import org.eclipse.jdt.internal.corext.fix.CleanUpConstants;
import org.eclipse.jdt.internal.corext.fix.CleanUpRefactoring;
import org.eclipse.jdt.internal.corext.fix.CleanUpRegistry;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.fix.CodeStyleCleanUp;
import org.eclipse.jdt.internal.ui.fix.MapCleanUpOptions;
import org.eclipse.jdt.ui.cleanup.ICleanUp;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -59,7 +61,16 @@ public class CleanupTest {
CleanUpRefactoring ref = new CleanUpRefactoring();
ref.addCompilationUnit(cu);
ref.addCleanUp(new CodeStyleCleanUp(options.getMap()));
// Load the class dynamically to avoid compile errors when running with older versions of Eclipse
Class<?> cleanUpClass;
try {
cleanUpClass = Class.forName("org.eclipse.jdt.internal.ui.fix.CodeStyleCleanUp");
} catch (ClassNotFoundException e) {
cleanUpClass = Class.forName("org.eclipse.jdt.internal.ui.fix.CodeStyleCleanUpCore");
}
Constructor<?> cleanUpConstructor = cleanUpClass.getConstructor(Map.class);
ref.addCleanUp((ICleanUp) cleanUpConstructor.newInstance(options.getMap()));
performRefactoring(ref);
}
@@ -21,13 +21,15 @@
*/
package lombok.eclipse.compile;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IProblemRequestor;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.WorkingCopyOwner;
import org.eclipse.jdt.core.compiler.IProblem;
import org.junit.Rule;
@@ -47,6 +49,27 @@ public class NoErrorsTest {
public void fieldNameConstantsInAnnotation() throws Exception {
ICompilationUnit cu = setup.getPackageFragment().getCompilationUnit("Usage.java");
List<IProblem> problems = collectProblems(cu);
assertEquals(Collections.emptyList(), problems);
}
@Test
public void builderJavadoc() throws Exception {
ICompilationUnit cu = setup.getPackageFragment().getCompilationUnit("Usage.java");
List<IProblem> problems = collectProblems(cu);
assertEquals(Collections.emptyList(), problems);
}
@Test
public void synchronizedUsage() throws Exception {
ICompilationUnit cu = setup.getPackageFragment().getCompilationUnit("Usage.java");
List<IProblem> problems = collectProblems(cu);
assertEquals(Collections.emptyList(), problems);
}
private List<IProblem> collectProblems(ICompilationUnit cu) throws JavaModelException {
final List<IProblem> problems = new ArrayList<IProblem>();
final IProblemRequestor requestor = new IProblemRequestor() {
@Override
@@ -83,7 +106,6 @@ public class NoErrorsTest {
workingCopy.discardWorkingCopy();
}
System.out.println(problems);
assertTrue(problems.isEmpty());
return problems;
}
}
+17
View File
@@ -0,0 +1,17 @@
/**
* Block comment
*/
class BlockComment {
/**
* Method
*/
private void test() {
}
}
/// Markdown
/// Comment
class MarkdownComment {
/// Method
private void test() {
}
}
+19
View File
@@ -0,0 +1,19 @@
/**
* Block comment
*/
class BlockComment {
/**
* Method
*/
private void test() {}
}
/// Markdown
/// Comment
class MarkdownComment {
/// Method
private void test() {}
}
@@ -1,6 +1,7 @@
class AccessorsFluent {
private String fieldName = "";
@java.lang.SuppressWarnings("all")
@lombok.Generated
public String fieldName() {
return this.fieldName;
}
@@ -8,6 +9,7 @@ class AccessorsFluent {
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public AccessorsFluent fieldName(final String fieldName) {
this.fieldName = fieldName;
return this;
@@ -17,10 +19,12 @@ class AccessorsFluentOnClass {
private String fieldName = "";
private String otherFieldWithOverride = "";
@java.lang.SuppressWarnings("all")
@lombok.Generated
public String fieldName() {
return this.fieldName;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public String getOtherFieldWithOverride() {
return this.otherFieldWithOverride;
}
@@ -28,6 +32,7 @@ class AccessorsFluentOnClass {
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public AccessorsFluentOnClass fieldName(final String fieldName) {
this.fieldName = fieldName;
return this;
@@ -39,6 +44,7 @@ class AccessorsChain {
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public AccessorsChain setRunning(final boolean isRunning) {
this.isRunning = isRunning;
return this;
@@ -48,6 +54,7 @@ class AccessorsPrefix {
private String fieldName;
private String fActualField;
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void setActualField(final String fActualField) {
this.fActualField = fActualField;
}
@@ -56,10 +63,12 @@ class AccessorsPrefix2 {
private String fieldName;
private String fActualField;
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void setFieldName(final String fieldName) {
this.fieldName = fieldName;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void setActualField(final String fActualField) {
this.fActualField = fActualField;
}
@@ -71,11 +80,13 @@ class AccessorsPrefix3 {
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "AccessorsPrefix3(fName=" + this.getName() + ")";
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
if (!(o instanceof AccessorsPrefix3)) return false;
@@ -87,11 +98,13 @@ class AccessorsPrefix3 {
return true;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
protected boolean canEqual(final java.lang.Object other) {
return other instanceof AccessorsPrefix3;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public int hashCode() {
final int PRIME = 59;
int result = 1;
@@ -106,6 +119,7 @@ class AccessorsFluentGenerics<T extends Number> {
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public AccessorsFluentGenerics<T> name(final String name) {
this.name = name;
return this;
@@ -114,6 +128,7 @@ class AccessorsFluentGenerics<T extends Number> {
class AccessorsFluentNoChaining {
private String name;
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void name(final String name) {
this.name = name;
}
@@ -121,6 +136,7 @@ class AccessorsFluentNoChaining {
class AccessorsFluentStatic<T extends Number> {
private static String name;
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static void name(final String name) {
AccessorsFluentStatic.name = name;
}
@@ -8,6 +8,7 @@ class AccessorsOuter {
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public AccessorsOuter.AccessorsInner1 setTest3(final String zTest3) {
this.zTest3 = zTest3;
return this;
@@ -16,6 +17,7 @@ class AccessorsOuter {
class AccessorsInner2 {
private String fTest4;
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void setTest4(final String fTest4) {
this.fTest4 = fTest4;
}
@@ -24,6 +26,7 @@ class AccessorsOuter {
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public AccessorsOuter setTest(final String fTest) {
this.fTest = fTest;
return this;
@@ -32,8 +35,9 @@ class AccessorsOuter {
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public AccessorsOuter setTest2(final String zTest2) {
this.zTest2 = zTest2;
return this;
}
}
}
@@ -1,10 +1,12 @@
class AccessorsConfiguration {
private String m_FieldName = "";
@java.lang.SuppressWarnings("all")
@lombok.Generated
public String fieldName() {
return this.m_FieldName;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void fieldName(final String m_FieldName) {
this.m_FieldName = m_FieldName;
}
@@ -12,6 +14,7 @@ class AccessorsConfiguration {
class AccessorsConfiguration2 {
private String m_FieldName = "";
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void setM_FieldName(final String m_FieldName) {
this.m_FieldName = m_FieldName;
}
@@ -22,6 +25,7 @@ class AccessorsConfiguration3 {
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public AccessorsConfiguration3 setFieldName(final String fFieldName) {
this.fFieldName = fFieldName;
return this;
@@ -1,18 +1,17 @@
public class AccessorsInAnonymousClass {
Object annonymous = new Object() {
class Inner {
private String string;
@java.lang.SuppressWarnings("all")
@lombok.Generated
public String string() {
return this.string;
}
/**
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public Inner string(final String string) {
this.string = string;
return this;
@@ -4,8 +4,9 @@ class AccessorsMakeFinal1 {
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public final AccessorsMakeFinal1 test(final String test) {
this.test = test;
return this;
}
}
}
@@ -1,7 +1,8 @@
class AccessorsMakeFinalLombokConfig {
private String test;
@java.lang.SuppressWarnings("all")
@lombok.Generated
public final void setTest(final String test) {
this.test = test;
}
}
}
@@ -1,6 +1,7 @@
class AccessorsNoParams {
private String otherFieldWithOverride = "";
@java.lang.SuppressWarnings("all")
@lombok.Generated
public String otherFieldWithOverride() {
return this.otherFieldWithOverride;
}
@@ -8,7 +9,8 @@ class AccessorsNoParams {
class AccessorsNoParams2 {
private boolean foo;
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void setFoo(final boolean foo) {
this.foo = foo;
}
}
}
@@ -1,48 +1,48 @@
public final class BuilderAccessWithGetter {
private final String string;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderAccessWithGetter(final String string) {
this.string = string;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
private static class BuilderAccessWithGetterBuilder {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private String string;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderAccessWithGetterBuilder() {
}
/**
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
private BuilderAccessWithGetter.BuilderAccessWithGetterBuilder string(final String string) {
this.string = string;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
private BuilderAccessWithGetter build() {
return new BuilderAccessWithGetter(this.string);
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderAccessWithGetter.BuilderAccessWithGetterBuilder(string=" + this.string + ")";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
private static BuilderAccessWithGetter.BuilderAccessWithGetterBuilder builder() {
return new BuilderAccessWithGetter.BuilderAccessWithGetterBuilder();
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public String getString() {
return this.string;
}
@@ -3,22 +3,29 @@ class BuilderComplex {
private static <T extends Number> void testVoidWithGenerics(T number, int arg2, String arg3, BuilderComplex selfRef) {
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static class TestVoidName<T extends Number> {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private T number;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private int arg2;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private String arg3;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private BuilderComplex selfRef;
@java.lang.SuppressWarnings("all")
@lombok.Generated
TestVoidName() {
}
/**
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderComplex.TestVoidName<T> number(final T number) {
this.number = number;
return this;
@@ -27,6 +34,7 @@ class BuilderComplex {
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderComplex.TestVoidName<T> arg2(final int arg2) {
this.arg2 = arg2;
return this;
@@ -35,6 +43,7 @@ class BuilderComplex {
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderComplex.TestVoidName<T> arg3(final String arg3) {
this.arg3 = arg3;
return this;
@@ -43,21 +52,25 @@ class BuilderComplex {
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderComplex.TestVoidName<T> selfRef(final BuilderComplex selfRef) {
this.selfRef = selfRef;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void execute() {
BuilderComplex.<T>testVoidWithGenerics(this.number, this.arg2, this.arg3, this.selfRef);
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderComplex.TestVoidName(number=" + this.number + ", arg2=" + this.arg2 + ", arg3=" + this.arg3 + ", selfRef=" + this.selfRef + ")";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static <T extends Number> BuilderComplex.TestVoidName<T> builder() {
return new BuilderComplex.TestVoidName<T>();
}
@@ -1,5 +1,4 @@
import java.util.List;
class BuilderConstructorJavadoc<T> {
/**
* This is a comment
@@ -10,26 +9,30 @@ class BuilderConstructorJavadoc<T> {
* {@code @code} or <code>tags</code>
* @param predef don't copy this one
* @param predefWithJavadoc don't copy this one
* @param last also copy last param
*/
BuilderConstructorJavadoc(int basic, int multiline, int predef, int predefWithJavadoc) {
BuilderConstructorJavadoc(int basic, int multiline, int predef, int predefWithJavadoc, int last) {
}
public static class BuilderConstructorJavadocBuilder<T> {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private int basic;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private int multiline;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private int predef;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private int predefWithJavadoc;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private int last;
public BuilderConstructorJavadocBuilder<T> predef(final int x) {
this.predef = x;
return this;
}
/**
* This javadoc remains untouched.
* @param x 1/100 of the thing
@@ -39,21 +42,20 @@ class BuilderConstructorJavadoc<T> {
this.predefWithJavadoc = x;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderConstructorJavadocBuilder() {
}
/**
* @param basic tag is moved to the setter
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderConstructorJavadoc.BuilderConstructorJavadocBuilder<T> basic(final int basic) {
this.basic = basic;
return this;
}
/**
* @param multiline a param comment
* can be on multiple lines and can use
@@ -61,25 +63,36 @@ class BuilderConstructorJavadoc<T> {
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderConstructorJavadoc.BuilderConstructorJavadocBuilder<T> multiline(final int multiline) {
this.multiline = multiline;
return this;
}
/**
* @param last also copy last param
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderConstructorJavadoc.BuilderConstructorJavadocBuilder<T> last(final int last) {
this.last = last;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderConstructorJavadoc<T> build() {
return new BuilderConstructorJavadoc<T>(this.basic, this.multiline, this.predef, this.predefWithJavadoc);
return new BuilderConstructorJavadoc<T>(this.basic, this.multiline, this.predef, this.predefWithJavadoc, this.last);
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderConstructorJavadoc.BuilderConstructorJavadocBuilder(basic=" + this.basic + ", multiline=" + this.multiline + ", predef=" + this.predef + ", predefWithJavadoc=" + this.predefWithJavadoc + ")";
return "BuilderConstructorJavadoc.BuilderConstructorJavadocBuilder(basic=" + this.basic + ", multiline=" + this.multiline + ", predef=" + this.predef + ", predefWithJavadoc=" + this.predefWithJavadoc + ", last=" + this.last + ")";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static <T> BuilderConstructorJavadoc.BuilderConstructorJavadocBuilder<T> builder() {
return new BuilderConstructorJavadoc.BuilderConstructorJavadocBuilder<T>();
}
}
}
@@ -3,38 +3,49 @@ public final class BuilderDefaults {
private final String name;
private final long z;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private static int $default$x() {
return 10;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
private static long $default$z() {
return System.currentTimeMillis();
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderDefaults(final int x, final String name, final long z) {
this.x = x;
this.name = name;
this.z = z;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static class BuilderDefaultsBuilder {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private boolean x$set;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private int x$value;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private String name;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private boolean z$set;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private long z$value;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderDefaultsBuilder() {
}
/**
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderDefaults.BuilderDefaultsBuilder x(final int x) {
this.x$value = x;
x$set = true;
@@ -44,6 +55,7 @@ public final class BuilderDefaults {
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderDefaults.BuilderDefaultsBuilder name(final String name) {
this.name = name;
return this;
@@ -52,12 +64,14 @@ public final class BuilderDefaults {
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderDefaults.BuilderDefaultsBuilder z(final long z) {
this.z$value = z;
z$set = true;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderDefaults build() {
int x$value = this.x$value;
if (!this.x$set) x$value = BuilderDefaults.$default$x();
@@ -67,28 +81,34 @@ public final class BuilderDefaults {
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderDefaults.BuilderDefaultsBuilder(x$value=" + this.x$value + ", name=" + this.name + ", z$value=" + this.z$value + ")";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static BuilderDefaults.BuilderDefaultsBuilder builder() {
return new BuilderDefaults.BuilderDefaultsBuilder();
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public int getX() {
return this.x;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public String getName() {
return this.name;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public long getZ() {
return this.z;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
if (!(o instanceof BuilderDefaults)) return false;
@@ -102,6 +122,7 @@ public final class BuilderDefaults {
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public int hashCode() {
final int PRIME = 59;
int result = 1;
@@ -114,7 +135,8 @@ public final class BuilderDefaults {
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderDefaults(x=" + this.getX() + ", name=" + this.getName() + ", z=" + this.getZ() + ")";
}
}
}
@@ -1,62 +1,64 @@
import lombok.Value;
public class BuilderDefaultsArray {
int[] x;
java.lang.String[][] y;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private static int[] $default$x() {
return new int[] {1, 2};
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
private static java.lang.String[][] $default$y() {
return new java.lang.String[][] {};
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderDefaultsArray(final int[] x, final java.lang.String[][] y) {
this.x = x;
this.y = y;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static class BuilderDefaultsArrayBuilder {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private boolean x$set;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private int[] x$value;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private boolean y$set;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private java.lang.String[][] y$value;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderDefaultsArrayBuilder() {
}
/**
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderDefaultsArray.BuilderDefaultsArrayBuilder x(final int[] x) {
this.x$value = x;
x$set = true;
return this;
}
/**
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderDefaultsArray.BuilderDefaultsArrayBuilder y(final java.lang.String[][] y) {
this.y$value = y;
y$set = true;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderDefaultsArray build() {
int[] x$value = this.x$value;
if (!this.x$set) x$value = BuilderDefaultsArray.$default$x();
@@ -64,15 +66,15 @@ public class BuilderDefaultsArray {
if (!this.y$set) y$value = BuilderDefaultsArray.$default$y();
return new BuilderDefaultsArray(x$value, y$value);
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderDefaultsArray.BuilderDefaultsArrayBuilder(x$value=" + java.util.Arrays.toString(this.x$value) + ", y$value=" + java.util.Arrays.deepToString(this.y$value) + ")";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static BuilderDefaultsArray.BuilderDefaultsArrayBuilder builder() {
return new BuilderDefaultsArray.BuilderDefaultsArrayBuilder();
}
@@ -4,44 +4,57 @@ public class BuilderDefaultsGenerics<N extends Number, T, R extends List<T>> {
private T tee;
private R arrr;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private static <N extends Number, T, R extends List<T>> java.util.concurrent.Callable<N> $default$callable() {
return null;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
private static <N extends Number, T, R extends List<T>> T $default$tee() {
return null;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
private static <N extends Number, T, R extends List<T>> R $default$arrr() {
return null;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderDefaultsGenerics(final java.util.concurrent.Callable<N> callable, final T tee, final R arrr) {
this.callable = callable;
this.tee = tee;
this.arrr = arrr;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static class BuilderDefaultsGenericsBuilder<N extends Number, T, R extends List<T>> {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private boolean callable$set;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private java.util.concurrent.Callable<N> callable$value;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private boolean tee$set;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private T tee$value;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private boolean arrr$set;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private R arrr$value;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderDefaultsGenericsBuilder() {
}
/**
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderDefaultsGenerics.BuilderDefaultsGenericsBuilder<N, T, R> callable(final java.util.concurrent.Callable<N> callable) {
this.callable$value = callable;
callable$set = true;
@@ -51,6 +64,7 @@ public class BuilderDefaultsGenerics<N extends Number, T, R extends List<T>> {
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderDefaultsGenerics.BuilderDefaultsGenericsBuilder<N, T, R> tee(final T tee) {
this.tee$value = tee;
tee$set = true;
@@ -60,12 +74,14 @@ public class BuilderDefaultsGenerics<N extends Number, T, R extends List<T>> {
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderDefaultsGenerics.BuilderDefaultsGenericsBuilder<N, T, R> arrr(final R arrr) {
this.arrr$value = arrr;
arrr$set = true;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderDefaultsGenerics<N, T, R> build() {
java.util.concurrent.Callable<N> callable$value = this.callable$value;
if (!this.callable$set) callable$value = BuilderDefaultsGenerics.<N, T, R>$default$callable();
@@ -77,11 +93,13 @@ public class BuilderDefaultsGenerics<N extends Number, T, R extends List<T>> {
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderDefaultsGenerics.BuilderDefaultsGenericsBuilder(callable$value=" + this.callable$value + ", tee$value=" + this.tee$value + ", arrr$value=" + this.arrr$value + ")";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static <N extends Number, T, R extends List<T>> BuilderDefaultsGenerics.BuilderDefaultsGenericsBuilder<N, T, R> builder() {
return new BuilderDefaultsGenerics.BuilderDefaultsGenericsBuilder<N, T, R>();
}
@@ -1,59 +1,58 @@
import java.util.Arrays;
public class BuilderDefaultsTargetTyping {
String foo;
static String doSth(java.util.List<Integer> i, java.util.List<Character> c) {
return null;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
private static String $default$foo() {
return doSth(Arrays.asList(1), Arrays.asList('a'));
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderDefaultsTargetTyping(final String foo) {
this.foo = foo;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static class BuilderDefaultsTargetTypingBuilder {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private boolean foo$set;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private String foo$value;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderDefaultsTargetTypingBuilder() {
}
/**
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderDefaultsTargetTyping.BuilderDefaultsTargetTypingBuilder foo(final String foo) {
this.foo$value = foo;
foo$set = true;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderDefaultsTargetTyping build() {
String foo$value = this.foo$value;
if (!this.foo$set) foo$value = BuilderDefaultsTargetTyping.$default$foo();
return new BuilderDefaultsTargetTyping(foo$value);
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderDefaultsTargetTyping.BuilderDefaultsTargetTypingBuilder(foo$value=" + this.foo$value + ")";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static BuilderDefaultsTargetTyping.BuilderDefaultsTargetTypingBuilder builder() {
return new BuilderDefaultsTargetTyping.BuilderDefaultsTargetTypingBuilder();
}
@@ -5,26 +5,33 @@ public class BuilderDefaultsWarnings {
int z;
java.util.List<String> items;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderDefaultsWarnings(final long x, final int z, final java.util.List<String> items) {
this.x = x;
this.z = z;
this.items = items;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static class BuilderDefaultsWarningsBuilder {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private long x;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private int z;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private java.util.ArrayList<String> items;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderDefaultsWarningsBuilder() {
}
/**
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderDefaultsWarnings.BuilderDefaultsWarningsBuilder x(final long x) {
this.x = x;
return this;
@@ -33,17 +40,20 @@ public class BuilderDefaultsWarnings {
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderDefaultsWarnings.BuilderDefaultsWarningsBuilder z(final int z) {
this.z = z;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderDefaultsWarnings.BuilderDefaultsWarningsBuilder item(final String item) {
if (this.items == null) this.items = new java.util.ArrayList<String>();
this.items.add(item);
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderDefaultsWarnings.BuilderDefaultsWarningsBuilder items(final java.util.Collection<? extends String> items) {
if (items == null) {
throw new java.lang.NullPointerException("items cannot be null");
@@ -53,11 +63,13 @@ public class BuilderDefaultsWarnings {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderDefaultsWarnings.BuilderDefaultsWarningsBuilder clearItems() {
if (this.items != null) this.items.clear();
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderDefaultsWarnings build() {
java.util.List<String> items;
switch (this.items == null ? 0 : this.items.size()) {
@@ -74,11 +86,13 @@ public class BuilderDefaultsWarnings {
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderDefaultsWarnings.BuilderDefaultsWarningsBuilder(x=" + this.x + ", z=" + this.z + ", items=" + this.items + ")";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static BuilderDefaultsWarnings.BuilderDefaultsWarningsBuilder builder() {
return new BuilderDefaultsWarnings.BuilderDefaultsWarningsBuilder();
}
@@ -88,21 +102,26 @@ class NoBuilderButHasDefaults {
public NoBuilderButHasDefaults() {
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static class NoBuilderButHasDefaultsBuilder {
@java.lang.SuppressWarnings("all")
@lombok.Generated
NoBuilderButHasDefaultsBuilder() {
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public NoBuilderButHasDefaults build() {
return new NoBuilderButHasDefaults();
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "NoBuilderButHasDefaults.NoBuilderButHasDefaultsBuilder()";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static NoBuilderButHasDefaults.NoBuilderButHasDefaultsBuilder builder() {
return new NoBuilderButHasDefaults.NoBuilderButHasDefaultsBuilder();
}
@@ -5,18 +5,23 @@ class BuilderGenericMethod<T> {
return null;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public class MapBuilder<N extends Number> {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private int a;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private long b;
@java.lang.SuppressWarnings("all")
@lombok.Generated
MapBuilder() {
}
/**
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderGenericMethod<T>.MapBuilder<N> a(final int a) {
this.a = a;
return this;
@@ -25,21 +30,25 @@ class BuilderGenericMethod<T> {
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderGenericMethod<T>.MapBuilder<N> b(final long b) {
this.b = b;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public Map<N, T> build() {
return BuilderGenericMethod.this.<N>foo(this.a, this.b);
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderGenericMethod.MapBuilder(a=" + this.a + ", b=" + this.b + ")";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public <N extends Number> BuilderGenericMethod<T>.MapBuilder<N> builder() {
return this.new MapBuilder<N>();
}
@@ -4,22 +4,29 @@ class BuilderInstanceMethod<T> {
return "" + show + yes + also + $andMe;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public class StringBuilder {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private int show;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private int yes;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private List<T> also;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private int $andMe;
@java.lang.SuppressWarnings("all")
@lombok.Generated
StringBuilder() {
}
/**
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderInstanceMethod<T>.StringBuilder show(final int show) {
this.show = show;
return this;
@@ -28,6 +35,7 @@ class BuilderInstanceMethod<T> {
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderInstanceMethod<T>.StringBuilder yes(final int yes) {
this.yes = yes;
return this;
@@ -36,6 +44,7 @@ class BuilderInstanceMethod<T> {
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderInstanceMethod<T>.StringBuilder also(final List<T> also) {
this.also = also;
return this;
@@ -44,21 +53,25 @@ class BuilderInstanceMethod<T> {
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderInstanceMethod<T>.StringBuilder $andMe(final int $andMe) {
this.$andMe = $andMe;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public String build() {
return BuilderInstanceMethod.this.create(this.show, this.yes, this.also, this.$andMe);
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderInstanceMethod.StringBuilder(show=" + this.show + ", yes=" + this.yes + ", also=" + this.also + ", $andMe=" + this.$andMe + ")";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderInstanceMethod<T>.StringBuilder builder() {
return this.new StringBuilder();
}
@@ -24,12 +24,16 @@ class BuilderJavadoc<T> {
private final int predefWithJavadoc;
public static class BuilderJavadocBuilder<T> {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private int basic;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private int getsetwith;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private int predef;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private int predefWithJavadoc;
public BuilderJavadocBuilder<T> predef(final int x) {
this.predef = x * 10;
@@ -45,6 +49,7 @@ class BuilderJavadoc<T> {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderJavadocBuilder() {
}
/**
@@ -54,6 +59,7 @@ class BuilderJavadoc<T> {
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderJavadoc.BuilderJavadocBuilder<T> basic(final int basic) {
this.basic = basic;
return this;
@@ -64,21 +70,34 @@ class BuilderJavadoc<T> {
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderJavadoc.BuilderJavadocBuilder<T> getsetwith(final int getsetwith) {
this.getsetwith = getsetwith;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderJavadoc<T> build() {
return new BuilderJavadoc<T>(this.basic, this.getsetwith, this.predef, this.predefWithJavadoc);
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderJavadoc.BuilderJavadocBuilder(basic=" + this.basic + ", getsetwith=" + this.getsetwith + ", predef=" + this.predef + ", predefWithJavadoc=" + this.predefWithJavadoc + ")";
}
}
/**
* Creates a new {@code BuilderJavadoc} instance.
*
* @param basic basic gets only a builder setter.
* @see #getsetwith
* @param getsetwith getsetwith gets a builder setter, an instance getter and setter, and a wither.
* @param predef Predef has a predefined builder setter with no javadoc, and the builder setter does not get this one.
* @param predefWithJavadoc predefWithJavadoc has a predefined builder setter with javadoc, so it keeps that one untouched.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderJavadoc(final int basic, final int getsetwith, final int predef, final int predefWithJavadoc) {
this.basic = basic;
this.getsetwith = getsetwith;
@@ -86,6 +105,7 @@ class BuilderJavadoc<T> {
this.predefWithJavadoc = predefWithJavadoc;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static <T> BuilderJavadoc.BuilderJavadocBuilder<T> builder() {
return new BuilderJavadoc.BuilderJavadocBuilder<T>();
}
@@ -94,6 +114,7 @@ class BuilderJavadoc<T> {
* @return tag is moved to the getter.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public int getGetsetwith() {
return this.getsetwith;
}
@@ -102,6 +123,7 @@ class BuilderJavadoc<T> {
* @param tag is moved to the setters and wither.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void setGetsetwith(final int getsetwith) {
this.getsetwith = getsetwith;
}
@@ -111,6 +133,7 @@ class BuilderJavadoc<T> {
* @return a clone of this object, except with this updated property (returns {@code this} if an identical value is passed).
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderJavadoc<T> withGetsetwith(final int getsetwith) {
return this.getsetwith == getsetwith ? this : new BuilderJavadoc<T>(this.basic, getsetwith, this.predef, this.predefWithJavadoc);
}
@@ -4,44 +4,54 @@ class BuilderNestedInEnum {
public static final class TestBuilder {
private final String field;
@java.lang.SuppressWarnings("all")
@lombok.Generated
TestBuilder(final String field) {
this.field = field;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static class TestBuilderBuilder {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private String field;
@java.lang.SuppressWarnings("all")
@lombok.Generated
TestBuilderBuilder() {
}
/**
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderNestedInEnum.TestEnum.TestBuilder.TestBuilderBuilder field(final String field) {
this.field = field;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderNestedInEnum.TestEnum.TestBuilder build() {
return new BuilderNestedInEnum.TestEnum.TestBuilder(this.field);
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderNestedInEnum.TestEnum.TestBuilder.TestBuilderBuilder(field=" + this.field + ")";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static BuilderNestedInEnum.TestEnum.TestBuilder.TestBuilderBuilder builder() {
return new BuilderNestedInEnum.TestEnum.TestBuilder.TestBuilderBuilder();
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public String getField() {
return this.field;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
if (!(o instanceof BuilderNestedInEnum.TestEnum.TestBuilder)) return false;
@@ -53,6 +63,7 @@ class BuilderNestedInEnum {
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public int hashCode() {
final int PRIME = 59;
int result = 1;
@@ -62,9 +73,10 @@ class BuilderNestedInEnum {
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderNestedInEnum.TestEnum.TestBuilder(field=" + this.getField() + ")";
}
}
}
}
}
@@ -0,0 +1,83 @@
public class BuilderNestedJavadoc {
public static class NestedClass {
/**
* Example javadoc
*/
String name;
/**
* Creates a new {@code NestedClass} instance.
*
* @param name Example javadoc
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
NestedClass(final String name) {
this.name = name;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static class NestedClassBuilder {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private String name;
@java.lang.SuppressWarnings("all")
@lombok.Generated
NestedClassBuilder() {
}
/**
* Example javadoc
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderNestedJavadoc.NestedClass.NestedClassBuilder name(final String name) {
this.name = name;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderNestedJavadoc.NestedClass build() {
return new BuilderNestedJavadoc.NestedClass(this.name);
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderNestedJavadoc.NestedClass.NestedClassBuilder(name=" + this.name + ")";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static BuilderNestedJavadoc.NestedClass.NestedClassBuilder builder() {
return new BuilderNestedJavadoc.NestedClass.NestedClassBuilder();
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderNestedJavadoc() {
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static class BuilderNestedJavadocBuilder {
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderNestedJavadocBuilder() {
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderNestedJavadoc build() {
return new BuilderNestedJavadoc();
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderNestedJavadoc.BuilderNestedJavadocBuilder()";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static BuilderNestedJavadoc.BuilderNestedJavadocBuilder builder() {
return new BuilderNestedJavadoc.BuilderNestedJavadocBuilder();
}
}
@@ -1,47 +1,45 @@
public class BuilderOnNestedClass<T> {
private T t;
public static class Nested {
private String a;
@java.lang.SuppressWarnings("all")
@lombok.Generated
Nested(final String a) {
this.a = a;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static class NestedBuilder {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private String a;
@java.lang.SuppressWarnings("all")
@lombok.Generated
NestedBuilder() {
}
/**
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderOnNestedClass.Nested.NestedBuilder a(final String a) {
this.a = a;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderOnNestedClass.Nested build() {
return new BuilderOnNestedClass.Nested(this.a);
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderOnNestedClass.Nested.NestedBuilder(a=" + this.a + ")";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static BuilderOnNestedClass.Nested.NestedBuilder builder() {
return new BuilderOnNestedClass.Nested.NestedBuilder();
}
@@ -1,39 +1,39 @@
// version 14:
public record BuilderOnNestedRecord<T>(T t) {
public record Nested(String a) {
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static class NestedBuilder {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private String a;
@java.lang.SuppressWarnings("all")
@lombok.Generated
NestedBuilder() {
}
/**
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderOnNestedRecord.Nested.NestedBuilder a(final String a) {
this.a = a;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderOnNestedRecord.Nested build() {
return new BuilderOnNestedRecord.Nested(this.a);
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderOnNestedRecord.Nested.NestedBuilder(a=" + this.a + ")";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static BuilderOnNestedRecord.Nested.NestedBuilder builder() {
return new BuilderOnNestedRecord.Nested.NestedBuilder();
}
@@ -5,23 +5,29 @@ class BuilderSimple<T> {
private List<T> also;
private int $butNotMe;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderSimple(final int yes, final List<T> also) {
this.yes = yes;
this.also = also;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
protected static class BuilderSimpleBuilder<T> {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private int yes;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private List<T> also;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderSimpleBuilder() {
}
/**
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSimple.BuilderSimpleBuilder<T> yes(final int yes) {
this.yes = yes;
return this;
@@ -30,21 +36,25 @@ class BuilderSimple<T> {
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSimple.BuilderSimpleBuilder<T> also(final List<T> also) {
this.also = also;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSimple<T> build() {
return new BuilderSimple<T>(this.yes, this.also);
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderSimple.BuilderSimpleBuilder(yes=" + this.yes + ", also=" + this.also + ")";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
protected static <T> BuilderSimple.BuilderSimpleBuilder<T> builder() {
return new BuilderSimple.BuilderSimpleBuilder<T>();
}
@@ -2,18 +2,23 @@
import java.util.List;
public record BuilderSimpleOnRecord<T>(List<T> l, String a) {
@java.lang.SuppressWarnings("all")
@lombok.Generated
protected static class BuilderSimpleOnRecordBuilder<T> {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private List<T> l;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private String a;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderSimpleOnRecordBuilder() {
}
/**
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSimpleOnRecord.BuilderSimpleOnRecordBuilder<T> l(final List<T> l) {
this.l = l;
return this;
@@ -22,21 +27,25 @@ public record BuilderSimpleOnRecord<T>(List<T> l, String a) {
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSimpleOnRecord.BuilderSimpleOnRecordBuilder<T> a(final String a) {
this.a = a;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSimpleOnRecord<T> build() {
return new BuilderSimpleOnRecord<T>(this.l, this.a);
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderSimpleOnRecord.BuilderSimpleOnRecordBuilder(l=" + this.l + ", a=" + this.a + ")";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
protected static <T> BuilderSimpleOnRecord.BuilderSimpleOnRecordBuilder<T> builder() {
return new BuilderSimpleOnRecord.BuilderSimpleOnRecordBuilder<T>();
}
@@ -2,35 +2,43 @@ import java.util.List;
class BuilderSimpleWithSetterPrefix<T> {
private int unprefixed;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderSimpleWithSetterPrefix(final int unprefixed) {
this.unprefixed = unprefixed;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
protected static class BuilderSimpleWithSetterPrefixBuilder<T> {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private int unprefixed;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderSimpleWithSetterPrefixBuilder() {
}
/**
* @return {@code this}.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSimpleWithSetterPrefix.BuilderSimpleWithSetterPrefixBuilder<T> withUnprefixed(final int unprefixed) {
this.unprefixed = unprefixed;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSimpleWithSetterPrefix<T> build() {
return new BuilderSimpleWithSetterPrefix<T>(this.unprefixed);
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderSimpleWithSetterPrefix.BuilderSimpleWithSetterPrefixBuilder(unprefixed=" + this.unprefixed + ")";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
protected static <T> BuilderSimpleWithSetterPrefix.BuilderSimpleWithSetterPrefixBuilder<T> builder() {
return new BuilderSimpleWithSetterPrefix.BuilderSimpleWithSetterPrefixBuilder<T>();
}
@@ -11,22 +11,29 @@ class BuilderSingularAnnotatedTypes {
private Set<@MyAnnotation @NonNull String> foos;
private Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderSingularAnnotatedTypes(final Set<@MyAnnotation @NonNull String> foos, final Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars) {
this.foos = foos;
this.bars = bars;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static class BuilderSingularAnnotatedTypesBuilder {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private java.util.ArrayList<@MyAnnotation @NonNull String> foos;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private java.util.ArrayList<@MyAnnotation @NonNull String> bars$key;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private java.util.ArrayList<@MyAnnotation @NonNull Integer> bars$value;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderSingularAnnotatedTypesBuilder() {
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularAnnotatedTypes.BuilderSingularAnnotatedTypesBuilder foo(@MyAnnotation @NonNull final String foo) {
if (foo == null) {
throw new java.lang.NullPointerException("foo is marked non-null but is null");
@@ -36,6 +43,7 @@ class BuilderSingularAnnotatedTypes {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularAnnotatedTypes.BuilderSingularAnnotatedTypesBuilder foos(final java.util.Collection<? extends @MyAnnotation @NonNull String> foos) {
if (foos == null) {
throw new java.lang.NullPointerException("foos cannot be null");
@@ -45,11 +53,13 @@ class BuilderSingularAnnotatedTypes {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularAnnotatedTypes.BuilderSingularAnnotatedTypesBuilder clearFoos() {
if (this.foos != null) this.foos.clear();
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularAnnotatedTypes.BuilderSingularAnnotatedTypesBuilder bar(@MyAnnotation @NonNull final String barKey, @MyAnnotation @NonNull final Integer barValue) {
if (barKey == null) {
throw new java.lang.NullPointerException("barKey is marked non-null but is null");
@@ -66,6 +76,7 @@ class BuilderSingularAnnotatedTypes {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularAnnotatedTypes.BuilderSingularAnnotatedTypesBuilder bars(final java.util.Map<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> bars) {
if (bars == null) {
throw new java.lang.NullPointerException("bars cannot be null");
@@ -81,6 +92,7 @@ class BuilderSingularAnnotatedTypes {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularAnnotatedTypes.BuilderSingularAnnotatedTypesBuilder clearBars() {
if (this.bars$key != null) {
this.bars$key.clear();
@@ -89,6 +101,7 @@ class BuilderSingularAnnotatedTypes {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularAnnotatedTypes build() {
java.util.Set<@MyAnnotation @NonNull String> foos;
switch (this.foos == null ? 0 : this.foos.size()) {
@@ -120,12 +133,14 @@ class BuilderSingularAnnotatedTypes {
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderSingularAnnotatedTypes.BuilderSingularAnnotatedTypesBuilder(foos=" + this.foos + ", bars$key=" + this.bars$key + ", bars$value=" + this.bars$value + ")";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static BuilderSingularAnnotatedTypes.BuilderSingularAnnotatedTypesBuilder builder() {
return new BuilderSingularAnnotatedTypes.BuilderSingularAnnotatedTypesBuilder();
}
}
}
@@ -11,22 +11,29 @@ class BuilderSingularAnnotatedTypesWithSetterPrefix {
private Set<@MyAnnotation @NonNull String> foos;
private Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderSingularAnnotatedTypesWithSetterPrefix(final Set<@MyAnnotation @NonNull String> foos, final Map<@MyAnnotation @NonNull String, @MyAnnotation @NonNull Integer> bars) {
this.foos = foos;
this.bars = bars;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static class BuilderSingularAnnotatedTypesWithSetterPrefixBuilder {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private java.util.ArrayList<@MyAnnotation @NonNull String> foos;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private java.util.ArrayList<@MyAnnotation @NonNull String> bars$key;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private java.util.ArrayList<@MyAnnotation @NonNull Integer> bars$value;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderSingularAnnotatedTypesWithSetterPrefixBuilder() {
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularAnnotatedTypesWithSetterPrefix.BuilderSingularAnnotatedTypesWithSetterPrefixBuilder withFoo(@MyAnnotation @NonNull final String foo) {
if (foo == null) {
throw new java.lang.NullPointerException("foo is marked non-null but is null");
@@ -36,6 +43,7 @@ class BuilderSingularAnnotatedTypesWithSetterPrefix {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularAnnotatedTypesWithSetterPrefix.BuilderSingularAnnotatedTypesWithSetterPrefixBuilder withFoos(final java.util.Collection<? extends @MyAnnotation @NonNull String> foos) {
if (foos == null) {
throw new java.lang.NullPointerException("foos cannot be null");
@@ -45,11 +53,13 @@ class BuilderSingularAnnotatedTypesWithSetterPrefix {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularAnnotatedTypesWithSetterPrefix.BuilderSingularAnnotatedTypesWithSetterPrefixBuilder clearFoos() {
if (this.foos != null) this.foos.clear();
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularAnnotatedTypesWithSetterPrefix.BuilderSingularAnnotatedTypesWithSetterPrefixBuilder withBar(@MyAnnotation @NonNull final String barKey, @MyAnnotation @NonNull final Integer barValue) {
if (barKey == null) {
throw new java.lang.NullPointerException("barKey is marked non-null but is null");
@@ -66,6 +76,7 @@ class BuilderSingularAnnotatedTypesWithSetterPrefix {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularAnnotatedTypesWithSetterPrefix.BuilderSingularAnnotatedTypesWithSetterPrefixBuilder withBars(final java.util.Map<? extends @MyAnnotation @NonNull String, ? extends @MyAnnotation @NonNull Integer> bars) {
if (bars == null) {
throw new java.lang.NullPointerException("bars cannot be null");
@@ -81,6 +92,7 @@ class BuilderSingularAnnotatedTypesWithSetterPrefix {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularAnnotatedTypesWithSetterPrefix.BuilderSingularAnnotatedTypesWithSetterPrefixBuilder clearBars() {
if (this.bars$key != null) {
this.bars$key.clear();
@@ -89,6 +101,7 @@ class BuilderSingularAnnotatedTypesWithSetterPrefix {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularAnnotatedTypesWithSetterPrefix build() {
java.util.Set<@MyAnnotation @NonNull String> foos;
switch (this.foos == null ? 0 : this.foos.size()) {
@@ -120,11 +133,13 @@ class BuilderSingularAnnotatedTypesWithSetterPrefix {
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderSingularAnnotatedTypesWithSetterPrefix.BuilderSingularAnnotatedTypesWithSetterPrefixBuilder(foos=" + this.foos + ", bars$key=" + this.bars$key + ", bars$value=" + this.bars$value + ")";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static BuilderSingularAnnotatedTypesWithSetterPrefix.BuilderSingularAnnotatedTypesWithSetterPrefixBuilder builder() {
return new BuilderSingularAnnotatedTypesWithSetterPrefix.BuilderSingularAnnotatedTypesWithSetterPrefixBuilder();
}
@@ -11,6 +11,7 @@ class BuilderSingularGuavaListsSets<T> {
private ImmutableSortedSet<String> passes;
private ImmutableTable<? extends Number, ? extends Number, String> users;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderSingularGuavaListsSets(final ImmutableList<T> cards, final ImmutableCollection<? extends Number> frogs, final ImmutableSet rawSet, final ImmutableSortedSet<String> passes, final ImmutableTable<? extends Number, ? extends Number, String> users) {
this.cards = cards;
this.frogs = frogs;
@@ -19,27 +20,36 @@ class BuilderSingularGuavaListsSets<T> {
this.users = users;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static class BuilderSingularGuavaListsSetsBuilder<T> {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private com.google.common.collect.ImmutableList.Builder<T> cards;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private com.google.common.collect.ImmutableList.Builder<Number> frogs;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private com.google.common.collect.ImmutableSet.Builder<java.lang.Object> rawSet;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private com.google.common.collect.ImmutableSortedSet.Builder<String> passes;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private com.google.common.collect.ImmutableTable.Builder<Number, Number, String> users;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderSingularGuavaListsSetsBuilder() {
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder<T> card(final T card) {
if (this.cards == null) this.cards = com.google.common.collect.ImmutableList.builder();
this.cards.add(card);
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder<T> cards(final java.lang.Iterable<? extends T> cards) {
if (cards == null) {
throw new java.lang.NullPointerException("cards cannot be null");
@@ -49,17 +59,20 @@ class BuilderSingularGuavaListsSets<T> {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder<T> clearCards() {
this.cards = null;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder<T> frog(final Number frog) {
if (this.frogs == null) this.frogs = com.google.common.collect.ImmutableList.builder();
this.frogs.add(frog);
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder<T> frogs(final java.lang.Iterable<? extends Number> frogs) {
if (frogs == null) {
throw new java.lang.NullPointerException("frogs cannot be null");
@@ -69,17 +82,20 @@ class BuilderSingularGuavaListsSets<T> {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder<T> clearFrogs() {
this.frogs = null;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder<T> rawSet(final java.lang.Object rawSet) {
if (this.rawSet == null) this.rawSet = com.google.common.collect.ImmutableSet.builder();
this.rawSet.add(rawSet);
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder<T> rawSet(final java.lang.Iterable<?> rawSet) {
if (rawSet == null) {
throw new java.lang.NullPointerException("rawSet cannot be null");
@@ -89,17 +105,20 @@ class BuilderSingularGuavaListsSets<T> {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder<T> clearRawSet() {
this.rawSet = null;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder<T> pass(final String pass) {
if (this.passes == null) this.passes = com.google.common.collect.ImmutableSortedSet.naturalOrder();
this.passes.add(pass);
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder<T> passes(final java.lang.Iterable<? extends String> passes) {
if (passes == null) {
throw new java.lang.NullPointerException("passes cannot be null");
@@ -109,17 +128,20 @@ class BuilderSingularGuavaListsSets<T> {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder<T> clearPasses() {
this.passes = null;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder<T> user(final Number rowKey, final Number columnKey, final String value) {
if (this.users == null) this.users = com.google.common.collect.ImmutableTable.builder();
this.users.put(rowKey, columnKey, value);
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder<T> users(final com.google.common.collect.Table<? extends Number, ? extends Number, ? extends String> users) {
if (users == null) {
throw new java.lang.NullPointerException("users cannot be null");
@@ -129,11 +151,13 @@ class BuilderSingularGuavaListsSets<T> {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder<T> clearUsers() {
this.users = null;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularGuavaListsSets<T> build() {
com.google.common.collect.ImmutableList<T> cards = this.cards == null ? com.google.common.collect.ImmutableList.<T>of() : this.cards.build();
com.google.common.collect.ImmutableCollection<Number> frogs = this.frogs == null ? com.google.common.collect.ImmutableList.<Number>of() : this.frogs.build();
@@ -144,11 +168,13 @@ class BuilderSingularGuavaListsSets<T> {
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder(cards=" + this.cards + ", frogs=" + this.frogs + ", rawSet=" + this.rawSet + ", passes=" + this.passes + ", users=" + this.users + ")";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static <T> BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder<T> builder() {
return new BuilderSingularGuavaListsSets.BuilderSingularGuavaListsSetsBuilder<T>();
}
@@ -7,29 +7,37 @@ class BuilderSingularGuavaMaps<K, V> {
@SuppressWarnings("all")
private ImmutableBiMap rawMap;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderSingularGuavaMaps(final ImmutableMap<K, V> battleaxes, final ImmutableSortedMap<Integer, ? extends V> vertices, final ImmutableBiMap rawMap) {
this.battleaxes = battleaxes;
this.vertices = vertices;
this.rawMap = rawMap;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static class BuilderSingularGuavaMapsBuilder<K, V> {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private com.google.common.collect.ImmutableMap.Builder<K, V> battleaxes;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private com.google.common.collect.ImmutableSortedMap.Builder<Integer, V> vertices;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private com.google.common.collect.ImmutableBiMap.Builder<java.lang.Object, java.lang.Object> rawMap;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderSingularGuavaMapsBuilder() {
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularGuavaMaps.BuilderSingularGuavaMapsBuilder<K, V> battleaxe(final K key, final V value) {
if (this.battleaxes == null) this.battleaxes = com.google.common.collect.ImmutableMap.builder();
this.battleaxes.put(key, value);
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularGuavaMaps.BuilderSingularGuavaMapsBuilder<K, V> battleaxes(final java.util.Map<? extends K, ? extends V> battleaxes) {
if (battleaxes == null) {
throw new java.lang.NullPointerException("battleaxes cannot be null");
@@ -39,17 +47,20 @@ class BuilderSingularGuavaMaps<K, V> {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularGuavaMaps.BuilderSingularGuavaMapsBuilder<K, V> clearBattleaxes() {
this.battleaxes = null;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularGuavaMaps.BuilderSingularGuavaMapsBuilder<K, V> vertex(final Integer key, final V value) {
if (this.vertices == null) this.vertices = com.google.common.collect.ImmutableSortedMap.naturalOrder();
this.vertices.put(key, value);
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularGuavaMaps.BuilderSingularGuavaMapsBuilder<K, V> vertices(final java.util.Map<? extends Integer, ? extends V> vertices) {
if (vertices == null) {
throw new java.lang.NullPointerException("vertices cannot be null");
@@ -59,17 +70,20 @@ class BuilderSingularGuavaMaps<K, V> {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularGuavaMaps.BuilderSingularGuavaMapsBuilder<K, V> clearVertices() {
this.vertices = null;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularGuavaMaps.BuilderSingularGuavaMapsBuilder<K, V> rawMap(final java.lang.Object key, final java.lang.Object value) {
if (this.rawMap == null) this.rawMap = com.google.common.collect.ImmutableBiMap.builder();
this.rawMap.put(key, value);
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularGuavaMaps.BuilderSingularGuavaMapsBuilder<K, V> rawMap(final java.util.Map<?, ?> rawMap) {
if (rawMap == null) {
throw new java.lang.NullPointerException("rawMap cannot be null");
@@ -79,11 +93,13 @@ class BuilderSingularGuavaMaps<K, V> {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularGuavaMaps.BuilderSingularGuavaMapsBuilder<K, V> clearRawMap() {
this.rawMap = null;
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularGuavaMaps<K, V> build() {
com.google.common.collect.ImmutableMap<K, V> battleaxes = this.battleaxes == null ? com.google.common.collect.ImmutableMap.<K, V>of() : this.battleaxes.build();
com.google.common.collect.ImmutableSortedMap<Integer, V> vertices = this.vertices == null ? com.google.common.collect.ImmutableSortedMap.<Integer, V>of() : this.vertices.build();
@@ -92,11 +108,13 @@ class BuilderSingularGuavaMaps<K, V> {
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderSingularGuavaMaps.BuilderSingularGuavaMapsBuilder(battleaxes=" + this.battleaxes + ", vertices=" + this.vertices + ", rawMap=" + this.rawMap + ")";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static <K, V> BuilderSingularGuavaMaps.BuilderSingularGuavaMapsBuilder<K, V> builder() {
return new BuilderSingularGuavaMaps.BuilderSingularGuavaMapsBuilder<K, V>();
}
@@ -6,29 +6,37 @@ class BuilderSingularLists<T> {
@SuppressWarnings("all")
private List rawList;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderSingularLists(final List<T> children, final Collection<? extends Number> scarves, final List rawList) {
this.children = children;
this.scarves = scarves;
this.rawList = rawList;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static class BuilderSingularListsBuilder<T> {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private java.util.ArrayList<T> children;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private java.util.ArrayList<Number> scarves;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private java.util.ArrayList<java.lang.Object> rawList;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderSingularListsBuilder() {
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularLists.BuilderSingularListsBuilder<T> child(final T child) {
if (this.children == null) this.children = new java.util.ArrayList<T>();
this.children.add(child);
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularLists.BuilderSingularListsBuilder<T> children(final java.util.Collection<? extends T> children) {
if (children == null) {
throw new java.lang.NullPointerException("children cannot be null");
@@ -38,17 +46,20 @@ class BuilderSingularLists<T> {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularLists.BuilderSingularListsBuilder<T> clearChildren() {
if (this.children != null) this.children.clear();
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularLists.BuilderSingularListsBuilder<T> scarf(final Number scarf) {
if (this.scarves == null) this.scarves = new java.util.ArrayList<Number>();
this.scarves.add(scarf);
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularLists.BuilderSingularListsBuilder<T> scarves(final java.util.Collection<? extends Number> scarves) {
if (scarves == null) {
throw new java.lang.NullPointerException("scarves cannot be null");
@@ -58,17 +69,20 @@ class BuilderSingularLists<T> {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularLists.BuilderSingularListsBuilder<T> clearScarves() {
if (this.scarves != null) this.scarves.clear();
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularLists.BuilderSingularListsBuilder<T> rawList(final java.lang.Object rawList) {
if (this.rawList == null) this.rawList = new java.util.ArrayList<java.lang.Object>();
this.rawList.add(rawList);
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularLists.BuilderSingularListsBuilder<T> rawList(final java.util.Collection<?> rawList) {
if (rawList == null) {
throw new java.lang.NullPointerException("rawList cannot be null");
@@ -78,11 +92,13 @@ class BuilderSingularLists<T> {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularLists.BuilderSingularListsBuilder<T> clearRawList() {
if (this.rawList != null) this.rawList.clear();
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularLists<T> build() {
java.util.List<T> children;
switch (this.children == null ? 0 : this.children.size()) {
@@ -121,11 +137,13 @@ class BuilderSingularLists<T> {
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderSingularLists.BuilderSingularListsBuilder(children=" + this.children + ", scarves=" + this.scarves + ", rawList=" + this.rawList + ")";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static <T> BuilderSingularLists.BuilderSingularListsBuilder<T> builder() {
return new BuilderSingularLists.BuilderSingularListsBuilder<T>();
}
@@ -5,29 +5,37 @@ class BuilderSingularNoAuto {
private List<String> widgets;
private List<String> items;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderSingularNoAuto(final List<String> things, final List<String> widgets, final List<String> items) {
this.things = things;
this.widgets = widgets;
this.items = items;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static class BuilderSingularNoAutoBuilder {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private java.util.ArrayList<String> things;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private java.util.ArrayList<String> widgets;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private java.util.ArrayList<String> items;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderSingularNoAutoBuilder() {
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNoAuto.BuilderSingularNoAutoBuilder things(final String things) {
if (this.things == null) this.things = new java.util.ArrayList<String>();
this.things.add(things);
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNoAuto.BuilderSingularNoAutoBuilder things(final java.util.Collection<? extends String> things) {
if (things == null) {
throw new java.lang.NullPointerException("things cannot be null");
@@ -37,17 +45,20 @@ class BuilderSingularNoAuto {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNoAuto.BuilderSingularNoAutoBuilder clearThings() {
if (this.things != null) this.things.clear();
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNoAuto.BuilderSingularNoAutoBuilder widget(final String widget) {
if (this.widgets == null) this.widgets = new java.util.ArrayList<String>();
this.widgets.add(widget);
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNoAuto.BuilderSingularNoAutoBuilder widgets(final java.util.Collection<? extends String> widgets) {
if (widgets == null) {
throw new java.lang.NullPointerException("widgets cannot be null");
@@ -57,17 +68,20 @@ class BuilderSingularNoAuto {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNoAuto.BuilderSingularNoAutoBuilder clearWidgets() {
if (this.widgets != null) this.widgets.clear();
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNoAuto.BuilderSingularNoAutoBuilder items(final String items) {
if (this.items == null) this.items = new java.util.ArrayList<String>();
this.items.add(items);
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNoAuto.BuilderSingularNoAutoBuilder items(final java.util.Collection<? extends String> items) {
if (items == null) {
throw new java.lang.NullPointerException("items cannot be null");
@@ -77,11 +91,13 @@ class BuilderSingularNoAuto {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNoAuto.BuilderSingularNoAutoBuilder clearItems() {
if (this.items != null) this.items.clear();
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNoAuto build() {
java.util.List<String> things;
switch (this.things == null ? 0 : this.things.size()) {
@@ -120,11 +136,13 @@ class BuilderSingularNoAuto {
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderSingularNoAuto.BuilderSingularNoAutoBuilder(things=" + this.things + ", widgets=" + this.widgets + ", items=" + this.items + ")";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static BuilderSingularNoAuto.BuilderSingularNoAutoBuilder builder() {
return new BuilderSingularNoAuto.BuilderSingularNoAutoBuilder();
}
@@ -5,29 +5,37 @@ class BuilderSingularNoAutoWithSetterPrefix {
private List<String> widgets;
private List<String> items;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderSingularNoAutoWithSetterPrefix(final List<String> things, final List<String> widgets, final List<String> items) {
this.things = things;
this.widgets = widgets;
this.items = items;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static class BuilderSingularNoAutoWithSetterPrefixBuilder {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private java.util.ArrayList<String> things;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private java.util.ArrayList<String> widgets;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private java.util.ArrayList<String> items;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderSingularNoAutoWithSetterPrefixBuilder() {
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNoAutoWithSetterPrefix.BuilderSingularNoAutoWithSetterPrefixBuilder withThings(final String things) {
if (this.things == null) this.things = new java.util.ArrayList<String>();
this.things.add(things);
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNoAutoWithSetterPrefix.BuilderSingularNoAutoWithSetterPrefixBuilder withThings(final java.util.Collection<? extends String> things) {
if (things == null) {
throw new java.lang.NullPointerException("things cannot be null");
@@ -37,17 +45,20 @@ class BuilderSingularNoAutoWithSetterPrefix {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNoAutoWithSetterPrefix.BuilderSingularNoAutoWithSetterPrefixBuilder clearThings() {
if (this.things != null) this.things.clear();
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNoAutoWithSetterPrefix.BuilderSingularNoAutoWithSetterPrefixBuilder withWidget(final String widget) {
if (this.widgets == null) this.widgets = new java.util.ArrayList<String>();
this.widgets.add(widget);
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNoAutoWithSetterPrefix.BuilderSingularNoAutoWithSetterPrefixBuilder withWidgets(final java.util.Collection<? extends String> widgets) {
if (widgets == null) {
throw new java.lang.NullPointerException("widgets cannot be null");
@@ -57,17 +68,20 @@ class BuilderSingularNoAutoWithSetterPrefix {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNoAutoWithSetterPrefix.BuilderSingularNoAutoWithSetterPrefixBuilder clearWidgets() {
if (this.widgets != null) this.widgets.clear();
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNoAutoWithSetterPrefix.BuilderSingularNoAutoWithSetterPrefixBuilder withItems(final String items) {
if (this.items == null) this.items = new java.util.ArrayList<String>();
this.items.add(items);
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNoAutoWithSetterPrefix.BuilderSingularNoAutoWithSetterPrefixBuilder withItems(final java.util.Collection<? extends String> items) {
if (items == null) {
throw new java.lang.NullPointerException("items cannot be null");
@@ -77,11 +91,13 @@ class BuilderSingularNoAutoWithSetterPrefix {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNoAutoWithSetterPrefix.BuilderSingularNoAutoWithSetterPrefixBuilder clearItems() {
if (this.items != null) this.items.clear();
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNoAutoWithSetterPrefix build() {
java.util.List<String> things;
switch (this.things == null ? 0 : this.things.size()) {
@@ -120,11 +136,13 @@ class BuilderSingularNoAutoWithSetterPrefix {
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderSingularNoAutoWithSetterPrefix.BuilderSingularNoAutoWithSetterPrefixBuilder(things=" + this.things + ", widgets=" + this.widgets + ", items=" + this.items + ")";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static BuilderSingularNoAutoWithSetterPrefix.BuilderSingularNoAutoWithSetterPrefixBuilder builder() {
return new BuilderSingularNoAutoWithSetterPrefix.BuilderSingularNoAutoWithSetterPrefixBuilder();
}
@@ -5,26 +5,33 @@ class BuilderSingularNullBehavior1 {
private List<String> names;
private List<String> locations;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderSingularNullBehavior1(final List<String> names, final List<String> locations) {
this.names = names;
this.locations = locations;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static class BuilderSingularNullBehavior1Builder {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private java.util.ArrayList<String> names;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private java.util.ArrayList<String> locations;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderSingularNullBehavior1Builder() {
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNullBehavior1.@org.checkerframework.checker.nullness.qual.NonNull BuilderSingularNullBehavior1Builder name(final String name) {
if (this.names == null) this.names = new java.util.ArrayList<String>();
this.names.add(name);
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNullBehavior1.@org.checkerframework.checker.nullness.qual.NonNull BuilderSingularNullBehavior1Builder names(final java.util.@org.checkerframework.checker.nullness.qual.NonNull Collection<? extends String> names) {
assert names != null : "names cannot be null";
if (this.names == null) this.names = new java.util.ArrayList<String>();
@@ -32,17 +39,20 @@ class BuilderSingularNullBehavior1 {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNullBehavior1.@org.checkerframework.checker.nullness.qual.NonNull BuilderSingularNullBehavior1Builder clearNames() {
if (this.names != null) this.names.clear();
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNullBehavior1.@org.checkerframework.checker.nullness.qual.NonNull BuilderSingularNullBehavior1Builder location(final String location) {
if (this.locations == null) this.locations = new java.util.ArrayList<String>();
this.locations.add(location);
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNullBehavior1.@org.checkerframework.checker.nullness.qual.NonNull BuilderSingularNullBehavior1Builder locations(final java.util.@org.checkerframework.checker.nullness.qual.Nullable Collection<? extends String> locations) {
if (locations != null) {
if (this.locations == null) this.locations = new java.util.ArrayList<String>();
@@ -51,12 +61,14 @@ class BuilderSingularNullBehavior1 {
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNullBehavior1.@org.checkerframework.checker.nullness.qual.NonNull BuilderSingularNullBehavior1Builder clearLocations() {
if (this.locations != null) this.locations.clear();
return this;
}
@org.checkerframework.checker.nullness.qual.NonNull
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNullBehavior1 build() {
java.util.List<String> names;
switch (this.names == null ? 0 : this.names.size()) {
@@ -84,11 +96,13 @@ class BuilderSingularNullBehavior1 {
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.@org.checkerframework.checker.nullness.qual.NonNull String toString() {
return "BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder(names=" + this.names + ", locations=" + this.locations + ")";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static BuilderSingularNullBehavior1.@org.checkerframework.checker.nullness.qual.NonNull BuilderSingularNullBehavior1Builder builder() {
return new BuilderSingularNullBehavior1.BuilderSingularNullBehavior1Builder();
}
@@ -3,18 +3,23 @@ import java.util.List;
class BuilderSingularNullBehavior2 {
private List<String> locations;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderSingularNullBehavior2(final List<String> locations) {
this.locations = locations;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static class BuilderSingularNullBehavior2Builder {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private java.util.ArrayList<String> locations;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderSingularNullBehavior2Builder() {
}
@org.springframework.lang.NonNull
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNullBehavior2.BuilderSingularNullBehavior2Builder location(final String location) {
if (this.locations == null) this.locations = new java.util.ArrayList<String>();
this.locations.add(location);
@@ -22,6 +27,7 @@ class BuilderSingularNullBehavior2 {
}
@org.springframework.lang.NonNull
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNullBehavior2.BuilderSingularNullBehavior2Builder locations(@org.springframework.lang.NonNull final java.util.Collection<? extends String> locations) {
java.util.Objects.requireNonNull(locations, "locations cannot be null");
if (this.locations == null) this.locations = new java.util.ArrayList<String>();
@@ -30,12 +36,14 @@ class BuilderSingularNullBehavior2 {
}
@org.springframework.lang.NonNull
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNullBehavior2.BuilderSingularNullBehavior2Builder clearLocations() {
if (this.locations != null) this.locations.clear();
return this;
}
@org.springframework.lang.NonNull
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularNullBehavior2 build() {
java.util.List<String> locations;
switch (this.locations == null ? 0 : this.locations.size()) {
@@ -53,13 +61,15 @@ class BuilderSingularNullBehavior2 {
@org.springframework.lang.NonNull
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderSingularNullBehavior2.BuilderSingularNullBehavior2Builder(locations=" + this.locations + ")";
}
}
@org.springframework.lang.NonNull
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static BuilderSingularNullBehavior2.BuilderSingularNullBehavior2Builder builder() {
return new BuilderSingularNullBehavior2.BuilderSingularNullBehavior2Builder();
}
}
}
@@ -3,23 +3,30 @@ import java.util.Collection;
import java.util.List;
public record BuilderSingularOnRecord<T>(List<T> children, Collection<? extends Number> scarves, @SuppressWarnings("all") List rawList) {
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static class BuilderSingularOnRecordBuilder<T> {
@java.lang.SuppressWarnings("all")
@lombok.Generated
private java.util.ArrayList<T> children;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private java.util.ArrayList<Number> scarves;
@java.lang.SuppressWarnings("all")
@lombok.Generated
private java.util.ArrayList<java.lang.Object> rawList;
@java.lang.SuppressWarnings("all")
@lombok.Generated
BuilderSingularOnRecordBuilder() {
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularOnRecord.BuilderSingularOnRecordBuilder<T> child(final T child) {
if (this.children == null) this.children = new java.util.ArrayList<T>();
this.children.add(child);
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularOnRecord.BuilderSingularOnRecordBuilder<T> children(final java.util.Collection<? extends T> children) {
if (children == null) {
throw new java.lang.NullPointerException("children cannot be null");
@@ -29,17 +36,20 @@ public record BuilderSingularOnRecord<T>(List<T> children, Collection<? extends
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularOnRecord.BuilderSingularOnRecordBuilder<T> clearChildren() {
if (this.children != null) this.children.clear();
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularOnRecord.BuilderSingularOnRecordBuilder<T> scarf(final Number scarf) {
if (this.scarves == null) this.scarves = new java.util.ArrayList<Number>();
this.scarves.add(scarf);
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularOnRecord.BuilderSingularOnRecordBuilder<T> scarves(final java.util.Collection<? extends Number> scarves) {
if (scarves == null) {
throw new java.lang.NullPointerException("scarves cannot be null");
@@ -49,17 +59,20 @@ public record BuilderSingularOnRecord<T>(List<T> children, Collection<? extends
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularOnRecord.BuilderSingularOnRecordBuilder<T> clearScarves() {
if (this.scarves != null) this.scarves.clear();
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularOnRecord.BuilderSingularOnRecordBuilder<T> rawList(final java.lang.Object rawList) {
if (this.rawList == null) this.rawList = new java.util.ArrayList<java.lang.Object>();
this.rawList.add(rawList);
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularOnRecord.BuilderSingularOnRecordBuilder<T> rawList(final java.util.Collection<?> rawList) {
if (rawList == null) {
throw new java.lang.NullPointerException("rawList cannot be null");
@@ -69,11 +82,13 @@ public record BuilderSingularOnRecord<T>(List<T> children, Collection<? extends
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularOnRecord.BuilderSingularOnRecordBuilder<T> clearRawList() {
if (this.rawList != null) this.rawList.clear();
return this;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public BuilderSingularOnRecord<T> build() {
java.util.List<T> children;
switch (this.children == null ? 0 : this.children.size()) {
@@ -112,11 +127,13 @@ public record BuilderSingularOnRecord<T>(List<T> children, Collection<? extends
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "BuilderSingularOnRecord.BuilderSingularOnRecordBuilder(children=" + this.children + ", scarves=" + this.scarves + ", rawList=" + this.rawList + ")";
}
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public static <T> BuilderSingularOnRecord.BuilderSingularOnRecordBuilder<T> builder() {
return new BuilderSingularOnRecord.BuilderSingularOnRecordBuilder<T>();
}
Loaded 100 of 726 files, more files were not shown because too many files have changed in this diff. Show more