diff options
30 files changed, 242 insertions, 59 deletions
@@ -45,7 +45,7 @@ Roel Spilker <r.spilker@gmail.com> Roland Praml <pram@gmx.de> Rostislav Krasny <45571812+rosti-il@users.noreply.github.com> Samuel Pereira <samuel.p.araujo@gmail.com> -Sander Koning <askoning@gmail.com> +Sasha Koning <askoning@gmail.com> Szymon Pacanowski <spacanowski@gmail.com> Taiki Sugawara <buzz.taiki@gmail.com> Takuya Murakami <tmurakam@tmurakam.org> diff --git a/buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.46.xml b/buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.46.xml new file mode 100644 index 00000000..37de93e6 --- /dev/null +++ b/buildScripts/ivy-repo/org.projectlombok-lombok.patcher-0.46.xml @@ -0,0 +1,14 @@ +<ivy-module version="2.0"> + <info organisation="org.projectlombok" module="lombok.patcher" revision="0.46" publication="20230111220000"> + <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.46.jar" /> + </publications> +</ivy-module> diff --git a/buildScripts/ivy.xml b/buildScripts/ivy.xml index afd799d0..4977590f 100644 --- a/buildScripts/ivy.xml +++ b/buildScripts/ivy.xml @@ -29,7 +29,9 @@ <conf name="ecj11" /> <conf name="ecj14" /> <conf name="ecj16" /> + <conf name="ecj19" /> + <conf name="eclipse-202212" /> <conf name="eclipse-oxygen" /> <conf name="eclipse-202006" /> @@ -37,7 +39,7 @@ </configurations> <dependencies> - <dependency org="org.projectlombok" name="lombok.patcher" rev="0.44" conf="build,stripe->default" /> + <dependency org="org.projectlombok" name="lombok.patcher" rev="0.46" 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" /> @@ -77,6 +79,7 @@ <!-- ecjs --> + <dependency org="org.eclipse.jdt" name="ecj" rev="3.32.0" conf="ecj19->master" /> <dependency org="org.eclipse.jdt" name="ecj" rev="3.25.0" conf="ecj16->master" /> <dependency org="org.eclipse.jdt" name="ecj" rev="3.22.0.v20200530-2032" conf="ecj14->master" /> <dependency org="org.eclipse.jdt" name="ecj" rev="3.16.0" conf="ecj11->master" /> @@ -86,6 +89,18 @@ <!-- eclipses --> + <dependency org="org.eclipse.platform" name="org.eclipse.core.runtime" rev="3.26.100" conf="eclipse-202212->default" transitive="false" /> + <dependency org="org.eclipse.jdt" name="org.eclipse.jdt.core" rev="3.32.0" conf="eclipse-202212->default" transitive="false" /> + <dependency org="org.eclipse.jdt" name="org.eclipse.jdt.ui" rev="3.27.100" conf="eclipse-202212->default" transitive="false" /> + <dependency org="org.eclipse.platform" name="org.eclipse.equinox.common" rev="3.17.0" conf="eclipse-202212->default" transitive="false" /> + <dependency org="org.eclipse.platform" name="org.eclipse.equinox.registry" rev="3.11.200" conf="eclipse-202212->default" transitive="false" /> + <dependency org="org.eclipse.platform" name="org.eclipse.equinox.app" rev="1.6.200" conf="eclipse-202212->default" transitive="false" /> + <dependency org="org.eclipse.platform" name="org.eclipse.core.resources" rev="3.18.100" conf="eclipse-202212->default" transitive="false" /> + <dependency org="org.eclipse.platform" name="org.eclipse.core.contenttype" rev="3.8.200" conf="eclipse-202212->default" transitive="false" /> + <dependency org="org.eclipse.platform" name="org.eclipse.core.jobs" rev="3.13.200" conf="eclipse-202212->default" transitive="false" /> + <dependency org="org.eclipse.platform" name="org.eclipse.osgi" rev="3.18.200" conf="eclipse-202212->default" transitive="false" /> + <dependency org="org.eclipse.platform" name="org.eclipse.text" rev="3.12.300" conf="eclipse-202212->default" transitive="false" /> + <dependency org="org.eclipse.platform" name="org.eclipse.core.runtime" rev="3.13.0" conf="eclipse-oxygen->default" transitive="false" /> <dependency org="org.eclipse.jdt" name="org.eclipse.jdt.core" rev="3.13.102" conf="eclipse-oxygen->default" transitive="false" /> <dependency org="org.eclipse.jdt" name="org.eclipse.jdt.ui" rev="3.13.100" conf="eclipse-oxygen->default" transitive="false" /> diff --git a/buildScripts/tests.ant.xml b/buildScripts/tests.ant.xml index 0191d642..0eeff097 100644 --- a/buildScripts/tests.ant.xml +++ b/buildScripts/tests.ant.xml @@ -1,5 +1,5 @@ <!-- - Copyright (C) 2020-2021 The Project Lombok Authors. + Copyright (C) 2020-2023 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,14 +126,14 @@ This buildfile is part of projectlombok.org. It takes care of compiling and runn <test.javacX version="11" /> </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.javac17" depends="test.formatter.compile, test.compile" description="runs the tests on your default VM, using javac17 as underlying compiler"> <test.javacX version="17" /> </target> - <target name="test.javac18" depends="test.formatter.compile, test.compile" description="runs the tests on your default VM, using javac18 as underlying compiler"> - <test.javacX version="18" /> + <!-- 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.javac19" depends="test.formatter.compile, test.compile" description="runs the tests on your default VM, using javac19 as underlying compiler"> + <test.javacX version="19" /> </target> <target name="test.javacCurrent" depends="test.formatter.compile, test.compile" description="runs the tests on your default VM, using its javac as underlying compiler"> @@ -157,7 +157,7 @@ This buildfile is part of projectlombok.org. It takes care of compiling and runn <condition property="compiler.compliance.level" value="-Dcompiler.compliance.level=@{compiler.compliance.level}" else="-Dnot=set"> <not><equals arg1="@{compiler.compliance.level}" arg2="latest" /></not> </condition> - <echo>Running TestEclipse on eclipse-@{version} on JVM${ant.java.version} using. Compiler compliance level: @{compiler.compliance.level}</echo> + <echo>Running TestEclipse on eclipse-@{version} on JVM${ant.java.version}. Compiler compliance level: @{compiler.compliance.level}</echo> <junit haltonfailure="yes" fork="true" forkmode="once"> <formatter classname="lombok.ant.SimpleTestFormatter" usefile="false" unless="tests.quiet" /> <jvmarg value="-Xbootclasspath/a:${jdk8-rt.loc}" /> @@ -176,6 +176,11 @@ This buildfile is part of projectlombok.org. It takes care of compiling and runn </sequential> </macrodef> + <target name="test.eclipse-202212" depends="test.formatter.compile, test.compile" description="runs the tests on your default VM, testing the 2022-12 release of eclipse"> + <fetchdep.eclipse version="202212" /> + <test.eclipse-X version="202212" /> + </target> + <target name="test.eclipse-oxygen" depends="test.formatter.compile, test.compile" description="runs the tests on your default VM, testing the oxygen release of eclipse"> <test.eclipse-X version="oxygen" /> </target> @@ -216,16 +221,21 @@ This buildfile is part of projectlombok.org. It takes care of compiling and runn <test.ecj-X version="11" /> </target> - <target name="test.ecj14" depends="test.formatter.compile, test.compile" description="runs the tests on your default VM, testing the ecj11 release"> + <target name="test.ecj14" depends="test.formatter.compile, test.compile" description="runs the tests on your default VM, testing the ecj14 release"> <fetchdep.ecj version="14" /> <test.ecj-X version="14" /> </target> - <target name="test.ecj16" depends="test.formatter.compile, test.compile" description="runs the tests on your default VM, testing the ecj11 release"> + <target name="test.ecj16" depends="test.formatter.compile, test.compile" description="runs the tests on your default VM, testing the ecj16 release"> <fetchdep.ecj version="16" /> <test.ecj-X version="16" /> </target> - <target name="test" depends="test.javacCurrent, test.eclipse-202006" description="runs the tests against the default JVM, javac, and eclipse" /> - <target name="test.broad" depends="test.javac8, test.javac17, test.javac18, test.eclipse-oxygen, test.eclipse-202006, test.eclipse-202006-jdk8" description="runs the tests against the default JVM, javac, and eclipse" /> + <target name="test.ecj19" depends="test.formatter.compile, test.compile" description="runs the tests on your default VM, testing the ecj19 release"> + <fetchdep.ecj version="19" /> + <test.ecj-X version="19" /> + </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.javac19, test.eclipse-oxygen, test.eclipse-202212, test.eclipse-202006-jdk8" description="runs the tests against the default JVM, javac, and eclipse" /> </project> diff --git a/doc/changelog.markdown b/doc/changelog.markdown index 49d04b94..8dacf88a 100644 --- a/doc/changelog.markdown +++ b/doc/changelog.markdown @@ -87,7 +87,7 @@ Lombok Changelog ### v1.18.10 (September 10th, 2019) * PROMOTION: `@Wither` has been promoted to the main package, renamed to `@With`. Otherwise, no changes have been made to the annotation. The old experimental annotation will remain for a few versions as a deprecated annotation. If you had `lombok.config` configuration for this annotation, the configuration keys for this feature have been renamed. -* FEATURE: You can now configure a custom logger framework using the new `@CustomLog` annotation in combination with the `lombok.log.custom.declaration` configuration key. See the [log documentation](https://projectlombok.org/features/Log) for more information. [Pullrequest #2086](https://github.com/projectlombok/lombok/pull/2086) with thanks to Adam Juraszek. +* FEATURE: You can now configure a custom logger framework using the new `@CustomLog` annotation in combination with the `lombok.log.custom.declaration` configuration key. See the [log documentation](https://projectlombok.org/features/log) for more information. [Pullrequest #2086](https://github.com/projectlombok/lombok/pull/2086) with thanks to Adam Juraszek. * ENHANCEMENT: Thanks to Mark Haynes, the `staticConstructor` will now also be generated if a (private) constructor already exists. [Issue #2100](https://github.com/projectlombok/lombok/issues/2100) * ENHANCEMENT: `val` is now capable of decoding the type of convoluted expressions (particularly if the right hand side involves lambdas and conditional (ternary) expressions). [Pull Request #2109](https://github.com/projectlombok/lombok/pull/2109) with thanks to Alexander Bulgakov. * ENHANCEMENT: You can now configure the generated builder class name via the config system, using key `lombok.builder.className`. See the [Builder documentation](https://projectlombok.org/features/Builder) and [SuperBuilder documentation](https://projectlombok.org/features/experimental/SuperBuilder) @@ -175,7 +175,7 @@ Lombok Changelog * BUGFIX: Solved some issues in eclipse that resulted in error 'A save participant caused problems'. [Issue #879](https://github.com/projectlombok/lombok/issues/879) * BUGFIX: Netbeans on jdk9. [Issue #1617](https://github.com/projectlombok/lombok/issues/1617) * BUGFIX: Netbeans < 9. [Issue #1555](https://github.com/projectlombok/lombok/issues/1555) -* PROMOTION: `var` has been promoted from experimental to the main package with no changes. The 'old' experimental one is still around but is deprecated, and is an alias for the new main package one. [var documentation](https://projectlombok.org/features/var.html). +* PROMOTION: `var` has been promoted from experimental to the main package with no changes. The 'old' experimental one is still around but is deprecated, and is an alias for the new main package one. [var documentation](https://projectlombok.org/features/var). * OLD-CRUFT: `lombok.experimental.Builder` and `lombok.experimental.Value` are deprecated remnants of when these features were still in experimental. They are now removed entirely. If your project is dependent on an older version of lombok which still has those; fret not, lombok still processes these annotations. It just no longer includes them in the jar. ### v1.16.20 (January 9th, 2018) @@ -195,9 +195,9 @@ Lombok Changelog * FEATURE: Lombok has a new [website](https://projectlombok.org/)! A few very minor changes to the code to be more consistent with it have been added, mostly to the javadoc. ### v1.16.16 "Dancing Elephant" (March 23rd, 2017) -* FEATURE: `@Builder.Default` lets you configure default values for your fields when using `@Builder`. See the [Builder feature page](https://projectlombok.org/features/Builder.html) for more information. [Issue #1201](https://github.com/projectlombok/lombok/issues/1201) +* FEATURE: `@Builder.Default` lets you configure default values for your fields when using `@Builder`. See the [Builder feature page](https://projectlombok.org/features/Builder) for more information. [Issue #1201](https://github.com/projectlombok/lombok/issues/1201) * PLATFORM: JDK9 now supported for compilation (delomboking with java9 not yet possible). Note, you'll have to do some command line wrangling. See [Issue #985](https://github.com/projectlombok/lombok/issues/985) -* BUGFIX: The `onX` feature (which lets you add annotations to generated methods) did not work if the annotation you added contained named parameters, and you are compiling with JDK8's javac. We can't fix this (it's a bug in javac), but we have provided an alternate, prettier way to do `onX` on javac8+. [Issue #778](https://github.com/projectlombok/lombok/issues/778) [onX documentation](https://projectlombok.org/features/experimental/onX.html) +* BUGFIX: The `onX` feature (which lets you add annotations to generated methods) did not work if the annotation you added contained named parameters, and you are compiling with JDK8's javac. We can't fix this (it's a bug in javac), but we have provided an alternate, prettier way to do `onX` on javac8+. [Issue #778](https://github.com/projectlombok/lombok/issues/778) [onX documentation](https://projectlombok.org/features/experimental/onX) * BUGFIX: `@Data` and `@Value` now respect the configuration for field access when generating equals, hashCode and toString. [Issue #1329](https://github.com/projectlombok/lombok/issues/1329) * BUGFIX: `@Builder` now marks generated builder 'setters' as `@Deprecated` if the source field is deprecated. [Issue #1342](https://github.com/projectlombok/lombok/issues/1342) * CHANGE: `@ConstructorProperties` will now also be generated for private and package private constructors. This is useful for Jackson [Issue #1180](https://github.com/projectlombok/lombok/issues/1180) @@ -241,8 +241,8 @@ Lombok Changelog * ENHANCEMENT: Putting `@NonNull` on a parameter of an abstract method no longer generates a warning, to allow you to use this annotation to document intended behaviour [Issue #807](https://github.com/projectlombok/lombok/issues/807). ### v1.16.6 (August 18th, 2015) -* FEATURE: `@Helper` can be placed on method-local inner classes to make all methods in the class accessible to the rest of the method. [Full documentation](https://projectlombok.org/features/experimental/Helper.html). -* FEATURE: `@Builder(toBuilder = true)` is now available. It produces an instance method that creates a new builder, initialized with all the values of that instance. For more, read the [Feature page on Builder](https://projectlombok.org/features/Builder.html). +* FEATURE: `@Helper` can be placed on method-local inner classes to make all methods in the class accessible to the rest of the method. [Full documentation](https://projectlombok.org/features/experimental/Helper). +* FEATURE: `@Builder(toBuilder = true)` is now available. It produces an instance method that creates a new builder, initialized with all the values of that instance. For more, read the [Feature page on Builder](https://projectlombok.org/features/Builder). * FEATURE: the `hashCode()` method generated by lombok via `@EqualsAndHashCode`, `@Data`, and `@Value` is now smarter about nulls; they are treated as if they hash to a magic prime instead of 0, which reduces hash collisions. * FEATURE: `@NoArgsConstructor(force = true)` can be used to create no args constructors even if final fields are present. * BUGFIX: Parameterized static methods with `@Builder` would produce compiler errors in javac. [Issue #828](https://github.com/projectlombok/lombok/issues/828). @@ -257,7 +257,7 @@ Lombok Changelog ### v1.16.2 (February 10th, 2015) * FEATURE: The config key `lombok.extern.findbugs.addSuppressFBWarnings` can now be used to add findbugs suppress warnings annotations to all code lombok generates. This addresses feature request [Issue #737](https://github.com/projectlombok/lombok/issues/737). -* FEATURE: New lombok annotation: `@UtilityClass`, for making utility classes (not instantiable, contains only static 'function' methods). See the [feature documentation](https://projectlombok.org/features/experimental/UtilityClass.html) for more information. +* FEATURE: New lombok annotation: `@UtilityClass`, for making utility classes (not instantiable, contains only static 'function' methods). See the [feature documentation](https://projectlombok.org/features/experimental/UtilityClass) for more information. * BUGFIX: The ant `delombok` task was broken starting with v1.16.0. Note that the task def class has been changed; taskdef `lombok.delombok.ant.Tasks$Delombok` instead of the old `lombok.delombok.ant.DelombokTask`. [Issue #810](https://github.com/projectlombok/lombok/issues/810). * BUGFIX: `val` in javac would occasionally fail if used inside inner classes. This is (probably) fixed. [Issue #729](https://github.com/projectlombok/lombok/issues/729) and [Issue #616](https://github.com/projectlombok/lombok/issues/616). * BUGFIX: Starting with v1.16.0, lombok would fail to execute as an executable jar if it was in a path with spaces in it. [Issue #812](https://github.com/projectlombok/lombok/issues/812). @@ -267,7 +267,7 @@ Lombok Changelog * BUGFIX: `@ExtensionMethod` was broken in Eclipse using java 8. [Issue #777](https://github.com/projectlombok/lombok/issues/777), [Issue #782](https://github.com/projectlombok/lombok/issues/782) * BUGFIX: delombok: Using exotic characters in your source files would overzealously backslash-u escape them. Now, all characters are printed unescaped, assuming your chosen encoding can support them. Otherwise, they are escaped. [Issue #794](https://github.com/projectlombok/lombok/issues/794) * PROMOTION: `@Builder` has graduated from experimental to the main package with a few changes (addition of `@Singular`, removal of the `fluent` and `chain` options). The old one still exists and has been deprecated. -* FEATURE: `@Builder` now supports adding the `@Singular` annotation to any field/parameter that represents a collection, which results in a method in the generated builder that takes in one element of that collection and adds it. Lombok takes care of generating the appropriate code to produce a compacted immutable version of the appropriate type. In this version, java.util collections and guava's ImmutableCollections are supported. See the [feature documentation](https://projectlombok.org/features/Builder.html) for more information. +* FEATURE: `@Builder` now supports adding the `@Singular` annotation to any field/parameter that represents a collection, which results in a method in the generated builder that takes in one element of that collection and adds it. Lombok takes care of generating the appropriate code to produce a compacted immutable version of the appropriate type. In this version, java.util collections and guava's ImmutableCollections are supported. See the [feature documentation](https://projectlombok.org/features/Builder) for more information. * FEATURE: Added a launcher to the lombok boot process which removes the need for `-Xbootclasspath` to be in your `eclipse.ini` file, and removes all non-public API and third party dependencies (such as ASM) from the lombok jar, thus removing them from your IDE's auto complete offerings in any project that uses lombok. For those debugging lombok, the launcher enables hot code replace which makes debugging a lot easier, as previously one was required to shut down the IDE, rebuild the jar, and relaunch. Add `-Dshadow.override.lombok=/path/to/lombok/bin` to the launch target for hot code replace. ### v1.14.8 (September 15th, 2014) @@ -291,8 +291,8 @@ Lombok Changelog * BUGFIX: mvn builds fail with a 'URI not absolute' exception. [Issue #718](https://github.com/projectlombok/lombok/issues/718) ### v1.14.0 "Branching Cobra" (May 27th, 2014) -* FEATURE: You can now configure aspects of lombok project wide (or even workspace wide, or just for a single package) via the [configuration system](https://projectlombok.org/features/configuration.html). You can configure many things; run `java -jar lombok.jar config -gv` for the complete list. -* DEPRECATION: `@Delegate` has been moved to `lombok.experimental.Delegate`, and corner cases such as recursive delegation (delegating a type that itself has fields or methods annotated with `@Delegate`) are now error conditions. See the [feature documentation](https://projectlombok.org/features/experimental/Delegate.html) for more information. +* FEATURE: You can now configure aspects of lombok project wide (or even workspace wide, or just for a single package) via the [configuration system](https://projectlombok.org/features/configuration). You can configure many things; run `java -jar lombok.jar config -gv` for the complete list. +* DEPRECATION: `@Delegate` has been moved to `lombok.experimental.Delegate`, and corner cases such as recursive delegation (delegating a type that itself has fields or methods annotated with `@Delegate`) are now error conditions. See the [feature documentation](https://projectlombok.org/features/experimental/Delegate) for more information. * FEATURE: It is now possible to put annotations, such as `@Nullable`, on the one parameter of generated `equals()` methods by specifying the `onParam=` option on `@EqualsAndHashCode`, similar to how that feature already exists for `@Setter`. [Issue #709](https://github.com/projectlombok/lombok/issues/709) * CHANGE: suppressConstructorProperties should now be configured via lombok configuration. [Issue #694](https://github.com/projectlombok/lombok/issues/694) * CHANGE: The `canEqual` method generated by `@EqualsAndHashCode`, `@Value` and `@Data` is now `protected` instead of `public`. [Issue #695](https://github.com/projectlombok/lombok/issues/695) @@ -331,10 +331,10 @@ Lombok Changelog * GERMANY: Major version bumped from 0 to 1, because allegedly this is important. Rest assured, this change is nevertheless backwards compatible. ### v0.12.0 "Angry Butterfly" (July 16th, 2013) -* FEATURE: javadoc on fields will now be copied to generated getters / setters / withers. There are ways to specify separate javadoc for the field, the setter, and the getter, and `@param` and `@return` are handled appropriately. Addresses feature request [Issue #132](https://github.com/projectlombok/lombok/issues/132). [@Getter and @Setter documentation](https://projectlombok.org/features/GetterSetter.html). [@Wither documentation](https://projectlombok.org/features/experimental/Wither.html). -* CHANGE: The desugaring of @Getter(lazy=true) is now less object creation intensive. Documentation has been updated to reflect what the new desugaring looks like. [@Getter(lazy=true) documentation](https://projectlombok.org/features/GetterLazy.html). -* PROMOTION: `@Value` has been promoted from experimental to the main package with no changes. The 'old' experimental one is still around but is deprecated, and is an alias for the new main package one. [@Value documentation](https://projectlombok.org/features/Value.html). -* FEATURE: {Experimental} `@Builder` support. One of our earliest feature request issues, [Issue #89](https://github.com/projectlombok/lombok/issues/89), has finally been addressed. [@Builder documentation](https://projectlombok.org/features/experimental/Builder.html). +* FEATURE: javadoc on fields will now be copied to generated getters / setters / withers. There are ways to specify separate javadoc for the field, the setter, and the getter, and `@param` and `@return` are handled appropriately. Addresses feature request [Issue #132](https://github.com/projectlombok/lombok/issues/132). [@Getter and @Setter documentation](https://projectlombok.org/features/GetterSetter). [@Wither documentation](https://projectlombok.org/features/experimental/Wither). +* CHANGE: The desugaring of @Getter(lazy=true) is now less object creation intensive. Documentation has been updated to reflect what the new desugaring looks like. [@Getter(lazy=true) documentation](https://projectlombok.org/features/GetterLazy). +* PROMOTION: `@Value` has been promoted from experimental to the main package with no changes. The 'old' experimental one is still around but is deprecated, and is an alias for the new main package one. [@Value documentation](https://projectlombok.org/features/Value). +* FEATURE: {Experimental} `@Builder` support. One of our earliest feature request issues, [Issue #89](https://github.com/projectlombok/lombok/issues/89), has finally been addressed. [@Builder documentation](https://projectlombok.org/features/experimental/Builder). * FEATURE: `@NonNull` on a method or constructor parameter now generates a null-check statement at the start of your method. This nullcheck will throw a `NullPointerException` with the name of the parameter as the message. [Issue #549](https://github.com/projectlombok/lombok/issues/549) * BUGFIX: Usage of `Lombok.sneakyThrow()` or `@SneakyThrows` would sometimes result in invalid classes (classes which fail with `VerifyError`). [Issue #543](https://github.com/projectlombok/lombok/issues/543) * BUGFIX: Using `val` in try-with-resources did not work for javac. [Issue #555](https://github.com/projectlombok/lombok/issues/555) @@ -344,7 +344,7 @@ Lombok Changelog ### v0.11.8 (April 23rd, 2013) * FEATURE: Major performance improvements in eclipse by profiling the project clean process. * CHANGE: {Experimental} The experimental `@Value` feature no longer implies the also experimental `@Wither`. If you like your `@Value` classes to make withers, add `@Wither` to the class right next to `@Value`. -* FEATURE: {Experimental} Reintroduced `onMethod`, `onConstructor` and `onParam` to `@Getter`, `@Setter`, `@Wither`, and `@XArgsConstructor`. These parameters allow you to add annotations to the methods/constructors that lombok will generate. This is a workaround feature: The stability of the feature on future versions of javac is not guaranteed, and if a better way to implement this feature is found, this feature's current incarnation will be removed without a reasonable period of deprecation. [Documentation on the onX feature](https://projectlombok.org/features/experimental/onX.html) +* FEATURE: {Experimental} Reintroduced `onMethod`, `onConstructor` and `onParam` to `@Getter`, `@Setter`, `@Wither`, and `@XArgsConstructor`. These parameters allow you to add annotations to the methods/constructors that lombok will generate. This is a workaround feature: The stability of the feature on future versions of javac is not guaranteed, and if a better way to implement this feature is found, this feature's current incarnation will be removed without a reasonable period of deprecation. [Documentation on the onX feature](https://projectlombok.org/features/experimental/onX) * FEATURE: Added support for Log4j v2.0 via `@Log4j2` [Issue #505](https://github.com/projectlombok/lombok/issues/505) * ENHANCEMENT: The Lombok installer can now find and install lombok into [JBoss Developer Studio](http://www.redhat.com/products/jbossenterprisemiddleware/developer-studio/). The installer will now also look for eclipse and eclipse variants in your home directory. [Issue #507](https://github.com/projectlombok/lombok/issues/507) * BUGFIX: `@ExtensionMethods` no longer causes `VerifyError` exceptions when running eclipse-compiled code if extension methods are called on expressions which are method calls whose return type is a type variable. For example, `someList.get(i).extensionMethod()` would fail that way. [Issue #509](https://github.com/projectlombok/lombok/issues/509) @@ -359,7 +359,7 @@ Lombok Changelog * BUGFIX: `@Deprecated` on a field that gets a generated setter in eclipse would result in `IllegalArgumentException`, which you wouldn't see unless you have the error log open. If you have save actions defined, you'd get a popup box with the exception. Now fixed. [Issue #481](https://github.com/projectlombok/lombok/issues/481) ### v0.11.4 (August 13th, 2012) -* FEATURE: {Experimental} `@Value`, `@Wither` and `@FieldDefaults` are now available. These are a lot like `@Data` but geared towards immutable classes. [Documentation on @Value](https://projectlombok.org/features/experimental/Value.html), [Documentation on @Wither](https://projectlombok.org/features/experimental/Wither.html) and [Documentation on @FieldDefaults](https://projectlombok.org/features/experimental/FieldDefaults.html). +* FEATURE: {Experimental} `@Value`, `@Wither` and `@FieldDefaults` are now available. These are a lot like `@Data` but geared towards immutable classes. [Documentation on @Value](https://projectlombok.org/features/experimental/Value), [Documentation on @Wither](https://projectlombok.org/features/experimental/Wither) and [Documentation on @FieldDefaults](https://projectlombok.org/features/experimental/FieldDefaults). * BUGFIX: Eclipse would throw an OOME if using `@ExtensionMethod`. [Issue #463](https://github.com/projectlombok/lombok/issues/463) * BUGFIX: {Netbeans} `@Cleanup` and `@Synchronized` cause far fewer issues in the netbeans editor. [Issue #466](https://github.com/projectlombok/lombok/issues/466) * BUGFIX: {Installer} Erroneous messages about the installer complaining about needing root access when installing or removing lombok from eclipse installs has been fixed. The installer edge of this problem was actually already fixed in v0.11.2. [Issue #436](https://github.com/projectlombok/lombok/issues/436) @@ -369,7 +369,7 @@ Lombok Changelog ### v0.11.2 "Dashing Kakapo" (July 3rd, 2012) * FEATURE: {Experimental} `@ExtensionMethod` is now available to add extensions to -any type in the form of static methods that take as first parameter an object of that type. [Documentation on @ExtensionMethod](https://projectlombok.org/features/experimental/ExtensionMethod.html) +any type in the form of static methods that take as first parameter an object of that type. [Documentation on @ExtensionMethod](https://projectlombok.org/features/experimental/ExtensionMethod) * FEATURE: ONGOING: Fix for using lombok together with gwt-designer. * ENHANCEMENT: Small performance enhancements in `equals` and `hashCode`. [Issue #439](https://github.com/projectlombok/lombok/issues/439) * BUGFIX: Eclipse would display an error message regarding an invalid super constructor in the wrong location. [Issue #409](https://github.com/projectlombok/lombok/issues/409) @@ -380,9 +380,9 @@ any type in the form of static methods that take as first parameter an object of * BUGFIX: Setting breakpoints on code above the first generated method was not possible. [Issue #450](https://github.com/projectlombok/lombok/issues/450) ### v0.11.0 (March 26th, 2012) -* FEATURE: {Experimental} 'fluent' getters and setters (using just `fieldName` as methodname instead of `getFieldName`), setters that return `this` instead of `void`, and support for fields with prefixes is introduced with this lombok version. Also, the number of parameters of any existing methods with the same name that lombok would generate are now taken into account; previously if you had any method named `setX` regardless of how many parameters it has, lombok would avoid generating a `setX` method. Now lombok generates the method if all present `setX` methods have a number of parameters other than 1. [documentation](https://projectlombok.org/features/experimental/Accessors.html). +* FEATURE: {Experimental} 'fluent' getters and setters (using just `fieldName` as methodname instead of `getFieldName`), setters that return `this` instead of `void`, and support for fields with prefixes is introduced with this lombok version. Also, the number of parameters of any existing methods with the same name that lombok would generate are now taken into account; previously if you had any method named `setX` regardless of how many parameters it has, lombok would avoid generating a `setX` method. Now lombok generates the method if all present `setX` methods have a number of parameters other than 1. [documentation](https://projectlombok.org/features/experimental/Accessors). * FEATURE: The combination of `@Delegate` and `@Getter` or `@Data` will now delegate to the result of a generated getter. [Issue #401](https://github.com/projectlombok/lombok/issues/401) -* FEATURE: Developing android apps on eclipse with lombok is now possible by running `java -jar lombok.jar publicApi` and including the generated jar in your project. [Documentation on using lombok for android development](https://projectlombok.org/setup/android.html). +* FEATURE: Developing android apps on eclipse with lombok is now possible by running `java -jar lombok.jar publicApi` and including the generated jar in your project. [Documentation on using lombok for android development](https://projectlombok.org/setup/android). * BUGFIX: In NetBeans the generated default constructor would still be generated even if Lombok also generated constructors. [Issue #399](https://github.com/projectlombok/lombok/issues/399) * BUGFIX: Some classes that contain @SneakyThrows would not compile (throw ClassFormatError). [Issue #412](https://github.com/projectlombok/lombok/issues/412) * BUGFIX: delombok: When `@Delegate` would generate a method with type parameters of the type `T extends package.Class`, a dot would be prepended to the type name. [Issue #414](https://github.com/projectlombok/lombok/issues/414) @@ -394,7 +394,7 @@ any type in the form of static methods that take as first parameter an object of * BUGFIX: PrettyCommentsPrinter now prints default clause of annotation methods. Fixes [Issue #423](https://github.com/projectlombok/lombok/issues/423) ### v0.10.8 (January 19th, 2012) -* FEATURE: `@Delegate` can now be used on a no-argument method, which works similarly to adding it to fields. See [documentation](https://projectlombok.org/features/Delegate.html). +* FEATURE: `@Delegate` can now be used on a no-argument method, which works similarly to adding it to fields. See [documentation](https://projectlombok.org/features/Delegate). * BUGFIX: Eclipse refactoring Extract Interface was broken when using lombok annotation to generate methods. [Issue #159](https://github.com/projectlombok/lombok/issues/159) * BUGFIX: Eclipse action Sort Members was broken when using lombok annotations to generate methods or fields. [Issue #338](https://github.com/projectlombok/lombok/issues/338) * BUGFIX: Eclipse action Refactor/Rename on an inner type was broken when using lombok annotations. [Issue #389](https://github.com/projectlombok/lombok/issues/389) @@ -432,15 +432,15 @@ any type in the form of static methods that take as first parameter an object of * ENHANCEMENT: `@NotNull` is now also recognized as an annotation indicating that lombok should generate nullcheck guards in generated constructors and setters. [Issue #344](https://github.com/projectlombok/lombok/issues/344) ### v0.10.0 "Burning Emu" (August 19th, 2011) -* FEATURE: New annotation: @Delegate. This annotation lets lombok generate delegation methods for a given field. [More…](https://projectlombok.org/features/Delegate.html) -* FEATURE: Added support for 'val'. Val is an immutable variable that infers its type from the right hand side of the initializing expression. [More…](https://projectlombok.org/features/val.html) -* FEATURE: Added support for several logging frameworks via the `@Log`, `@Slf4j`, etc. annotation. [More…](https://projectlombok.org/features/Log.html) +* FEATURE: New annotation: @Delegate. This annotation lets lombok generate delegation methods for a given field. [More…](https://projectlombok.org/features/Delegate) +* FEATURE: Added support for 'val'. Val is an immutable variable that infers its type from the right hand side of the initializing expression. [More…](https://projectlombok.org/features/val) +* FEATURE: Added support for several logging frameworks via the `@Log`, `@Slf4j`, etc. annotation. [More…](https://projectlombok.org/features/log) * FEATURE: Lombok now supports post-compile transformers. [Issue #217](https://github.com/projectlombok/lombok/issues/217) * FEATURE: Using `@SneakyThrows` no longer requires a runtime dependency on lombok.jar. In fact, any call to `Lombok.sneakyThrows(ex)` is optimized at the bytecode level and no longer requires you to actually have lombok.jar or lombok-runtime.jar on the classpath. * FEATURE: @*X*ArgsConstructor, @Getter, and @ToString can now be used on enum declarations. Previously, behaviour of these annotations on enums was undefined. * FEATURE: @Getter/@Setter (and by extension, @Data) in v0.9.3 and earlier would generate getter and setter method names that did not conform to the beanspec, primarily when faced with boolean properties. This has been fixed. In practice this won't affect you unless you have properties named `isFoo` or `hasFoo`. Now the setter generated for this will be called `setFoo` (as the property name is `foo`) and not `setIsFoo`. Also, `hasFoo` is now no longer special; the names would be `isHasFoo` and `setHasFoo`. The java bean spec does not give `has` special meaning. -* FEATURE: `@EqualsAndHashCode` (and by extension, `@Data`) now add a `canEqual` method which improves the sanity of equality amongst a hierarchy of classes. [More…](https://projectlombok.org/features/EqualsAndHashCode.html) -* FEATURE: `@Getter` now supports a `lazy=true` attribute. [More…](https://projectlombok.org/features/GetterLazy.html) +* FEATURE: `@EqualsAndHashCode` (and by extension, `@Data`) now add a `canEqual` method which improves the sanity of equality amongst a hierarchy of classes. [More…](https://projectlombok.org/features/EqualsAndHashCode) +* FEATURE: `@Getter` now supports a `lazy=true` attribute. [More…](https://projectlombok.org/features/GetterLazy) * ENHANCEMENT: The installer will now find Eclipse installations when they are located in a subdirectory of a directory containing the word 'eclipse' . [Issue #283](https://github.com/projectlombok/lombok/issues/283) * ENHANCEMENT: Add null check for `@Cleanup` [Issue #227](https://github.com/projectlombok/lombok/issues/227) * BUGFIX: Lombok is now compatible with javac 7. @@ -475,7 +475,7 @@ any type in the form of static methods that take as first parameter an object of ### v0.9.2 "Hailbunny" (December 15th, 2009) * preliminary support for lombok on NetBeans! - thanks go to Jan Lahoda from NetBeans. [Issue #93](https://github.com/projectlombok/lombok/issues/93) -* lombok now ships with the delombok tool, which copies an entire directory filled with sources to a new directory, desugaring any java files to what it would look like without lombok's transformations. Compiling the sources in this new directory without lombok support should result in the same class files as compiling the original with lombok support. Great to double check on what lombok is doing, and for chaining the delombok-ed sources to source-based java tools such as Google Web Toolkit or javadoc. lombok.jar itself also provides an ant task for delombok. [Full documentation of delombok](https://projectlombok.org/features/delombok.html). +* lombok now ships with the delombok tool, which copies an entire directory filled with sources to a new directory, desugaring any java files to what it would look like without lombok's transformations. Compiling the sources in this new directory without lombok support should result in the same class files as compiling the original with lombok support. Great to double check on what lombok is doing, and for chaining the delombok-ed sources to source-based java tools such as Google Web Toolkit or javadoc. lombok.jar itself also provides an ant task for delombok. [Full documentation of delombok](https://projectlombok.org/features/delombok). * Lombok now works on openjdk7 (tested with JDK7m5)! For all the folks on the cutting edge, this should be very good news. [Issue #134](https://github.com/projectlombok/lombok/issues/134) - thanks go to Jan Lahoda from NetBeans. * lombok now has various command-line accessible utilities bundled with it. Run `java -jar lombok.jar --help` to see them. Included (aside from the already mentioned delombok): * Ability to create a tiny jar named lombok-runtime.jar with runtime dependencies. The lombok transformations that have a runtime dependency on this jar can be listed as well. Run `java -jar lombok.jar createRuntime --help` for more information. diff --git a/src/core/lombok/CustomLog.java b/src/core/lombok/CustomLog.java index d1f45f7c..c6ea400d 100644 --- a/src/core/lombok/CustomLog.java +++ b/src/core/lombok/CustomLog.java @@ -29,7 +29,7 @@ import java.lang.annotation.Target; /** * Causes lombok to generate a logger field based on a custom logger implementation. * <p> - * Complete documentation is found at <a href="https://projectlombok.org/features/Log">the project lombok features page for lombok log annotations</a>. + * Complete documentation is found at <a href="https://projectlombok.org/features/log">the project lombok features page for lombok log annotations</a>. * <p> * Example: * <pre> diff --git a/src/core/lombok/extern/apachecommons/CommonsLog.java b/src/core/lombok/extern/apachecommons/CommonsLog.java index ca808329..973f556f 100644 --- a/src/core/lombok/extern/apachecommons/CommonsLog.java +++ b/src/core/lombok/extern/apachecommons/CommonsLog.java @@ -29,7 +29,7 @@ import java.lang.annotation.Target; /** * Causes lombok to generate a logger field. * <p> - * Complete documentation is found at <a href="https://projectlombok.org/features/Log">the project lombok features page for lombok log annotations</a>. + * Complete documentation is found at <a href="https://projectlombok.org/features/log">the project lombok features page for lombok log annotations</a>. * <p> * Example: * <pre> diff --git a/src/core/lombok/extern/flogger/Flogger.java b/src/core/lombok/extern/flogger/Flogger.java index 3446e949..893032ed 100644 --- a/src/core/lombok/extern/flogger/Flogger.java +++ b/src/core/lombok/extern/flogger/Flogger.java @@ -29,7 +29,7 @@ import java.lang.annotation.Target; /** * Causes lombok to generate a logger field. * <p> - * Complete documentation is found at <a href="https://projectlombok.org/features/Log">the project lombok features page for lombok log annotations</a>. + * Complete documentation is found at <a href="https://projectlombok.org/features/log">the project lombok features page for lombok log annotations</a>. * <p> * Example: * <pre> diff --git a/src/core/lombok/extern/java/Log.java b/src/core/lombok/extern/java/Log.java index f2b5024f..96e52191 100644 --- a/src/core/lombok/extern/java/Log.java +++ b/src/core/lombok/extern/java/Log.java @@ -29,7 +29,7 @@ import java.lang.annotation.Target; /** * Causes lombok to generate a logger field. * <p> - * Complete documentation is found at <a href="https://projectlombok.org/features/Log">the project lombok features page for lombok log annotations</a>. + * Complete documentation is found at <a href="https://projectlombok.org/features/log">the project lombok features page for lombok log annotations</a>. * <p> * Example: * <pre> diff --git a/src/core/lombok/extern/jbosslog/JBossLog.java b/src/core/lombok/extern/jbosslog/JBossLog.java index 960a111b..a6e5e353 100644 --- a/src/core/lombok/extern/jbosslog/JBossLog.java +++ b/src/core/lombok/extern/jbosslog/JBossLog.java @@ -29,7 +29,7 @@ import java.lang.annotation.Target; /** * Causes lombok to generate a logger field. * <p> - * Complete documentation is found at <a href="https://projectlombok.org/features/Log">the project lombok features page for lombok log annotations</a>. + * Complete documentation is found at <a href="https://projectlombok.org/features/log">the project lombok features page for lombok log annotations</a>. * <p> * Example: * <pre> diff --git a/src/core/lombok/extern/log4j/Log4j.java b/src/core/lombok/extern/log4j/Log4j.java index 1b4a973b..3db01029 100644 --- a/src/core/lombok/extern/log4j/Log4j.java +++ b/src/core/lombok/extern/log4j/Log4j.java @@ -29,7 +29,7 @@ import java.lang.annotation.Target; /** * Causes lombok to generate a logger field. * <p> - * Complete documentation is found at <a href="https://projectlombok.org/features/Log">the project lombok features page for lombok log annotations</a>. + * Complete documentation is found at <a href="https://projectlombok.org/features/log">the project lombok features page for lombok log annotations</a>. * <p> * Example: * <pre> diff --git a/src/core/lombok/extern/log4j/Log4j2.java b/src/core/lombok/extern/log4j/Log4j2.java index 571b0563..3e59a532 100644 --- a/src/core/lombok/extern/log4j/Log4j2.java +++ b/src/core/lombok/extern/log4j/Log4j2.java @@ -29,7 +29,7 @@ import java.lang.annotation.Target; /** * Causes lombok to generate a logger field. * <p> - * Complete documentation is found at <a href="https://projectlombok.org/features/Log">the project lombok features page for lombok log annotations</a>. + * Complete documentation is found at <a href="https://projectlombok.org/features/log">the project lombok features page for lombok log annotations</a>. * <p> * Example: * <pre> diff --git a/src/core/lombok/extern/slf4j/Slf4j.java b/src/core/lombok/extern/slf4j/Slf4j.java index c4aded24..da65e27c 100644 --- a/src/core/lombok/extern/slf4j/Slf4j.java +++ b/src/core/lombok/extern/slf4j/Slf4j.java @@ -29,7 +29,7 @@ import java.lang.annotation.Target; /** * Causes lombok to generate a logger field. * <p> - * Complete documentation is found at <a href="https://projectlombok.org/features/Log">the project lombok features page for lombok log annotations</a>. + * Complete documentation is found at <a href="https://projectlombok.org/features/log">the project lombok features page for lombok log annotations</a>. * <p> * Example: * <pre> diff --git a/src/core/lombok/extern/slf4j/XSlf4j.java b/src/core/lombok/extern/slf4j/XSlf4j.java index b99554a5..2dfef265 100644 --- a/src/core/lombok/extern/slf4j/XSlf4j.java +++ b/src/core/lombok/extern/slf4j/XSlf4j.java @@ -29,7 +29,7 @@ import java.lang.annotation.Target; /** * Causes lombok to generate a logger field. * <p> - * Complete documentation is found at <a href="https://projectlombok.org/features/Log">the project lombok features page for lombok log annotations</a>. + * Complete documentation is found at <a href="https://projectlombok.org/features/log">the project lombok features page for lombok log annotations</a>. * <p> * Example: * <pre> diff --git a/src/delombok/lombok/delombok/PrettyPrinter.java b/src/delombok/lombok/delombok/PrettyPrinter.java index 605b9391..13836d77 100644 --- a/src/delombok/lombok/delombok/PrettyPrinter.java +++ b/src/delombok/lombok/delombok/PrettyPrinter.java @@ -1448,6 +1448,31 @@ public class PrettyPrinter extends JCTree.Visitor { print(")"); } + void printConstantCaseLabel(JCTree tree) { + print((JCTree) readObject(tree, "expr", null)); + } + + void printPatternCaseLabel(JCTree tree) { + print((JCTree) readObject(tree, "pat", null)); + JCTree guard = readObject(tree, "guard", null); + if (guard != null) { + print(" when "); + print(guard); + } + } + + void printRecordPattern(JCTree tree) { + print((JCTree) readObject(tree, "deconstructor", null)); + print("("); + print(readObject(tree, "nested", List.<JCTree>nil()), ", "); + print(")"); + JCVariableDecl var = readObject(tree, "var", null); + if (var != null) { + print(" "); + print(var.name); + } + } + @Override public void visitTry(JCTry tree) { aPrint("try "); List<?> resources = readObject(tree, "resources", List.nil()); @@ -1672,6 +1697,12 @@ public class PrettyPrinter extends JCTree.Visitor { printGuardPattern(tree); } else if (className.endsWith("$JCParenthesizedPattern")) { // Introduced in JDK17 printParenthesizedPattern(tree); + } else if (className.endsWith("$JCConstantCaseLabel")) { // Introduced in JDK19 + printConstantCaseLabel(tree); + } else if (className.endsWith("$JCPatternCaseLabel")) { // Introduced in JDK19 + printPatternCaseLabel(tree); + } else if (className.endsWith("$JCRecordPattern")) { // Introduced in JDK19 + printRecordPattern(tree); } else { throw new AssertionError("Unhandled tree type: " + tree.getClass() + ": " + tree); } diff --git a/src/utils/lombok/javac/JavacTreeMaker.java b/src/utils/lombok/javac/JavacTreeMaker.java index d369b4e4..09855951 100644 --- a/src/utils/lombok/javac/JavacTreeMaker.java +++ b/src/utils/lombok/javac/JavacTreeMaker.java @@ -610,6 +610,8 @@ public class JavacTreeMaker { List<JCTree> labels; if (pat == null) { labels = tryResolve(DefaultCaseLabel) ? List.of(DefaultCaseLabel()) : List.<JCTree>nil(); + } else if (tryResolve(ConstantCaseLabel)) { + labels = List.<JCTree>of(ConstantCaseLabel(pat)); } else { labels = List.<JCTree>of(pat); } @@ -622,6 +624,12 @@ public class JavacTreeMaker { return invoke(DefaultCaseLabel); } + //javac versions: 19 + private static final MethodId<JCTree> ConstantCaseLabel = MethodId("ConstantCaseLabel", JCTree.class, JCExpression.class); + public JCTree ConstantCaseLabel(JCExpression expr) { + return invoke(ConstantCaseLabel, expr); + } + //javac versions: 6-8 private static final MethodId<JCSynchronized> Synchronized = MethodId("Synchronized"); public JCSynchronized Synchronized(JCExpression lock, JCBlock body) { diff --git a/test/core/src/lombok/RunTestsViaEcj.java b/test/core/src/lombok/RunTestsViaEcj.java index 60a6e92a..f4e75542 100644 --- a/test/core/src/lombok/RunTestsViaEcj.java +++ b/test/core/src/lombok/RunTestsViaEcj.java @@ -308,6 +308,14 @@ public class RunTestsViaEcj extends AbstractRunTests { mainTypeName = CharOperation.subarray(fileNameCharArray, start, end); } + @Override public int hashCode() { + return System.identityHashCode(this); + } + + @Override public boolean equals(Object obj) { + return this == obj; + } + @Override public char[] getContents() { return source; } diff --git a/test/pretty/resource/after/RecordPattern.java b/test/pretty/resource/after/RecordPattern.java new file mode 100644 index 00000000..ad9fae0b --- /dev/null +++ b/test/pretty/resource/after/RecordPattern.java @@ -0,0 +1,15 @@ +record Point(int x, int y) { +} +record Rectangle(Point upperLeft, Point lowerRight) { +} + +public class RecordPattern { + void recordPattern(Object o) { + if (o instanceof Point(int x, int y)) { + } + if (o instanceof Point(int x, int y) p) { + } + if (o instanceof Rectangle(Point(int x1, int y1), Point(int x2, int y2))) { + } + } +}
\ No newline at end of file diff --git a/test/pretty/resource/after/Switch19.java b/test/pretty/resource/after/Switch19.java new file mode 100644 index 00000000..5947830b --- /dev/null +++ b/test/pretty/resource/after/Switch19.java @@ -0,0 +1,32 @@ +public class Switch19 { + String switchPatternMatching(Object o) { + return switch (o) { + case Integer i -> String.format("int %d", i); + case Long l -> String.format("long %d", l); + case Double d -> String.format("double %f", d); + case String s -> String.format("String %s", s); + default -> o.toString(); + }; + } + + String switchNull(Object o) { + return switch (o) { + case null, default -> "?"; + }; + } + + String switchGuardPattern(Object o) { + return switch (o) { + case String s when s.length() > 1 -> s; + case String s -> s; + default -> o.toString(); + }; + } + + String switchParenthesizedPattern(Object o) { + return switch (o) { + case (String s) -> s; + default -> o.toString(); + }; + } +} diff --git a/test/pretty/resource/before/RecordPattern.java b/test/pretty/resource/before/RecordPattern.java new file mode 100644 index 00000000..93c07965 --- /dev/null +++ b/test/pretty/resource/before/RecordPattern.java @@ -0,0 +1,16 @@ +// version 19: +record Point(int x, int y) { +} +record Rectangle(Point upperLeft, Point lowerRight) { +} + +public class RecordPattern { + void recordPattern(Object o) { + if (o instanceof Point(int x, int y)) { + } + if (o instanceof Point(int x, int y) p) { + } + if (o instanceof Rectangle(Point(int x1, int y1), Point(int x2, int y2))) { + } + } +}
\ No newline at end of file diff --git a/test/pretty/resource/before/Switch17.java b/test/pretty/resource/before/Switch17.java index 17754e82..42a8f181 100644 --- a/test/pretty/resource/before/Switch17.java +++ b/test/pretty/resource/before/Switch17.java @@ -1,4 +1,4 @@ -// version 17: +// version 17:18 public class Switch17 { String switchPatternMatching(Object o) { return switch (o) { diff --git a/test/pretty/resource/before/Switch19.java b/test/pretty/resource/before/Switch19.java new file mode 100644 index 00000000..05b27928 --- /dev/null +++ b/test/pretty/resource/before/Switch19.java @@ -0,0 +1,33 @@ +// version 19: +public class Switch19 { + String switchPatternMatching(Object o) { + return switch (o) { + case Integer i -> String.format("int %d", i); + case Long l -> String.format("long %d", l); + case Double d -> String.format("double %f", d); + case String s -> String.format("String %s", s); + default -> o.toString(); + }; + } + + String switchNull(Object o) { + return switch (o) { + case null, default -> "?"; + }; + } + + String switchGuardPattern(Object o) { + return switch (o) { + case String s when s.length() > 1 -> s; + case String s -> s; + default -> o.toString(); + }; + } + + String switchParenthesizedPattern(Object o) { + return switch (o) { + case (String s) -> s; + default -> o.toString(); + }; + } +} diff --git a/test/transform/resource/after-delombok/CheckerFrameworkBuilder.java b/test/transform/resource/after-delombok/CheckerFrameworkBuilder.java index 99245e11..64f07c37 100644 --- a/test/transform/resource/after-delombok/CheckerFrameworkBuilder.java +++ b/test/transform/resource/after-delombok/CheckerFrameworkBuilder.java @@ -1,3 +1,5 @@ +//version 8: +//skip-idempotent import java.util.List; class CheckerFrameworkBuilder { int x; diff --git a/test/transform/resource/after-delombok/LoggerFloggerRecord.java b/test/transform/resource/after-delombok/LoggerFloggerRecord.java index 9cc0c9c0..bd51d056 100644 --- a/test/transform/resource/after-delombok/LoggerFloggerRecord.java +++ b/test/transform/resource/after-delombok/LoggerFloggerRecord.java @@ -1,5 +1,6 @@ +// version 14: class LoggerFloggerRecord { - record Inner(String x) { + public record Inner(String x) { @java.lang.SuppressWarnings("all") private static final com.google.common.flogger.FluentLogger log = com.google.common.flogger.FluentLogger.forEnclosingClass(); } diff --git a/test/transform/resource/after-delombok/ValInvalidParameter.java b/test/transform/resource/after-delombok/ValInvalidParameter.java index f3d4229c..787a20bf 100644 --- a/test/transform/resource/after-delombok/ValInvalidParameter.java +++ b/test/transform/resource/after-delombok/ValInvalidParameter.java @@ -1,3 +1,4 @@ +//version 7:8 public class ValInvalidParameter { public void val() { final java.lang.Object a = a(new NonExistingClass()); diff --git a/test/transform/resource/after-ecj/LoggerFloggerRecord.java b/test/transform/resource/after-ecj/LoggerFloggerRecord.java index 86004b67..fde69e74 100644 --- a/test/transform/resource/after-ecj/LoggerFloggerRecord.java +++ b/test/transform/resource/after-ecj/LoggerFloggerRecord.java @@ -1,6 +1,7 @@ +// version 19: import lombok.extern.flogger.Flogger; class LoggerFloggerRecord { - static @Flogger record Inner(String x) { + public @Flogger record Inner(com log) { private static final com.google.common.flogger.FluentLogger log = com.google.common.flogger.FluentLogger.forEnclosingClass(); /* Implicit */ private final String x; <clinit>() { diff --git a/test/transform/resource/after-ecj/NonNullOnRecord3.java b/test/transform/resource/after-ecj/NonNullOnRecord3.java index 44c00098..37f0afcf 100644 --- a/test/transform/resource/after-ecj/NonNullOnRecord3.java +++ b/test/transform/resource/after-ecj/NonNullOnRecord3.java @@ -1,13 +1,9 @@ -// version 14: +// version 19: import lombok.NonNull; public record NonNullOnRecord3(String a) { /* Implicit */ private final String a; public NonNullOnRecord3(String a) { super(); - .a = a; - } - public NonNullOnRecord3(String a) { - super(); this.a = a; } public void method(@NonNull String param) { diff --git a/test/transform/resource/before/LoggerFloggerRecord.java b/test/transform/resource/before/LoggerFloggerRecord.java index 908704d6..f8f48f2c 100644 --- a/test/transform/resource/before/LoggerFloggerRecord.java +++ b/test/transform/resource/before/LoggerFloggerRecord.java @@ -4,5 +4,5 @@ import lombok.extern.flogger.Flogger; class LoggerFloggerRecord { @Flogger - record Inner(String x) {} + public record Inner(String x) {} } diff --git a/test/transform/resource/before/ValInvalidParameter.java b/test/transform/resource/before/ValInvalidParameter.java index f4961c4e..10487e47 100644 --- a/test/transform/resource/before/ValInvalidParameter.java +++ b/test/transform/resource/before/ValInvalidParameter.java @@ -1,4 +1,4 @@ -//version :9 +//version 8:9 import lombok.val; public class ValInvalidParameter { diff --git a/website/templates/setup/vscode.html b/website/templates/setup/vscode.html index bf9c3e58..c3712291 100644 --- a/website/templates/setup/vscode.html +++ b/website/templates/setup/vscode.html @@ -5,11 +5,11 @@ <p> The <a href="https://code.visualstudio.com/">Microsoft Visual Studio Code</a> editor is compatible with lombok. </p><p> - Add the <a href="https://marketplace.visualstudio.com/items?itemName=GabrielBB.vscode-lombok">vscode-lombok</a> plugin to your Visual Studio Code IDE to add lombok support. + The <a href="https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-java-pack">Extension Pack for Java</a> provides built-in support for Lombok. <ul><li> press <code>Ctrl + Shift + X</code> to open the extension manager. </li><li> - Type <code>lombok</code> to find the plugin, and click <code>install</code>. + Type <code>java</code> to find the plugin, and click <code>install</code>. </li><li> Reload VS Code when asked. </li></ul> |