commit | f19117aa41a09c4ba8b7b720604832daec552b85 | [log] [tgz] |
---|---|---|
author | Pawel Labaj <pawel@labaj.com.pl> | Sat Feb 20 07:50:23 2021 -0800 |
committer | Google Java Core Libraries <java-core-libraries-team+copybara@google.com> | Sat Feb 20 07:50:53 2021 -0800 |
tree | c61eb3aa74018a630f2ec89dae6e674ae5d30f9a | |
parent | 7647c20d4e98678dc1511273bdb76edc48b04e54 [diff] |
Allow an AutoValue property builder to have a parameter. Previously, a property builder for `abstract ImmutableSet<String> foos()` had to look like `abstract ImmutableSet.Builder<String> foosBuilder()`. For `ImmutableSortedSet`, this meant that you could only construct a builder using `ImmutableSortedSet.naturalOrder()`. Now, if you have `abstract ImmutableSortedSet<String> foos()` you can optionally write `abstract ImmutableSortedSet.Builder<String> foosBuilder(Comparator<String> comparator)`. This works because `ImmutableSortedSet.Builder<T>` has a constructor `ImmutableSortedSet.Builder(Comparator<T>)`. This change is closely based on https://github.com/google/auto/pull/983 by Paweł Łabaj. I adjusted the formatting slightly, renamed a couple of methods, and reworded the new text in the user guide. The only substantive change is that I removed the special knowledge of the static `orderedBy` method (from `ImmutableSortedSet` and `ImmutableSortedMap`) since the builder constructor works just as well in those cases. Closes https://github.com/google/auto/pull/983. Fixes https://github.com/google/auto/issues/984. RELNOTES=AutoValue property builders can now have a single parameter which is passed to the constructor of the new builder. PiperOrigin-RevId: 358583454
A collection of source code generators for Java.
Java is full of code that is mechanical, repetitive, typically untested and sometimes the source of subtle bugs. Sounds like a job for robots!
The Auto subprojects are a collection of code generators that automate those types of tasks. They create the code you would have written, but without the bugs.
Save time. Save code. Save sanity.
AutoFactory - JSR-330-compatible factories
AutoService - Provider-configuration files for ServiceLoader
AutoValue - Immutable value-type code generation for Java 7+.
Common - Helper utilities for writing annotation processors.
Copyright 2013 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.