From 00cb81ed0959a55eb671e89768934094ca0e5e6f Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Fri, 16 Jul 2021 12:06:45 -0700 Subject: Add support for printing `AnnotationValue`s and `AnnotationMirror`s `AnnotationValue#toString` is specified to return a string "suitable for representing this value in the source code of an annotation", but recent versions of javac have started using simple names for types in annotations and class literals instead of qualified names, which breaks annotation processors that expect the source representation to be self-contained (see https://bugs.openjdk.java.net/browse/JDK-8164819). This change adds `AnnotationMirrors.toString` and `AnnotationValues.toString`, which format `AnnotationValue`s and `AnnotationMirror`s using qualified names of types to ensure the types can be resolved in generated code. RELNOTES=Add `AnnotationMirrors.toString` and `AnnotationValues.toString` PiperOrigin-RevId: 385196293 --- .../com/google/auto/common/AnnotationMirrors.java | 11 + .../com/google/auto/common/AnnotationOutput.java | 254 +++++++++++++++++++++ .../com/google/auto/common/AnnotationValues.java | 17 ++ .../google/auto/common/AnnotationMirrorsTest.java | 67 ++++++ .../google/auto/common/AnnotationValuesTest.java | 62 +++++ 5 files changed, 411 insertions(+) create mode 100644 common/src/main/java/com/google/auto/common/AnnotationOutput.java diff --git a/common/src/main/java/com/google/auto/common/AnnotationMirrors.java b/common/src/main/java/com/google/auto/common/AnnotationMirrors.java index 9ce5cd9b..2f59dd39 100644 --- a/common/src/main/java/com/google/auto/common/AnnotationMirrors.java +++ b/common/src/main/java/com/google/auto/common/AnnotationMirrors.java @@ -191,5 +191,16 @@ public final class AnnotationMirrors { .collect(toImmutableSet()); } + /** + * Returns a string representation of the given annotation mirror, suitable for inclusion in a + * Java source file to reproduce the annotation in source form. + * + *

Fully qualified names are used for types in annotations, class literals, and enum constants, + * ensuring that the source form will compile without requiring additional imports. + */ + public static String toString(AnnotationMirror annotationMirror) { + return AnnotationOutput.toString(annotationMirror); + } + private AnnotationMirrors() {} } diff --git a/common/src/main/java/com/google/auto/common/AnnotationOutput.java b/common/src/main/java/com/google/auto/common/AnnotationOutput.java new file mode 100644 index 00000000..fa1e1623 --- /dev/null +++ b/common/src/main/java/com/google/auto/common/AnnotationOutput.java @@ -0,0 +1,254 @@ +/* + * Copyright 2014 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. + */ +package com.google.auto.common; + +import static com.google.auto.common.MoreTypes.asTypeElement; + +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Iterables; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import javax.lang.model.element.AnnotationMirror; +import javax.lang.model.element.AnnotationValue; +import javax.lang.model.element.AnnotationValueVisitor; +import javax.lang.model.element.ExecutableElement; +import javax.lang.model.element.VariableElement; +import javax.lang.model.type.TypeMirror; +import javax.lang.model.util.SimpleAnnotationValueVisitor8; +import org.checkerframework.checker.nullness.qual.Nullable; + +/** + * Handling of default values for annotation members. + * + * @author emcmanus@google.com (Éamonn McManus) + */ +final class AnnotationOutput { + private AnnotationOutput() {} // There are no instances of this class. + + /** + * Visitor that produces a string representation of an annotation value, suitable for inclusion in + * a Java source file as an annotation member or as the initializer of a variable of the + * appropriate type. The syntax for the two is the same except for annotation members that are + * themselves annotations. Within an annotation, an annotation member can be written as + * {@code @NestedAnnotation(...)}, while in an initializer it must be written as an object, for + * example the construction of an {@code @AutoAnnotation} class. That's why we have this abstract + * class and two concrete subclasses. + */ + private static class SourceFormVisitor + extends SimpleAnnotationValueVisitor8<@Nullable Void, StringBuilder> { + + private String formatType(TypeMirror typeMirror) { + return asTypeElement(typeMirror).getQualifiedName().toString(); + } + + @Override + protected @Nullable Void defaultAction(Object value, StringBuilder sb) { + sb.append(value); + return null; + } + + @Override + public @Nullable Void visitArray(List values, StringBuilder sb) { + sb.append('{'); + String sep = ""; + for (AnnotationValue value : values) { + sb.append(sep); + visit(value, sb); + sep = ", "; + } + sb.append('}'); + return null; + } + + @Override + public @Nullable Void visitChar(char c, StringBuilder sb) { + appendQuoted(sb, c); + return null; + } + + @Override + public @Nullable Void visitLong(long i, StringBuilder sb) { + sb.append(i).append('L'); + return null; + } + + @Override + public @Nullable Void visitDouble(double d, StringBuilder sb) { + if (Double.isNaN(d)) { + sb.append("Double.NaN"); + } else if (d == Double.POSITIVE_INFINITY) { + sb.append("Double.POSITIVE_INFINITY"); + } else if (d == Double.NEGATIVE_INFINITY) { + sb.append("Double.NEGATIVE_INFINITY"); + } else { + sb.append(d); + } + return null; + } + + @Override + public @Nullable Void visitFloat(float f, StringBuilder sb) { + if (Float.isNaN(f)) { + sb.append("Float.NaN"); + } else if (f == Float.POSITIVE_INFINITY) { + sb.append("Float.POSITIVE_INFINITY"); + } else if (f == Float.NEGATIVE_INFINITY) { + sb.append("Float.NEGATIVE_INFINITY"); + } else { + sb.append(f).append('F'); + } + return null; + } + + @Override + public @Nullable Void visitEnumConstant(VariableElement c, StringBuilder sb) { + sb.append(formatType(c.asType())).append('.').append(c.getSimpleName()); + return null; + } + + @Override + public @Nullable Void visitString(String s, StringBuilder sb) { + appendQuoted(sb, s); + return null; + } + + @Override + public @Nullable Void visitType(TypeMirror classConstant, StringBuilder sb) { + sb.append(formatType(classConstant)).append(".class"); + return null; + } + + @Override + public @Nullable Void visitAnnotation(AnnotationMirror a, StringBuilder sb) { + sb.append('@').append(formatType(a.getAnnotationType())); + ImmutableMap map = + ImmutableMap.copyOf(a.getElementValues()); + if (!map.isEmpty()) { + sb.append('('); + Optional shortForm = shortForm(map); + if (shortForm.isPresent()) { + this.visit(maybeShorten(shortForm.get()), sb); + } else { + String sep = ""; + for (Map.Entry entry : map.entrySet()) { + sb.append(sep).append(entry.getKey().getSimpleName()).append(" = "); + sep = ", "; + this.visit(maybeShorten(entry.getValue()), sb); + } + } + sb.append(')'); + } + return null; + } + } + + private static AnnotationValue maybeShorten(AnnotationValue value) { + return ARRAY_VISITOR.visit(value, value); + } + + private static final AnnotationValueVisitor ARRAY_VISITOR = + new SimpleAnnotationValueVisitor8() { + @Override + public AnnotationValue visitArray( + List values, AnnotationValue input) { + if (values.size() == 1) { + // We can shorten @Foo(a = {23}) to @Foo(a = 23). For the specific case where `a` is + // actually `value`, we'll already have shortened that in visitAnnotation, so + // effectively we go from @Foo(value = {23}) to @Foo({23}) to @Foo(23). + return Iterables.getOnlyElement(values); + } + return input; + } + + @Override + protected AnnotationValue defaultAction(Object o, AnnotationValue input) { + return input; + } + }; + + // We can shorten @Annot(value = 23) to @Annot(23). + private static Optional shortForm( + Map values) { + if (values.size() == 1 + && Iterables.getOnlyElement(values.keySet()).getSimpleName().contentEquals("value")) { + return Optional.of(Iterables.getOnlyElement(values.values())); + } + return Optional.empty(); + } + + /** + * Returns a string representation of the given annotation value, suitable for inclusion in a Java + * source file as the initializer of a variable of the appropriate type. + */ + static String toString(AnnotationValue annotationValue) { + StringBuilder sb = new StringBuilder(); + new SourceFormVisitor().visit(annotationValue, sb); + return sb.toString(); + } + + /** + * Returns a string representation of the given annotation mirror, suitable for inclusion in a + * Java source file to reproduce the annotation in source form. + */ + static String toString(AnnotationMirror annotationMirror) { + StringBuilder sb = new StringBuilder(); + new SourceFormVisitor().visitAnnotation(annotationMirror, sb); + return sb.toString(); + } + + private static StringBuilder appendQuoted(StringBuilder sb, String s) { + sb.append('"'); + for (int i = 0; i < s.length(); i++) { + appendEscaped(sb, s.charAt(i)); + } + return sb.append('"'); + } + + private static StringBuilder appendQuoted(StringBuilder sb, char c) { + sb.append('\''); + appendEscaped(sb, c); + return sb.append('\''); + } + + private static void appendEscaped(StringBuilder sb, char c) { + switch (c) { + case '\\': + case '"': + case '\'': + sb.append('\\').append(c); + break; + case '\n': + sb.append("\\n"); + break; + case '\r': + sb.append("\\r"); + break; + case '\t': + sb.append("\\t"); + break; + default: + if (c < 0x20) { + sb.append(String.format("\\%03o", (int) c)); + } else if (c < 0x7f || Character.isLetter(c)) { + sb.append(c); + } else { + sb.append(String.format("\\u%04x", (int) c)); + } + break; + } + } +} diff --git a/common/src/main/java/com/google/auto/common/AnnotationValues.java b/common/src/main/java/com/google/auto/common/AnnotationValues.java index 0712e56a..a3cc9495 100644 --- a/common/src/main/java/com/google/auto/common/AnnotationValues.java +++ b/common/src/main/java/com/google/auto/common/AnnotationValues.java @@ -512,5 +512,22 @@ public final class AnnotationValues { return ANNOTATION_VALUES_VISITOR.visit(value); } + /** + * Returns a string representation of the given annotation value, suitable for inclusion in a Java + * source file as part of an annotation. For example, if {@code annotationValue} represents the + * string {@code unchecked} in the annotation {@code @SuppressWarnings("unchecked")}, this method + * will return the string {@code "unchecked"}, which you can then use as part of an annotation + * being generated. + * + *

For all annotation values other than nested annotations, the returned string can also be + * used to initialize a variable of the appropriate type. + * + *

Fully qualified names are used for types in annotations, class literals, and enum constants, + * ensuring that the source form will compile without requiring additional imports. + */ + public static String toString(AnnotationValue annotationValue) { + return AnnotationOutput.toString(annotationValue); + } + private AnnotationValues() {} } diff --git a/common/src/test/java/com/google/auto/common/AnnotationMirrorsTest.java b/common/src/test/java/com/google/auto/common/AnnotationMirrorsTest.java index b1dfe3b3..83494a84 100644 --- a/common/src/test/java/com/google/auto/common/AnnotationMirrorsTest.java +++ b/common/src/test/java/com/google/auto/common/AnnotationMirrorsTest.java @@ -296,6 +296,73 @@ public class AnnotationMirrorsTest { AnnotationMirrors.getAnnotatedAnnotations(element, annotatingAnnotationElement)); } + @Test + public void toSourceString() { + assertThat(AnnotationMirrors.toString(annotationOn(AlsoSimplyAnnotated.class))) + .isEqualTo("@com.google.auto.common.AnnotationMirrorsTest.SimpleAnnotation"); + assertThat(AnnotationMirrors.toString(annotationOn(SimplyAnnotated.class))) + .isEqualTo("@com.google.auto.common.AnnotationMirrorsTest.SimpleAnnotation"); + assertThat(AnnotationMirrors.toString(annotationOn(StringySet.class))) + .isEqualTo("@com.google.auto.common.AnnotationMirrorsTest.Stringy(\"foo\")"); + assertThat(AnnotationMirrors.toString(annotationOn(StringyUnset.class))) + .isEqualTo("@com.google.auto.common.AnnotationMirrorsTest.Stringy"); + assertThat(AnnotationMirrors.toString(annotationOn(TestBlahNestedAnnotated.class))) + .isEqualTo( + "@com.google.auto.common.AnnotationMirrorsTest.AnnotatedOuter(@com.google.auto.common.AnnotationMirrorsTest.DefaultingOuter(com.google.auto.common.AnnotationMirrorsTest.SimpleEnum.BLAH))"); + assertThat(AnnotationMirrors.toString(annotationOn(TestClassBlah2.class))) + .isEqualTo( + "@com.google.auto.common.AnnotationMirrorsTest.Outer(com.google.auto.common.AnnotationMirrorsTest.SimpleEnum.BLAH)"); + assertThat(AnnotationMirrors.toString(annotationOn(TestClassBlah.class))) + .isEqualTo( + "@com.google.auto.common.AnnotationMirrorsTest.Outer(com.google.auto.common.AnnotationMirrorsTest.SimpleEnum.BLAH)"); + assertThat(AnnotationMirrors.toString(annotationOn(TestClassFoo.class))) + .isEqualTo( + "@com.google.auto.common.AnnotationMirrorsTest.Outer(com.google.auto.common.AnnotationMirrorsTest.SimpleEnum.FOO)"); + assertThat(AnnotationMirrors.toString(annotationOn(TestDefaultNestedAnnotated.class))) + .isEqualTo( + "@com.google.auto.common.AnnotationMirrorsTest.AnnotatedOuter(@com.google.auto.common.AnnotationMirrorsTest.DefaultingOuter)"); + assertThat(AnnotationMirrors.toString(annotationOn(TestFooNestedAnnotated.class))) + .isEqualTo( + "@com.google.auto.common.AnnotationMirrorsTest.AnnotatedOuter(@com.google.auto.common.AnnotationMirrorsTest.DefaultingOuter(com.google.auto.common.AnnotationMirrorsTest.SimpleEnum.FOO))"); + assertThat(AnnotationMirrors.toString(annotationOn(TestValueArrayWithBlahFoo.class))) + .isEqualTo( + "@com.google.auto.common.AnnotationMirrorsTest.OuterWithValueArray({@com.google.auto.common.AnnotationMirrorsTest.DefaultingOuter(com.google.auto.common.AnnotationMirrorsTest.SimpleEnum.BLAH)," + + " @com.google.auto.common.AnnotationMirrorsTest.DefaultingOuter(com.google.auto.common.AnnotationMirrorsTest.SimpleEnum.FOO)})"); + assertThat(AnnotationMirrors.toString(annotationOn(TestValueArrayWithDefault.class))) + .isEqualTo("@com.google.auto.common.AnnotationMirrorsTest.OuterWithValueArray"); + assertThat(AnnotationMirrors.toString(annotationOn(TestValueArrayWithEmpty.class))) + .isEqualTo("@com.google.auto.common.AnnotationMirrorsTest.OuterWithValueArray({})"); + assertThat(AnnotationMirrors.toString(annotationOn(TestValueArrayWithFooAndDefaultBlah.class))) + .isEqualTo( + "@com.google.auto.common.AnnotationMirrorsTest.OuterWithValueArray({@com.google.auto.common.AnnotationMirrorsTest.DefaultingOuter(com.google.auto.common.AnnotationMirrorsTest.SimpleEnum.FOO)," + + " @com.google.auto.common.AnnotationMirrorsTest.DefaultingOuter})"); + assertThat(AnnotationMirrors.toString(annotationOn(TestValueArrayWithFooBlah2.class))) + .isEqualTo( + "@com.google.auto.common.AnnotationMirrorsTest.OuterWithValueArray({@com.google.auto.common.AnnotationMirrorsTest.DefaultingOuter(com.google.auto.common.AnnotationMirrorsTest.SimpleEnum.FOO)," + + " @com.google.auto.common.AnnotationMirrorsTest.DefaultingOuter(com.google.auto.common.AnnotationMirrorsTest.SimpleEnum.BLAH)})"); + assertThat(AnnotationMirrors.toString(annotationOn(TestValueArrayWithFooBlah.class))) + .isEqualTo( + "@com.google.auto.common.AnnotationMirrorsTest.OuterWithValueArray({@com.google.auto.common.AnnotationMirrorsTest.DefaultingOuter(com.google.auto.common.AnnotationMirrorsTest.SimpleEnum.FOO)," + + " @com.google.auto.common.AnnotationMirrorsTest.DefaultingOuter(com.google.auto.common.AnnotationMirrorsTest.SimpleEnum.BLAH)})"); + assertThat(AnnotationMirrors.toString(annotationOn(TestValueArrayWithOneBlah.class))) + .isEqualTo( + "@com.google.auto.common.AnnotationMirrorsTest.OuterWithValueArray(@com.google.auto.common.AnnotationMirrorsTest.DefaultingOuter(com.google.auto.common.AnnotationMirrorsTest.SimpleEnum.BLAH))"); + assertThat(AnnotationMirrors.toString(annotationOn(TestValueArrayWithOneDefault.class))) + .isEqualTo( + "@com.google.auto.common.AnnotationMirrorsTest.OuterWithValueArray(@com.google.auto.common.AnnotationMirrorsTest.DefaultingOuter)"); + assertThat(AnnotationMirrors.toString(annotationOn(TestValueArrayWithOneFoo.class))) + .isEqualTo( + "@com.google.auto.common.AnnotationMirrorsTest.OuterWithValueArray(@com.google.auto.common.AnnotationMirrorsTest.DefaultingOuter(com.google.auto.common.AnnotationMirrorsTest.SimpleEnum.FOO))"); + assertThat(AnnotationMirrors.toString(annotationOn(TestWithDefaultingOuterBlah.class))) + .isEqualTo( + "@com.google.auto.common.AnnotationMirrorsTest.DefaultingOuter(com.google.auto.common.AnnotationMirrorsTest.SimpleEnum.BLAH)"); + assertThat(AnnotationMirrors.toString(annotationOn(TestWithDefaultingOuterDefault.class))) + .isEqualTo("@com.google.auto.common.AnnotationMirrorsTest.DefaultingOuter"); + assertThat(AnnotationMirrors.toString(annotationOn(TestWithDefaultingOuterFoo.class))) + .isEqualTo( + "@com.google.auto.common.AnnotationMirrorsTest.DefaultingOuter(com.google.auto.common.AnnotationMirrorsTest.SimpleEnum.FOO)"); + } + private void getAnnotatedAnnotationsAsserts( ImmutableSet annotatedAnnotations) { assertThat(annotatedAnnotations) diff --git a/common/src/test/java/com/google/auto/common/AnnotationValuesTest.java b/common/src/test/java/com/google/auto/common/AnnotationValuesTest.java index 825c85af..2f99fff2 100644 --- a/common/src/test/java/com/google/auto/common/AnnotationValuesTest.java +++ b/common/src/test/java/com/google/auto/common/AnnotationValuesTest.java @@ -17,8 +17,10 @@ package com.google.auto.common; import static com.google.common.collect.ImmutableList.toImmutableList; import static com.google.common.truth.Truth.assertThat; +import static java.util.stream.Collectors.joining; import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; import com.google.common.truth.Correspondence; import com.google.testing.compile.CompilationRule; import javax.lang.model.element.AnnotationMirror; @@ -344,6 +346,66 @@ public final class AnnotationValuesTest { assertThat(AnnotationValues.getChars(value)).containsExactly('b', 'c').inOrder(); } + @Test + public void toSourceString() { + ImmutableMap inputs = + ImmutableMap.builder() + .put("classValue", "com.google.auto.common.AnnotationValuesTest.InsideClassA.class") + .put( + "classValues", + "{com.google.auto.common.AnnotationValuesTest.InsideClassA.class," + + " com.google.auto.common.AnnotationValuesTest.InsideClassB.class}") + .put( + "genericClassValue", + "com.google.auto.common.AnnotationValuesTest.GenericClass.class") + .put( + "insideAnnotationValue", + "@com.google.auto.common.AnnotationValuesTest.InsideAnnotation(19)") + .put( + "insideAnnotationValues", + "{@com.google.auto.common.AnnotationValuesTest.InsideAnnotation(20)," + + " @com.google.auto.common.AnnotationValuesTest.InsideAnnotation(21)}") + .put("stringValue", "\"hello\"") + .put("stringValues", "{\"it\\'s\", \"me\"}") + .put("enumValue", "com.google.auto.common.AnnotationValuesTest.Foo.BAR") + .put( + "enumValues", + "{com.google.auto.common.AnnotationValuesTest.Foo.BAZ," + + " com.google.auto.common.AnnotationValuesTest.Foo.BAH}") + .put("intValue", "5") + .put("intValues", "{1, 2}") + .put("longValue", "6L") + .put("longValues", "{3L, 4L}") + .put("byteValue", "7") + .put("byteValues", "{8, 9}") + .put("shortValue", "10") + .put("shortValues", "{11, 12}") + .put("floatValue", "13.0F") + .put("floatValues", "{14.0F, 15.0F}") + .put("doubleValue", "16.0") + .put("doubleValues", "{17.0, 18.0}") + .put("booleanValue", "true") + .put("booleanValues", "{true, false}") + .put("charValue", "'a'") + .put("charValues", "{'b', 'c'}") + .build(); + inputs.forEach( + (name, expected) -> + assertThat( + AnnotationValues.toString( + AnnotationMirrors.getAnnotationValue(annotationMirror, name))) + .isEqualTo(expected)); + assertThat(AnnotationMirrors.toString(annotationMirror)) + .isEqualTo( + inputs.entrySet().stream() + .map(e -> e.getKey() + " = " + e.getValue()) + .collect( + joining( + ", ", + "@com.google.auto.common.AnnotationValuesTest.MultiValueAnnotation(", + ")"))); + } + private TypeElement getTypeElement(Class clazz) { return elements.getTypeElement(clazz.getCanonicalName()); } -- cgit v1.2.3 From e3a8b2b30e6bfa913a1e9f9aac23c7d19a80fc31 Mon Sep 17 00:00:00 2001 From: Google Java Core Libraries Date: Wed, 21 Jul 2021 01:54:40 -0700 Subject: Mark non-static non-abstract methods as final in the examples. Make examples follow the best practice to consider that other developers will try to read and understand your value class while looking only at your hand-written class, not the actual (generated) implementation class. Marking all concrete methods final will make it clear that the generated subclass will not be overriding them. RELNOTES=n/a PiperOrigin-RevId: 385963571 --- value/userguide/builders-howto.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/value/userguide/builders-howto.md b/value/userguide/builders-howto.md index e7cf5373..aebdbfd3 100644 --- a/value/userguide/builders-howto.md +++ b/value/userguide/builders-howto.md @@ -154,7 +154,7 @@ public abstract class Animal { abstract Builder toBuilder(); - public Animal withName(String name) { + public final Animal withName(String name) { return toBuilder().setName(name).build(); } @@ -201,7 +201,7 @@ public abstract class Animal { abstract Animal autoBuild(); // not public - public Animal build() { + public final Animal build() { Animal animal = autoBuild(); Preconditions.checkState(animal.numberOfLegs() >= 0, "Negative legs"); return animal; @@ -235,7 +235,7 @@ public abstract class Animal { abstract Animal autoBuild(); // not public - public Animal build() { + public final Animal build() { setName(name().toLowerCase()); return autoBuild(); } @@ -279,7 +279,7 @@ public abstract class Animal { abstract Animal autoBuild(); // not public - public Animal build() { + public final Animal build() { if (!name().isPresent()) { setName(numberOfLegs() + "-legged creature"); } @@ -491,7 +491,7 @@ public abstract class Animal { public abstract Builder setNumberOfLegs(int value); abstract ImmutableSet.Builder countriesBuilder(); - public Builder addCountry(String value) { + public final Builder addCountry(String value) { countriesBuilder().add(value); return this; } -- cgit v1.2.3 From 22db69dff4ad60b4a752e8bd27f0d8e9f06fd38d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 22 Jul 2021 11:00:20 -0700 Subject: Bump auto-value-annotations from 1.8.1 to 1.8.2 in /factory Bumps [auto-value-annotations](https://github.com/google/auto) from 1.8.1 to 1.8.2.

Release notes

Sourced from auto-value-annotations's releases.

AutoValue 1.8.2

  • Fixed a bug with AutoBuilder and property builder methods. (05ea1356)
  • Generated builder code is now slightly friendly to null-analysis. (f00c32a5)
  • Fixed a problem where @SerializableAutoValue could generate incorrect code for complex types. (689c8d49)
  • Implicitly exclude Kotlin @Metadata annotations from @CopyAnnotations (7d3aa66e)
Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.auto.value:auto-value-annotations&package-manager=maven&previous-version=1.8.1&new-version=1.8.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1134 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1134 from google:dependabot/maven/factory/com.google.auto.value-auto-value-annotations-1.8.2 99d6b31d42c8888db5b3ebf585d4ebd84cc38325 PiperOrigin-RevId: 386277940 --- factory/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/factory/pom.xml b/factory/pom.xml index 629223a9..62f9df3f 100644 --- a/factory/pom.xml +++ b/factory/pom.xml @@ -37,7 +37,7 @@ UTF-8 1.0 - 1.8.1 + 1.8.2 1.8 30.1.1-jre 1.1.3 -- cgit v1.2.3 From df56d1878675cec6e3952d41c45c51ac8837517d Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Fri, 23 Jul 2021 10:14:27 -0700 Subject: Add explicit casts to deficient numeric types To avoid `possible lossy conversion from int to byte/short` errors when using `AnnotationValue`s for `byte` or `short` in some contexts, e.g.: ``` void f() { g(0); } void g(byte b) {} ``` ``` error: incompatible types: possible lossy conversion from int to byte g(0); ^ ``` RELNOTES=n/a PiperOrigin-RevId: 386478953 --- .../main/java/com/google/auto/common/AnnotationOutput.java | 12 ++++++++++++ .../java/com/google/auto/common/AnnotationValuesTest.java | 8 ++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/com/google/auto/common/AnnotationOutput.java b/common/src/main/java/com/google/auto/common/AnnotationOutput.java index fa1e1623..e52bde66 100644 --- a/common/src/main/java/com/google/auto/common/AnnotationOutput.java +++ b/common/src/main/java/com/google/auto/common/AnnotationOutput.java @@ -74,6 +74,18 @@ final class AnnotationOutput { return null; } + @Override + public @Nullable Void visitByte(byte b, StringBuilder sb) { + sb.append("(byte) ").append(b); + return null; + } + + @Override + public @Nullable Void visitShort(short s, StringBuilder sb) { + sb.append("(short) ").append(s); + return null; + } + @Override public @Nullable Void visitChar(char c, StringBuilder sb) { appendQuoted(sb, c); diff --git a/common/src/test/java/com/google/auto/common/AnnotationValuesTest.java b/common/src/test/java/com/google/auto/common/AnnotationValuesTest.java index 2f99fff2..c6997b2a 100644 --- a/common/src/test/java/com/google/auto/common/AnnotationValuesTest.java +++ b/common/src/test/java/com/google/auto/common/AnnotationValuesTest.java @@ -376,10 +376,10 @@ public final class AnnotationValuesTest { .put("intValues", "{1, 2}") .put("longValue", "6L") .put("longValues", "{3L, 4L}") - .put("byteValue", "7") - .put("byteValues", "{8, 9}") - .put("shortValue", "10") - .put("shortValues", "{11, 12}") + .put("byteValue", "(byte) 7") + .put("byteValues", "{(byte) 8, (byte) 9}") + .put("shortValue", "(short) 10") + .put("shortValues", "{(short) 11, (short) 12}") .put("floatValue", "13.0F") .put("floatValues", "{14.0F, 15.0F}") .put("doubleValue", "16.0") -- cgit v1.2.3 From bc250f6f57d190ecd57027b69b8146b912ee8150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Sat, 24 Jul 2021 08:37:57 -0700 Subject: Simplify old GWT-handling code in AutoValue. RELNOTES=n/a PiperOrigin-RevId: 386635339 --- .../auto/value/processor/GwtCompatibility.java | 30 +--------------------- .../auto/value/processor/GwtSerialization.java | 16 +++++------- 2 files changed, 7 insertions(+), 39 deletions(-) diff --git a/value/src/main/java/com/google/auto/value/processor/GwtCompatibility.java b/value/src/main/java/com/google/auto/value/processor/GwtCompatibility.java index fae4e092..35fcbbf0 100644 --- a/value/src/main/java/com/google/auto/value/processor/GwtCompatibility.java +++ b/value/src/main/java/com/google/auto/value/processor/GwtCompatibility.java @@ -15,15 +15,9 @@ */ package com.google.auto.value.processor; -import static java.util.stream.Collectors.joining; - -import java.util.Collections; import java.util.List; -import java.util.Map; import java.util.Optional; import javax.lang.model.element.AnnotationMirror; -import javax.lang.model.element.AnnotationValue; -import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.Name; import javax.lang.model.element.TypeElement; @@ -46,29 +40,7 @@ class GwtCompatibility { return gwtCompatibleAnnotation; } - // Get rid of the misconceived - // in the return type of getElementValues(). - static Map getElementValues(AnnotationMirror annotation) { - return Collections.unmodifiableMap( - annotation.getElementValues()); - } - String gwtCompatibleAnnotationString() { - if (gwtCompatibleAnnotation.isPresent()) { - AnnotationMirror annotation = gwtCompatibleAnnotation.get(); - TypeElement annotationElement = (TypeElement) annotation.getAnnotationType().asElement(); - String annotationArguments; - if (annotation.getElementValues().isEmpty()) { - annotationArguments = ""; - } else { - annotationArguments = - getElementValues(annotation).entrySet().stream() - .map(e -> e.getKey().getSimpleName() + " = " + e.getValue()) - .collect(joining(", ", "(", ")")); - } - return "@" + annotationElement.getQualifiedName() + annotationArguments; - } else { - return ""; - } + return gwtCompatibleAnnotation.map(AnnotationOutput::sourceFormForAnnotation).orElse(""); } } diff --git a/value/src/main/java/com/google/auto/value/processor/GwtSerialization.java b/value/src/main/java/com/google/auto/value/processor/GwtSerialization.java index 30ad0926..8673d3db 100644 --- a/value/src/main/java/com/google/auto/value/processor/GwtSerialization.java +++ b/value/src/main/java/com/google/auto/value/processor/GwtSerialization.java @@ -18,6 +18,7 @@ package com.google.auto.value.processor; import static java.nio.charset.StandardCharsets.UTF_8; import static java.util.stream.Collectors.toList; +import com.google.auto.common.AnnotationMirrors; import com.google.auto.value.processor.AutoValueishProcessor.GetterProperty; import com.google.auto.value.processor.PropertyBuilderClassifier.PropertyBuilder; import com.google.common.collect.ImmutableMap; @@ -26,13 +27,10 @@ import com.google.escapevelocity.Template; import java.io.IOException; import java.io.Writer; import java.util.List; -import java.util.Map; import java.util.Optional; import java.util.zip.CRC32; import javax.annotation.processing.ProcessingEnvironment; import javax.lang.model.element.AnnotationMirror; -import javax.lang.model.element.AnnotationValue; -import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import javax.lang.model.type.TypeMirror; import javax.tools.Diagnostic; @@ -60,13 +58,11 @@ class GwtSerialization { Optional optionalGwtCompatible = gwtCompatibility.gwtCompatibleAnnotation(); if (optionalGwtCompatible.isPresent()) { AnnotationMirror gwtCompatible = optionalGwtCompatible.get(); - for (Map.Entry entry : - GwtCompatibility.getElementValues(gwtCompatible).entrySet()) { - if (entry.getKey().getSimpleName().contentEquals("serializable") - && entry.getValue().getValue().equals(true)) { - return true; - } - } + return AnnotationMirrors.getAnnotationValuesWithDefaults(gwtCompatible).entrySet().stream() + .anyMatch( + e -> + e.getKey().getSimpleName().contentEquals("serializable") + && e.getValue().getValue().equals(true)); } return false; } -- cgit v1.2.3 From 3e1a3182f63f3850efad64b61f5b1e2a9a7d148f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 24 Jul 2021 23:48:37 -0700 Subject: Bump errorprone.version from 2.7.1 to 2.8.0 in /value Bumps `errorprone.version` from 2.7.1 to 2.8.0. Updates `error_prone_annotations` from 2.7.1 to 2.8.0
Release notes

Sourced from error_prone_annotations's releases.

Error Prone 2.8.0

New Checks:

Fixes #1652, #2122, #2122, #2366, #2404, #2411

Commits

Updates `error_prone_type_annotations` from 2.7.1 to 2.8.0
Release notes

Sourced from error_prone_type_annotations's releases.

Error Prone 2.8.0

New Checks:

Fixes #1652, #2122, #2122, #2366, #2404, #2411

Commits

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1138 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1138 from google:dependabot/maven/value/errorprone.version-2.8.0 7f6aa3ff48bfd9d013ae3dc7d6fabe7549cdd307 PiperOrigin-RevId: 386693475 --- value/processor/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/value/processor/pom.xml b/value/processor/pom.xml index 0a3e1bf1..dd2a5d92 100644 --- a/value/processor/pom.xml +++ b/value/processor/pom.xml @@ -42,7 +42,7 @@ 1.0 - 2.7.1 + 2.8.0 -- cgit v1.2.3 From 08fd0fbc08574f4a270287f5e21ff341fe4c3af0 Mon Sep 17 00:00:00 2001 From: Liam Miller-Cushon Date: Mon, 26 Jul 2021 23:11:24 -0700 Subject: Migrate from `AnnotationMirror#toString` to `auto-common`'s `AnnotationMirrors.toString`. PiperOrigin-RevId: 387036753 --- factory/pom.xml | 2 +- factory/src/main/java/com/google/auto/factory/processor/Key.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/factory/pom.xml b/factory/pom.xml index 62f9df3f..f818e2cc 100644 --- a/factory/pom.xml +++ b/factory/pom.xml @@ -71,7 +71,7 @@ com.google.auto auto-common - 1.1 + 1.1.2 com.google.auto.value diff --git a/factory/src/main/java/com/google/auto/factory/processor/Key.java b/factory/src/main/java/com/google/auto/factory/processor/Key.java index 728149eb..6dc76445 100644 --- a/factory/src/main/java/com/google/auto/factory/processor/Key.java +++ b/factory/src/main/java/com/google/auto/factory/processor/Key.java @@ -97,7 +97,7 @@ abstract class Key { public final String toString() { String typeQualifiedName = MoreTypes.asTypeElement(type().get()).toString(); return qualifier().isPresent() - ? qualifier().get() + "/" + typeQualifiedName + ? AnnotationMirrors.toString(qualifier().get()) + "/" + typeQualifiedName : typeQualifiedName; } } -- cgit v1.2.3 From 4c810b8fb3f01b65e4dc1391c754cde5a894f550 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 27 Jul 2021 22:54:41 -0700 Subject: Bump auto-common from 1.1 to 1.1.2 in /service Bumps [auto-common](https://github.com/google/auto) from 1.1 to 1.1.2.
Release notes

Sourced from auto-common's releases.

AutoCommon 1.1.2

  • Add AnnotationMirrors.toString and AnnotationValues.toString (00cb81ed)

(The AutoCommon 1.1.1 release was incorrect and should not be used.)

Commits
  • 3cd32f8 Set version number for auto-common to 1.1.2.
  • 3e1a318 Bump errorprone.version from 2.7.1 to 2.8.0 in /value
  • bc250f6 Simplify old GWT-handling code in AutoValue.
  • df56d18 Add explicit casts to deficient numeric types
  • 22db69d Bump auto-value-annotations from 1.8.1 to 1.8.2 in /factory
  • e3a8b2b Mark non-static non-abstract methods as final in the examples.
  • 00cb81e Add support for printing AnnotationValues and AnnotationMirrors
  • 04ebf9c Bump kotlin.version from 1.5.20 to 1.5.21 in /value
  • f09743c Annotate com.google.auto.factory for null hygiene.
  • 895a4d5 Internal change
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.auto:auto-common&package-manager=maven&previous-version=1.1&new-version=1.1.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1141 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1141 from google:dependabot/maven/service/com.google.auto-auto-common-1.1.2 007c9c7da3ed01a16c156e604052d9ea1fe52915 PiperOrigin-RevId: 387275498 --- service/processor/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/processor/pom.xml b/service/processor/pom.xml index 262493a9..f8b45cb6 100644 --- a/service/processor/pom.xml +++ b/service/processor/pom.xml @@ -49,7 +49,7 @@ com.google.auto auto-common - 1.1 + 1.1.2 com.google.guava -- cgit v1.2.3 From 703b733cb984afc55f49d0dd7402671eb293af56 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 28 Jul 2021 07:32:14 -0700 Subject: Bump auto-common from 1.1 to 1.1.2 in /value Bumps [auto-common](https://github.com/google/auto) from 1.1 to 1.1.2.
Release notes

Sourced from auto-common's releases.

AutoCommon 1.1.2

  • Add AnnotationMirrors.toString and AnnotationValues.toString (00cb81ed)

(The AutoCommon 1.1.1 release was incorrect and should not be used.)

Commits
  • 3cd32f8 Set version number for auto-common to 1.1.2.
  • 3e1a318 Bump errorprone.version from 2.7.1 to 2.8.0 in /value
  • bc250f6 Simplify old GWT-handling code in AutoValue.
  • df56d18 Add explicit casts to deficient numeric types
  • 22db69d Bump auto-value-annotations from 1.8.1 to 1.8.2 in /factory
  • e3a8b2b Mark non-static non-abstract methods as final in the examples.
  • 00cb81e Add support for printing AnnotationValues and AnnotationMirrors
  • 04ebf9c Bump kotlin.version from 1.5.20 to 1.5.21 in /value
  • f09743c Annotate com.google.auto.factory for null hygiene.
  • 895a4d5 Internal change
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.auto:auto-common&package-manager=maven&previous-version=1.1&new-version=1.1.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1143 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1143 from google:dependabot/maven/value/com.google.auto-auto-common-1.1.2 46385e2b7f300565a7aa0abf3f97cdd48ab38cf9 PiperOrigin-RevId: 387345617 --- value/processor/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/value/processor/pom.xml b/value/processor/pom.xml index dd2a5d92..7de2d12e 100644 --- a/value/processor/pom.xml +++ b/value/processor/pom.xml @@ -49,7 +49,7 @@ com.google.auto auto-common - 1.1 + 1.1.2 com.google.auto.service -- cgit v1.2.3 From 91d1ae994941dd4eabef4ba6736e8280a7ca4e9d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 30 Jul 2021 09:39:19 -0700 Subject: Bump styfle/cancel-workflow-action from 0.9.0 to 0.9.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [styfle/cancel-workflow-action](https://github.com/styfle/cancel-workflow-action) from 0.9.0 to 0.9.1.
Release notes

Sourced from styfle/cancel-workflow-action's releases.

0.9.1

Patches

  • Fix: cancelling jobs from different repos where two branches have the same name: #105
  • Fix: use getBooleanInput instead of getInput: #92
  • Chore: add permissions configuration in the README.md: #96
  • Chore: add prettier config, format file, add lint workflow: #63
  • Chore: create dependabot.yml: #68
  • Bump typescript from 4.1.5 to 4.2.4: #71
  • Bump actions/setup-node requirement to v2.1.5: #69
  • Bump @​vercel/ncc to 0.28.3: #73
  • Bump @​actions/core from 1.2.6 to 1.2.7: #74
  • Bump @​vercel/ncc from 0.28.3 to 0.28.5: #81
  • Bump @​actions/core from 1.2.7 to 1.3.0: #90
  • Bump prettier from 2.2.1 to 2.3.0: #85
  • Bump @​vercel/ncc from 0.28.5 to 0.28.6: #95
  • Bump typescript from 4.2.4 to 4.3.2: #94
  • Bump prettier from 2.3.0 to 2.3.1: #97
  • Bump typescript from 4.3.2 to 4.3.4: #99
  • Bump prettier from 2.3.1 to 2.3.2: #100
  • Bump typescript from 4.3.4 to 4.3.5: #101
  • Bump husky from 6.0.0 to 7.0.0: #102
  • Bump husky from 7.0.0 to 7.0.1: #103

Credits

Huge thanks to @​mikehardy, @​MichaelDeBoey, @​Warashi, @​adrienbernede, and @​spaceface777 for helping!

Commits
  • a40b884 0.9.1
  • a66ae1f fix cancelling jobs from different repos where two branches have the same nam...
  • b54f1a5 Bump husky from 7.0.0 to 7.0.1 (#103)
  • cc6225c Bump husky from 6.0.0 to 7.0.0 (#102)
  • c94109d Bump typescript from 4.3.4 to 4.3.5 (#101)
  • fc3581b Bump prettier from 2.3.1 to 2.3.2 (#100)
  • 6f9f8b4 Bump typescript from 4.3.2 to 4.3.4 (#99)
  • 6135c0f Bump prettier from 2.3.0 to 2.3.1 (#97)
  • 531a036 chore: add permissions configuration in the README.md (#96)
  • 1f10757 Bump typescript from 4.2.4 to 4.3.2 (#94)
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=styfle/cancel-workflow-action&package-manager=github_actions&previous-version=0.9.0&new-version=0.9.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1144 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1144 from google:dependabot/github_actions/styfle/cancel-workflow-action-0.9.1 a4071785e7306bf3fc7ae3de0b1c8e057ab50db9 PiperOrigin-RevId: 387823847 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec922435..11c5e86c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: steps: # Cancel any previous runs for the same branch that are still running. - name: 'Cancel previous runs' - uses: styfle/cancel-workflow-action@0.9.0 + uses: styfle/cancel-workflow-action@0.9.1 with: access_token: ${{ github.token }} - name: 'Check out repository' -- cgit v1.2.3 From ebfa3ff6911e8a73d86d1dbce440dd4696c5164d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 4 Aug 2021 07:23:48 -0700 Subject: Bump errorprone.version from 2.8.0 to 2.8.1 in /value Bumps `errorprone.version` from 2.8.0 to 2.8.1. Updates `error_prone_annotations` from 2.8.0 to 2.8.1
Commits
  • 3f51efd Release Error Prone 2.8.1
  • fb208dd Use nexus-staging-maven-plugin to release to maven central from maven
  • b660308 Handle more cases in ReturnMissingNullable.
  • cc5ef9e Fix typo in the "The Problem" paragraph.
  • 4c57125 All forEach on subtypes of Collection
  • 6a63b57 Discourage looping over the result of toCharArray()
  • 4e91cb4 Automatic code cleanup.
  • de0b017 Add a flag to configure the default nullness annotation
  • c5218ed Add suggested fixes for OptionalOfRedundantMethod
  • 91416d5 Remove removed tests from TEST_DEPS, and add assertions to prevent recurrence.
  • See full diff in compare view

Updates `error_prone_type_annotations` from 2.8.0 to 2.8.1
Commits
  • 3f51efd Release Error Prone 2.8.1
  • fb208dd Use nexus-staging-maven-plugin to release to maven central from maven
  • b660308 Handle more cases in ReturnMissingNullable.
  • cc5ef9e Fix typo in the "The Problem" paragraph.
  • 4c57125 All forEach on subtypes of Collection
  • 6a63b57 Discourage looping over the result of toCharArray()
  • 4e91cb4 Automatic code cleanup.
  • de0b017 Add a flag to configure the default nullness annotation
  • c5218ed Add suggested fixes for OptionalOfRedundantMethod
  • 91416d5 Remove removed tests from TEST_DEPS, and add assertions to prevent recurrence.
  • See full diff in compare view

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1145 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1145 from google:dependabot/maven/value/errorprone.version-2.8.1 97ffdad1f701439cfea7132fbdb7f78f36db1219 PiperOrigin-RevId: 388690899 --- value/processor/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/value/processor/pom.xml b/value/processor/pom.xml index 7de2d12e..421b28b6 100644 --- a/value/processor/pom.xml +++ b/value/processor/pom.xml @@ -42,7 +42,7 @@ 1.0 - 2.8.0 + 2.8.1 -- cgit v1.2.3 From 04b2353bf026381c59b8eedcd4ae54e41d19f5ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Mon, 16 Aug 2021 11:14:12 -0700 Subject: Avoid `instanceof TypeElement` in Auto code. The documentation for [`Element`](https://docs.oracle.com/en/java/javase/11/docs/api/java.compiler/javax/lang/model/element/Element.html) specifies that `instanceof` is not safe: > Using `instanceof` is _not_ necessarily a reliable idiom for determining the effective class of an object in this modeling hierarchy since an implementation may choose to have a single object implement multiple `Element` subinterfaces. RELNOTES=n/a PiperOrigin-RevId: 391091995 --- common/src/main/java/com/google/auto/common/Overrides.java | 2 +- .../java/com/google/auto/value/processor/AutoAnnotationProcessor.java | 2 +- .../java/com/google/auto/value/processor/AutoValueishProcessor.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/com/google/auto/common/Overrides.java b/common/src/main/java/com/google/auto/common/Overrides.java index 775c304a..632d1703 100644 --- a/common/src/main/java/com/google/auto/common/Overrides.java +++ b/common/src/main/java/com/google/auto/common/Overrides.java @@ -117,7 +117,7 @@ abstract class Overrides { // can't be overridden. return false; } - if (!(overridden.getEnclosingElement() instanceof TypeElement)) { + if (!MoreElements.isType(overridden.getEnclosingElement())) { return false; // We don't know how this could happen but we avoid blowing up if it does. } diff --git a/value/src/main/java/com/google/auto/value/processor/AutoAnnotationProcessor.java b/value/src/main/java/com/google/auto/value/processor/AutoAnnotationProcessor.java index 3acf9332..cc0e62ec 100644 --- a/value/src/main/java/com/google/auto/value/processor/AutoAnnotationProcessor.java +++ b/value/src/main/java/com/google/auto/value/processor/AutoAnnotationProcessor.java @@ -287,7 +287,7 @@ public class AutoAnnotationProcessor extends AbstractProcessor { private String generatedClassName(ExecutableElement method) { TypeElement type = MoreElements.asType(method.getEnclosingElement()); String name = type.getSimpleName().toString(); - while (type.getEnclosingElement() instanceof TypeElement) { + while (MoreElements.isType(type.getEnclosingElement())) { type = MoreElements.asType(type.getEnclosingElement()); name = type.getSimpleName() + "_" + name; } diff --git a/value/src/main/java/com/google/auto/value/processor/AutoValueishProcessor.java b/value/src/main/java/com/google/auto/value/processor/AutoValueishProcessor.java index 93f2f79e..9b860552 100644 --- a/value/src/main/java/com/google/auto/value/processor/AutoValueishProcessor.java +++ b/value/src/main/java/com/google/auto/value/processor/AutoValueishProcessor.java @@ -484,7 +484,7 @@ abstract class AutoValueishProcessor extends AbstractProcessor { */ static String generatedClassName(TypeElement type, String prefix) { String name = type.getSimpleName().toString(); - while (type.getEnclosingElement() instanceof TypeElement) { + while (MoreElements.isType(type.getEnclosingElement())) { type = MoreElements.asType(type.getEnclosingElement()); name = type.getSimpleName() + "_" + name; } -- cgit v1.2.3 From 58534760badbe9bd8938f329b923043972748ba3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 20 Aug 2021 09:31:21 -0700 Subject: Bump mockito-core from 3.11.2 to 3.12.0 in /value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [mockito-core](https://github.com/mockito/mockito) from 3.11.2 to 3.12.0.
Release notes

Sourced from mockito-core's releases.

v3.12.0

Changelog generated by Shipkit Changelog Gradle Plugin

3.12.0

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.mockito:mockito-core&package-manager=maven&previous-version=3.11.2&new-version=3.12.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1147 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1147 from google:dependabot/maven/value/org.mockito-mockito-core-3.12.0 7eca0a5602c7b85651743744bbfba481539dc809 PiperOrigin-RevId: 392008007 --- value/processor/pom.xml | 2 +- value/src/it/functional/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/value/processor/pom.xml b/value/processor/pom.xml index 421b28b6..bc2ddf0b 100644 --- a/value/processor/pom.xml +++ b/value/processor/pom.xml @@ -125,7 +125,7 @@ org.mockito mockito-core - 3.11.2 + 3.12.0 test
diff --git a/value/src/it/functional/pom.xml b/value/src/it/functional/pom.xml index 0dc89c29..fce45ef5 100644 --- a/value/src/it/functional/pom.xml +++ b/value/src/it/functional/pom.xml @@ -99,7 +99,7 @@ org.mockito mockito-core - 3.11.2 + 3.12.0 test -- cgit v1.2.3 From 4e39de3ec84bc36a6a957399f3c52e902c07c56f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Aug 2021 06:43:17 -0700 Subject: Bump errorprone.version from 2.8.1 to 2.9.0 in /value Bumps `errorprone.version` from 2.8.1 to 2.9.0. Updates `error_prone_annotations` from 2.8.1 to 2.9.0
Release notes

Sourced from error_prone_annotations's releases.

Error Prone 2.9.0

Release Error Prone 2.9.0

New checks:

  • DeprecatedVariable
  • PublicApiNamedStreamShouldReturnStream

Fixes #2124, #2371, #2393, #2470

Commits
  • 0cfe2ad Release Error Prone 2.9.0
  • b6e5831 Work around another javac bug in InvalidLink
  • 7b03871 Fix crashes / wrong suggestions in FloggerStringConcatenation
  • 43d34de Add ReadableInstant.getMillis() and ReadableDuration.getMillis() to `Retu...
  • 1511398 Updating the BugPattern summary for ConstantField to "Field name is CONSTANT_...
  • 9e37e5c Add Map.Entry APIs to ReturnValueIgnored (currently flagged off).
  • 7844fe4 When generating docs, remove pages for deleted checkers
  • 4aad239 Discourage public Foo stream() where Foo does not end with "Stream"
  • ba12995 Recognize orElseThrow() in some checks that handle get()
  • 10ae8a1 Remove DISALLOW_ARGUMENT_REUSE flag for InlineMe - we won't support re-using a
  • Additional commits viewable in compare view

Updates `error_prone_type_annotations` from 2.8.1 to 2.9.0
Release notes

Sourced from error_prone_type_annotations's releases.

Error Prone 2.9.0

Release Error Prone 2.9.0

New checks:

  • DeprecatedVariable
  • PublicApiNamedStreamShouldReturnStream

Fixes #2124, #2371, #2393, #2470

Commits
  • 0cfe2ad Release Error Prone 2.9.0
  • b6e5831 Work around another javac bug in InvalidLink
  • 7b03871 Fix crashes / wrong suggestions in FloggerStringConcatenation
  • 43d34de Add ReadableInstant.getMillis() and ReadableDuration.getMillis() to `Retu...
  • 1511398 Updating the BugPattern summary for ConstantField to "Field name is CONSTANT_...
  • 9e37e5c Add Map.Entry APIs to ReturnValueIgnored (currently flagged off).
  • 7844fe4 When generating docs, remove pages for deleted checkers
  • 4aad239 Discourage public Foo stream() where Foo does not end with "Stream"
  • ba12995 Recognize orElseThrow() in some checks that handle get()
  • 10ae8a1 Remove DISALLOW_ARGUMENT_REUSE flag for InlineMe - we won't support re-using a
  • Additional commits viewable in compare view

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1150 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1150 from google:dependabot/maven/value/errorprone.version-2.9.0 3bf95c739a71fca5402c52d898f9ddff5aedb4ba PiperOrigin-RevId: 392418940 --- value/processor/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/value/processor/pom.xml b/value/processor/pom.xml index bc2ddf0b..4e6a8fab 100644 --- a/value/processor/pom.xml +++ b/value/processor/pom.xml @@ -42,7 +42,7 @@ 1.0 - 2.8.1 + 2.9.0 -- cgit v1.2.3 From 3d8d97e27adf7a18ee8f6f717d37699264128737 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Aug 2021 06:47:43 -0700 Subject: Bump mockito-core from 3.12.0 to 3.12.1 in /value Bumps [mockito-core](https://github.com/mockito/mockito) from 3.12.0 to 3.12.1.
Release notes

Sourced from mockito-core's releases.

v3.12.1

Changelog generated by Shipkit Changelog Gradle Plugin

3.12.1

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.mockito:mockito-core&package-manager=maven&previous-version=3.12.0&new-version=3.12.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1151 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1151 from google:dependabot/maven/value/org.mockito-mockito-core-3.12.1 76a22bba80a8c33763d3c39904b6e8f549fea934 PiperOrigin-RevId: 392419872 --- value/processor/pom.xml | 2 +- value/src/it/functional/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/value/processor/pom.xml b/value/processor/pom.xml index 4e6a8fab..97a2ddde 100644 --- a/value/processor/pom.xml +++ b/value/processor/pom.xml @@ -125,7 +125,7 @@ org.mockito mockito-core - 3.12.0 + 3.12.1 test
diff --git a/value/src/it/functional/pom.xml b/value/src/it/functional/pom.xml index fce45ef5..ad88aa31 100644 --- a/value/src/it/functional/pom.xml +++ b/value/src/it/functional/pom.xml @@ -99,7 +99,7 @@ org.mockito mockito-core - 3.12.0 + 3.12.1 test -- cgit v1.2.3 From bbe8f4e24995ed1cc19f0e7409b8acd790ba4eb3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Aug 2021 06:06:55 -0700 Subject: Bump plexus-java from 1.0.7 to 1.1.0 in /factory Bumps [plexus-java](https://github.com/codehaus-plexus/plexus-languages) from 1.0.7 to 1.1.0.
Commits
  • abcd162 [maven-release-plugin] prepare release plexus-languages-1.1.0
  • 868b3d7 Support requires static transitive
  • 1c91b4f Bump maven-enforcer-plugin from 3.0.0-M3 to 3.0.0
  • 5bfae5f Bump plexus from 7 to 8
  • cee4f63 Require Java 8
  • 3473197 Update CI setup
  • 5cadf50 Removed outdated java versions from CI
  • b8baee4 Bump actions/setup-java from 2.1.0 to 2.2.0
  • 7cd361b Bump mockito-core from 3.11.2 to 3.12.1
  • c9c9cfe update search.maven.org url
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.codehaus.plexus:plexus-java&package-manager=maven&previous-version=1.0.7&new-version=1.1.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1153 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1153 from google:dependabot/maven/factory/org.codehaus.plexus-plexus-java-1.1.0 c912f703a2395db1e893f526b721a8a961096e07 PiperOrigin-RevId: 392645298 --- factory/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/factory/pom.xml b/factory/pom.xml index f818e2cc..d89ad34e 100644 --- a/factory/pom.xml +++ b/factory/pom.xml @@ -170,7 +170,7 @@ org.codehaus.plexus plexus-java - 1.0.7 + 1.1.0
-- cgit v1.2.3 From 63901aa768df6b10c93191bcfecbc8d131a6ca34 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Aug 2021 06:07:02 -0700 Subject: Bump plexus-java from 1.0.7 to 1.1.0 in /value Bumps [plexus-java](https://github.com/codehaus-plexus/plexus-languages) from 1.0.7 to 1.1.0.
Commits
  • abcd162 [maven-release-plugin] prepare release plexus-languages-1.1.0
  • 868b3d7 Support requires static transitive
  • 1c91b4f Bump maven-enforcer-plugin from 3.0.0-M3 to 3.0.0
  • 5bfae5f Bump plexus from 7 to 8
  • cee4f63 Require Java 8
  • 3473197 Update CI setup
  • 5cadf50 Removed outdated java versions from CI
  • b8baee4 Bump actions/setup-java from 2.1.0 to 2.2.0
  • 7cd361b Bump mockito-core from 3.11.2 to 3.12.1
  • c9c9cfe update search.maven.org url
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.codehaus.plexus:plexus-java&package-manager=maven&previous-version=1.0.7&new-version=1.1.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1154 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1154 from google:dependabot/maven/value/org.codehaus.plexus-plexus-java-1.1.0 e395c2de338c00566c6f0f33de97ae88f8fb783a PiperOrigin-RevId: 392645318 --- value/pom.xml | 2 +- value/src/it/functional/pom.xml | 4 ++-- value/src/it/gwtserializer/pom.xml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/value/pom.xml b/value/pom.xml index 70ad3ac4..ffbbe5bc 100644 --- a/value/pom.xml +++ b/value/pom.xml @@ -150,7 +150,7 @@ org.codehaus.plexus plexus-java - 1.0.7 + 1.1.0 diff --git a/value/src/it/functional/pom.xml b/value/src/it/functional/pom.xml index ad88aa31..d3e5532c 100644 --- a/value/src/it/functional/pom.xml +++ b/value/src/it/functional/pom.xml @@ -166,7 +166,7 @@ org.codehaus.plexus plexus-java - 1.0.7 + 1.1.0 @@ -221,7 +221,7 @@ org.codehaus.plexus plexus-java - 1.0.7 + 1.1.0 diff --git a/value/src/it/gwtserializer/pom.xml b/value/src/it/gwtserializer/pom.xml index 407563e0..88bf677a 100644 --- a/value/src/it/gwtserializer/pom.xml +++ b/value/src/it/gwtserializer/pom.xml @@ -99,7 +99,7 @@ org.codehaus.plexus plexus-java - 1.0.7 + 1.1.0 -- cgit v1.2.3 From 7444bd937f1c57e257fc7ec7c321dfe0f433f5c9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Aug 2021 06:35:25 -0700 Subject: Bump plexus-java from 1.0.7 to 1.1.0 in /common Bumps [plexus-java](https://github.com/codehaus-plexus/plexus-languages) from 1.0.7 to 1.1.0.
Commits
  • abcd162 [maven-release-plugin] prepare release plexus-languages-1.1.0
  • 868b3d7 Support requires static transitive
  • 1c91b4f Bump maven-enforcer-plugin from 3.0.0-M3 to 3.0.0
  • 5bfae5f Bump plexus from 7 to 8
  • cee4f63 Require Java 8
  • 3473197 Update CI setup
  • 5cadf50 Removed outdated java versions from CI
  • b8baee4 Bump actions/setup-java from 2.1.0 to 2.2.0
  • 7cd361b Bump mockito-core from 3.11.2 to 3.12.1
  • c9c9cfe update search.maven.org url
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.codehaus.plexus:plexus-java&package-manager=maven&previous-version=1.0.7&new-version=1.1.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1152 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1152 from google:dependabot/maven/common/org.codehaus.plexus-plexus-java-1.1.0 ac0a0188d0bde415f987b11701e6baf4b95e7183 PiperOrigin-RevId: 392649903 --- common/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/pom.xml b/common/pom.xml index b34fb625..86525aca 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -128,7 +128,7 @@ org.codehaus.plexus plexus-java - 1.0.7 + 1.1.0 -- cgit v1.2.3 From 490d0225646a69caa39f1b20af9c260e482dfa88 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Aug 2021 06:35:32 -0700 Subject: Bump plexus-java from 1.0.7 to 1.1.0 in /service Bumps [plexus-java](https://github.com/codehaus-plexus/plexus-languages) from 1.0.7 to 1.1.0.
Commits
  • abcd162 [maven-release-plugin] prepare release plexus-languages-1.1.0
  • 868b3d7 Support requires static transitive
  • 1c91b4f Bump maven-enforcer-plugin from 3.0.0-M3 to 3.0.0
  • 5bfae5f Bump plexus from 7 to 8
  • cee4f63 Require Java 8
  • 3473197 Update CI setup
  • 5cadf50 Removed outdated java versions from CI
  • b8baee4 Bump actions/setup-java from 2.1.0 to 2.2.0
  • 7cd361b Bump mockito-core from 3.11.2 to 3.12.1
  • c9c9cfe update search.maven.org url
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.codehaus.plexus:plexus-java&package-manager=maven&previous-version=1.0.7&new-version=1.1.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1155 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1155 from google:dependabot/maven/service/org.codehaus.plexus-plexus-java-1.1.0 5d89d14b4b04294a98f577d6ad767babc7a0f043 PiperOrigin-RevId: 392649920 --- service/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/pom.xml b/service/pom.xml index e29bdc37..1a8a72bb 100644 --- a/service/pom.xml +++ b/service/pom.xml @@ -123,7 +123,7 @@ org.codehaus.plexus plexus-java - 1.0.7 + 1.1.0 -- cgit v1.2.3 From 8ae16f680ec64b15651101da32e33a65f18443a8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 Aug 2021 06:49:33 -0700 Subject: Bump mockito-core from 3.12.1 to 3.12.3 in /value Bumps [mockito-core](https://github.com/mockito/mockito) from 3.12.1 to 3.12.3.
Release notes

Sourced from mockito-core's releases.

v3.12.3

Changelog generated by Shipkit Changelog Gradle Plugin

3.12.3

v3.12.2

Changelog generated by Shipkit Changelog Gradle Plugin

3.12.2

Commits
  • 2576950 Merge pull request #2405 from mockito/fix-proxy-mock-maker
  • cb5e3a6 Fix implementation of proxy mock maker for toString and add additional unit t...
  • 03ae33a Merge pull request #2397 from mockito/proxy-mock-maker
  • 0863afb Merge pull request #2402 from mockito/avoid-cache-breakage
  • 3ed0655 Remove deprecation warning
  • e1f9855 Fixes or removes tests that build on unfulfilled assumptions.
  • c740965 Allow for building without Android SDK. Remove warnings.
  • 1a8946f Remove special handling for hashCode/equals as it breaks Mockito's internal m...
  • 4f81d4f Fix cache key computation for generated mock/spy classes (#2400)
  • ff6d1c8 Add a limited mock maker that is based only on the java.lang.reflect.Proxy ut...
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.mockito:mockito-core&package-manager=maven&previous-version=3.12.1&new-version=3.12.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1157 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1157 from google:dependabot/maven/value/org.mockito-mockito-core-3.12.3 a949bf0a3e90d4610363d590868c08f07e4d0505 PiperOrigin-RevId: 392885738 --- value/processor/pom.xml | 2 +- value/src/it/functional/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/value/processor/pom.xml b/value/processor/pom.xml index 97a2ddde..3da0a49b 100644 --- a/value/processor/pom.xml +++ b/value/processor/pom.xml @@ -125,7 +125,7 @@ org.mockito mockito-core - 3.12.1 + 3.12.3 test diff --git a/value/src/it/functional/pom.xml b/value/src/it/functional/pom.xml index d3e5532c..a45d012d 100644 --- a/value/src/it/functional/pom.xml +++ b/value/src/it/functional/pom.xml @@ -99,7 +99,7 @@ org.mockito mockito-core - 3.12.1 + 3.12.3 test -- cgit v1.2.3 From 1e50cb6b71397b19f7435f9c35066dc24f404ce7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 Aug 2021 07:17:05 -0700 Subject: Bump kotlin.version from 1.5.21 to 1.5.30 in /value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps `kotlin.version` from 1.5.21 to 1.5.30. Updates `kotlin-stdlib` from 1.5.21 to 1.5.30
Release notes

Sourced from kotlin-stdlib's releases.

Kotlin 1.5.30

Changelog

1.5.30

Backend. Native. Debug

  • KT-47405 Incorrect path from inlined method in stacktrace on iOS-simulator ARM64
  • KT-47408 Incorrect line number of inlined method on iOS-simulator ARM64

Compiler

New Features

  • KT-44261 Support RxJava 3 nullability annotations
  • KT-32443 Experimental declarations should be contagious even when they are not explicitly used
  • KT-45844 Forbid using experimental markers on override declarations
  • KT-45845 Forbid using experimental markers on getter
  • KT-46644 Resolve overrides for IrProperty on deserialization
  • KT-46967 Support class type parameters annotations in FIR
  • KT-47402 Native: optimize access to object declarations that have only const vals and no init blocks
  • KT-47709 Make when statements with enum, sealed, and Boolean subjects exhaustive by default
  • KT-47699 Support programmatic creation of class annotations and corresponding feature flag on JVM

Performance Improvements

  • KT-45103 Direct invoke optimization
  • KT-47785 Compilation time increased when trying to compile AssertJ DB expression in 1.5.21

Fixes

  • KT-48361 INTEGER_OPERATOR_RESOLVE_WILL_CHANGE is not reported in some positions
  • KT-48180 JVM / IR: AssertionError: "Lambda with offset already exists" caused by calling inline function with default lambda parameter
  • KT-47328 JVM / IR: NoSuchFieldError with missing CHECKCAST
  • KT-48172 "IllegalStateException: Cannot serialize error type: [ERROR : ]" in 1.5.21 with java kotlin interop
  • KT-48230 JVM IR: CCE for multiple receivers case
  • KT-48262 "Inconsistent type" with JSpecify @​NullMarked
  • KT-48167 JVM / IR: If Map#entrySet is implemented in an interface, Kotlin compiler generates incorrect code for its implementation
  • KT-47988 JVM / IR: "VerifyError: Bad type on operand stack" when invoking apply with a local method reference
  • KT-48163 JVM / IR: "VerifyError: Bad type on operand stack" when throwing result of smartcast
  • KT-47833 False positive "Type argument is not within its bounds " with upcasting in 1.5.30-M1
  • KT-47830 Some code doesn't compile with unrestricted builder inference
  • KT-39883 Deprecate computing constant values if complex boolean expressions in when condition branches and conditions of loops
  • KT-47037 Eliminate builder inference restrictions
  • KT-46726 IR + BuilderInference: AssertionError: Unbound private symbol on usage of this in a BuilderInference lambda
  • KT-43855 Support gradual introduction of new nullability annotations
  • KT-43142 FIR: Check UPPER_BOUND_VIOLATED for type alias constructors properly
  • KT-45228 Leaking builder inference type variables though callable references
  • KT-42270 NI: NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER for BuilderInference with extension functions
  • KT-46029 JVM / IR: "Unbound private symbol: " when trying to save SequenceScope in property

... (truncated)

Changelog

Sourced from kotlin-stdlib's changelog.

CHANGELOG

1.5.30-RC

Backend. Native. Debug

  • KT-47405 Incorrect path from inlined method in stacktrace on iOS-simulator ARM64
  • KT-47408 Incorrect line number of inlined method on iOS-simulator ARM64

Compiler

New Features

  • KT-47709 Make when statements with enum, sealed, and Boolean subjects exhaustive by default
  • KT-47699 Support programmatic creation of class annotations and corresponding feature flag on JVM

Performance Improvements

  • KT-47785 Compilation time increased when trying to compile AssertJ DB expression in 1.5.21

Fixes

  • KT-47941 "IllegalStateException: Expected some types" on a call with several excepted type constraints
  • KT-47854 "IllegalArgumentException: Type is inconsistent" with Android's @​Nullable annotation starting in Kotlin 1.5.20
  • KT-47899 "AssertionError: Intersection type should not be marked nullable" with 1.5.21
  • KT-47846 Stack overflow when handling enhanced recursive type parameter
  • KT-47747 Introduce specific error for calls which could be resolved only with unrestricted builder inference
  • KT-47739 JVM / IR: NoSuchFieldError with generic sealed classes
  • KT-47422 -Xjspecify-annotations: If a class has a @​Nullable type-parameter bound, Kotlin should still treat some users' type arguments as platform types
  • KT-47437 Type inference failure with raw types under -Xjspecify-annotations=strict
  • KT-47396 in @​NullMarked code should permit nullable types
  • KT-47729 False positive INTEGER_OPERATOR_RESOLVE_WILL_CHANGE warning: "expression will be resolved to Int in future releases"
  • KT-47333 Xcode 13: Compilation for iOS simulator fails
  • KT-47772 False negative WRONG_ANNOTATION_TARGET on type argument to function call
  • KT-47467 JVM / IR: "AssertionError: Annotation class expected: deserialized class Array" caused by java annotation as a parameter of another annotation
  • KT-47744 UninitializedPropertyAccessException compiler exception on nested builder inference calls
  • KT-47724 Type inference: False positive "Returning type parameter has been inferred to Nothing implicitly"
  • KT-47660 JVM / IR: Mockito verification fails when named parameters are ordered differently
  • KT-47589 Using RequiresOptIn annotation on constructor property results in error even if the annotation has no VALUE_PARAMETER target

IDE

  • KT-47947 Add language version 1.6 to the compiler configuration preferences

Libraries

  • KT-23351 Regex.splitToSequence, CharSequence.splitToSequence(Regex)
  • KT-42851 kotlin.time.Duration toString() shows wrong result for seconds
  • KT-45325 Parsing Duration from String
  • KT-34021 Regex.matchAt / matchesAt

... (truncated)

Commits
  • ec793b4 Fixed setting jvm target version if toolchain is not set
  • 7296d9a WA: Update K/N version to 1.5.30
  • 457420d Add tests for KT-48180
  • dd653ae JVM: remove InlineCodegen.expressionMap
  • bd15d1c [FIR]: Pass special origins for local functions (named and anonymous)
  • cd39bfe Copy methods for lambdas to DefaultImpls without receiver transformation
  • 8579e25 Add test for KT-48230
  • 69aa3f5 [JVM_IR] Fix inlining of callable references to extension methods
  • dc5b47b [Gradle, JS] Add test on valid of webpack config
  • af32a88 [Gradle, JS] Update webpack-dev-server
  • Additional commits viewable in compare view

Updates `kotlin-maven-plugin` from 1.5.21 to 1.5.30 Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1156 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1156 from google:dependabot/maven/value/kotlin.version-1.5.30 eeb01632cce34b06ab13e4bc4e437829c0ec6dc9 PiperOrigin-RevId: 392890810 --- value/src/it/functional/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/value/src/it/functional/pom.xml b/value/src/it/functional/pom.xml index a45d012d..b16399cf 100644 --- a/value/src/it/functional/pom.xml +++ b/value/src/it/functional/pom.xml @@ -32,7 +32,7 @@ HEAD-SNAPSHOT Auto-Value Functional Integration Test - 1.5.21 + 1.5.30 this-matches-nothing -- cgit v1.2.3 From 874777b7c08e01f59793e4eaaeaac1739541e19f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 25 Aug 2021 17:00:12 -0700 Subject: Bump mockito-core from 3.12.3 to 3.12.4 in /value Bumps [mockito-core](https://github.com/mockito/mockito) from 3.12.3 to 3.12.4.
Release notes

Sourced from mockito-core's releases.

v3.12.4

Changelog generated by Shipkit Changelog Gradle Plugin

3.12.4

  • 2021-08-25 - 1 commit(s) by Rafael Winterhalter
  • No notable improvements. No pull requests (issues) were referenced from commits.
Commits
  • 963a872 Properly resolve ProxyMockMaker by alias and handle null value as argument fo...
  • See full diff in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.mockito:mockito-core&package-manager=maven&previous-version=3.12.3&new-version=3.12.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1159 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1159 from google:dependabot/maven/value/org.mockito-mockito-core-3.12.4 3c07f60e061cfe075fa51387e9e9e9a474a5e19c PiperOrigin-RevId: 393010616 --- value/processor/pom.xml | 2 +- value/src/it/functional/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/value/processor/pom.xml b/value/processor/pom.xml index 3da0a49b..178aba4a 100644 --- a/value/processor/pom.xml +++ b/value/processor/pom.xml @@ -125,7 +125,7 @@ org.mockito mockito-core - 3.12.3 + 3.12.4 test
diff --git a/value/src/it/functional/pom.xml b/value/src/it/functional/pom.xml index b16399cf..eaaac4a2 100644 --- a/value/src/it/functional/pom.xml +++ b/value/src/it/functional/pom.xml @@ -99,7 +99,7 @@ org.mockito mockito-core - 3.12.3 + 3.12.4 test -- cgit v1.2.3 From 97537a324571558d9c91bb4b669e6acbbbc439ff Mon Sep 17 00:00:00 2001 From: Daniel Lacasse Date: Thu, 26 Aug 2021 11:40:02 -0700 Subject: Upgrade Gradle Test Kit to 7.2 It isn't exactly necessary to upgrade Gradle Test Kit to the latest version as Gradle Test Kit as with normal Java dependencies. The Gradle Test Kit JARs contains plumbing used to execute a Gradle build within as part of testing scenarios. The JARs are usually generated by the Gradle distribution at runtime. As the classes are released with each new Gradle version, they may not change between versions. The `dev.gradleplugins` project rerelease the Gradle Test Kit JARs to be used outside of a Gradle build and with a different Gradle version. Unfortunately, we keep the Gradle distribution versioning which leads to confusion about the "latest" version. Generally, using the latest version is safe but keep in mind the Gradle Test Kit JARs depend on the Gradle API, Groovy and Kotlin. If your project has a strong opinion on the version of those dependencies, you will need to resolve the version conflict. Note that Groovy and Kotlin dependencies are mostly for the DSL part of Gradle, which is unlikely to leak in Test Kit but could via the implementation of the classes. See https://github.com/gradle-plugins/toolbox/issues/51 and https://github.com/gradle-plugins/gradle-api/commit/34cb7f38429b7980e9c0c4396971df4fb42dcf8b Only the new version (7.2) for [Gradle API](https://repo1.maven.org/maven2/dev/gradleplugins/gradle-api/7.2/gradle-api-7.2.pom) and [Gradle Test Kit](https://repo1.maven.org/maven2/dev/gradleplugins/gradle-test-kit/7.2/gradle-test-kit-7.2.pom) has the fix for the POM.xml. If older versions are required, we can re-release an updated version. Don't hesitate to open additional issues regarding POM.xml issues, users usually use Gradle to resolve the dependencies, your feedback is very useful. Fixes #1160 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1160 from lacasseio:lacasseio/upgrade-test-kit-to-7.2 6435cd04b77436cb0de11b1c5b34e4f637bc3592 PiperOrigin-RevId: 393171389 --- value/src/it/functional/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/value/src/it/functional/pom.xml b/value/src/it/functional/pom.xml index eaaac4a2..3dafa4b5 100644 --- a/value/src/it/functional/pom.xml +++ b/value/src/it/functional/pom.xml @@ -93,7 +93,7 @@ dev.gradleplugins gradle-test-kit - 6.8.3 + 7.2 test -- cgit v1.2.3 From 02ff0f1be64c5350cda8d0b5bbe4bd874ecf7a1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Mon, 6 Sep 2021 07:24:05 -0700 Subject: Correct a `pom.xml` problem that was failing CI builds. Remove the unneeded `org.sonatype.oss:oss-parent` parent in two places. This was producing errors like this: ``` Error: Failed to execute goal org.apache.maven.plugins:maven-invoker-plugin:3.2.2:install (integration-test) on project auto-value-annotations: Failed to install project parents: MavenProject: com.google.auto.value:auto-value-annotations:HEAD-SNAPSHOT @ /home/runner/work/auto/auto/value/annotations/pom.xml: Failed to install POM: MavenProject: org.sonatype.oss:oss-parent:7 @ /home/runner/.m2/repository/org/sonatype/oss/oss-parent/7/oss-parent-7.pom: Failed to install artifact: org.sonatype.oss:oss-parent:pom:7: Failed to install artifact org.sonatype.oss:oss-parent:pom:7: cannot install /home/runner/.m2/repository/org/sonatype/oss/oss-parent/7/oss-parent-7.pom to same path -> [Help 1] ``` According to https://github.com/sonatype/oss-parents > This project is no longer active or supported. We suggest to manage parent POM files for your own organization as needed. The POM files from this project no longer work with latest Maven and/or Java versions. I don't think we were actually using anything from that parent, except maybe a release plugin. RELNOTES=n/a PiperOrigin-RevId: 395095285 --- factory/pom.xml | 6 ------ value/pom.xml | 6 ------ 2 files changed, 12 deletions(-) diff --git a/factory/pom.xml b/factory/pom.xml index d89ad34e..497754f5 100644 --- a/factory/pom.xml +++ b/factory/pom.xml @@ -19,12 +19,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 - - org.sonatype.oss - oss-parent - 7 - - com.google.auto.factory auto-factory HEAD-SNAPSHOT diff --git a/value/pom.xml b/value/pom.xml index ffbbe5bc..f6198de5 100644 --- a/value/pom.xml +++ b/value/pom.xml @@ -18,12 +18,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 - - org.sonatype.oss - oss-parent - 7 - - com.google.auto.value auto-value-parent HEAD-SNAPSHOT -- cgit v1.2.3 From fb96c8368254b6b2af06d166a94700d0531f6c18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Mon, 6 Sep 2021 10:18:04 -0700 Subject: Use annotation default values with `@AutoBuilder` and `@AutoAnnotation`. You can use `@AutoBuilder` to call an `@AutoAnnotation` method. As usual for `@AutoAnnotation`, each parameter of that method corresponds to an element of the annotation. If that element has a default value, the parameter should default to that same value. Trivial example: ```java class Example { @interface MyAnnotation { String value() default "foo"; } @AutoAnnotation static MyAnnotation myAnnotation(String value) { return new AutoAnnotation_Example_myAnnotation(value); } @AutoBuilder(callMethod = "myAnnotation") interface MyAnnotationBuilder { MyAnnotationBuilder value(String value); MyAnnotation build(); } static MyAnnotationBuilder myAnnotationBuilder() { return new AutoBuilder_Example_MyAnnotationBuilder(); } } ``` In the example, the call `myAnnotationBuilder().build()` has the same effect as `myAnnotationBuilder().value("foo").build()` because of `value() default "foo"`. RELNOTES=AutoBuilder now uses annotation defaults when building a call to an `@AutoAnnotation` method. PiperOrigin-RevId: 395114215 --- .../com/google/auto/value/AutoBuilderTest.java | 35 +++++++++++- .../java/com/google/auto/value/AutoAnnotation.java | 33 +++++++++++ .../auto/value/processor/AnnotationOutput.java | 12 ++-- .../auto/value/processor/AutoBuilderProcessor.java | 65 +++++++++++++++++++--- .../processor/AutoValueOrBuilderTemplateVars.java | 3 +- .../value/processor/AutoValueishProcessor.java | 38 ++++++++++++- .../google/auto/value/processor/BuilderSpec.java | 2 +- .../com/google/auto/value/processor/builder.vm | 4 +- 8 files changed, 171 insertions(+), 21 deletions(-) diff --git a/value/src/it/functional/src/test/java/com/google/auto/value/AutoBuilderTest.java b/value/src/it/functional/src/test/java/com/google/auto/value/AutoBuilderTest.java index 952edaac..dba81992 100644 --- a/value/src/it/functional/src/test/java/com/google/auto/value/AutoBuilderTest.java +++ b/value/src/it/functional/src/test/java/com/google/auto/value/AutoBuilderTest.java @@ -149,6 +149,12 @@ public final class AutoBuilderTest { return new AutoAnnotation_AutoBuilderTest_myAnnotation(value, truthiness); } + // This method has parameters for all the annotation elements. + @AutoAnnotation + static MyAnnotation myAnnotationAll(String value, int id, Truthiness truthiness) { + return new AutoAnnotation_AutoBuilderTest_myAnnotationAll(value, id, truthiness); + } + @AutoBuilder(callMethod = "myAnnotation") interface MyAnnotationBuilder { MyAnnotationBuilder value(String x); @@ -159,12 +165,28 @@ public final class AutoBuilderTest { } static MyAnnotationBuilder myAnnotationBuilder() { - return new AutoBuilder_AutoBuilderTest_MyAnnotationBuilder() - .truthiness(MyAnnotation.DEFAULT_TRUTHINESS); + return new AutoBuilder_AutoBuilderTest_MyAnnotationBuilder(); + } + + @AutoBuilder(callMethod = "myAnnotationAll") + interface MyAnnotationAllBuilder { + MyAnnotationAllBuilder value(String x); + + MyAnnotationAllBuilder id(int x); + + MyAnnotationAllBuilder truthiness(Truthiness x); + + MyAnnotation build(); + } + + static MyAnnotationAllBuilder myAnnotationAllBuilder() { + return new AutoBuilder_AutoBuilderTest_MyAnnotationAllBuilder(); } @Test public void simpleAutoAnnotation() { + // We haven't supplied a value for `truthiness`, so AutoBuilder should use the default one in + // the annotation. MyAnnotation annotation1 = myAnnotationBuilder().value("foo").build(); assertThat(annotation1.value()).isEqualTo("foo"); assertThat(annotation1.id()).isEqualTo(MyAnnotation.DEFAULT_ID); @@ -174,6 +196,15 @@ public final class AutoBuilderTest { assertThat(annotation2.value()).isEqualTo("bar"); assertThat(annotation2.id()).isEqualTo(MyAnnotation.DEFAULT_ID); assertThat(annotation2.truthiness()).isEqualTo(Truthiness.TRUTHY); + + MyAnnotation annotation3 = myAnnotationAllBuilder().value("foo").build(); + MyAnnotation annotation4 = + myAnnotationAllBuilder() + .value("foo") + .id(MyAnnotation.DEFAULT_ID) + .truthiness(MyAnnotation.DEFAULT_TRUTHINESS) + .build(); + assertThat(annotation3).isEqualTo(annotation4); } static class Overload { diff --git a/value/src/main/java/com/google/auto/value/AutoAnnotation.java b/value/src/main/java/com/google/auto/value/AutoAnnotation.java index d36d8e28..c6fab240 100644 --- a/value/src/main/java/com/google/auto/value/AutoAnnotation.java +++ b/value/src/main/java/com/google/auto/value/AutoAnnotation.java @@ -71,6 +71,39 @@ import java.lang.reflect.AnnotatedElement; * parameter corresponding to an array-valued annotation member, and the implementation of each such * member will also return a clone of the array. * + *

If your annotation has many elements, you may consider using {@code @AutoBuilder} to make it + * easier to construct instances. In that case, {@code default} values from the annotation will + * become default values for the parameters of the {@code @AutoAnnotation} method. For example: + * + *

+ * class Example {
+ *   {@code @interface} MyAnnotation {
+ *     String name() default "foo";
+ *     int number() default 23;
+ *   }
+ *
+ *   {@code @AutoAnnotation}
+ *   static MyAnnotation myAnnotation(String value) {
+ *     return new AutoAnnotation_Example_myAnnotation(value);
+ *   }
+ *
+ *   {@code @AutoBuilder(callMethod = "myAnnotation")}
+ *   interface MyAnnotationBuilder {
+ *     MyAnnotationBuilder name(String name);
+ *     MyAnnotationBuilder number(int number);
+ *     MyAnnotation build();
+ *   }
+ *
+ *   static MyAnnotationBuilder myAnnotationBuilder() {
+ *     return new AutoBuilder_Example_MyAnnotationBuilder();
+ *   }
+ * }
+ * 
+ * + * Here, {@code myAnnotationBuilder().build()} is the same as {@code + * myAnnotationBuilder().name("foo").number(23).build()} because those are the defaults in the + * annotation definition. + * * @author emcmanus@google.com (Éamonn McManus) */ @Target(ElementType.METHOD) diff --git a/value/src/main/java/com/google/auto/value/processor/AnnotationOutput.java b/value/src/main/java/com/google/auto/value/processor/AnnotationOutput.java index ed986ab7..0c8b8f0f 100644 --- a/value/src/main/java/com/google/auto/value/processor/AnnotationOutput.java +++ b/value/src/main/java/com/google/auto/value/processor/AnnotationOutput.java @@ -130,13 +130,13 @@ final class AnnotationOutput { private static class InitializerSourceFormVisitor extends SourceFormVisitor { private final ProcessingEnvironment processingEnv; private final String memberName; - private final Element context; + private final Element errorContext; InitializerSourceFormVisitor( - ProcessingEnvironment processingEnv, String memberName, Element context) { + ProcessingEnvironment processingEnv, String memberName, Element errorContext) { this.processingEnv = processingEnv; this.memberName = memberName; - this.context = context; + this.errorContext = errorContext; } @Override @@ -148,7 +148,7 @@ final class AnnotationOutput { "@AutoAnnotation cannot yet supply a default value for annotation-valued member '" + memberName + "'", - context); + errorContext); sb.append("null"); return null; } @@ -209,9 +209,9 @@ final class AnnotationOutput { AnnotationValue annotationValue, ProcessingEnvironment processingEnv, String memberName, - Element context) { + Element errorContext) { SourceFormVisitor visitor = - new InitializerSourceFormVisitor(processingEnv, memberName, context); + new InitializerSourceFormVisitor(processingEnv, memberName, errorContext); StringBuilder sb = new StringBuilder(); visitor.visit(annotationValue, sb); return sb.toString(); diff --git a/value/src/main/java/com/google/auto/value/processor/AutoBuilderProcessor.java b/value/src/main/java/com/google/auto/value/processor/AutoBuilderProcessor.java index b6a578fc..53fe836d 100644 --- a/value/src/main/java/com/google/auto/value/processor/AutoBuilderProcessor.java +++ b/value/src/main/java/com/google/auto/value/processor/AutoBuilderProcessor.java @@ -20,6 +20,7 @@ import static com.google.auto.common.MoreElements.getPackage; import static com.google.auto.common.MoreStreams.toImmutableList; import static com.google.auto.common.MoreStreams.toImmutableSet; import static com.google.auto.value.processor.AutoValueProcessor.OMIT_IDENTIFIERS_OPTION; +import static com.google.auto.value.processor.ClassNames.AUTO_ANNOTATION_NAME; import static com.google.auto.value.processor.ClassNames.AUTO_BUILDER_NAME; import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toCollection; @@ -38,6 +39,7 @@ import com.google.auto.value.processor.MissingTypes.MissingTypeException; import com.google.common.base.Ascii; import com.google.common.base.VerifyException; import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Maps; import java.lang.reflect.Field; @@ -60,6 +62,7 @@ import javax.lang.model.element.Modifier; import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; +import javax.lang.model.type.TypeKind; import javax.lang.model.type.TypeMirror; import net.ltgt.gradle.incap.IncrementalAnnotationProcessor; import net.ltgt.gradle.incap.IncrementalAnnotationProcessorType; @@ -134,7 +137,7 @@ public class AutoBuilderProcessor extends AutoValueishProcessor { Map propertyToGetterName = Maps.transformValues(classifier.builderGetters(), PropertyGetter::getName); AutoBuilderTemplateVars vars = new AutoBuilderTemplateVars(); - vars.props = propertySet(executable, propertyToGetterName); + vars.props = propertySet(autoBuilderType, executable, propertyToGetterName); builder.defineVars(vars, classifier); vars.identifiers = !processingEnv.getOptions().containsKey(OMIT_IDENTIFIERS_OPTION); String generatedClassName = generatedClassName(autoBuilderType, "AutoBuilder_"); @@ -152,7 +155,15 @@ public class AutoBuilderProcessor extends AutoValueishProcessor { } private ImmutableSet propertySet( - ExecutableElement executable, Map propertyToGetterName) { + TypeElement autoBuilderType, + ExecutableElement executable, + Map propertyToGetterName) { + boolean autoAnnotation = + MoreElements.getAnnotationMirror(executable, AUTO_ANNOTATION_NAME).isPresent(); + ImmutableMap builderInitializers = + autoAnnotation + ? autoAnnotationInitializers(autoBuilderType, executable) + : ImmutableMap.of(); // Fix any parameter names that are reserved words in Java. Java source code can't have // such parameter names, but Kotlin code might, for example. Map identifiers = @@ -161,18 +172,58 @@ public class AutoBuilderProcessor extends AutoValueishProcessor { fixReservedIdentifiers(identifiers); return executable.getParameters().stream() .map( - v -> - newProperty( - v, identifiers.get(v), propertyToGetterName.get(v.getSimpleName().toString()))) + v -> { + String name = v.getSimpleName().toString(); + return newProperty( + v, + identifiers.get(v), + propertyToGetterName.get(name), + Optional.ofNullable(builderInitializers.get(name))); + }) .collect(toImmutableSet()); } - private Property newProperty(VariableElement var, String identifier, String getterName) { + private Property newProperty( + VariableElement var, + String identifier, + String getterName, + Optional builderInitializer) { String name = var.getSimpleName().toString(); TypeMirror type = var.asType(); Optional nullableAnnotation = nullableAnnotationFor(var, var.asType()); return new Property( - name, identifier, TypeEncoder.encode(type), type, nullableAnnotation, getterName); + name, + identifier, + TypeEncoder.encode(type), + type, + nullableAnnotation, + getterName, + builderInitializer); + } + + private ImmutableMap autoAnnotationInitializers( + TypeElement autoBuilderType, ExecutableElement autoAnnotationMethod) { + // We expect the return type of an @AutoAnnotation method to be an annotation type. If it isn't, + // AutoAnnotation will presumably complain, so we don't need to complain further. + TypeMirror returnType = autoAnnotationMethod.getReturnType(); + if (!returnType.getKind().equals(TypeKind.DECLARED)) { + return ImmutableMap.of(); + } + // This might not actually be an annotation (if the code is wrong), but if that's the case we + // just won't see any contained ExecutableElement where getDefaultValue() returns something. + TypeElement annotation = MoreTypes.asTypeElement(returnType); + ImmutableMap.Builder builder = ImmutableMap.builder(); + for (ExecutableElement method : methodsIn(annotation.getEnclosedElements())) { + AnnotationValue defaultValue = method.getDefaultValue(); + if (defaultValue != null) { + String memberName = method.getSimpleName().toString(); + builder.put( + memberName, + AnnotationOutput.sourceFormForInitializer( + defaultValue, processingEnv, memberName, autoBuilderType)); + } + } + return builder.build(); } private ExecutableElement findExecutable( diff --git a/value/src/main/java/com/google/auto/value/processor/AutoValueOrBuilderTemplateVars.java b/value/src/main/java/com/google/auto/value/processor/AutoValueOrBuilderTemplateVars.java index 86cf4974..9fbc1652 100644 --- a/value/src/main/java/com/google/auto/value/processor/AutoValueOrBuilderTemplateVars.java +++ b/value/src/main/java/com/google/auto/value/processor/AutoValueOrBuilderTemplateVars.java @@ -109,7 +109,8 @@ abstract class AutoValueOrBuilderTemplateVars extends AutoValueishTemplateVars { * *
    *
  • it is {@code @Nullable} (in which case it defaults to null); - *
  • it is {@code Optional} (in which case it defaults to empty); + *
  • it has a builder initializer (for example it is {@code Optional}, which will have an + * initializer of {@code Optional.empty()}); *
  • it has a property-builder method (in which case it defaults to empty). *
*/ diff --git a/value/src/main/java/com/google/auto/value/processor/AutoValueishProcessor.java b/value/src/main/java/com/google/auto/value/processor/AutoValueishProcessor.java index 9b860552..ea085575 100644 --- a/value/src/main/java/com/google/auto/value/processor/AutoValueishProcessor.java +++ b/value/src/main/java/com/google/auto/value/processor/AutoValueishProcessor.java @@ -160,6 +160,7 @@ abstract class AutoValueishProcessor extends AbstractProcessor { private final Optional nullableAnnotation; private final Optionalish optional; private final String getter; + private final String builderInitializer; // empty, or with initial ` = `. Property( String name, @@ -167,16 +168,40 @@ abstract class AutoValueishProcessor extends AbstractProcessor { String type, TypeMirror typeMirror, Optional nullableAnnotation, - String getter) { + String getter, + Optional maybeBuilderInitializer) { this.name = name; this.identifier = identifier; this.type = type; this.typeMirror = typeMirror; this.nullableAnnotation = nullableAnnotation; this.optional = Optionalish.createIfOptional(typeMirror); + this.builderInitializer = + maybeBuilderInitializer.isPresent() + ? " = " + maybeBuilderInitializer.get() + : builderInitializer(); this.getter = getter; } + /** + * Returns the appropriate initializer for a builder property. Builder properties are never + * primitive; if the built property is an {@code int} the builder property will be an {@code + * Integer}. So the default value for a builder property will be null unless there is an + * initializer. The caller of the constructor may have supplied an initializer, but otherwise we + * supply one only if this property is an {@code Optional} and is not {@code @Nullable}. In that + * case the initializer sets it to {@code Optional.empty()}. + */ + private String builderInitializer() { + if (nullableAnnotation.isPresent()) { + return ""; + } + Optionalish optional = Optionalish.createIfOptional(typeMirror); + if (optional == null) { + return ""; + } + return " = " + optional.getEmpty(); + } + /** * Returns the name of the property as it should be used when declaring identifiers (fields and * parameters). If the original getter method was {@code foo()} then this will be {@code foo}. @@ -218,6 +243,14 @@ abstract class AutoValueishProcessor extends AbstractProcessor { return optional; } + /** + * Returns a string to be used as an initializer for a builder field for this property, + * including the leading {@code =}, or an empty string if there is no explicit initializer. + */ + public String getBuilderInitializer() { + return builderInitializer; + } + /** * Returns the string to use as a method annotation to indicate the nullability of this * property. It is either the empty string, if the property is not nullable, or an annotation @@ -266,7 +299,8 @@ abstract class AutoValueishProcessor extends AbstractProcessor { type, method.getReturnType(), nullableAnnotation, - method.getSimpleName().toString()); + method.getSimpleName().toString(), + Optional.empty()); this.method = method; this.fieldAnnotations = fieldAnnotations; this.methodAnnotations = methodAnnotations; diff --git a/value/src/main/java/com/google/auto/value/processor/BuilderSpec.java b/value/src/main/java/com/google/auto/value/processor/BuilderSpec.java index 9f45d172..dfdbb8c7 100644 --- a/value/src/main/java/com/google/auto/value/processor/BuilderSpec.java +++ b/value/src/main/java/com/google/auto/value/processor/BuilderSpec.java @@ -333,7 +333,7 @@ class BuilderSpec { vars.builderRequiredProperties = vars.props.stream() .filter(p -> !p.isNullable()) - .filter(p -> p.getOptional() == null) + .filter(p -> p.getBuilderInitializer().isEmpty()) .filter(p -> !vars.builderPropertyBuilders.containsKey(p.getName())) .collect(toImmutableSet()); } diff --git a/value/src/main/java/com/google/auto/value/processor/builder.vm b/value/src/main/java/com/google/auto/value/processor/builder.vm index 630330ca..950f9838 100644 --- a/value/src/main/java/com/google/auto/value/processor/builder.vm +++ b/value/src/main/java/com/google/auto/value/processor/builder.vm @@ -40,7 +40,7 @@ class ${builderName}${builderFormalTypes} ## #if ($p.kind.primitive) - private $types.boxedClass($p.typeMirror).simpleName $p; + private $types.boxedClass($p.typeMirror).simpleName $p $p.builderInitializer; #else @@ -54,7 +54,7 @@ class ${builderName}${builderFormalTypes} ## #end - private $p.type $p #if ($p.optional && !$p.nullable) = $p.optional.empty #end ; + private $p.type $p $p.builderInitializer; #end #end -- cgit v1.2.3 From aea6988cc8a5a3586c45cfbf3938f5971e5f2e9e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Sep 2021 10:53:40 -0700 Subject: Bump kotlin.version from 1.5.30 to 1.5.31 in /value Bumps `kotlin.version` from 1.5.30 to 1.5.31. Updates `kotlin-stdlib` from 1.5.30 to 1.5.31
Release notes

Sourced from kotlin-stdlib's releases.

Kotlin 1.5.31

Changelog

Compiler

Fixes

  • KT-48659 JVM / IR: Referential equality returns true for different instances
  • KT-48613 Kotlin/Native fails to compile debug binaries for watchosArm64 target
  • KT-48316 "No value passed for parameter" regression with Java annotation default values with JSR-305
  • KT-48343 Mistake in an error message for uninferred type variable without unrestricted builder inference
  • KT-48543 Native compiler crashes because of bridges for $default stubs
  • KT-48349 OptIn markers are forbidden on local variable / value parameter / property getter only in presence of explicit Target annotation
  • KT-48295 JVM / IR: VerifyError: Bad access to protected data in getfield
  • KT-48551 JVM / IR: "IllegalStateException: Inline class has no primary constructor" caused by inline class from one module and fun interface from another
  • KT-47917 JVM: "UTF8 string too large" caused by a big string
  • KT-48440 JVM IR: Missing checkcast in generated bytecode causes VerifyError in Kotlin 1.5.30
  • KT-48361 INTEGER_OPERATOR_RESOLVE_WILL_CHANGE is not reported in some positions
  • KT-48267 JVM IR: CCE on callable reference to Array constructor passed to inline function

Native

  • KT-48591 Kotlin/Native: Char.isHighSurrogate and Char.isLowSurrogate return wrong result for macosArm64 and iosArm64 with compiler cache enabled
  • KT-48491 CInterop broke in Kotlin 1.5.30

Checksums

File Sha256
kotlin-compiler-1.5.31.zip 661111286f3e5ac06aaf3a9403d869d9a96a176b62b141814be626a47249fe9e
kotlin-native-linux-x86_64-1.5.31.tar.gz f2ece84b7f00dfb95604afe729e60cf5be2acfd75b0a5031ba610b81a1c030a6
kotlin-native-macos-x86_64-1.5.31.tar.gz 8136035e1fab879f1e049dec0e1449f8f37c4386ca0616e8f3d26fb066946274
kotlin-native-macos-aarch64-1.5.31.tar.gz 136eff642b5d04ab786d9a44ca87fac035e901198de37e4e55a19a133a84c1b5
kotlin-native-windows-x86_64-1.5.31.zip d8bfff94e63ec768719436cff1fb5c713494dc4cbf414aaae9160ea7d3a9417e
Changelog

Sourced from kotlin-stdlib's changelog.

1.5.31

Compiler

Fixes

  • KT-48659 JVM / IR: Referential equality returns true for different instances
  • KT-48613 Kotlin/Native fails to compile debug binaries for watchosArm64 target
  • KT-48316 "No value passed for parameter" regression with Java annotation default values with JSR-305
  • KT-48343 Mistake in an error message for uninferred type variable without unrestricted builder inference
  • KT-48543 Native compiler crashes because of bridges for $default stubs
  • KT-48349 OptIn markers are forbidden on local variable / value parameter / property getter only in presence of explicit Target annotation
  • KT-48295 JVM / IR: VerifyError: Bad access to protected data in getfield
  • KT-48551 JVM / IR: "IllegalStateException: Inline class has no primary constructor" caused by inline class from one module and fun interface from another
  • KT-47917 JVM: "UTF8 string too large" caused by a big string
  • KT-48440 JVM IR: Missing checkcast in generated bytecode causes VerifyError in Kotlin 1.5.30
  • KT-48361 INTEGER_OPERATOR_RESOLVE_WILL_CHANGE is not reported in some positions
  • KT-48267 JVM IR: CCE on callable reference to Array constructor passed to inline function

Native

  • KT-48591 Kotlin/Native: Char.isHighSurrogate and Char.isLowSurrogate return wrong result for macosArm64 and iosArm64 with compiler cache enabled
  • KT-48491 CInterop broke in Kotlin 1.5.30
Commits
  • a2694eb WA: Update K/N version to 1.5.31
  • e1aadce Add changelog for 1.5.31
  • 8ebf19c Update asm: place asm-all above ideaIC dependency that has older asm
  • ec21756 Update asm: migrate to stable visitor API
  • a5c7c02 Update asm: update dependencies (verification-metadata.xml)
  • ab3eb55 Update asm: substitute asm from platform to more specific one
  • 0d9cc9e Set desired version of asm to avoid taking it from intellij core
  • 91af581 JVM IR: do not optimize casts for primitives in TypeOperatorLowering
  • f2109a7 [K/N] Add workaround for KT-48591
  • 5d4d91e [K/N] Add testcase for KT-48591
  • Additional commits viewable in compare view

Updates `kotlin-maven-plugin` from 1.5.30 to 1.5.31 Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1166 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1166 from google:dependabot/maven/value/kotlin.version-1.5.31 13252fa10564bf6b660f391d543a552200e5864a PiperOrigin-RevId: 398034542 --- value/src/it/functional/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/value/src/it/functional/pom.xml b/value/src/it/functional/pom.xml index 3dafa4b5..812cfaa1 100644 --- a/value/src/it/functional/pom.xml +++ b/value/src/it/functional/pom.xml @@ -32,7 +32,7 @@ HEAD-SNAPSHOT Auto-Value Functional Integration Test - 1.5.30 + 1.5.31 this-matches-nothing -- cgit v1.2.3 From 4509e21dab63b4b5b58d344b94d2515f40087016 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 24 Sep 2021 17:19:56 -0700 Subject: Bump guava.version from 30.1.1-jre to 31.0-jre in /service Bumps `guava.version` from 30.1.1-jre to 31.0-jre. Updates `guava` from 30.1.1-jre to 31.0-jre
Commits

Updates `guava-gwt` from 30.1.1-jre to 31.0-jre
Commits

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1169 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1169 from google:dependabot/maven/service/guava.version-31.0-jre d9642b1a93fcd511821a7a2d17e492a7bf1109d3 PiperOrigin-RevId: 398846134 --- service/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/pom.xml b/service/pom.xml index 1a8a72bb..e8065a08 100644 --- a/service/pom.xml +++ b/service/pom.xml @@ -37,7 +37,7 @@ UTF-8 1.8 - 30.1.1-jre + 31.0-jre 1.1.3 -- cgit v1.2.3 From 3063b25a45d9fa9a50c6bee9e762bb6467ab2fbd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 24 Sep 2021 17:20:02 -0700 Subject: Bump guava.version from 30.1.1-jre to 31.0-jre in /common Bumps `guava.version` from 30.1.1-jre to 31.0-jre. Updates `guava` from 30.1.1-jre to 31.0-jre
Commits

Updates `guava-testlib` from 30.1.1-jre to 31.0-jre
Commits

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1168 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1168 from google:dependabot/maven/common/guava.version-31.0-jre 2076ed93ecebacdf5aeb22857770c223b9f2e59e PiperOrigin-RevId: 398846145 --- common/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/pom.xml b/common/pom.xml index 86525aca..878c129e 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -36,7 +36,7 @@ UTF-8 1.8 - 30.1.1-jre + 31.0-jre 1.1.3 -- cgit v1.2.3 From 70010b57a94b71be55454d3e1fca9247c02e3542 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 24 Sep 2021 17:20:06 -0700 Subject: Bump guava.version from 30.1.1-jre to 31.0-jre in /value Bumps `guava.version` from 30.1.1-jre to 31.0-jre. Updates `guava` from 30.1.1-jre to 31.0-jre
Commits

Updates `guava-gwt` from 30.1.1-jre to 31.0-jre
Commits

Updates `guava-testlib` from 30.1.1-jre to 31.0-jre
Commits

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1170 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1170 from google:dependabot/maven/value/guava.version-31.0-jre 1fc2ae575ff1492af447589bcffe6fb5b48e62e7 PiperOrigin-RevId: 398846158 --- value/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/value/pom.xml b/value/pom.xml index f6198de5..a9eab33a 100644 --- a/value/pom.xml +++ b/value/pom.xml @@ -31,7 +31,7 @@ UTF-8 1.8 - 30.1.1-jre + 31.0-jre 1.1.3 -- cgit v1.2.3 From 4f4a588cc0b67a263b71e200abcb5d6a13a10e0e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Sep 2021 07:50:42 -0700 Subject: Bump guava from 30.1.1-jre to 31.0-jre in /factory Bumps [guava](https://github.com/google/guava) from 30.1.1-jre to 31.0-jre.
Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.guava:guava&package-manager=maven&previous-version=30.1.1-jre&new-version=31.0-jre)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1167 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1167 from google:dependabot/maven/factory/com.google.guava-guava-31.0-jre 4f2ba71ab139d9aee4236d486f2e1ef621b788b0 PiperOrigin-RevId: 399188770 --- factory/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/factory/pom.xml b/factory/pom.xml index 497754f5..3ccd2a34 100644 --- a/factory/pom.xml +++ b/factory/pom.xml @@ -33,7 +33,7 @@ 1.0 1.8.2 1.8 - 30.1.1-jre + 31.0-jre 1.1.3
-- cgit v1.2.3 From 07e4de84bf4ccf9e01e5368a320c7d1cb7ad8348 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 29 Sep 2021 10:39:46 -0700 Subject: Bump guava.version from 31.0-jre to 31.0.1-jre in /service Bumps `guava.version` from 31.0-jre to 31.0.1-jre. Updates `guava` from 31.0-jre to 31.0.1-jre
Release notes

Sourced from guava's releases.

31.0.1

Maven

<dependency>
  <groupId>com.google.guava</groupId>
  <artifactId>guava</artifactId>
  <version>31.0.1-jre</version>
  <!-- or, for Android: -->
  <version>31.0.1-android</version>
</dependency>

Jar files

Guava requires one runtime dependency, which you can download here:

Javadoc

JDiff

Changelog

Commits

Updates `guava-gwt` from 31.0-jre to 31.0.1-jre
Release notes

Sourced from guava-gwt's releases.

31.0.1

Maven

<dependency>
  <groupId>com.google.guava</groupId>
  <artifactId>guava</artifactId>
  <version>31.0.1-jre</version>
  <!-- or, for Android: -->
  <version>31.0.1-android</version>
</dependency>

Jar files

Guava requires one runtime dependency, which you can download here:

Javadoc

JDiff

Changelog

Commits

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1173 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1173 from google:dependabot/maven/service/guava.version-31.0.1-jre b9a2a7e1ac8d6c1fbb65b0130a356de73a3b2969 PiperOrigin-RevId: 399720307 --- service/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/pom.xml b/service/pom.xml index e8065a08..f3068854 100644 --- a/service/pom.xml +++ b/service/pom.xml @@ -37,7 +37,7 @@ UTF-8 1.8 - 31.0-jre + 31.0.1-jre 1.1.3 -- cgit v1.2.3 From 65642596e2791d149f473d0fc5d6c38a9dc51cca Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 29 Sep 2021 10:39:50 -0700 Subject: Bump guava.version from 31.0-jre to 31.0.1-jre in /common Bumps `guava.version` from 31.0-jre to 31.0.1-jre. Updates `guava` from 31.0-jre to 31.0.1-jre
Release notes

Sourced from guava's releases.

31.0.1

Maven

<dependency>
  <groupId>com.google.guava</groupId>
  <artifactId>guava</artifactId>
  <version>31.0.1-jre</version>
  <!-- or, for Android: -->
  <version>31.0.1-android</version>
</dependency>

Jar files

Guava requires one runtime dependency, which you can download here:

Javadoc

JDiff

Changelog

Commits

Updates `guava-testlib` from 31.0-jre to 31.0.1-jre
Release notes

Sourced from guava-testlib's releases.

31.0.1

Maven

<dependency>
  <groupId>com.google.guava</groupId>
  <artifactId>guava</artifactId>
  <version>31.0.1-jre</version>
  <!-- or, for Android: -->
  <version>31.0.1-android</version>
</dependency>

Jar files

Guava requires one runtime dependency, which you can download here:

Javadoc

JDiff

Changelog

Commits

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1172 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1172 from google:dependabot/maven/common/guava.version-31.0.1-jre 7050517cc326f67e7b658ae6c87f210b8bcf7511 PiperOrigin-RevId: 399720329 --- common/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/pom.xml b/common/pom.xml index 878c129e..a9c1e3f1 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -36,7 +36,7 @@ UTF-8 1.8 - 31.0-jre + 31.0.1-jre 1.1.3 -- cgit v1.2.3 From d14fe8cb0bb1a671d31bddeea723a17b413f6d7a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 29 Sep 2021 10:39:57 -0700 Subject: Bump guava.version from 31.0-jre to 31.0.1-jre in /value Bumps `guava.version` from 31.0-jre to 31.0.1-jre. Updates `guava` from 31.0-jre to 31.0.1-jre
Release notes

Sourced from guava's releases.

31.0.1

Maven

<dependency>
  <groupId>com.google.guava</groupId>
  <artifactId>guava</artifactId>
  <version>31.0.1-jre</version>
  <!-- or, for Android: -->
  <version>31.0.1-android</version>
</dependency>

Jar files

Guava requires one runtime dependency, which you can download here:

Javadoc

JDiff

Changelog

Commits

Updates `guava-gwt` from 31.0-jre to 31.0.1-jre
Release notes

Sourced from guava-gwt's releases.

31.0.1

Maven

<dependency>
  <groupId>com.google.guava</groupId>
  <artifactId>guava</artifactId>
  <version>31.0.1-jre</version>
  <!-- or, for Android: -->
  <version>31.0.1-android</version>
</dependency>

Jar files

Guava requires one runtime dependency, which you can download here:

Javadoc

JDiff

Changelog

Commits

Updates `guava-testlib` from 31.0-jre to 31.0.1-jre
Release notes

Sourced from guava-testlib's releases.

31.0.1

Maven

<dependency>
  <groupId>com.google.guava</groupId>
  <artifactId>guava</artifactId>
  <version>31.0.1-jre</version>
  <!-- or, for Android: -->
  <version>31.0.1-android</version>
</dependency>

Jar files

Guava requires one runtime dependency, which you can download here:

Javadoc

JDiff

Changelog

Commits

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1174 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1174 from google:dependabot/maven/value/guava.version-31.0.1-jre e472ff4c7cbf5a702eb5aeec7f7d17709bc056a8 PiperOrigin-RevId: 399720363 --- value/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/value/pom.xml b/value/pom.xml index a9eab33a..bce8e5f0 100644 --- a/value/pom.xml +++ b/value/pom.xml @@ -31,7 +31,7 @@ UTF-8 1.8 - 31.0-jre + 31.0.1-jre 1.1.3 -- cgit v1.2.3 From 781de861f81381180346236e1bfcae010fb4e2f4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 29 Sep 2021 10:58:21 -0700 Subject: Bump guava from 31.0-jre to 31.0.1-jre in /factory Bumps [guava](https://github.com/google/guava) from 31.0-jre to 31.0.1-jre.
Release notes

Sourced from guava's releases.

31.0.1

Maven

<dependency>
  <groupId>com.google.guava</groupId>
  <artifactId>guava</artifactId>
  <version>31.0.1-jre</version>
  <!-- or, for Android: -->
  <version>31.0.1-android</version>
</dependency>

Jar files

Guava requires one runtime dependency, which you can download here:

Javadoc

JDiff

Changelog

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.guava:guava&package-manager=maven&previous-version=31.0-jre&new-version=31.0.1-jre)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1171 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1171 from google:dependabot/maven/factory/com.google.guava-guava-31.0.1-jre 4461d55f88a4545de27bbcf3337b84e5c673fc66 PiperOrigin-RevId: 399725415 --- factory/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/factory/pom.xml b/factory/pom.xml index 3ccd2a34..ad0f9aec 100644 --- a/factory/pom.xml +++ b/factory/pom.xml @@ -33,7 +33,7 @@ 1.0 1.8.2 1.8 - 31.0-jre + 31.0.1-jre 1.1.3 -- cgit v1.2.3 From 206b67396601d99fe87580e7b76d65d3035cc8e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Fri, 1 Oct 2021 12:02:12 -0700 Subject: Include type parameters of parent types in generated factory classes. Suppose you have the following types: ``` interface Foo {...} interface FooFactory { Foo create(); } @AutoFactory(implementing = FooFactory.class) class FooImpl implements Foo {...} ``` Then the generated `FooImplFactory` class should look like this: ``` class FooImplFactory implements FooFactory {...} ``` But before this change that was only the case if there was a `@Provided M` constructor parameter. Now we examine whether the requested supertypes of the generated class have type parameters, and if so we copy those onto the generated class. This may not be 100% accurate but it should work for at least the commonest cases. RELNOTES=When a requested supertype of the generated factory class has a type parameter, the generated class now always has the same parameter. PiperOrigin-RevId: 400259157 --- .../auto/factory/processor/FactoryWriter.java | 21 +++++++++ .../processor/AutoFactoryProcessorTest.java | 16 +++++++ .../expected/Generics_ExplicitFooImplFactory.java | 48 +++++++++++++++++++++ .../expected/Generics_FooImplFactory.java | 34 +++++++++++++++ .../expected/Generics_FooImplWithClassFactory.java | 34 +++++++++++++++ factory/src/test/resources/good/Generics.java | 50 ++++++++++++++++++++++ 6 files changed, 203 insertions(+) create mode 100644 factory/src/test/resources/expected/Generics_ExplicitFooImplFactory.java create mode 100644 factory/src/test/resources/expected/Generics_FooImplFactory.java create mode 100644 factory/src/test/resources/expected/Generics_FooImplWithClassFactory.java create mode 100644 factory/src/test/resources/good/Generics.java diff --git a/factory/src/main/java/com/google/auto/factory/processor/FactoryWriter.java b/factory/src/main/java/com/google/auto/factory/processor/FactoryWriter.java index b7f9c3e4..8d6027dd 100644 --- a/factory/src/main/java/com/google/auto/factory/processor/FactoryWriter.java +++ b/factory/src/main/java/com/google/auto/factory/processor/FactoryWriter.java @@ -29,6 +29,7 @@ import static javax.lang.model.element.Modifier.STATIC; import com.google.auto.common.AnnotationMirrors; import com.google.auto.common.AnnotationValues; +import com.google.auto.common.MoreTypes; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSetMultimap; @@ -59,6 +60,7 @@ import javax.lang.model.SourceVersion; import javax.lang.model.element.AnnotationMirror; import javax.lang.model.element.Element; import javax.lang.model.element.VariableElement; +import javax.lang.model.type.DeclaredType; import javax.lang.model.type.TypeKind; import javax.lang.model.type.TypeMirror; import javax.lang.model.type.TypeVariable; @@ -338,9 +340,28 @@ final class FactoryWriter { for (ProviderField provider : descriptor.providers().values()) { typeVariables.addAll(getReferencedTypeParameterNames(provider.key().type().get())); } + // If a parent type has a type parameter, like FooFactory, then the generated factory needs + // to have the same parameter, like FooImplFactory extends FooFactory. This is a little + // approximate, at least in the case where there is more than one parent type that has a type + // parameter. But that should be pretty rare, so let's keep it simple for now. + typeVariables.addAll(typeVariablesFrom(descriptor.extendingType())); + for (TypeMirror implementing : descriptor.implementingTypes()) { + typeVariables.addAll(typeVariablesFrom(implementing)); + } return typeVariables.build(); } + private static List typeVariablesFrom(TypeMirror type) { + if (type.getKind().equals(TypeKind.DECLARED)) { + DeclaredType declaredType = MoreTypes.asDeclared(type); + return declaredType.getTypeArguments().stream() + .filter(t -> t.getKind().equals(TypeKind.TYPEVAR)) + .map(t -> TypeVariableName.get(MoreTypes.asTypeVariable(t))) + .collect(toList()); + } + return ImmutableList.of(); + } + private static ImmutableSet getMethodTypeVariables( FactoryMethodDescriptor methodDescriptor, ImmutableSet factoryTypeVariables) { diff --git a/factory/src/test/java/com/google/auto/factory/processor/AutoFactoryProcessorTest.java b/factory/src/test/java/com/google/auto/factory/processor/AutoFactoryProcessorTest.java index 0df4c9ca..2ab0fe95 100644 --- a/factory/src/test/java/com/google/auto/factory/processor/AutoFactoryProcessorTest.java +++ b/factory/src/test/java/com/google/auto/factory/processor/AutoFactoryProcessorTest.java @@ -508,6 +508,22 @@ public class AutoFactoryProcessorTest { .hasSourceEquivalentTo(loadExpectedFile("expected/DefaultPackageFactory.java")); } + @Test + public void generics() { + JavaFileObject file = JavaFileObjects.forResource("good/Generics.java"); + Compilation compilation = javac.compile(file); + assertThat(compilation).succeededWithoutWarnings(); + assertThat(compilation) + .generatedSourceFile("tests.Generics_FooImplFactory") + .hasSourceEquivalentTo(loadExpectedFile("expected/Generics_FooImplFactory.java")); + assertThat(compilation) + .generatedSourceFile("tests.Generics_ExplicitFooImplFactory") + .hasSourceEquivalentTo(loadExpectedFile("expected/Generics_ExplicitFooImplFactory.java")); + assertThat(compilation) + .generatedSourceFile("tests.Generics_FooImplWithClassFactory") + .hasSourceEquivalentTo(loadExpectedFile("expected/Generics_FooImplWithClassFactory.java")); + } + private JavaFileObject loadExpectedFile(String resourceName) { if (isJavaxAnnotationProcessingGeneratedAvailable()) { return JavaFileObjects.forResource(resourceName); diff --git a/factory/src/test/resources/expected/Generics_ExplicitFooImplFactory.java b/factory/src/test/resources/expected/Generics_ExplicitFooImplFactory.java new file mode 100644 index 00000000..00c6d92c --- /dev/null +++ b/factory/src/test/resources/expected/Generics_ExplicitFooImplFactory.java @@ -0,0 +1,48 @@ +/* + * Copyright 2021 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. + */ +package tests; + +import javax.annotation.processing.Generated; +import javax.inject.Inject; +import javax.inject.Provider; + +@Generated( + value = "com.google.auto.factory.processor.AutoFactoryProcessor", + comments = "https://github.com/google/auto/tree/master/factory" + ) +final class Generics_ExplicitFooImplFactory + implements Generics.FooFactory { + private final Provider unusedProvider; + + @Inject + Generics_ExplicitFooImplFactory(Provider unusedProvider) { + this.unusedProvider = checkNotNull(unusedProvider, 1); + } + + @Override + public Generics.ExplicitFooImpl create() { + return new Generics.ExplicitFooImpl(checkNotNull(unusedProvider.get(), 1)); + } + + private static T checkNotNull(T reference, int argumentIndex) { + if (reference == null) { + throw new NullPointerException( + "@AutoFactory method argument is null but is not marked @Nullable. Argument index: " + + argumentIndex); + } + return reference; + } +} diff --git a/factory/src/test/resources/expected/Generics_FooImplFactory.java b/factory/src/test/resources/expected/Generics_FooImplFactory.java new file mode 100644 index 00000000..2fb560a7 --- /dev/null +++ b/factory/src/test/resources/expected/Generics_FooImplFactory.java @@ -0,0 +1,34 @@ +/* + * Copyright 2021 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. + */ +package tests; + +import javax.annotation.processing.Generated; +import javax.inject.Inject; + +@Generated( + value = "com.google.auto.factory.processor.AutoFactoryProcessor", + comments = "https://github.com/google/auto/tree/master/factory" + ) +final class Generics_FooImplFactory implements Generics.FooFactory { + @Inject + Generics_FooImplFactory() { + } + + @Override + public Generics.FooImpl create() { + return new Generics.FooImpl(); + } +} diff --git a/factory/src/test/resources/expected/Generics_FooImplWithClassFactory.java b/factory/src/test/resources/expected/Generics_FooImplWithClassFactory.java new file mode 100644 index 00000000..b338454f --- /dev/null +++ b/factory/src/test/resources/expected/Generics_FooImplWithClassFactory.java @@ -0,0 +1,34 @@ +/* + * Copyright 2021 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. + */ +package tests; + +import javax.annotation.processing.Generated; +import javax.inject.Inject; + +@Generated( + value = "com.google.auto.factory.processor.AutoFactoryProcessor", + comments = "https://github.com/google/auto/tree/master/factory" + ) +final class Generics_FooImplWithClassFactory extends Generics.FooFactoryClass { + @Inject + Generics_FooImplWithClassFactory() { + } + + @Override + public Generics.FooImplWithClass create() { + return new Generics.FooImplWithClass(); + } +} diff --git a/factory/src/test/resources/good/Generics.java b/factory/src/test/resources/good/Generics.java new file mode 100644 index 00000000..638302fe --- /dev/null +++ b/factory/src/test/resources/good/Generics.java @@ -0,0 +1,50 @@ +/* + * Copyright 2021 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. + */ +package tests; + +import com.google.auto.factory.AutoFactory; +import com.google.auto.factory.Provided; + +class Generics { + interface Bar {} + + interface Foo {} + + interface FooFactory { + Foo create(); + } + + // The generated FooImplFactory should also have an type parameter, so we can + // have FooImplFactory implements FooFactory. + @AutoFactory(implementing = FooFactory.class) + static final class FooImpl implements Foo { + FooImpl() {} + } + + // The generated ExplicitFooImplFactory should have an type parameter, which + // serves both for FooFactory and for Provider in the constructor. + @AutoFactory(implementing = FooFactory.class) + static final class ExplicitFooImpl implements Foo { + ExplicitFooImpl(@Provided M unused) {} + } + + abstract static class FooFactoryClass { + abstract Foo create(); + } + + @AutoFactory(extending = FooFactoryClass.class) + static final class FooImplWithClass implements Foo {} +} -- cgit v1.2.3 From 8ad800edde0e8c743666a5d814e86ecd6c6f39c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Tue, 5 Oct 2021 15:34:20 -0700 Subject: Ensure the order of copied annotations is deterministic. Fixes https://github.com/google/auto/issues/1176. RELNOTES=The order of annotations copied into generated code is now deterministic. PiperOrigin-RevId: 401086698 --- .../value/processor/AutoValueishProcessor.java | 7 +-- .../value/processor/AutoValueCompilationTest.java | 57 ++++++++++++++++++++++ .../value/processor/PropertyAnnotationsTest.java | 15 ++++-- 3 files changed, 72 insertions(+), 7 deletions(-) diff --git a/value/src/main/java/com/google/auto/value/processor/AutoValueishProcessor.java b/value/src/main/java/com/google/auto/value/processor/AutoValueishProcessor.java index ea085575..55a94a71 100644 --- a/value/src/main/java/com/google/auto/value/processor/AutoValueishProcessor.java +++ b/value/src/main/java/com/google/auto/value/processor/AutoValueishProcessor.java @@ -501,9 +501,9 @@ abstract class AutoValueishProcessor extends AbstractProcessor { /** Returns the spelling to be used in the generated code for the given list of annotations. */ static ImmutableList annotationStrings(List annotations) { - // TODO(b/68008628): use ImmutableList.toImmutableList() when that works. return annotations.stream() .map(AnnotationOutput::sourceFormForAnnotation) + .sorted() // ensures deterministic order .collect(toImmutableList()); } @@ -623,8 +623,9 @@ abstract class AutoValueishProcessor extends AbstractProcessor { List elementAnnotations = element.getAnnotationMirrors(); OptionalInt nullableAnnotationIndex = nullableAnnotationIndex(elementAnnotations); if (nullableAnnotationIndex.isPresent()) { - ImmutableList annotations = annotationStrings(elementAnnotations); - return Optional.of(annotations.get(nullableAnnotationIndex.getAsInt()) + " "); + AnnotationMirror annotation = elementAnnotations.get(nullableAnnotationIndex.getAsInt()); + String annotationString = AnnotationOutput.sourceFormForAnnotation(annotation); + return Optional.of(annotationString + " "); } else { return Optional.empty(); } diff --git a/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java b/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java index ab6690fd..9d7f7856 100644 --- a/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java +++ b/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java @@ -3051,6 +3051,63 @@ public class AutoValueCompilationTest { .containsMatch("(?s:@Parent.ProtectedAnnotation\\s*@Override\\s*public String foo\\(\\))"); } + @Test + public void methodAnnotationsCopiedInLexicographicalOrder() { + JavaFileObject bazFileObject = + JavaFileObjects.forSourceLines( + "foo.bar.Baz", + "package foo.bar;", + "", + "import com.google.auto.value.AutoValue;", + "import com.package1.Annotation1;", + "import com.package2.Annotation0;", + "", + "@AutoValue", + "public abstract class Baz extends Parent {", + " @Annotation0", + " @Annotation1", + " @Override", + " public abstract String foo();", + "}"); + JavaFileObject parentFileObject = + JavaFileObjects.forSourceLines( + "foo.bar.Parent", + "package foo.bar;", + "", + "public abstract class Parent {", + " public abstract String foo();", + "}"); + JavaFileObject annotation1FileObject = + JavaFileObjects.forSourceLines( + "com.package1.Annotation1", + "package com.package1;", + "", + "import java.lang.annotation.ElementType;", + "import java.lang.annotation.Target;", + "", + "@Target({ElementType.FIELD, ElementType.METHOD})", + "public @interface Annotation1 {}"); + JavaFileObject annotation0FileObject = + JavaFileObjects.forSourceLines( + "com.package2.Annotation0", + "package com.package2;", + "", + "public @interface Annotation0 {}"); + Compilation compilation = + javac() + .withProcessors(new AutoValueProcessor()) + .withOptions("-Xlint:-processing", "-implicit:none") + .compile(bazFileObject, parentFileObject, annotation1FileObject, annotation0FileObject); + assertThat(compilation).succeededWithoutWarnings(); + assertThat(compilation) + .generatedSourceFile("foo.bar.AutoValue_Baz") + .contentsAsUtf8String() + .containsMatch( + "(?s:@Annotation1\\s+@Annotation0\\s+@Override\\s+public String foo\\(\\))"); + // @Annotation1 precedes @Annotation 0 because + // @com.package2.Annotation1 precedes @com.package1.Annotation0 + } + @Test public void nonVisibleProtectedAnnotationFromOtherPackage() { JavaFileObject bazFileObject = diff --git a/value/src/test/java/com/google/auto/value/processor/PropertyAnnotationsTest.java b/value/src/test/java/com/google/auto/value/processor/PropertyAnnotationsTest.java index 48d8cd6e..1d7e89f5 100644 --- a/value/src/test/java/com/google/auto/value/processor/PropertyAnnotationsTest.java +++ b/value/src/test/java/com/google/auto/value/processor/PropertyAnnotationsTest.java @@ -510,11 +510,14 @@ public class PropertyAnnotationsTest { "@PropertyAnnotationsTest.InheritedAnnotation") .build(); + // Annotations are in lexicographical order of FQN: + // @com.google.auto.value.processor.PropertyAnnotationsTest.InheritedAnnotation precedes + // @java.lang.Deprecated JavaFileObject outputFile = new OutputFileBuilder() .setImports(imports) - .addMethodAnnotations("@Deprecated", "@PropertyAnnotationsTest.InheritedAnnotation") - .addFieldAnnotations("@Deprecated", "@PropertyAnnotationsTest.InheritedAnnotation") + .addMethodAnnotations("@PropertyAnnotationsTest.InheritedAnnotation", "@Deprecated") + .addFieldAnnotations("@PropertyAnnotationsTest.InheritedAnnotation", "@Deprecated") .build(); Compilation compilation = @@ -548,12 +551,16 @@ public class PropertyAnnotationsTest { .addInnerTypes("@Target(ElementType.METHOD) @interface MethodsOnly {}") .build(); + // Annotations are in lexicographical order of FQN: + // @com.google.auto.value.processor.PropertyAnnotationsTest.InheritedAnnotation precedes + // @foo.bar.Baz.MethodsOnly precedes + // @java.lang.Deprecated JavaFileObject outputFile = new OutputFileBuilder() .setImports(getImports(PropertyAnnotationsTest.class)) - .addFieldAnnotations("@Deprecated", "@PropertyAnnotationsTest.InheritedAnnotation") + .addFieldAnnotations("@PropertyAnnotationsTest.InheritedAnnotation", "@Deprecated") .addMethodAnnotations( - "@Deprecated", "@PropertyAnnotationsTest.InheritedAnnotation", "@Baz.MethodsOnly") + "@PropertyAnnotationsTest.InheritedAnnotation", "@Baz.MethodsOnly", "@Deprecated") .build(); Compilation compilation = -- cgit v1.2.3 From c0ed322f31659cf6cd1ead542253953bff02448a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 Oct 2021 08:16:42 -0700 Subject: Bump mockito-core from 3.12.4 to 4.0.0 in /value Bumps [mockito-core](https://github.com/mockito/mockito) from 3.12.4 to 4.0.0.
Release notes

Sourced from mockito-core's releases.

v4.0.0

Mockito 4: Removing deprecated APIs.

All of these APIs have been marked as deprecated and have been present in Mockito for quite a while.

An overview of now-deleted classes/methods:

  • org.mockito.Matchers which was an alias for org.mockito.ArgumentMatchers
  • org.mockito.ArgumentMatchers#{anyObject,anyVararg} both which were aliases for org.mockito.ArgumentMatchers#any
  • org.mockito.ArgumentMatchers#any*Of, which were aliases for the same method name without the Of and the generic parameters (which were ignored)
  • org.mockito.ArgumentMatchers#{is}{Not}Null(Class) which took a class which was ignored. Aliases for the same methods without the parameter
  • org.mockito.MockedStatic#verify which had the parameter types reversed
  • org.mockito.Mockito#verifyZeroInteractions an alias of verifyNoMoreInteractions
  • org.mockito.Mockito#debug framework integration API that we later refactored
  • org.mockito.configuration.AnnotationEngine which was leaking internal APIs and instead users should use org.mockito.plugins.AnnotationEngine
  • org.mockito.exceptions.verification.TooLittleActualInvocations fixed the grammar from "Little" to "Few"
  • Numerous internal APIs that we never officially supported and can now remove
  • org.mockito.plugins.InstantiatorProvider which was leaking internal APIs and instead users should use InstantiatorProvider2 (we should probably rename back to remove the number in a future major release)
  • org.mockito.runners a package that hosted several old JUnit runners which were no longer supported. Users should instead use org.mockito.junit.MockitoJUnitRunner which is our official JUnit4 runner.
Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.mockito:mockito-core&package-manager=maven&previous-version=3.12.4&new-version=4.0.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1178 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1178 from google:dependabot/maven/value/org.mockito-mockito-core-4.0.0 b54dea4780601b4bd03dce561a6b25fa78ad88bc PiperOrigin-RevId: 401774634 --- value/processor/pom.xml | 2 +- value/src/it/functional/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/value/processor/pom.xml b/value/processor/pom.xml index 178aba4a..4b646f2b 100644 --- a/value/processor/pom.xml +++ b/value/processor/pom.xml @@ -125,7 +125,7 @@ org.mockito mockito-core - 3.12.4 + 4.0.0 test diff --git a/value/src/it/functional/pom.xml b/value/src/it/functional/pom.xml index 812cfaa1..f32d0217 100644 --- a/value/src/it/functional/pom.xml +++ b/value/src/it/functional/pom.xml @@ -99,7 +99,7 @@ org.mockito mockito-core - 3.12.4 + 4.0.0 test -- cgit v1.2.3 From d8c193437fabb0843a96efc69356dc5fb3838eff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Fri, 15 Oct 2021 11:50:25 -0700 Subject: Refine the check for overriding interface methods. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit One interface method overrides another only if the overrider is in a subinterface of the overridden. This is the first bullet in [JLS §9.4.1.1](https://docs.oracle.com/javase/specs/jls/se17/html/jls-9.html#jls-9.4.1.1). Remove a test that was checking for the old behaviour. It was intended to fix a bug in Dagger, but Dagger now works fine without this fix, and has its own test for the relevant situation. RELNOTES=In `MoreElements.overrides` and `.getLocalAndInheritedMethods`, an interface method is no longer considered to override another interface method unless the first interface inherits from the second. This means that `.getLocalAndInheritedMethods` may now return two methods with the same signature where before it only returned one. PiperOrigin-RevId: 403430316 --- .../java/com/google/auto/common/Overrides.java | 9 ++++-- .../com/google/auto/common/MoreElementsTest.java | 34 ---------------------- .../java/com/google/auto/common/OverridesTest.java | 30 +++++++++++++++++-- 3 files changed, 35 insertions(+), 38 deletions(-) diff --git a/common/src/main/java/com/google/auto/common/Overrides.java b/common/src/main/java/com/google/auto/common/Overrides.java index 632d1703..cdcd741d 100644 --- a/common/src/main/java/com/google/auto/common/Overrides.java +++ b/common/src/main/java/com/google/auto/common/Overrides.java @@ -170,9 +170,14 @@ abstract class Overrides { return false; } } else { - return in.getKind().isInterface(); - // Method mI in or inherited by interface I (JLS 9.4.1.1). We've already checked everything. + // Method mI in or inherited by interface I (JLS 9.4.1.1). We've already checked everything, + // except that `overrider` must also be in a subinterface of `overridden`. // If this is not an interface then we don't know what it is so we say no. + TypeElement overriderType = MoreElements.asType(overrider.getEnclosingElement()); + return in.getKind().isInterface() + && typeUtils.isSubtype( + typeUtils.erasure(overriderType.asType()), + typeUtils.erasure(overriddenType.asType())); } } diff --git a/common/src/test/java/com/google/auto/common/MoreElementsTest.java b/common/src/test/java/com/google/auto/common/MoreElementsTest.java index b98b79b9..eaa504a1 100644 --- a/common/src/test/java/com/google/auto/common/MoreElementsTest.java +++ b/common/src/test/java/com/google/auto/common/MoreElementsTest.java @@ -388,40 +388,6 @@ public class MoreElementsTest { .inOrder(); } - static class Injectable {} - - public static class MenuManager { - public interface ParentComponent extends MenuItemA.ParentComponent, MenuItemB.ParentComponent {} - } - - public static class MenuItemA { - public interface ParentComponent { - Injectable injectable(); - } - } - - public static class MenuItemB { - public interface ParentComponent { - Injectable injectable(); - } - } - - public static class Main { - public interface ParentComponent extends MenuManager.ParentComponent {} - } - - // Example from https://github.com/williamlian/daggerbug - @Test - public void getLocalAndInheritedMethods_DaggerBug() { - TypeElement main = elements.getTypeElement(Main.ParentComponent.class.getCanonicalName()); - Set methods = - MoreElements.getLocalAndInheritedMethods(main, compilation.getTypes(), elements); - assertThat(methods).hasSize(1); - ExecutableElement method = methods.iterator().next(); - assertThat(method.getSimpleName().toString()).isEqualTo("injectable"); - assertThat(method.getParameters()).isEmpty(); - } - private Set visibleMethodsFromObject() { Types types = compilation.getTypes(); TypeMirror intMirror = types.getPrimitiveType(TypeKind.INT); diff --git a/common/src/test/java/com/google/auto/common/OverridesTest.java b/common/src/test/java/com/google/auto/common/OverridesTest.java index c5ccc5f6..8d77fc76 100644 --- a/common/src/test/java/com/google/auto/common/OverridesTest.java +++ b/common/src/test/java/com/google/auto/common/OverridesTest.java @@ -79,8 +79,8 @@ import org.junit.runners.model.Statement; @RunWith(Parameterized.class) public class OverridesTest { @Parameterized.Parameters(name = "{0}") - public static ImmutableList data() { - return ImmutableList.of(CompilerType.JAVAC, CompilerType.ECJ); + public static CompilerType[] data() { + return CompilerType.values(); } @Rule public CompilationRule compilation = new CompilationRule(); @@ -133,12 +133,16 @@ public class OverridesTest { void m(String x); void n(); + + Number number(); } interface Two { void m(); void m(int x); + + Integer number(); } static class Parent { @@ -156,6 +160,11 @@ public class OverridesTest { @Override public void n() {} + + @Override + public Number number() { + return 0; + } } static class ChildOfOneAndTwo implements One, Two { @@ -170,6 +179,11 @@ public class OverridesTest { @Override public void n() {} + + @Override + public Integer number() { + return 0; + } } static class ChildOfParentAndOne extends Parent implements One { @@ -181,6 +195,11 @@ public class OverridesTest { @Override public void n() {} + + @Override + public Number number() { + return 0; + } } static class ChildOfParentAndOneAndTwo extends Parent implements One, Two { @@ -192,6 +211,11 @@ public class OverridesTest { @Override public void n() {} + + @Override + public Integer number() { + return 0; + } } abstract static class AbstractChildOfOne implements One {} @@ -199,6 +223,8 @@ public class OverridesTest { abstract static class AbstractChildOfOneAndTwo implements One, Two {} abstract static class AbstractChildOfParentAndOneAndTwo extends Parent implements One, Two {} + + interface ExtendingOneAndTwo extends One, Two {} } static class MoreTypesForInheritance { -- cgit v1.2.3 From 80d62d328649ba6338278a5d9e64877c0abd269e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Oct 2021 17:02:12 -0700 Subject: Bump auto-common from 1.1.2 to 1.2 in /value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [auto-common](https://github.com/google/auto) from 1.1.2 to 1.2.
Release notes

Sourced from auto-common's releases.

AutoCommon 1.2

  • In MoreElements.overrides and .getLocalAndInheritedMethods, an interface method is no longer considered to override another interface method unless the first interface inherits from the second. This means that .getLocalAndInheritedMethods may now return two methods with the same signature where before it only returned one. (d8c19343)
Commits
  • 370f9ca [prepare release] Bump version to 1.2 in preparation for release.
  • 502238d [prepare-release] AutoValue 1.2-rc1 version bump.
  • 85e1312 Merge pull request #314 from google/eclipsehack_exceptions
  • 05f9fd0 Merge pull request #313 from google/internal_duplication_improvement
  • 605b912 Merge pull request #312 from google/explicit_final
  • 8b565b8 Merge pull request #311 from google/guava_19
  • a8c5f89 In EclipseHack, catch any exception from propertyOrderer.determinePropertyOrd...
  • dac3fb5 When checking FactoryMethodDescriptor's and ImplementationMethodDescriptor's ...
  • 2627d42 Add an explicit check for @​AutoValue class being private, since otherwise tha...
  • b1db512 Rely on Guava 19.0 and use CharMatcher.whitespace() since CharMatcher.WHITESP...
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.auto:auto-common&package-manager=maven&previous-version=1.1.2&new-version=1.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1182 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1182 from google:dependabot/maven/value/com.google.auto-auto-common-1.2 f1929821a042611148d673da98a1e74164ba4c80 PiperOrigin-RevId: 403499407 --- value/processor/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/value/processor/pom.xml b/value/processor/pom.xml index 4b646f2b..71ed0219 100644 --- a/value/processor/pom.xml +++ b/value/processor/pom.xml @@ -49,7 +49,7 @@ com.google.auto auto-common - 1.1.2 + 1.2 com.google.auto.service -- cgit v1.2.3 From ea067258dd9c09af5741375e0c2eb23de033afbe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Oct 2021 17:02:27 -0700 Subject: Bump auto-common from 1.1.2 to 1.2 in /service MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [auto-common](https://github.com/google/auto) from 1.1.2 to 1.2.
Release notes

Sourced from auto-common's releases.

AutoCommon 1.2

  • In MoreElements.overrides and .getLocalAndInheritedMethods, an interface method is no longer considered to override another interface method unless the first interface inherits from the second. This means that .getLocalAndInheritedMethods may now return two methods with the same signature where before it only returned one. (d8c19343)
Commits
  • 370f9ca [prepare release] Bump version to 1.2 in preparation for release.
  • 502238d [prepare-release] AutoValue 1.2-rc1 version bump.
  • 85e1312 Merge pull request #314 from google/eclipsehack_exceptions
  • 05f9fd0 Merge pull request #313 from google/internal_duplication_improvement
  • 605b912 Merge pull request #312 from google/explicit_final
  • 8b565b8 Merge pull request #311 from google/guava_19
  • a8c5f89 In EclipseHack, catch any exception from propertyOrderer.determinePropertyOrd...
  • dac3fb5 When checking FactoryMethodDescriptor's and ImplementationMethodDescriptor's ...
  • 2627d42 Add an explicit check for @​AutoValue class being private, since otherwise tha...
  • b1db512 Rely on Guava 19.0 and use CharMatcher.whitespace() since CharMatcher.WHITESP...
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.auto:auto-common&package-manager=maven&previous-version=1.1.2&new-version=1.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1183 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1183 from google:dependabot/maven/service/com.google.auto-auto-common-1.2 8aae3b010f1119d1ab20fbaac611766bdb228213 PiperOrigin-RevId: 403499462 --- service/processor/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/processor/pom.xml b/service/processor/pom.xml index f8b45cb6..76fd8483 100644 --- a/service/processor/pom.xml +++ b/service/processor/pom.xml @@ -49,7 +49,7 @@ com.google.auto auto-common - 1.1.2 + 1.2 com.google.guava -- cgit v1.2.3 From 63b5ce5fc627472c8dd2787cbc4bf7a6557a23af Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Oct 2021 17:02:53 -0700 Subject: Bump auto-common from 1.1.2 to 1.2 in /factory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [auto-common](https://github.com/google/auto) from 1.1.2 to 1.2.
Release notes

Sourced from auto-common's releases.

AutoCommon 1.2

  • In MoreElements.overrides and .getLocalAndInheritedMethods, an interface method is no longer considered to override another interface method unless the first interface inherits from the second. This means that .getLocalAndInheritedMethods may now return two methods with the same signature where before it only returned one. (d8c19343)
Commits
  • 370f9ca [prepare release] Bump version to 1.2 in preparation for release.
  • 502238d [prepare-release] AutoValue 1.2-rc1 version bump.
  • 85e1312 Merge pull request #314 from google/eclipsehack_exceptions
  • 05f9fd0 Merge pull request #313 from google/internal_duplication_improvement
  • 605b912 Merge pull request #312 from google/explicit_final
  • 8b565b8 Merge pull request #311 from google/guava_19
  • a8c5f89 In EclipseHack, catch any exception from propertyOrderer.determinePropertyOrd...
  • dac3fb5 When checking FactoryMethodDescriptor's and ImplementationMethodDescriptor's ...
  • 2627d42 Add an explicit check for @​AutoValue class being private, since otherwise tha...
  • b1db512 Rely on Guava 19.0 and use CharMatcher.whitespace() since CharMatcher.WHITESP...
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.auto:auto-common&package-manager=maven&previous-version=1.1.2&new-version=1.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1181 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1181 from google:dependabot/maven/factory/com.google.auto-auto-common-1.2 b957d699fa93a0c4496bb38e2d53407b92b85641 PiperOrigin-RevId: 403499541 --- factory/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/factory/pom.xml b/factory/pom.xml index ad0f9aec..e3077a01 100644 --- a/factory/pom.xml +++ b/factory/pom.xml @@ -65,7 +65,7 @@ com.google.auto auto-common - 1.1.2 + 1.2 com.google.auto.value -- cgit v1.2.3 From 80d19bd441187e3a9f7b65272d2f10b7858a3d7a Mon Sep 17 00:00:00 2001 From: Google Java Core Libraries Date: Mon, 18 Oct 2021 07:48:50 -0700 Subject: fix typo ("implemention") RELNOTES=n/a PiperOrigin-RevId: 403958525 --- value/userguide/howto.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/value/userguide/howto.md b/value/userguide/howto.md index c4511854..0a7607b5 100644 --- a/value/userguide/howto.md +++ b/value/userguide/howto.md @@ -608,7 +608,7 @@ variant as just described. ### Copying to the generated class If you want to copy annotations from your `@AutoValue`-annotated class to the -generated `AutoValue_...` implemention, annotate your class with +generated `AutoValue_...` implementation, annotate your class with [`@AutoValue.CopyAnnotations`]. For example, if `Example.java` is: -- cgit v1.2.3 From e66de800e245561108cef75a99214a38af18e872 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Oct 2021 09:05:05 -0700 Subject: Bump actions/checkout from 2.3.4 to 2.3.5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/checkout](https://github.com/actions/checkout) from 2.3.4 to 2.3.5.
Release notes

Sourced from actions/checkout's releases.

v2.3.5

Update dependencies

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=2.3.4&new-version=2.3.5)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1180 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1180 from google:dependabot/github_actions/actions/checkout-2.3.5 dfbbde575a17db800e0a9e1c6119628e7586fe62 PiperOrigin-RevId: 403975324 --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 11c5e86c..12fddc48 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: with: access_token: ${{ github.token }} - name: 'Check out repository' - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v2.3.5 - name: 'Cache local Maven repository' uses: actions/cache@v2.1.6 with: @@ -49,7 +49,7 @@ jobs: runs-on: ubuntu-latest steps: - name: 'Check out repository' - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v2.3.5 - name: 'Cache local Maven repository' uses: actions/cache@v2.1.6 with: @@ -78,7 +78,7 @@ jobs: runs-on: ubuntu-latest steps: - name: 'Check out repository' - uses: actions/checkout@v2.3.4 + uses: actions/checkout@v2.3.5 - name: 'Cache local Maven repository' uses: actions/cache@v2.1.6 with: -- cgit v1.2.3 From e0740327d830597e17273946418f6adc976bc619 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Tue, 19 Oct 2021 10:52:20 -0700 Subject: Handle missing type when copying annotations. If you have `@CopyAnnotations` and `@Foo(Bar.class)`, and if `Bar` is undefined, we want to defer processing to give some other annotation processor a chance to define `Bar`. This turns out to be quite difficult, because javac essentially makes it look as if you have written `@Foo("")` in this case. So we check to see if an annotation element that _should_ be a class is something else (a string in this case). RELNOTES=We now handle better the case where an annotation being copied references a missing class. PiperOrigin-RevId: 404307632 --- .../auto/value/processor/AnnotationOutput.java | 52 ++++++++++++++++ .../value/processor/AutoValueCompilationTest.java | 70 +++++++++++++++++++++- 2 files changed, 120 insertions(+), 2 deletions(-) diff --git a/value/src/main/java/com/google/auto/value/processor/AnnotationOutput.java b/value/src/main/java/com/google/auto/value/processor/AnnotationOutput.java index 0c8b8f0f..ed6abaa6 100644 --- a/value/src/main/java/com/google/auto/value/processor/AnnotationOutput.java +++ b/value/src/main/java/com/google/auto/value/processor/AnnotationOutput.java @@ -15,6 +15,8 @@ */ package com.google.auto.value.processor; +import com.google.auto.common.MoreTypes; +import com.google.auto.value.processor.MissingTypes.MissingTypeException; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Iterables; import java.util.List; @@ -24,8 +26,10 @@ import javax.annotation.processing.ProcessingEnvironment; import javax.lang.model.element.AnnotationMirror; import javax.lang.model.element.AnnotationValue; import javax.lang.model.element.Element; +import javax.lang.model.element.ElementKind; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.VariableElement; +import javax.lang.model.type.TypeKind; import javax.lang.model.type.TypeMirror; import javax.lang.model.util.SimpleAnnotationValueVisitor8; import javax.tools.Diagnostic; @@ -222,11 +226,59 @@ final class AnnotationOutput { * Java source file to reproduce the annotation in source form. */ static String sourceFormForAnnotation(AnnotationMirror annotationMirror) { + // If a value in the annotation is a reference to a class constant and that class constant is + // undefined, javac unhelpfully converts it into a string "" and visits that instead. We + // want to catch this case and defer processing to allow the class to be defined by another + // annotation processor. So we look for annotation elements whose type is Class but whose + // reported value is a string. Unfortunately we can't extract the ErrorType corresponding to the + // missing class portably. With javac, the AttributeValue is a + // com.sun.tools.javac.code.Attribute.UnresolvedClass, which has a public field classType that + // is the ErrorType we need, but obviously that's nonportable and fragile. + validateClassValues(annotationMirror); StringBuilder sb = new StringBuilder(); new AnnotationSourceFormVisitor().visitAnnotation(annotationMirror, sb); return sb.toString(); } + /** + * Throws an exception if this annotation contains a value for a Class element that is not + * actually a type. The assumption is that the value is the string {@code ""} which javac + * presents when a Class value is an undefined type. + */ + private static void validateClassValues(AnnotationMirror annotationMirror) { + // A class literal can appear in three places: + // * for an element of type Class, for example @SomeAnnotation(Foo.class); + // * for an element of type Class[], for example @SomeAnnotation({Foo.class, Bar.class}); + // * inside a nested annotation, for example @SomeAnnotation(@Nested(Foo.class)). + // These three possibilities are the three branches of the if/else chain below. + annotationMirror + .getElementValues() + .forEach( + (method, value) -> { + TypeMirror type = method.getReturnType(); + if (isJavaLangClass(type) && !(value.getValue() instanceof TypeMirror)) { + throw new MissingTypeException(null); + } else if (type.getKind().equals(TypeKind.ARRAY) + && isJavaLangClass(MoreTypes.asArray(type).getComponentType()) + && value.getValue() instanceof List) { + @SuppressWarnings("unchecked") // a List can only be a List here + List values = (List) value.getValue(); + if (values.stream().anyMatch(av -> !(av.getValue() instanceof TypeMirror))) { + throw new MissingTypeException(null); + } + } else if (type.getKind().equals(TypeKind.DECLARED) + && MoreTypes.asElement(type).getKind().equals(ElementKind.ANNOTATION_TYPE) + && value.getValue() instanceof AnnotationMirror) { + validateClassValues((AnnotationMirror) value.getValue()); + } + }); + } + + private static boolean isJavaLangClass(TypeMirror type) { + return type.getKind().equals(TypeKind.DECLARED) + && MoreTypes.asTypeElement(type).getQualifiedName().contentEquals("java.lang.Class"); + } + private static StringBuilder appendQuoted(StringBuilder sb, String s) { sb.append('"'); for (int i = 0; i < s.length(); i++) { diff --git a/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java b/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java index 9d7f7856..b5dbb408 100644 --- a/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java +++ b/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java @@ -21,6 +21,7 @@ import static com.google.testing.compile.CompilationSubject.compilations; import static com.google.testing.compile.Compiler.javac; import static java.util.stream.Collectors.joining; +import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.truth.Expect; @@ -2913,8 +2914,6 @@ public class AutoValueCompilationTest { "foo.bar.Bar", "package foo.bar;", "", - "import com.google.auto.value.AutoValue;", - "", "@" + Foo.class.getCanonicalName(), "public abstract class Bar {", " public abstract BarFoo barFoo();", @@ -2927,6 +2926,73 @@ public class AutoValueCompilationTest { assertThat(compilation).succeededWithoutWarnings(); } + @Test + public void referencingGeneratedClassInAnnotation() { + // Test that ensures that a type that does not exist can be referenced by a copied annotation + // as long as it later does come into existence. The BarFoo type referenced here does not exist + // when the AutoValueProcessor runs on the first round, but the FooProcessor then generates it. + // That generation provokes a further round of annotation processing and AutoValueProcessor + // should succeed then. + // We test the three places that a class reference could appear: as the value of a Class + // element, as the value of a Class[] element, in a nested annotation. + JavaFileObject barFileObject = + JavaFileObjects.forSourceLines( + "foo.bar.Bar", + "package foo.bar;", + "", + "@" + Foo.class.getCanonicalName(), + "public abstract class Bar {", + "}"); + JavaFileObject referenceClassFileObject = + JavaFileObjects.forSourceLines( + "foo.bar.ReferenceClass", + "package foo.bar;", + "", + "@interface ReferenceClass {", + " Class value() default Void.class;", + " Class[] values() default {};", + " Nested nested() default @Nested;", + " @interface Nested {", + " Class[] values() default {};", + " }", + "}"); + ImmutableList annotations = ImmutableList.of( + "@ReferenceClass(BarFoo.class)", + "@ReferenceClass(values = {Void.class, BarFoo.class})", + "@ReferenceClass(nested = @ReferenceClass.Nested(values = {Void.class, BarFoo.class}))"); + for (String annotation : annotations) { + JavaFileObject bazFileObject = + JavaFileObjects.forSourceLines( + "foo.bar.Baz", + "package foo.bar;", + "", + "import com.google.auto.value.AutoValue;", + "", + "@AutoValue", + "@AutoValue.CopyAnnotations", + annotation, + "public abstract class Baz {", + " public abstract int foo();", + "", + " public static Baz create(int foo) {", + " return new AutoValue_Baz(foo);", + " }", + "}"); + Compilation compilation = + javac() + .withProcessors(new AutoValueProcessor(), new FooProcessor()) + .withOptions("-Xlint:-processing", "-implicit:none") + .compile(bazFileObject, barFileObject, referenceClassFileObject); + expect.about(compilations()).that(compilation).succeededWithoutWarnings(); + if (compilation.status().equals(Compilation.Status.SUCCESS)) { + expect.about(compilations()).that(compilation) + .generatedSourceFile("foo.bar.AutoValue_Baz") + .contentsAsUtf8String() + .contains(annotation); + } + } + } + @Test public void annotationReferencesUndefined() { // Test that we don't throw an exception if asked to compile @SuppressWarnings(UNDEFINED) -- cgit v1.2.3 From 8abfb9cdd873457a0696df08c38cb7f04d7208f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Tue, 19 Oct 2021 17:35:10 -0700 Subject: Use `Objects.requireNonNull(x)` instead of `x.getClass()` in no-identifiers mode. RELNOTES=n/a PiperOrigin-RevId: 404405947 --- value/src/main/java/com/google/auto/value/processor/autovalue.vm | 6 +----- value/src/main/java/com/google/auto/value/processor/builder.vm | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/value/src/main/java/com/google/auto/value/processor/autovalue.vm b/value/src/main/java/com/google/auto/value/processor/autovalue.vm index 86cfe493..18ca827a 100644 --- a/value/src/main/java/com/google/auto/value/processor/autovalue.vm +++ b/value/src/main/java/com/google/auto/value/processor/autovalue.vm @@ -75,15 +75,11 @@ ${modifiers}class $subclass$formalTypes extends $origClass$actualTypes { ## the constructor is called from the extension code. #if ($identifiers) - if ($p == null) { throw new NullPointerException("Null $p.name"); } #else - ## Just throw NullPointerException with no message if it's null. - ## The Object cast has no effect on the code but silences an ErrorProne warning. - - ((`java.lang.Object`) ${p}).getClass(); + `java.util.Objects`.requireNonNull($p); #end #end diff --git a/value/src/main/java/com/google/auto/value/processor/builder.vm b/value/src/main/java/com/google/auto/value/processor/builder.vm index 950f9838..b1787f25 100644 --- a/value/src/main/java/com/google/auto/value/processor/builder.vm +++ b/value/src/main/java/com/google/auto/value/processor/builder.vm @@ -94,15 +94,11 @@ class ${builderName}${builderFormalTypes} ## #if (!$setter.primitiveParameter && !$p.nullable && ${setter.copy($p)} == $p) #if ($identifiers) - if ($p == null) { throw new NullPointerException("Null $p.name"); } #else - ## Just throw NullPointerException with no message if it's null. - ## The Object cast has no effect on the code but silences an ErrorProne warning. - - ((`java.lang.Object`) ${p}).getClass(); + `java.util.Objects`.requireNonNull($p); #end #end -- cgit v1.2.3 From 15c76191f79a2a26a9f914541a5c9ac4965dd0c7 Mon Sep 17 00:00:00 2001 From: Google Java Core Libraries Date: Fri, 29 Oct 2021 07:59:37 -0700 Subject: Use Java 11's Optional.isEmpty() method in docs: `!optional.isPresent()` -> `optional.isEmpty()` RELNOTES=n/a PiperOrigin-RevId: 406359326 --- value/userguide/builders-howto.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/value/userguide/builders-howto.md b/value/userguide/builders-howto.md index aebdbfd3..e38e3188 100644 --- a/value/userguide/builders-howto.md +++ b/value/userguide/builders-howto.md @@ -280,7 +280,7 @@ public abstract class Animal { abstract Animal autoBuild(); // not public public final Animal build() { - if (!name().isPresent()) { + if (name().isEmpty()) { setName(numberOfLegs() + "-legged creature"); } return autoBuild(); -- cgit v1.2.3 From 0820e2e2a460bb42a15de190e4825e066a77f5ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Tue, 2 Nov 2021 13:15:09 -0700 Subject: Make it easier to make a step-builder for AutoValue. We no longer require each setter method in an `@AutoValue.Builder` class `Builder` to return `Builder`. A setter can return some supertype, in particular a step interface. That removes the need to override each inherited setter method just to change its return type. Also add documentation showing how this works. Previously we just linked to an example in a GitHub issue. RELNOTES=Making a step-builder for AutoValue is now easier because the inherited setters don't need to be restated in the `Builder` class so that they return `Builder`. PiperOrigin-RevId: 407161124 --- .../java/com/google/auto/value/AutoValueTest.java | 44 +++++++++++++ .../value/processor/BuilderMethodClassifier.java | 7 +- .../processor/AutoBuilderCompilationTest.java | 2 +- .../value/processor/AutoValueCompilationTest.java | 6 +- value/userguide/builders-howto.md | 74 ++++++++++++++++++++-- 5 files changed, 123 insertions(+), 10 deletions(-) diff --git a/value/src/it/functional/src/test/java/com/google/auto/value/AutoValueTest.java b/value/src/it/functional/src/test/java/com/google/auto/value/AutoValueTest.java index 3a7e7bc4..fd87b3e5 100644 --- a/value/src/it/functional/src/test/java/com/google/auto/value/AutoValueTest.java +++ b/value/src/it/functional/src/test/java/com/google/auto/value/AutoValueTest.java @@ -3623,4 +3623,48 @@ public class AutoValueTest { } catch (IllegalStateException expected) { } } + + @AutoValue + public abstract static class Stepped { + public abstract String one(); + + public abstract int two(); + + public abstract double three(); + + public interface StepOne { + StepTwo setOne(T x); + } + + public interface StepTwo { + StepThree setTwo(int x); + } + + public interface StepThree { + Stepped setThreeAndBuild(double x); + } + + public static StepOne builder() { + return new AutoValue_AutoValueTest_Stepped.Builder(); + } + + @AutoValue.Builder + abstract static class Builder implements StepOne, StepTwo, StepThree { + abstract Builder setThree(double x); + abstract Stepped build(); + + @Override + public Stepped setThreeAndBuild(double x) { + return setThree(x).build(); + } + } + } + + @Test + public void stepBuilder() { + Stepped stepped = Stepped.builder().setOne("one").setTwo(2).setThreeAndBuild(3.0); + assertThat(stepped.one()).isEqualTo("one"); + assertThat(stepped.two()).isEqualTo(2); + assertThat(stepped.three()).isEqualTo(3.0); + } } diff --git a/value/src/main/java/com/google/auto/value/processor/BuilderMethodClassifier.java b/value/src/main/java/com/google/auto/value/processor/BuilderMethodClassifier.java index 51773e6f..a4336f5e 100644 --- a/value/src/main/java/com/google/auto/value/processor/BuilderMethodClassifier.java +++ b/value/src/main/java/com/google/auto/value/processor/BuilderMethodClassifier.java @@ -386,14 +386,17 @@ abstract class BuilderMethodClassifier { DeclaredType builderTypeMirror = MoreTypes.asDeclared(builderType.asType()); ExecutableType methodMirror = MoreTypes.asExecutable(typeUtils.asMemberOf(builderTypeMirror, method)); - if (TYPE_EQUIVALENCE.equivalent(methodMirror.getReturnType(), builderType.asType())) { + TypeMirror returnType = methodMirror.getReturnType(); + if (typeUtils.isSubtype(builderType.asType(), returnType) + && !MoreTypes.isTypeOf(Object.class, returnType)) { + // We allow the return type to be a supertype (other than Object), to support step builders. TypeMirror parameterType = Iterables.getOnlyElement(methodMirror.getParameterTypes()); propertyNameToSetters.put( propertyName, new PropertySetter(method, parameterType, function.get())); } else { errorReporter.reportError( method, - "[%sBuilderRet] Setter methods must return %s", + "[%sBuilderRet] Setter methods must return %s or a supertype", autoWhat(), builderType.asType()); } diff --git a/value/src/test/java/com/google/auto/value/processor/AutoBuilderCompilationTest.java b/value/src/test/java/com/google/auto/value/processor/AutoBuilderCompilationTest.java index 50b6b271..16a8a2b5 100644 --- a/value/src/test/java/com/google/auto/value/processor/AutoBuilderCompilationTest.java +++ b/value/src/test/java/com/google/auto/value/processor/AutoBuilderCompilationTest.java @@ -724,7 +724,7 @@ public final class AutoBuilderCompilationTest { assertThat(compilation).failed(); assertThat(compilation) .hadErrorContaining( - "[AutoBuilderBuilderRet] Setter methods must return foo.bar.Baz.Builder") + "[AutoBuilderBuilderRet] Setter methods must return foo.bar.Baz.Builder or a supertype") .inFile(javaFileObject) .onLineContaining("two(int x)"); } diff --git a/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java b/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java index b5dbb408..1bb84f75 100644 --- a/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java +++ b/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java @@ -1851,6 +1851,8 @@ public class AutoValueCompilationTest { @Test public void autoValueBuilderSetterReturnType() { + // We do allow the return type of a setter to be a supertype of the builder type, to support + // step builders. But we don't allow it to be Object. JavaFileObject javaFileObject = JavaFileObjects.forSourceLines( "foo.bar.Baz", @@ -1864,7 +1866,7 @@ public class AutoValueCompilationTest { "", " @AutoValue.Builder", " public interface Builder {", - " void blim(int x);", + " Object blim(int x);", " Baz build();", " }", "}"); @@ -1875,7 +1877,7 @@ public class AutoValueCompilationTest { assertThat(compilation) .hadErrorContaining("Setter methods must return foo.bar.Baz.Builder") .inFile(javaFileObject) - .onLineContaining("void blim(int x)"); + .onLineContaining("Object blim(int x)"); } @Test diff --git a/value/userguide/builders-howto.md b/value/userguide/builders-howto.md index e38e3188..3ff89468 100644 --- a/value/userguide/builders-howto.md +++ b/value/userguide/builders-howto.md @@ -623,11 +623,75 @@ in an exception because the required properties of `Species` have not been set. A [_step builder_](http://rdafbn.blogspot.com/2012/07/step-builder-pattern_28.html) is a collection of builder interfaces that take you step by step through the -setting of each of a list of required properties. We think that these are a nice -idea in principle but not necessarily in practice. Regardless, if you want to -use AutoValue to implement a step builder, -[this example](https://github.com/google/auto/issues/1000#issuecomment-792875738) -shows you how. +setting of each of a list of required properties. This means you can be sure at +compile time that all the properties are set before you build, at the expense of +some extra code and a bit less flexibility. + +Here is an example: + +```java +@AutoValue +public abstract class Stepped { + public abstract String foo(); + public abstract String bar(); + public abstract int baz(); + + public static FooStep builder() { + return new AutoValue_Stepped.Builder(); + } + + public interface FooStep { + BarStep setFoo(String foo); + } + + public interface BarStep { + BazStep setBar(String bar); + } + + public interface BazStep { + Build setBaz(int baz); + } + + public interface Build { + Stepped build(); + } + + @AutoValue.Builder + abstract static class Builder implements FooStep, BarStep, BazStep, Build {} +} +``` + +It might be used like this: + +```java +Stepped stepped = Stepped.builder().setFoo("foo").setBar("bar").setBaz(3).build(); +``` + +The idea is that the only way to build an instance of `Stepped` +is to go through the steps imposed by the `FooStep`, `BarStep`, and +`BazStep` interfaces to set the properties in order, with a final build step. + +Once you have set the `baz` property there is nothing else to do except build, +so you could also combine the `setBaz` and `build` methods like this: + +```java + ... + + public interface BazStep { + Stepped setBazAndBuild(int baz); + } + + @AutoValue.Builder + abstract static class Builder implements FooStep, BarStep, BazStep { + abstract Builder setBaz(int baz); + abstract Stepped build(); + + @Override + public Stepped setBazAndBuild(int baz) { + return setBaz(baz).build(); + } + } +``` ## ... create a builder for something other than an `@AutoValue`? -- cgit v1.2.3 From ce31cc18c042bf64995f92d6ca917a94b1e419fb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Nov 2021 14:40:40 -0700 Subject: Bump actions/checkout from 2.3.5 to 2.4.0 Bumps [actions/checkout](https://github.com/actions/checkout) from 2.3.5 to 2.4.0.
Release notes

Sourced from actions/checkout's releases.

v2.4.0

  • Convert SSH URLs like org-<ORG_ID>@github.com: to https://github.com/ - pr
Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=2.3.5&new-version=2.4.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1193 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1193 from google:dependabot/github_actions/actions/checkout-2.4.0 37d55469c74a36487bc8c20bdd74c7341ddb298e PiperOrigin-RevId: 407181305 --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 12fddc48..c9fb8ae4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: with: access_token: ${{ github.token }} - name: 'Check out repository' - uses: actions/checkout@v2.3.5 + uses: actions/checkout@v2.4.0 - name: 'Cache local Maven repository' uses: actions/cache@v2.1.6 with: @@ -49,7 +49,7 @@ jobs: runs-on: ubuntu-latest steps: - name: 'Check out repository' - uses: actions/checkout@v2.3.5 + uses: actions/checkout@v2.4.0 - name: 'Cache local Maven repository' uses: actions/cache@v2.1.6 with: @@ -78,7 +78,7 @@ jobs: runs-on: ubuntu-latest steps: - name: 'Check out repository' - uses: actions/checkout@v2.3.5 + uses: actions/checkout@v2.4.0 - name: 'Cache local Maven repository' uses: actions/cache@v2.1.6 with: -- cgit v1.2.3 From d8083fded3f919a77be8ee3f68d23ce43e7d99a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Wed, 3 Nov 2021 06:51:20 -0700 Subject: Handle missing classes better in AutoService. Fixes https://github.com/google/auto/issues/1189. Closes https://github.com/google/auto/pull/1190/files. Many thanks to @astubbs for the bug report and repro, which was the basis for the new test here. If an `@AutoService` annotation references a missing class, the `value` on [this line](https://github.com/google/auto/blob/15c76191f79a2a26a9f914541a5c9ac4965dd0c7/service/processor/src/main/java/com/google/auto/service/processor/AutoServiceProcessor.java#L306)... ```java .flatMap(value -> value.accept(this, null).stream()) ``` is the string `""`, due to quirky javac behaviour. Currently, the visitor expects an array of class literals, or, in its recursive call, a single class literal, but not a string. Since the visitor has no override for [`visitString`](https://docs.oracle.com/en/java/javase/11/docs/api/java.compiler/javax/lang/model/element/AnnotationValueVisitor.html#visitString(java.lang.String,P)), a null default value is returned. We can simply provide an empty `ImmutableSet` as the default value to fix the problem. There is no need to handle this error case specially, since the compiler will be outputting its own errors about the missing class anyway. RELNOTES=AutoService no longer throws an exception for a missing service class. PiperOrigin-RevId: 407325586 --- .../service/processor/AutoServiceProcessor.java | 15 +++++++++++-- .../processor/AutoServiceProcessorTest.java | 15 +++++++++++++ ...ericServiceProviderWithMissingServiceClass.java | 25 ++++++++++++++++++++++ 3 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 service/processor/src/test/resources/test/GenericServiceProviderWithMissingServiceClass.java diff --git a/service/processor/src/main/java/com/google/auto/service/processor/AutoServiceProcessor.java b/service/processor/src/main/java/com/google/auto/service/processor/AutoServiceProcessor.java index f12299a5..85a24cb4 100644 --- a/service/processor/src/main/java/com/google/auto/service/processor/AutoServiceProcessor.java +++ b/service/processor/src/main/java/com/google/auto/service/processor/AutoServiceProcessor.java @@ -25,12 +25,15 @@ import com.google.auto.common.MoreTypes; import com.google.auto.service.AutoService; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.HashMultimap; +import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Multimap; import com.google.common.collect.Sets; import java.io.IOException; import java.io.OutputStream; +import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -68,6 +71,8 @@ public class AutoServiceProcessor extends AbstractProcessor { @VisibleForTesting static final String MISSING_SERVICES_ERROR = "No service interfaces provided for element!"; + private final List exceptionStacks = Collections.synchronizedList(new ArrayList<>()); + /** * Maps the class names of service provider interfaces to the * class names of the concrete classes which implement them. @@ -109,11 +114,17 @@ public class AutoServiceProcessor extends AbstractProcessor { processImpl(annotations, roundEnv); } catch (RuntimeException e) { // We don't allow exceptions of any kind to propagate to the compiler - fatalError(getStackTraceAsString(e)); + String trace = getStackTraceAsString(e); + exceptionStacks.add(trace); + fatalError(trace); } return false; } + ImmutableList exceptionStacks() { + return ImmutableList.copyOf(exceptionStacks); + } + private void processImpl(Set annotations, RoundEnvironment roundEnv) { if (roundEnv.processingOver()) { generateConfigFiles(); @@ -291,7 +302,7 @@ public class AutoServiceProcessor extends AbstractProcessor { private ImmutableSet getValueFieldOfClasses(AnnotationMirror annotationMirror) { return getAnnotationValue(annotationMirror, "value") .accept( - new SimpleAnnotationValueVisitor8, Void>() { + new SimpleAnnotationValueVisitor8, Void>(ImmutableSet.of()) { @Override public ImmutableSet visitType(TypeMirror typeMirror, Void v) { // TODO(ronshapiro): class literals may not always be declared types, i.e. diff --git a/service/processor/src/test/java/com/google/auto/service/processor/AutoServiceProcessorTest.java b/service/processor/src/test/java/com/google/auto/service/processor/AutoServiceProcessorTest.java index 35615689..7a176dd9 100644 --- a/service/processor/src/test/java/com/google/auto/service/processor/AutoServiceProcessorTest.java +++ b/service/processor/src/test/java/com/google/auto/service/processor/AutoServiceProcessorTest.java @@ -17,6 +17,7 @@ package com.google.auto.service.processor; import static com.google.auto.service.processor.AutoServiceProcessor.MISSING_SERVICES_ERROR; import static com.google.testing.compile.CompilationSubject.assertThat; +import static com.google.common.truth.Truth.assertThat; import com.google.common.io.Resources; import com.google.testing.compile.Compilation; @@ -144,4 +145,18 @@ public class AutoServiceProcessorTest { .contentsAsUtf8String() .isEqualTo("test.EnclosingGeneric$GenericServiceProvider\n"); } + + @Test + public void missing() { + AutoServiceProcessor processor = new AutoServiceProcessor(); + Compilation compilation = + Compiler.javac() + .withProcessors(processor) + .withOptions("-Averify=true") + .compile( + JavaFileObjects.forResource( + "test/GenericServiceProviderWithMissingServiceClass.java")); + assertThat(compilation).failed(); + assertThat(processor.exceptionStacks()).isEmpty(); + } } diff --git a/service/processor/src/test/resources/test/GenericServiceProviderWithMissingServiceClass.java b/service/processor/src/test/resources/test/GenericServiceProviderWithMissingServiceClass.java new file mode 100644 index 00000000..3ca34454 --- /dev/null +++ b/service/processor/src/test/resources/test/GenericServiceProviderWithMissingServiceClass.java @@ -0,0 +1,25 @@ +/* + * Copyright 2021 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. + */ +package test; + +import com.google.auto.service.AutoService; + +/** + * A service that references a missing class. This is useful for testing that the processor behaves + * correctly. + */ +@AutoService(MissingServiceClass.class) +public class GenericServiceProviderWithMissingServiceClass implements MissingServiceClass {} -- cgit v1.2.3 From 27f3297dd4598bd0bf1842a129b7b3690bee5647 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 4 Nov 2021 11:44:21 -0700 Subject: Bump auto-service-annotations from 1.0 to 1.0.1 in /value Bumps [auto-service-annotations](https://github.com/google/auto) from 1.0 to 1.0.1.
Release notes

Sourced from auto-service-annotations's releases.

AutoFactory 1.0.1

  • Fixed Gradle incremental compilation. (8f17e4c4)

AutoCommon 1.0.1

  • Added some methods to allow annotation processors to use Streams functionality that is present in mainline Guava but not Android Guava. This can be useful if Android Guava might be on the processor path.

AutoService 1.0.1

  • AutoService no longer throws an exception for a missing service class. (d8083fde)
  • Fixed a bug in AutoServiceProcessor that could lead to some services not being processed. (d4c865be)
Commits
  • e057b8b Set version number for auto-common to 1.0.1.
  • 15d49d9 Replace server Guava API usage with Android compatible alternatives.
  • 64b9ecc Bump actions/cache from 2.1.5 to 2.1.6
  • 7d3aa66 Implicitly exclude Kotlin @Metadata annotations from @CopyAnnotations
  • 2b77e44 Bump kotlin.version from 1.5.0 to 1.5.10 in /value
  • acb0765 Bump truth from 1.1.2 to 1.1.3 in /factory
  • 7f8bd35 Bump truth from 1.1.2 to 1.1.3 in /common
  • d482097 Bump truth from 1.1.2 to 1.1.3 in /service
  • 31eeb67 Bump truth.version from 1.1.2 to 1.1.3 in /value
  • 54baeb3 Update an AutoValue test to the newer compile-testing API.
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.auto.service:auto-service-annotations&package-manager=maven&previous-version=1.0&new-version=1.0.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1196 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1196 from google:dependabot/maven/value/com.google.auto.service-auto-service-annotations-1.0.1 c100e469dabe1917010bf6e38505c8a9bd848dcc PiperOrigin-RevId: 407632903 --- value/processor/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/value/processor/pom.xml b/value/processor/pom.xml index 71ed0219..e2548a94 100644 --- a/value/processor/pom.xml +++ b/value/processor/pom.xml @@ -41,7 +41,7 @@ - 1.0 + 1.0.1 2.9.0 -- cgit v1.2.3 From c219995e4742825ea8d8f248e09662664d88ae42 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 4 Nov 2021 11:44:56 -0700 Subject: Bump auto-service-annotations from 1.0 to 1.0.1 in /factory Bumps [auto-service-annotations](https://github.com/google/auto) from 1.0 to 1.0.1.
Release notes

Sourced from auto-service-annotations's releases.

AutoFactory 1.0.1

  • Fixed Gradle incremental compilation. (8f17e4c4)

AutoCommon 1.0.1

  • Added some methods to allow annotation processors to use Streams functionality that is present in mainline Guava but not Android Guava. This can be useful if Android Guava might be on the processor path.

AutoService 1.0.1

  • AutoService no longer throws an exception for a missing service class. (d8083fde)
  • Fixed a bug in AutoServiceProcessor that could lead to some services not being processed. (d4c865be)
Commits
  • e057b8b Set version number for auto-common to 1.0.1.
  • 15d49d9 Replace server Guava API usage with Android compatible alternatives.
  • 64b9ecc Bump actions/cache from 2.1.5 to 2.1.6
  • 7d3aa66 Implicitly exclude Kotlin @Metadata annotations from @CopyAnnotations
  • 2b77e44 Bump kotlin.version from 1.5.0 to 1.5.10 in /value
  • acb0765 Bump truth from 1.1.2 to 1.1.3 in /factory
  • 7f8bd35 Bump truth from 1.1.2 to 1.1.3 in /common
  • d482097 Bump truth from 1.1.2 to 1.1.3 in /service
  • 31eeb67 Bump truth.version from 1.1.2 to 1.1.3 in /value
  • 54baeb3 Update an AutoValue test to the newer compile-testing API.
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.auto.service:auto-service-annotations&package-manager=maven&previous-version=1.0&new-version=1.0.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1194 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1194 from google:dependabot/maven/factory/com.google.auto.service-auto-service-annotations-1.0.1 fbdbf72f2bfdedbb72243847cece52a9b52169ba PiperOrigin-RevId: 407633060 --- factory/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/factory/pom.xml b/factory/pom.xml index e3077a01..b7ad3c9c 100644 --- a/factory/pom.xml +++ b/factory/pom.xml @@ -30,7 +30,7 @@ UTF-8 - 1.0 + 1.0.1 1.8.2 1.8 31.0.1-jre -- cgit v1.2.3 From 66c620dc6d2682222d08ace43541b9976f13b3f4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 4 Nov 2021 12:02:49 -0700 Subject: Bump auto-service from 1.0 to 1.0.1 in /value Bumps [auto-service](https://github.com/google/auto) from 1.0 to 1.0.1.
Release notes

Sourced from auto-service's releases.

AutoFactory 1.0.1

  • Fixed Gradle incremental compilation. (8f17e4c4)

AutoCommon 1.0.1

  • Added some methods to allow annotation processors to use Streams functionality that is present in mainline Guava but not Android Guava. This can be useful if Android Guava might be on the processor path.

AutoService 1.0.1

  • AutoService no longer throws an exception for a missing service class. (d8083fde)
  • Fixed a bug in AutoServiceProcessor that could lead to some services not being processed. (d4c865be)
Commits
  • e057b8b Set version number for auto-common to 1.0.1.
  • 15d49d9 Replace server Guava API usage with Android compatible alternatives.
  • 64b9ecc Bump actions/cache from 2.1.5 to 2.1.6
  • 7d3aa66 Implicitly exclude Kotlin @Metadata annotations from @CopyAnnotations
  • 2b77e44 Bump kotlin.version from 1.5.0 to 1.5.10 in /value
  • acb0765 Bump truth from 1.1.2 to 1.1.3 in /factory
  • 7f8bd35 Bump truth from 1.1.2 to 1.1.3 in /common
  • d482097 Bump truth from 1.1.2 to 1.1.3 in /service
  • 31eeb67 Bump truth.version from 1.1.2 to 1.1.3 in /value
  • 54baeb3 Update an AutoValue test to the newer compile-testing API.
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.auto.service:auto-service&package-manager=maven&previous-version=1.0&new-version=1.0.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1195 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1195 from google:dependabot/maven/value/com.google.auto.service-auto-service-1.0.1 9db434150e6a81e94dddefe19254c0de6901b4b0 PiperOrigin-RevId: 407637478 --- value/src/it/functional/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/value/src/it/functional/pom.xml b/value/src/it/functional/pom.xml index f32d0217..48dda7c8 100644 --- a/value/src/it/functional/pom.xml +++ b/value/src/it/functional/pom.xml @@ -49,7 +49,7 @@ com.google.auto.service auto-service - 1.0 + 1.0.1 com.google.guava -- cgit v1.2.3 From d6d9657feadae88134a6817df541796cf86a4356 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Nov 2021 08:34:48 -0800 Subject: Bump errorprone.version from 2.9.0 to 2.10.0 in /value Bumps `errorprone.version` from 2.9.0 to 2.10.0. Updates `error_prone_annotations` from 2.9.0 to 2.10.0
Release notes

Sourced from error_prone_annotations's releases.

Error Prone 2.10.0

New checks

Fixed issues: #2616, #2629

Full Changelog: https://github.com/google/error-prone/compare/v2.9.0...v2.10.0

Commits
  • 199a31b Release Error Prone 2.10.0
  • 99cdb15 Always annotate arrays now that we place type-use annotations in the right pl...
  • 0fc9146 Recognize libcore.util.Nullable as type-use, and add a TODO about "hybrid" an...
  • 0f34024 Move check for the regex "." to a new WARNING-level check
  • eb3708a Delete obsolete travis config
  • 5538acc Automated rollback of commit 34d98e8cf1d8da2dc6d261d70c85e96dc4a0d031.
  • f91fff5 ASTHelpers: add getAnnotations method, to allow extraction of annotations fro...
  • cdfa8b8 Add the DistinctVarargs BugChecker. This will generate warning when method ex...
  • 122e512 Add InlineMe:CheckFixCompiles flag, which allows InlineMe users to optional...
  • dd91993 Add ByteString.fromHex to AlwaysThrows
  • Additional commits viewable in compare view

Updates `error_prone_type_annotations` from 2.9.0 to 2.10.0
Release notes

Sourced from error_prone_type_annotations's releases.

Error Prone 2.10.0

New checks

Fixed issues: #2616, #2629

Full Changelog: https://github.com/google/error-prone/compare/v2.9.0...v2.10.0

Commits
  • 199a31b Release Error Prone 2.10.0
  • 99cdb15 Always annotate arrays now that we place type-use annotations in the right pl...
  • 0fc9146 Recognize libcore.util.Nullable as type-use, and add a TODO about "hybrid" an...
  • 0f34024 Move check for the regex "." to a new WARNING-level check
  • eb3708a Delete obsolete travis config
  • 5538acc Automated rollback of commit 34d98e8cf1d8da2dc6d261d70c85e96dc4a0d031.
  • f91fff5 ASTHelpers: add getAnnotations method, to allow extraction of annotations fro...
  • cdfa8b8 Add the DistinctVarargs BugChecker. This will generate warning when method ex...
  • 122e512 Add InlineMe:CheckFixCompiles flag, which allows InlineMe users to optional...
  • dd91993 Add ByteString.fromHex to AlwaysThrows
  • Additional commits viewable in compare view

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1197 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1197 from google:dependabot/maven/value/errorprone.version-2.10.0 7c19735ade5daa5fe75f371e7f5edf3183313d28 PiperOrigin-RevId: 408350656 --- value/processor/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/value/processor/pom.xml b/value/processor/pom.xml index e2548a94..fdfa60c3 100644 --- a/value/processor/pom.xml +++ b/value/processor/pom.xml @@ -42,7 +42,7 @@ 1.0.1 - 2.9.0 + 2.10.0 -- cgit v1.2.3 From 102506c383e4e8165a1d8e23247549915d3ebcfb Mon Sep 17 00:00:00 2001 From: Brad Corso Date: Fri, 12 Nov 2021 11:36:01 -0800 Subject: Remove usage of Guava 30 API (Comparators.min). This CL removes the only Guava 30 usage in auto-common, Comparators.min. Motivation for change: Currently when writing annotation processors in Bazel, the Guava version is pinned to the version used by JavaBuilder. For the latest Bazel release, 4.2.1, this version is pinned to Guava 29, which means we can't use the latest auto-common in our annotation processors due to the usage of Comparators.min. Fwiw, Bazel 5.0 upgrades to Guava 30, but that version is still in the pre-release phase. RELNOTES=Remove usage of Guava 30 API (Comparators.min). PiperOrigin-RevId: 409461735 --- common/src/main/java/com/google/auto/common/Visibility.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/com/google/auto/common/Visibility.java b/common/src/main/java/com/google/auto/common/Visibility.java index 36f4ad6d..db15f8bd 100644 --- a/common/src/main/java/com/google/auto/common/Visibility.java +++ b/common/src/main/java/com/google/auto/common/Visibility.java @@ -16,10 +16,10 @@ package com.google.auto.common; import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.collect.Comparators.min; import static javax.lang.model.element.ElementKind.PACKAGE; import com.google.common.base.Enums; +import com.google.common.collect.Ordering; import java.util.Set; import javax.lang.model.element.Element; import javax.lang.model.element.ElementKind; @@ -77,7 +77,9 @@ public enum Visibility { Visibility effectiveVisibility = PUBLIC; Element currentElement = element; while (currentElement != null) { - effectiveVisibility = min(effectiveVisibility, ofElement(currentElement)); + // NOTE: We don't use Guava's Comparators.min() because that requires Guava 30, which would + // make this library unusable in annotation processors using Bazel < 5.0. + effectiveVisibility = Ordering.natural().min(effectiveVisibility, ofElement(currentElement)); currentElement = currentElement.getEnclosingElement(); } return effectiveVisibility; -- cgit v1.2.3 From 0c4828f8e50d95ab0d4b26f881719374795415aa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 16 Nov 2021 10:18:46 -0800 Subject: Bump kotlin.version from 1.5.31 to 1.6.0 in /value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps `kotlin.version` from 1.5.31 to 1.6.0. Updates `kotlin-stdlib` from 1.5.31 to 1.6.0
Release notes

Sourced from kotlin-stdlib's releases.

Kotlin 1.6.0-RC2

Learn how to install Kotlin 1.6.0-RC2 plugin and how to configure build with 1.6.0-RC2

Changelog

Compiler

New Features

  • KT-43919 Support loading Java annotations on base classes and implementing interfaces' type arguments

Performance Improvements

  • KT-45185 FIR2IR: get rid of IrBuiltIns usages

Fixes

  • KT-49477 Has ran into recursion problem with two interdependant delegates
  • KT-49371 JVM / IR: "NoSuchMethodError" with multiple inheritance
  • KT-49294 Turning FlowCollector into 'fun interface' leads to AbstractMethodError
  • KT-18282 Companion object referencing it's own method during construction compiles successfully but fails at runtime with VerifyError
  • KT-25289 Prohibit access to class members in the super constructor call of its companion and nested object
  • KT-32753 Prohibit @​JvmField on property in primary constructor that overrides interface property
  • KT-43433 Suspend conversion is disabled message in cases where it is not supported and quickfix to update language version is suggested
  • KT-49209 Default upper bound for type variables should be non-null
  • KT-22562 Deprecate calls to "suspend" named functions with single dangling lambda argument
  • KT-49335 NPE in RepeatedAnnotationLowering.wrapAnnotationEntriesInContainer when using @Repeatable annotation from different file
  • KT-49322 Postpone promoting warnings to errors for ProperTypeInferenceConstraintsProcessing feature
  • KT-49285 Exception on nested builder inference calls
  • KT-49101 IllegalArgumentException: ClassicTypeSystemContext couldn't handle: Captured(out Number)
  • KT-36399 Gradually support TYPE_USE nullability annotations read from class-files
  • KT-11454 Load annotations on TYPE_USE/TYPE_PARAMETER positions from Java class-files
  • KT-18768 @Notnull annotation from Java does not work with varargs
  • KT-24392 Nullability of Java arrays is read incorrectly if @Nullable annotation has both targets TYPE_USE and VALUE_PARAMETER
  • KT-48157 FIR: incorrect resolve with built-in names in use
  • KT-46409 FIR: erroneous resolve to qualifier instead of extension
  • KT-44566 FirConflictsChecker do not check for conflicting overloads across multiple files
  • KT-37318 FIR: Discuss treating flexible bounded constraints in inference
  • KT-45989 FIR: wrong callable reference type inferred
  • KT-46058 [FIR] Remove state from some checkers
  • KT-45973 FIR: wrong projection type inferred
  • KT-43083 [FIR] False positive 'HIDDEN' on internal
  • KT-46727 Report warning on contravariant usages of star projected argument from Java
  • KT-40668 FIR: Ambiguity on qualifier when having multiple different same-named objects in near scopes
  • KT-37081 [FIR] errors NO_ELSE_IN_WHEN and INCOMPATIBLE_TYPES absence
  • KT-48162 NON_VARARG_SPREAD isn't reported on *toTypedArray() call
  • KT-45118 ClassCastException caused by parent and child class in if-else
  • KT-47605 Kotlin/Native: switch to LLD linker for MinGW targets
  • KT-44436 Support default not null annotations to enhance T into T!!
  • KT-49190 Increase stub versions

... (truncated)

Changelog

Sourced from kotlin-stdlib's changelog.

CHANGELOG

Commits

Updates `kotlin-maven-plugin` from 1.5.31 to 1.6.0 Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1202 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1202 from google:dependabot/maven/value/kotlin.version-1.6.0 3fa930b99df3bb863a8c168c64e6771e36241137 PiperOrigin-RevId: 410287033 --- value/src/it/functional/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/value/src/it/functional/pom.xml b/value/src/it/functional/pom.xml index 48dda7c8..c485ae4c 100644 --- a/value/src/it/functional/pom.xml +++ b/value/src/it/functional/pom.xml @@ -32,7 +32,7 @@ HEAD-SNAPSHOT Auto-Value Functional Integration Test - 1.5.31 + 1.6.0 this-matches-nothing -- cgit v1.2.3 From c7abcf71f4fa1ca999a642fb39b7f88ba7578a8b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Nov 2021 11:13:23 -0800 Subject: Bump auto-common from 1.2 to 1.2.1 in /value Bumps [auto-common](https://github.com/google/auto) from 1.2 to 1.2.1.
Release notes

Sourced from auto-common's releases.

AutoCommon 1.2.1

  • Remove usage of Guava 30 API (Comparators.min). (102506c3)
Commits
  • ae5b058 Set version number for auto-common to 1.2.1.
  • 102506c Remove usage of Guava 30 API (Comparators.min).
  • d6d9657 Bump errorprone.version from 2.9.0 to 2.10.0 in /value
  • 66c620d Bump auto-service from 1.0 to 1.0.1 in /value
  • c219995 Bump auto-service-annotations from 1.0 to 1.0.1 in /factory
  • 27f3297 Bump auto-service-annotations from 1.0 to 1.0.1 in /value
  • d8083fd Handle missing classes better in AutoService.
  • ce31cc1 Bump actions/checkout from 2.3.5 to 2.4.0
  • 0820e2e Make it easier to make a step-builder for AutoValue.
  • 15c7619 Use Java 11's Optional.isEmpty() method in docs: !optional.isPresent() -> `...
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.auto:auto-common&package-manager=maven&previous-version=1.2&new-version=1.2.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1203 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1203 from google:dependabot/maven/value/com.google.auto-auto-common-1.2.1 dba819b3fda5f3af9e1317e9a49f631b6be98d91 PiperOrigin-RevId: 410579022 --- value/processor/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/value/processor/pom.xml b/value/processor/pom.xml index fdfa60c3..b1ece053 100644 --- a/value/processor/pom.xml +++ b/value/processor/pom.xml @@ -49,7 +49,7 @@ com.google.auto auto-common - 1.2 + 1.2.1 com.google.auto.service -- cgit v1.2.3 From 83436ccc69314fe5dcaf7b15b862580e9defb281 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Nov 2021 11:13:25 -0800 Subject: Bump auto-common from 1.2 to 1.2.1 in /factory Bumps [auto-common](https://github.com/google/auto) from 1.2 to 1.2.1.
Release notes

Sourced from auto-common's releases.

AutoCommon 1.2.1

  • Remove usage of Guava 30 API (Comparators.min). (102506c3)
Commits
  • ae5b058 Set version number for auto-common to 1.2.1.
  • 102506c Remove usage of Guava 30 API (Comparators.min).
  • d6d9657 Bump errorprone.version from 2.9.0 to 2.10.0 in /value
  • 66c620d Bump auto-service from 1.0 to 1.0.1 in /value
  • c219995 Bump auto-service-annotations from 1.0 to 1.0.1 in /factory
  • 27f3297 Bump auto-service-annotations from 1.0 to 1.0.1 in /value
  • d8083fd Handle missing classes better in AutoService.
  • ce31cc1 Bump actions/checkout from 2.3.5 to 2.4.0
  • 0820e2e Make it easier to make a step-builder for AutoValue.
  • 15c7619 Use Java 11's Optional.isEmpty() method in docs: !optional.isPresent() -> `...
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.auto:auto-common&package-manager=maven&previous-version=1.2&new-version=1.2.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1205 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1205 from google:dependabot/maven/factory/com.google.auto-auto-common-1.2.1 3b8042c8a2c4e135c3b75f46b148aab4ef8decbc PiperOrigin-RevId: 410579030 --- factory/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/factory/pom.xml b/factory/pom.xml index b7ad3c9c..ff6281b3 100644 --- a/factory/pom.xml +++ b/factory/pom.xml @@ -65,7 +65,7 @@ com.google.auto auto-common - 1.2 + 1.2.1 com.google.auto.value -- cgit v1.2.3 From 93875a79b4397216201c6b3910a93f28a60cbe8b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 19 Nov 2021 03:46:40 -0800 Subject: Bump auto-common from 1.2 to 1.2.1 in /service Bumps [auto-common](https://github.com/google/auto) from 1.2 to 1.2.1.
Release notes

Sourced from auto-common's releases.

AutoCommon 1.2.1

  • Remove usage of Guava 30 API (Comparators.min). (102506c3)
Commits
  • ae5b058 Set version number for auto-common to 1.2.1.
  • 102506c Remove usage of Guava 30 API (Comparators.min).
  • d6d9657 Bump errorprone.version from 2.9.0 to 2.10.0 in /value
  • 66c620d Bump auto-service from 1.0 to 1.0.1 in /value
  • c219995 Bump auto-service-annotations from 1.0 to 1.0.1 in /factory
  • 27f3297 Bump auto-service-annotations from 1.0 to 1.0.1 in /value
  • d8083fd Handle missing classes better in AutoService.
  • ce31cc1 Bump actions/checkout from 2.3.5 to 2.4.0
  • 0820e2e Make it easier to make a step-builder for AutoValue.
  • 15c7619 Use Java 11's Optional.isEmpty() method in docs: !optional.isPresent() -> `...
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=com.google.auto:auto-common&package-manager=maven&previous-version=1.2&new-version=1.2.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1204 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1204 from google:dependabot/maven/service/com.google.auto-auto-common-1.2.1 10aa635be719e44d43767439b23c51f0172be6e8 PiperOrigin-RevId: 411022603 --- service/processor/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service/processor/pom.xml b/service/processor/pom.xml index 76fd8483..cef19ade 100644 --- a/service/processor/pom.xml +++ b/service/processor/pom.xml @@ -49,7 +49,7 @@ com.google.auto auto-common - 1.2 + 1.2.1 com.google.guava -- cgit v1.2.3 From fe67d853d6356943dc79541c892ab6d3e6a7b61a Mon Sep 17 00:00:00 2001 From: Eugene R Date: Sun, 21 Nov 2021 07:50:02 -0800 Subject: Set minimum Java version 1.7 in description Fixes #1201 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1201 from reugn:java-version 5c7bc3d58bf0c93bf39c6883f0cf8abae4434ea1 PiperOrigin-RevId: 411390904 --- value/annotations/pom.xml | 3 +-- value/processor/pom.xml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/value/annotations/pom.xml b/value/annotations/pom.xml index 3751e004..4fc183b6 100644 --- a/value/annotations/pom.xml +++ b/value/annotations/pom.xml @@ -24,12 +24,11 @@ HEAD-SNAPSHOT - com.google.auto.value auto-value-annotations HEAD-SNAPSHOT AutoValue Annotations - Immutable value-type code generation for Java 1.6+. + Immutable value-type code generation for Java 1.7+. https://github.com/google/auto/tree/master/value diff --git a/value/processor/pom.xml b/value/processor/pom.xml index b1ece053..e5320af8 100644 --- a/value/processor/pom.xml +++ b/value/processor/pom.xml @@ -24,12 +24,11 @@ HEAD-SNAPSHOT - com.google.auto.value auto-value HEAD-SNAPSHOT AutoValue Processor - Immutable value-type code generation for Java 1.6+. + Immutable value-type code generation for Java 1.7+. https://github.com/google/auto/tree/master/value -- cgit v1.2.3 From bcc87cdf11e35744cc1db2ca7d3c0eca7daac1a9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Nov 2021 08:59:39 -0800 Subject: Bump gradle-test-kit from 7.2 to 7.3 in /value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [gradle-test-kit](https://github.com/gradle/gradle) from 7.2 to 7.3.
Release notes

Sourced from gradle-test-kit's releases.

7.3

The Gradle team is excited to announce Gradle 7.3.

Read the Release Notes

We would like to thank the following community members for their contributions to this release of Gradle:

Attix Zhang, anatawa12, Anil Kumar Myla, Marcono1234, Nicola Corti, Scott Palmer, Marcin Zajączkowski, Alex Landau, Stefan Oehme, yinghao niu, Björn Kautler, Tomasz Godzik, Kristian Kraljic, Matthew Haughton, Raphael Fuchs, Sebastian Schuberth, Roberto Perez Alcolea, Xin Wang

Upgrade instructions

Switch your build to use Gradle 7.3 by updating your wrapper:

./gradlew wrapper --gradle-version=7.3

See the Gradle 7.x upgrade guide to learn about deprecations, breaking changes and other considerations when upgrading.

Reporting Problems

If you find a problem with this release, please file a bug on GitHub Issues adhering to our issue guidelines. If you're not sure you're encountering a bug, please use the forum.

7.3 RC5

The Gradle team is excited to announce Gradle 7.3-rc-5.

Read the Release Notes

We would like to thank the following community members for their contributions to this release of Gradle:

Attix Zhang, anatawa12, Anil Kumar Myla, Marcono1234, Nicola Corti, Scott Palmer,

... (truncated)

Changelog

Sourced from gradle-test-kit's changelog.

{ "latestReleaseSnapshot": { "version": "7.3-20211126011233+0000", "buildTime": "20211126011233+0000" }, "latestRc": { "version": "7.3-rc-5", "buildTime": "20211105184337+0000" }, "finalReleases": [ { "version": "7.3", "buildTime": "20211109204036+0000" }, { "version": "7.2", "buildTime": "20210817095903+0000" }, { "version": "7.1.1", "buildTime": "20210702121643+0000" }, { "version": "7.1", "buildTime": "20210614144726+0000" }, { "version": "7.0.2", "buildTime": "20210514120231+0000" }, { "version": "7.0.1", "buildTime": "20210510160858+0000" }, { "version": "7.0", "buildTime": "20210409222731+0000" }, { "version": "6.9.1", "buildTime": "20210820111518+0000" }, { "version": "6.9", "buildTime": "20210507072853+0000" }, { "version": "6.8.3", "buildTime": "20210222161328+0000" },

... (truncated)

Commits
  • 96754b8 Merge pull request #18902 Improve FSW probes description in release notes
  • f1270e6 Improve FSW probes description in release notes
  • ae9810f Merge pull request #18895 Improve release notes for @UntrackedTask
  • 4efaabb Improve release notes for @UntrackedTask
  • 6f18d6a Pass GE access key of both ge.gradle.org and e.grdev.net
  • e6a5946 Update wrapper to 7.3 RC5
  • 426f267 Merge pull request #18866 Always notify the build scan plugin once at the com...
  • 6786b22 Always notify the build scan plugin once at the completion of the build, rega...
  • a3ff2c2 Merge branch 'release' into oehme/cleanup-reprocessed-sources
  • 78657f4 Don't reprocess derived types if primary type is reprocessed
  • Additional commits viewable in compare view

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=dev.gradleplugins:gradle-test-kit&package-manager=maven&previous-version=7.2&new-version=7.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1208 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1208 from google:dependabot/maven/value/dev.gradleplugins-gradle-test-kit-7.3 bf73814eb0107a1fd35465496aed2fb5bd4c18f5 PiperOrigin-RevId: 413163061 --- value/src/it/functional/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/value/src/it/functional/pom.xml b/value/src/it/functional/pom.xml index c485ae4c..18e07a94 100644 --- a/value/src/it/functional/pom.xml +++ b/value/src/it/functional/pom.xml @@ -93,7 +93,7 @@ dev.gradleplugins gradle-test-kit - 7.2 + 7.3 test -- cgit v1.2.3 From 7e1ec07a91ba72b61851dddc86be3e7b9743e162 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Dec 2021 14:20:18 -0800 Subject: Bump mockito-core from 4.0.0 to 4.1.0 in /value MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [mockito-core](https://github.com/mockito/mockito) from 4.0.0 to 4.1.0.
Release notes

Sourced from mockito-core's releases.

v4.1.0

Changelog generated by Shipkit Changelog Gradle Plugin

4.1.0

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=org.mockito:mockito-core&package-manager=maven&previous-version=4.0.0&new-version=4.1.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1206 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1206 from google:dependabot/maven/value/org.mockito-mockito-core-4.1.0 ca499856c5d7f0b1729318db8fce237f72977b1b PiperOrigin-RevId: 413509900 --- value/processor/pom.xml | 2 +- value/src/it/functional/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/value/processor/pom.xml b/value/processor/pom.xml index e5320af8..b00457d5 100644 --- a/value/processor/pom.xml +++ b/value/processor/pom.xml @@ -124,7 +124,7 @@ org.mockito mockito-core - 4.0.0 + 4.1.0 test
diff --git a/value/src/it/functional/pom.xml b/value/src/it/functional/pom.xml index 18e07a94..8311389a 100644 --- a/value/src/it/functional/pom.xml +++ b/value/src/it/functional/pom.xml @@ -99,7 +99,7 @@ org.mockito mockito-core - 4.0.0 + 4.1.0 test -- cgit v1.2.3 From 0b21d83b085e39e41ee8b7a725a446ca652f9923 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Dec 2021 06:31:24 -0800 Subject: Bump actions/cache from 2.1.6 to 2.1.7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps [actions/cache](https://github.com/actions/cache) from 2.1.6 to 2.1.7.
Release notes

Sourced from actions/cache's releases.

v2.1.7

Support 10GB cache upload using the latest version 1.0.8 of @actions/cache

Commits

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/cache&package-manager=github_actions&previous-version=2.1.6&new-version=2.1.7)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) ---
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Fixes #1207 COPYBARA_INTEGRATE_REVIEW=https://github.com/google/auto/pull/1207 from google:dependabot/github_actions/actions/cache-2.1.7 de7b13f4ab2cb2e0c6067af335f9ddacb1a21732 PiperOrigin-RevId: 414425323 --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c9fb8ae4..44718421 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: - name: 'Check out repository' uses: actions/checkout@v2.4.0 - name: 'Cache local Maven repository' - uses: actions/cache@v2.1.6 + uses: actions/cache@v2.1.7 with: path: ~/.m2/repository key: maven-${{ hashFiles('**/pom.xml') }} @@ -51,7 +51,7 @@ jobs: - name: 'Check out repository' uses: actions/checkout@v2.4.0 - name: 'Cache local Maven repository' - uses: actions/cache@v2.1.6 + uses: actions/cache@v2.1.7 with: path: ~/.m2/repository key: maven-${{ hashFiles('**/pom.xml') }} @@ -80,7 +80,7 @@ jobs: - name: 'Check out repository' uses: actions/checkout@v2.4.0 - name: 'Cache local Maven repository' - uses: actions/cache@v2.1.6 + uses: actions/cache@v2.1.7 with: path: ~/.m2/repository key: maven-${{ hashFiles('**/pom.xml') }} -- cgit v1.2.3 From 1f8d7f26bf4b0613a8602085cae77f15693ab086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Mon, 6 Dec 2021 13:15:26 -0800 Subject: Make `@AutoBuilder` available unconditionally. RELNOTES=The `@AutoBuilder` annotation documented [here](https://github.com/google/auto/blob/master/value/userguide/autobuilder.md) is now fully stable and supported. PiperOrigin-RevId: 414523614 --- .../auto/value/processor/AutoBuilderProcessor.java | 8 ++------ .../processor/AutoBuilderCompilationTest.java | 24 ---------------------- value/userguide/autobuilder.md | 3 --- 3 files changed, 2 insertions(+), 33 deletions(-) diff --git a/value/src/main/java/com/google/auto/value/processor/AutoBuilderProcessor.java b/value/src/main/java/com/google/auto/value/processor/AutoBuilderProcessor.java index 53fe836d..79bccafd 100644 --- a/value/src/main/java/com/google/auto/value/processor/AutoBuilderProcessor.java +++ b/value/src/main/java/com/google/auto/value/processor/AutoBuilderProcessor.java @@ -98,12 +98,8 @@ public class AutoBuilderProcessor extends AutoValueishProcessor { @Override void processType(TypeElement autoBuilderType) { - if (!processingEnv.getOptions().containsKey(ALLOW_OPTION)) { - errorReporter() - .abortWithError( - autoBuilderType, - "Compile with -A%s to enable this UNSUPPORTED AND UNSTABLE prototype", - ALLOW_OPTION); + if (processingEnv.getOptions().containsKey(ALLOW_OPTION)) { + errorReporter().reportWarning(autoBuilderType, "The -A%s option is obsolete", ALLOW_OPTION); } if (autoBuilderType.getKind() != ElementKind.CLASS && autoBuilderType.getKind() != ElementKind.INTERFACE) { diff --git a/value/src/test/java/com/google/auto/value/processor/AutoBuilderCompilationTest.java b/value/src/test/java/com/google/auto/value/processor/AutoBuilderCompilationTest.java index 16a8a2b5..400250f0 100644 --- a/value/src/test/java/com/google/auto/value/processor/AutoBuilderCompilationTest.java +++ b/value/src/test/java/com/google/auto/value/processor/AutoBuilderCompilationTest.java @@ -115,7 +115,6 @@ public final class AutoBuilderCompilationTest { Compilation compilation = javac() .withProcessors(new AutoBuilderProcessor()) - .withOptions("-Acom.google.auto.value.AutoBuilderIsUnstable") .compile(javaFileObject); assertThat(compilation) .generatedSourceFile("foo.bar.AutoBuilder_Baz_Builder") @@ -148,7 +147,6 @@ public final class AutoBuilderCompilationTest { Compilation compilation = javac() .withProcessors(new AutoBuilderProcessor()) - .withOptions("-Acom.google.auto.value.AutoBuilderIsUnstable") .compile(javaFileObject); assertThat(compilation) .generatedSourceFile("foo.bar.AutoBuilder_Baz_Builder") @@ -192,7 +190,6 @@ public final class AutoBuilderCompilationTest { Compilation compilation = javac() .withProcessors(new AutoBuilderProcessor()) - .withOptions("-Acom.google.auto.value.AutoBuilderIsUnstable") .compile(built, builder); assertThat(compilation).succeededWithoutWarnings(); assertThat(compilation).generatedSourceFile("foo.bar.AutoBuilder_Builder"); @@ -214,7 +211,6 @@ public final class AutoBuilderCompilationTest { Compilation compilation = javac() .withProcessors(new AutoBuilderProcessor()) - .withOptions("-Acom.google.auto.value.AutoBuilderIsUnstable") .compile(javaFileObject); assertThat(compilation).failed(); assertThat(compilation) @@ -242,7 +238,6 @@ public final class AutoBuilderCompilationTest { Compilation compilation = javac() .withProcessors(new AutoBuilderProcessor()) - .withOptions("-Acom.google.auto.value.AutoBuilderIsUnstable") .compile(javaFileObject); assertThat(compilation).failed(); assertThat(compilation) @@ -271,7 +266,6 @@ public final class AutoBuilderCompilationTest { Compilation compilation = javac() .withProcessors(new AutoBuilderProcessor()) - .withOptions("-Acom.google.auto.value.AutoBuilderIsUnstable") .compile(javaFileObject); assertThat(compilation).failed(); assertThat(compilation) @@ -299,7 +293,6 @@ public final class AutoBuilderCompilationTest { Compilation compilation = javac() .withProcessors(new AutoBuilderProcessor()) - .withOptions("-Acom.google.auto.value.AutoBuilderIsUnstable") .compile(javaFileObject); assertThat(compilation).failed(); assertThat(compilation) @@ -328,7 +321,6 @@ public final class AutoBuilderCompilationTest { Compilation compilation = javac() .withProcessors(new AutoBuilderProcessor()) - .withOptions("-Acom.google.auto.value.AutoBuilderIsUnstable") .compile(javaFileObject); assertThat(compilation).failed(); assertThat(compilation) @@ -355,7 +347,6 @@ public final class AutoBuilderCompilationTest { Compilation compilation = javac() .withProcessors(new AutoBuilderProcessor()) - .withOptions("-Acom.google.auto.value.AutoBuilderIsUnstable") .compile(javaFileObject); assertThat(compilation).failed(); assertThat(compilation) @@ -386,7 +377,6 @@ public final class AutoBuilderCompilationTest { Compilation compilation = javac() .withProcessors(new AutoBuilderProcessor()) - .withOptions("-Acom.google.auto.value.AutoBuilderIsUnstable") .compile(javaFileObject); assertThat(compilation).failed(); assertThat(compilation) @@ -418,7 +408,6 @@ public final class AutoBuilderCompilationTest { Compilation compilation = javac() .withProcessors(new AutoBuilderProcessor()) - .withOptions("-Acom.google.auto.value.AutoBuilderIsUnstable") .compile(javaFileObject); assertThat(compilation).failed(); assertThat(compilation) @@ -451,7 +440,6 @@ public final class AutoBuilderCompilationTest { Compilation compilation = javac() .withProcessors(new AutoBuilderProcessor()) - .withOptions("-Acom.google.auto.value.AutoBuilderIsUnstable") .compile(javaFileObject); assertThat(compilation).failed(); assertThat(compilation) @@ -489,7 +477,6 @@ public final class AutoBuilderCompilationTest { Compilation compilation = javac() .withProcessors(new AutoBuilderProcessor()) - .withOptions("-Acom.google.auto.value.AutoBuilderIsUnstable") .compile(javaFileObject); assertThat(compilation).failed(); assertThat(compilation) @@ -519,7 +506,6 @@ public final class AutoBuilderCompilationTest { Compilation compilation = javac() .withProcessors(new AutoBuilderProcessor()) - .withOptions("-Acom.google.auto.value.AutoBuilderIsUnstable") .compile(javaFileObject); assertThat(compilation).failed(); assertThat(compilation) @@ -553,7 +539,6 @@ public final class AutoBuilderCompilationTest { Compilation compilation = javac() .withProcessors(new AutoBuilderProcessor()) - .withOptions("-Acom.google.auto.value.AutoBuilderIsUnstable") .compile(javaFileObject); assertThat(compilation).failed(); assertThat(compilation) @@ -584,7 +569,6 @@ public final class AutoBuilderCompilationTest { Compilation compilation = javac() .withProcessors(new AutoBuilderProcessor()) - .withOptions("-Acom.google.auto.value.AutoBuilderIsUnstable") .compile(javaFileObject); assertThat(compilation).failed(); assertThat(compilation) @@ -618,7 +602,6 @@ public final class AutoBuilderCompilationTest { Compilation compilation = javac() .withProcessors(new AutoBuilderProcessor()) - .withOptions("-Acom.google.auto.value.AutoBuilderIsUnstable") .compile(javaFileObject); assertThat(compilation).failed(); assertThat(compilation) @@ -650,7 +633,6 @@ public final class AutoBuilderCompilationTest { Compilation compilation = javac() .withProcessors(new AutoBuilderProcessor()) - .withOptions("-Acom.google.auto.value.AutoBuilderIsUnstable") .compile(javaFileObject); assertThat(compilation).failed(); assertThat(compilation) @@ -686,7 +668,6 @@ public final class AutoBuilderCompilationTest { Compilation compilation = javac() .withProcessors(new AutoBuilderProcessor()) - .withOptions("-Acom.google.auto.value.AutoBuilderIsUnstable") .compile(javaFileObject); assertThat(compilation).failed(); assertThat(compilation) @@ -719,7 +700,6 @@ public final class AutoBuilderCompilationTest { Compilation compilation = javac() .withProcessors(new AutoBuilderProcessor()) - .withOptions("-Acom.google.auto.value.AutoBuilderIsUnstable") .compile(javaFileObject); assertThat(compilation).failed(); assertThat(compilation) @@ -761,7 +741,6 @@ public final class AutoBuilderCompilationTest { Compilation compilation = javac() .withProcessors(new AutoBuilderProcessor()) - .withOptions("-Acom.google.auto.value.AutoBuilderIsUnstable") .compile(javaFileObject, nullableFileObject); assertThat(compilation).failed(); assertThat(compilation) @@ -794,7 +773,6 @@ public final class AutoBuilderCompilationTest { Compilation compilation = javac() .withProcessors(new AutoBuilderProcessor()) - .withOptions("-Acom.google.auto.value.AutoBuilderIsUnstable") .compile(javaFileObject); assertThat(compilation).failed(); assertThat(compilation) @@ -827,7 +805,6 @@ public final class AutoBuilderCompilationTest { Compilation compilation = javac() .withProcessors(new AutoBuilderProcessor()) - .withOptions("-Acom.google.auto.value.AutoBuilderIsUnstable") .compile(javaFileObject); assertThat(compilation).failed(); assertThat(compilation) @@ -862,7 +839,6 @@ public final class AutoBuilderCompilationTest { Compilation compilation = javac() .withProcessors(new AutoBuilderProcessor()) - .withOptions("-Acom.google.auto.value.AutoBuilderIsUnstable") .compile(javaFileObject); assertThat(compilation).failed(); assertThat(compilation) diff --git a/value/userguide/autobuilder.md b/value/userguide/autobuilder.md index ccd191ca..af9058bd 100644 --- a/value/userguide/autobuilder.md +++ b/value/userguide/autobuilder.md @@ -13,9 +13,6 @@ corresponding to the getter methods in the `@AutoValue` class, an `@AutoBuilder` has setter methods corresponding to the parameters of a constructor or static method. Apart from that, the two are very similar. -AutoBuilder is **unstable** and it is possible that its API -may change. We do not recommend depending on it for production code yet. - ## Example: calling a constructor Here is a simple example: -- cgit v1.2.3 From a74508b7eac6254f8e00cf5d3634a10c690e058d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Tue, 7 Dec 2021 11:23:33 -0800 Subject: Validate that `@AutoValue` (etc) classes have appropriate constructors. The class must have a non-private no-arg constructor so it can be subclassed in the generated code. Previously, if it didn't, we would generate code anyway and rely on the somewhat obscure compiler error message to signal the problem to the user. Now we check for the situation explicitly and produce a specific error message. Fixes https://github.com/google/auto/issues/1209. RELNOTES=n/a PiperOrigin-RevId: 414779231 --- .../auto/value/processor/AutoBuilderProcessor.java | 12 +-- .../auto/value/processor/AutoOneOfProcessor.java | 9 +- .../auto/value/processor/AutoValueProcessor.java | 31 +++---- .../value/processor/AutoValueishProcessor.java | 88 ++++++++++++++---- .../google/auto/value/processor/BuilderSpec.java | 32 +++++-- .../processor/AutoBuilderCompilationTest.java | 60 ++++++++++++ .../value/processor/AutoOneOfCompilationTest.java | 85 +++++++++++++++++ .../value/processor/AutoValueCompilationTest.java | 103 +++++++++++++++++++++ 8 files changed, 356 insertions(+), 64 deletions(-) diff --git a/value/src/main/java/com/google/auto/value/processor/AutoBuilderProcessor.java b/value/src/main/java/com/google/auto/value/processor/AutoBuilderProcessor.java index 79bccafd..fc0d8b3e 100644 --- a/value/src/main/java/com/google/auto/value/processor/AutoBuilderProcessor.java +++ b/value/src/main/java/com/google/auto/value/processor/AutoBuilderProcessor.java @@ -80,7 +80,7 @@ public class AutoBuilderProcessor extends AutoValueishProcessor { private static final String ALLOW_OPTION = "com.google.auto.value.AutoBuilderIsUnstable"; public AutoBuilderProcessor() { - super(AUTO_BUILDER_NAME); + super(AUTO_BUILDER_NAME, /* appliesToInterfaces= */ true); } @Override @@ -101,14 +101,6 @@ public class AutoBuilderProcessor extends AutoValueishProcessor { if (processingEnv.getOptions().containsKey(ALLOW_OPTION)) { errorReporter().reportWarning(autoBuilderType, "The -A%s option is obsolete", ALLOW_OPTION); } - if (autoBuilderType.getKind() != ElementKind.CLASS - && autoBuilderType.getKind() != ElementKind.INTERFACE) { - errorReporter() - .abortWithError( - autoBuilderType, - "[AutoBuilderWrongType] @AutoBuilder only applies to classes and interfaces"); - } - checkModifiersIfNested(autoBuilderType); // The annotation is guaranteed to be present by the contract of Processor#process AnnotationMirror autoBuilderAnnotation = getAnnotationMirror(autoBuilderType, AUTO_BUILDER_NAME).get(); @@ -125,7 +117,7 @@ public class AutoBuilderProcessor extends AutoValueishProcessor { Optional> maybeClassifier = BuilderMethodClassifierForAutoBuilder.classify( methods, errorReporter(), processingEnv, executable, builtType, autoBuilderType); - if (!maybeClassifier.isPresent()) { + if (!maybeClassifier.isPresent() || errorReporter().errorCount() > 0) { // We've already output one or more error messages. return; } diff --git a/value/src/main/java/com/google/auto/value/processor/AutoOneOfProcessor.java b/value/src/main/java/com/google/auto/value/processor/AutoOneOfProcessor.java index 711b138c..4d19d216 100644 --- a/value/src/main/java/com/google/auto/value/processor/AutoOneOfProcessor.java +++ b/value/src/main/java/com/google/auto/value/processor/AutoOneOfProcessor.java @@ -60,7 +60,7 @@ import net.ltgt.gradle.incap.IncrementalAnnotationProcessorType; @IncrementalAnnotationProcessor(IncrementalAnnotationProcessorType.ISOLATING) public class AutoOneOfProcessor extends AutoValueishProcessor { public AutoOneOfProcessor() { - super(AUTO_ONE_OF_NAME); + super(AUTO_ONE_OF_NAME, /* appliesToInterfaces= */ false); } @Override @@ -75,13 +75,6 @@ public class AutoOneOfProcessor extends AutoValueishProcessor { @Override void processType(TypeElement autoOneOfType) { - if (autoOneOfType.getKind() != ElementKind.CLASS) { - errorReporter() - .abortWithError( - autoOneOfType, - "[AutoOneOfNotClass] @" + AUTO_ONE_OF_NAME + " only applies to classes"); - } - checkModifiersIfNested(autoOneOfType); DeclaredType kindMirror = mirrorForKindType(autoOneOfType); // We are going to classify the methods of the @AutoOneOf class into several categories. diff --git a/value/src/main/java/com/google/auto/value/processor/AutoValueProcessor.java b/value/src/main/java/com/google/auto/value/processor/AutoValueProcessor.java index ab7da924..4479a056 100644 --- a/value/src/main/java/com/google/auto/value/processor/AutoValueProcessor.java +++ b/value/src/main/java/com/google/auto/value/processor/AutoValueProcessor.java @@ -18,6 +18,7 @@ package com.google.auto.value.processor; import static com.google.auto.common.MoreElements.getLocalAndInheritedMethods; import static com.google.auto.common.MoreStreams.toImmutableList; import static com.google.auto.value.processor.ClassNames.AUTO_VALUE_NAME; +import static com.google.common.base.Preconditions.checkState; import static com.google.common.collect.Sets.difference; import static com.google.common.collect.Sets.intersection; import static java.util.Comparator.naturalOrder; @@ -45,7 +46,6 @@ import javax.annotation.processing.ProcessingEnvironment; import javax.annotation.processing.Processor; import javax.annotation.processing.SupportedAnnotationTypes; import javax.lang.model.element.AnnotationMirror; -import javax.lang.model.element.ElementKind; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import javax.lang.model.type.TypeKind; @@ -79,21 +79,24 @@ public class AutoValueProcessor extends AutoValueishProcessor { @VisibleForTesting AutoValueProcessor(ClassLoader loaderForExtensions) { - super(AUTO_VALUE_NAME); - this.extensions = null; - this.loaderForExtensions = loaderForExtensions; + this(ImmutableList.of(), loaderForExtensions); } @VisibleForTesting - public AutoValueProcessor(Iterable extensions) { - super(AUTO_VALUE_NAME); - this.extensions = ImmutableList.copyOf(extensions); - this.loaderForExtensions = null; + public AutoValueProcessor(Iterable testExtensions) { + this(testExtensions, null); + } + + private AutoValueProcessor( + Iterable testExtensions, ClassLoader loaderForExtensions) { + super(AUTO_VALUE_NAME, /* appliesToInterfaces= */ false); + this.extensions = ImmutableList.copyOf(testExtensions); + this.loaderForExtensions = loaderForExtensions; } // Depending on how this AutoValueProcessor was constructed, we might already have a list of - // extensions when init() is run, or, if `extensions` is null, we have a ClassLoader that will be - // used to get the list using the ServiceLoader API. + // extensions when init() is run, or, if `loaderForExtensions` is not null, it is a ClassLoader + // that will be used to get the list using the ServiceLoader API. private ImmutableList extensions; private final ClassLoader loaderForExtensions; @@ -108,7 +111,8 @@ public class AutoValueProcessor extends AutoValueishProcessor { public synchronized void init(ProcessingEnvironment processingEnv) { super.init(processingEnv); - if (extensions == null) { + if (loaderForExtensions != null) { + checkState(extensions.isEmpty()); try { extensions = extensionsFromLoader(loaderForExtensions); } catch (RuntimeException | Error e) { @@ -165,10 +169,6 @@ public class AutoValueProcessor extends AutoValueishProcessor { @Override void processType(TypeElement type) { - if (type.getKind() != ElementKind.CLASS) { - errorReporter() - .abortWithError(type, "[AutoValueNotClass] @AutoValue only applies to classes"); - } if (ancestorIsAutoValue(type)) { errorReporter() .abortWithError(type, "[AutoValueExtend] One @AutoValue class may not extend another"); @@ -180,7 +180,6 @@ public class AutoValueProcessor extends AutoValueishProcessor { "[AutoValueImplAnnotation] @AutoValue may not be used to implement an annotation" + " interface; try using @AutoAnnotation instead"); } - checkModifiersIfNested(type); // We are going to classify the methods of the @AutoValue class into several categories. // This covers the methods in the class itself and the ones it inherits from supertypes. diff --git a/value/src/main/java/com/google/auto/value/processor/AutoValueishProcessor.java b/value/src/main/java/com/google/auto/value/processor/AutoValueishProcessor.java index 55a94a71..56e8a98a 100644 --- a/value/src/main/java/com/google/auto/value/processor/AutoValueishProcessor.java +++ b/value/src/main/java/com/google/auto/value/processor/AutoValueishProcessor.java @@ -29,6 +29,7 @@ import static java.util.stream.Collectors.joining; import static java.util.stream.Collectors.toCollection; import static java.util.stream.Collectors.toList; import static java.util.stream.Collectors.toSet; +import static javax.lang.model.util.ElementFilter.constructorsIn; import com.google.auto.common.MoreElements; import com.google.auto.common.MoreTypes; @@ -92,19 +93,22 @@ import javax.tools.JavaFileObject; */ abstract class AutoValueishProcessor extends AbstractProcessor { private final String annotationClassName; + private final boolean appliesToInterfaces; /** - * Qualified names of {@code @AutoValue} or {@code AutoOneOf} classes that we attempted to process - * but had to abandon because we needed other types that they referenced and those other types - * were missing. + * Qualified names of {@code @AutoValue} (etc) classes that we attempted to process but had to + * abandon because we needed other types that they referenced and those other types were missing. */ private final List deferredTypeNames = new ArrayList<>(); - AutoValueishProcessor(String annotationClassName) { + AutoValueishProcessor(String annotationClassName, boolean appliesToInterfaces) { this.annotationClassName = annotationClassName; + this.appliesToInterfaces = appliesToInterfaces; } - /** The annotation we are processing, {@code AutoValue} or {@code AutoOneOf}. */ + /** + * The annotation we are processing, for example {@code AutoValue} or {@code AutoBuilder}. + */ private TypeElement annotationType; /** The simple name of {@link #annotationType}. */ private String simpleAnnotationName; @@ -117,6 +121,10 @@ abstract class AutoValueishProcessor extends AbstractProcessor { super.init(processingEnv); errorReporter = new ErrorReporter(processingEnv); nullables = new Nullables(processingEnv); + annotationType = elementUtils().getTypeElement(annotationClassName); + if (annotationType != null) { + simpleAnnotationName = annotationType.getSimpleName().toString(); + } } final ErrorReporter errorReporter() { @@ -132,9 +140,9 @@ abstract class AutoValueishProcessor extends AbstractProcessor { } /** - * Qualified names of {@code @AutoValue} or {@code AutoOneOf} classes that we attempted to process - * but had to abandon because we needed other types that they referenced and those other types - * were missing. This is used by tests. + * Qualified names of {@code @AutoValue} (etc) classes that we attempted to process but had to + * abandon because we needed other types that they referenced and those other types were missing. + * This is used by tests. */ final ImmutableList deferredTypeNames() { return ImmutableList.copyOf(deferredTypeNames); @@ -339,7 +347,6 @@ abstract class AutoValueishProcessor extends AbstractProcessor { @Override public final boolean process(Set annotations, RoundEnvironment roundEnv) { - annotationType = elementUtils().getTypeElement(annotationClassName); if (annotationType == null) { // This should not happen. If the annotation type is not found, how did the processor get // triggered? @@ -352,7 +359,6 @@ abstract class AutoValueishProcessor extends AbstractProcessor { + " because the annotation class was not found"); return false; } - simpleAnnotationName = annotationType.getSimpleName().toString(); List deferredTypes = deferredTypeNames.stream() .map(name -> elementUtils().getTypeElement(name)) @@ -364,9 +370,10 @@ abstract class AutoValueishProcessor extends AbstractProcessor { for (TypeElement type : deferredTypes) { errorReporter.reportError( type, - "[AutoValueUndefined] Did not generate @%s class for %s because it references" + "[%sUndefined] Did not generate @%s class for %s because it references" + " undefined types", simpleAnnotationName, + simpleAnnotationName, type.getQualifiedName()); } return false; @@ -381,6 +388,7 @@ abstract class AutoValueishProcessor extends AbstractProcessor { deferredTypeNames.clear(); for (TypeElement type : types) { try { + validateType(type); processType(type); } catch (AbortProcessingException e) { // We abandoned this type; continue with the next. @@ -396,7 +404,8 @@ abstract class AutoValueishProcessor extends AbstractProcessor { String trace = Throwables.getStackTraceAsString(e); errorReporter.reportError( type, - "[AutoValueException] @%s processor threw an exception: %s", + "[%sException] @%s processor threw an exception: %s", + simpleAnnotationName, simpleAnnotationName, trace); throw e; @@ -406,8 +415,37 @@ abstract class AutoValueishProcessor extends AbstractProcessor { } /** - * Analyzes a single {@code @AutoValue} or {@code @AutoOneOf} class, and outputs the corresponding - * implementation class or classes. + * Validations common to all the subclasses. An {@code @AutoFoo} type must be a class, or possibly + * an interface for {@code @AutoBuilder}. If it is a class then it must have a non-private no-arg + * constructor. + */ + private void validateType(TypeElement type) { + ElementKind kind = type.getKind(); + boolean kindOk = + kind.equals(ElementKind.CLASS) + || (appliesToInterfaces && kind.equals(ElementKind.INTERFACE)); + if (!kindOk) { + String appliesTo = appliesToInterfaces ? "classes and interfaces" : "classes"; + errorReporter.abortWithError( + type, + "[%sWrongType] @%s only applies to %s", + simpleAnnotationName, + simpleAnnotationName, + appliesTo); + } + checkModifiersIfNested(type); + if (!hasVisibleNoArgConstructor(type)) { + errorReporter.reportError( + type, + "[%sConstructor] @%s class must have a non-private no-arg constructor", + simpleAnnotationName, + simpleAnnotationName); + } + } + + /** + * Analyzes a single {@code @AutoValue} (etc) class, and outputs the corresponding implementation + * class or classes. * * @param type the class with the {@code @AutoValue} or {@code @AutoOneOf} annotation. */ @@ -469,7 +507,9 @@ abstract class AutoValueishProcessor extends AbstractProcessor { if (p.isNullable() && returnType.getKind().isPrimitive()) { errorReporter() .reportError( - propertyMethod, "[AutoValueNullPrimitive] Primitive types cannot be @Nullable"); + propertyMethod, + "[%sNullPrimitive] Primitive types cannot be @Nullable", + simpleAnnotationName); } }); return props.build(); @@ -508,11 +548,10 @@ abstract class AutoValueishProcessor extends AbstractProcessor { } /** - * Returns the name of the generated {@code @AutoValue} or {@code @AutoOneOf} class, for example - * {@code AutoOneOf_TaskResult} or {@code $$AutoValue_SimpleMethod}. + * Returns the name of the generated {@code @AutoValue} (etc) class, for example {@code + * AutoOneOf_TaskResult} or {@code $$AutoValue_SimpleMethod}. * - * @param type the name of the type bearing the {@code @AutoValue} or {@code @AutoOneOf} - * annotation. + * @param type the name of the type bearing the {@code @AutoValue} (etc) annotation. * @param prefix the prefix to use in the generated class. This may start with one or more dollar * signs, for an {@code @AutoValue} implementation where there are AutoValue extensions. */ @@ -589,7 +628,8 @@ abstract class AutoValueishProcessor extends AbstractProcessor { for (ExecutableElement context : contexts) { errorReporter.reportError( context, - "[AutoValueDupProperty] More than one @%s property called %s", + "[%sDupProperty] More than one @%s property called %s", + simpleAnnotationName, simpleAnnotationName, name); } @@ -1187,6 +1227,14 @@ abstract class AutoValueishProcessor extends AbstractProcessor { return getAnnotationMirror(element, annotationName).isPresent(); } + /** True if the type is a class with a non-private no-arg constructor, or is an interface. */ + static boolean hasVisibleNoArgConstructor(TypeElement type) { + return type.getKind().isInterface() + || constructorsIn(type.getEnclosedElements()).stream() + .anyMatch( + c -> c.getParameters().isEmpty() && !c.getModifiers().contains(Modifier.PRIVATE)); + } + final void writeSourceFile(String className, String text, TypeElement originatingType) { try { JavaFileObject sourceFile = diff --git a/value/src/main/java/com/google/auto/value/processor/BuilderSpec.java b/value/src/main/java/com/google/auto/value/processor/BuilderSpec.java index dfdbb8c7..b612c104 100644 --- a/value/src/main/java/com/google/auto/value/processor/BuilderSpec.java +++ b/value/src/main/java/com/google/auto/value/processor/BuilderSpec.java @@ -18,6 +18,7 @@ package com.google.auto.value.processor; import static com.google.auto.common.MoreElements.getLocalAndInheritedMethods; import static com.google.auto.common.MoreStreams.toImmutableSet; import static com.google.auto.value.processor.AutoValueishProcessor.hasAnnotationMirror; +import static com.google.auto.value.processor.AutoValueishProcessor.hasVisibleNoArgConstructor; import static com.google.auto.value.processor.AutoValueishProcessor.nullableAnnotationFor; import static com.google.auto.value.processor.ClassNames.AUTO_VALUE_BUILDER_NAME; import static com.google.common.collect.Sets.immutableEnumSet; @@ -86,16 +87,9 @@ class BuilderSpec { Optional builderTypeElement = Optional.empty(); for (TypeElement containedClass : typesIn(autoValueClass.getEnclosedElements())) { if (hasAnnotationMirror(containedClass, AUTO_VALUE_BUILDER_NAME)) { - if (!CLASS_OR_INTERFACE.contains(containedClass.getKind())) { - errorReporter.reportError( - containedClass, - "[AutoValueBuilderClass] @AutoValue.Builder can only apply to a class or an" - + " interface"); - } else if (!containedClass.getModifiers().contains(Modifier.STATIC)) { - errorReporter.reportError( - containedClass, - "[AutoValueInnerBuilder] @AutoValue.Builder cannot be applied to a non-static class"); - } else if (builderTypeElement.isPresent()) { + findBuilderError(containedClass) + .ifPresent(error -> errorReporter.reportError(containedClass, "%s", error)); + if (builderTypeElement.isPresent()) { errorReporter.reportError( containedClass, "[AutoValueTwoBuilders] %s already has a Builder: %s", @@ -114,6 +108,24 @@ class BuilderSpec { } } + /** Finds why this {@code @AutoValue.Builder} class is bad, if it is bad. */ + private Optional findBuilderError(TypeElement builderTypeElement) { + if (!CLASS_OR_INTERFACE.contains(builderTypeElement.getKind())) { + return Optional.of( + "[AutoValueBuilderClass] @AutoValue.Builder can only apply to a class or an" + + " interface"); + } else if (!builderTypeElement.getModifiers().contains(Modifier.STATIC)) { + return Optional.of( + "[AutoValueInnerBuilder] @AutoValue.Builder cannot be applied to a non-static class"); + } else if (builderTypeElement.getKind().equals(ElementKind.CLASS) + && !hasVisibleNoArgConstructor(builderTypeElement)) { + return Optional.of( + "[AutoValueBuilderConstructor] @AutoValue.Builder class must have a non-private no-arg" + + " constructor"); + } + return Optional.empty(); + } + /** Representation of an {@code AutoValue.Builder} class or interface. */ class Builder implements AutoValueExtension.BuilderContext { private final TypeElement builderTypeElement; diff --git a/value/src/test/java/com/google/auto/value/processor/AutoBuilderCompilationTest.java b/value/src/test/java/com/google/auto/value/processor/AutoBuilderCompilationTest.java index 400250f0..96649bd1 100644 --- a/value/src/test/java/com/google/auto/value/processor/AutoBuilderCompilationTest.java +++ b/value/src/test/java/com/google/auto/value/processor/AutoBuilderCompilationTest.java @@ -246,6 +246,66 @@ public final class AutoBuilderCompilationTest { .onLineContaining("interface Builder"); } + @Test + public void autoBuilderClassMustHaveNoArgConstructor() { + JavaFileObject javaFileObject = + JavaFileObjects.forSourceLines( + "foo.bar.Baz", + "package foo.bar;", + "", + "import com.google.auto.value.AutoBuilder;", + "", + "public class Baz {", + " @AutoBuilder", + " abstract static class Builder {", + " Builder(int bogus) {}", + " Baz build();", + " }", + "}"); + Compilation compilation = + javac() + .withProcessors(new AutoBuilderProcessor()) + .withOptions("-Acom.google.auto.value.AutoBuilderIsUnstable") + .compile(javaFileObject); + assertThat(compilation).failed(); + assertThat(compilation) + .hadErrorContaining( + "[AutoBuilderConstructor] @AutoBuilder class must have a non-private no-arg" + + " constructor") + .inFile(javaFileObject) + .onLineContaining("class Builder"); + } + + @Test + public void autoBuilderClassMustHaveVisibleNoArgConstructor() { + JavaFileObject javaFileObject = + JavaFileObjects.forSourceLines( + "foo.bar.Baz", + "package foo.bar;", + "", + "import com.google.auto.value.AutoBuilder;", + "", + "public class Baz {", + " @AutoBuilder", + " abstract static class Builder {", + " private Builder() {}", + " Baz build();", + " }", + "}"); + Compilation compilation = + javac() + .withProcessors(new AutoBuilderProcessor()) + .withOptions("-Acom.google.auto.value.AutoBuilderIsUnstable") + .compile(javaFileObject); + assertThat(compilation).failed(); + assertThat(compilation) + .hadErrorContaining( + "[AutoBuilderConstructor] @AutoBuilder class must have a non-private no-arg" + + " constructor") + .inFile(javaFileObject) + .onLineContaining("class Builder"); + } + @Test public void autoBuilderNestedInPrivate() { JavaFileObject javaFileObject = diff --git a/value/src/test/java/com/google/auto/value/processor/AutoOneOfCompilationTest.java b/value/src/test/java/com/google/auto/value/processor/AutoOneOfCompilationTest.java index 788b543a..a55b74d0 100644 --- a/value/src/test/java/com/google/auto/value/processor/AutoOneOfCompilationTest.java +++ b/value/src/test/java/com/google/auto/value/processor/AutoOneOfCompilationTest.java @@ -462,6 +462,33 @@ public class AutoOneOfCompilationTest { .onLineContaining("GERBIL"); } + @Test + public void mustBeClass() { + JavaFileObject javaFileObject = + JavaFileObjects.forSourceLines( + "foo.bar.Pet", + "package foo.bar;", + "", + "import com.google.auto.value.AutoOneOf;", + "", + "@AutoOneOf(Pet.Kind.class)", + "public interface Pet {", + " public enum Kind {", + " DOG,", + " CAT,", + " }", + " Kind getKind();", + " String dog();", + " String cat();", + "}"); + Compilation compilation = + javac().withProcessors(new AutoOneOfProcessor()).compile(javaFileObject); + assertThat(compilation) + .hadErrorContaining("@AutoOneOf only applies to classes") + .inFile(javaFileObject) + .onLineContaining("interface Pet"); + } + @Test public void cantBeNullable() { JavaFileObject javaFileObject = @@ -490,4 +517,62 @@ public class AutoOneOfCompilationTest { .inFile(javaFileObject) .onLineContaining("@Nullable String dog()"); } + + @Test + public void mustHaveNoArgConstructor() { + JavaFileObject javaFileObject = + JavaFileObjects.forSourceLines( + "foo.bar.Pet", + "package foo.bar;", + "", + "import com.google.auto.value.AutoOneOf;", + "", + "@AutoOneOf(Pet.Kind.class)", + "public abstract class Pet {", + " Pet(boolean cuddly) {}", + "", + " public enum Kind {", + " DOG,", + " CAT,", + " }", + " public abstract Kind getKind();", + " public abstract String dog();", + " public abstract String cat();", + "}"); + Compilation compilation = + javac().withProcessors(new AutoOneOfProcessor()).compile(javaFileObject); + assertThat(compilation) + .hadErrorContaining("@AutoOneOf class must have a non-private no-arg constructor") + .inFile(javaFileObject) + .onLineContaining("class Pet"); + } + + @Test + public void mustHaveVisibleNoArgConstructor() { + JavaFileObject javaFileObject = + JavaFileObjects.forSourceLines( + "foo.bar.Pet", + "package foo.bar;", + "", + "import com.google.auto.value.AutoOneOf;", + "", + "@AutoOneOf(Pet.Kind.class)", + "public abstract class Pet {", + " private Pet() {}", + "", + " public enum Kind {", + " DOG,", + " CAT,", + " }", + " public abstract Kind getKind();", + " public abstract String dog();", + " public abstract String cat();", + "}"); + Compilation compilation = + javac().withProcessors(new AutoOneOfProcessor()).compile(javaFileObject); + assertThat(compilation) + .hadErrorContaining("@AutoOneOf class must have a non-private no-arg constructor") + .inFile(javaFileObject) + .onLineContaining("class Pet"); + } } diff --git a/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java b/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java index 1bb84f75..cd21ef37 100644 --- a/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java +++ b/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java @@ -555,6 +555,27 @@ public class AutoValueCompilationTest { assertThat(compilation).succeededWithoutWarnings(); } + @Test + public void autoValueMustBeClass() { + JavaFileObject javaFileObject = + JavaFileObjects.forSourceLines( + "foo.bar.Baz", + "package foo.bar;", + "", + "import com.google.auto.value.AutoValue;", + "", + "@AutoValue", + "public interface Baz {", + " String buh();", + "}"); + Compilation compilation = + javac().withProcessors(new AutoValueProcessor()).compile(javaFileObject); + assertThat(compilation) + .hadErrorContaining("@AutoValue only applies to classes") + .inFile(javaFileObject) + .onLineContaining("interface Baz"); + } + @Test public void autoValueMustBeStatic() { JavaFileObject javaFileObject = @@ -635,6 +656,52 @@ public class AutoValueCompilationTest { .onLineContaining("class Nested"); } + @Test + public void autoValueMustHaveNoArgConstructor() { + JavaFileObject javaFileObject = + JavaFileObjects.forSourceLines( + "foo.bar.Baz", + "package foo.bar;", + "", + "import com.google.auto.value.AutoValue;", + "", + "@AutoValue", + "public abstract class Baz {", + " Baz(int buh) {}", + "", + " public abstract int buh();", + "}"); + Compilation compilation = + javac().withProcessors(new AutoValueProcessor()).compile(javaFileObject); + assertThat(compilation) + .hadErrorContaining("@AutoValue class must have a non-private no-arg constructor") + .inFile(javaFileObject) + .onLineContaining("class Baz"); + } + + @Test + public void autoValueMustHaveVisibleNoArgConstructor() { + JavaFileObject javaFileObject = + JavaFileObjects.forSourceLines( + "foo.bar.Baz", + "package foo.bar;", + "", + "import com.google.auto.value.AutoValue;", + "", + "@AutoValue", + "public abstract class Baz {", + " private Baz() {}", + "", + " public abstract int buh();", + "}"); + Compilation compilation = + javac().withProcessors(new AutoValueProcessor()).compile(javaFileObject); + assertThat(compilation) + .hadErrorContaining("@AutoValue class must have a non-private no-arg constructor") + .inFile(javaFileObject) + .onLineContaining("class Baz"); + } + @Test public void noMultidimensionalPrimitiveArrays() { JavaFileObject javaFileObject = @@ -1448,6 +1515,42 @@ public class AutoValueCompilationTest { .onLineContaining("abstract class Builder"); } + @Test + public void autoValueBuilderMustHaveNoArgConstructor() { + JavaFileObject javaFileObject = + JavaFileObjects.forSourceLines( + "foo.bar.Example", + "package foo.bar;", + "", + "import com.google.auto.value.AutoValue;", + "", + "class Example {", + " @AutoValue", + " abstract static class Baz {", + " abstract int foo();", + "", + " static Builder builder() {", + " return new AutoValue_Example_Baz.Builder();", + " }", + "", + " @AutoValue.Builder", + " abstract static class Builder {", + " Builder(int defaultFoo) {}", + " abstract Builder foo(int x);", + " abstract Baz build();", + " }", + " }", + "}"); + Compilation compilation = + javac() + .withProcessors(new AutoValueProcessor(), new AutoValueBuilderProcessor()) + .compile(javaFileObject); + assertThat(compilation) + .hadErrorContaining("@AutoValue.Builder class must have a non-private no-arg constructor") + .inFile(javaFileObject) + .onLineContaining("class Builder"); + } + @Test public void autoValueBuilderOnEnum() { JavaFileObject javaFileObject = -- cgit v1.2.3 From 8a1d7263784327db25dd0ea943b1541a751416a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Tue, 7 Dec 2021 14:29:36 -0800 Subject: Remove references to obsolete `AutoBuilderIsUnstable` option. RELNOTES=n/a PiperOrigin-RevId: 414827073 --- value/src/it/functional/pom.xml | 1 - .../src/test/java/com/google/auto/value/CompileWithEclipseTest.java | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/value/src/it/functional/pom.xml b/value/src/it/functional/pom.xml index 8311389a..18f3718b 100644 --- a/value/src/it/functional/pom.xml +++ b/value/src/it/functional/pom.xml @@ -176,7 +176,6 @@ -Xlint:all -encoding utf8 - -Acom.google.auto.value.AutoBuilderIsUnstable true true diff --git a/value/src/it/functional/src/test/java/com/google/auto/value/CompileWithEclipseTest.java b/value/src/it/functional/src/test/java/com/google/auto/value/CompileWithEclipseTest.java index ca10fb45..5f08a725 100644 --- a/value/src/it/functional/src/test/java/com/google/auto/value/CompileWithEclipseTest.java +++ b/value/src/it/functional/src/test/java/com/google/auto/value/CompileWithEclipseTest.java @@ -127,8 +127,7 @@ public class CompileWithEclipseTest { version, "-target", version, - "-warn:-warningToken,-intfAnnotation", - "-Acom.google.auto.value.AutoBuilderIsUnstable"); + "-warn:-warningToken,-intfAnnotation"); JavaCompiler.CompilationTask task = compiler.getTask(null, fileManager, null, options, null, sourceFileObjects); // Explicitly supply an empty list of extensions for AutoValueProcessor, because otherwise this -- cgit v1.2.3 From 07f37b2be9e060f57eed3e3f5cdccab6a53f0927 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Mon, 13 Dec 2021 07:55:03 -0800 Subject: Disallow `@AutoValue final class`. We will otherwise try to generate a subclass for it which obviously won't compile. This is pretty unlikely anyway since a non-trivial `@AutoValue` class has to be abstract and a class can't be both final and abstract. Fixes https://github.com/google/auto/issues/1215. RELNOTES=n/a PiperOrigin-RevId: 416042702 --- .../value/processor/AutoValueishProcessor.java | 9 +++++++- .../value/processor/AutoValueCompilationTest.java | 25 +++++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/value/src/main/java/com/google/auto/value/processor/AutoValueishProcessor.java b/value/src/main/java/com/google/auto/value/processor/AutoValueishProcessor.java index 56e8a98a..31f1ec1c 100644 --- a/value/src/main/java/com/google/auto/value/processor/AutoValueishProcessor.java +++ b/value/src/main/java/com/google/auto/value/processor/AutoValueishProcessor.java @@ -417,7 +417,7 @@ abstract class AutoValueishProcessor extends AbstractProcessor { /** * Validations common to all the subclasses. An {@code @AutoFoo} type must be a class, or possibly * an interface for {@code @AutoBuilder}. If it is a class then it must have a non-private no-arg - * constructor. + * constructor. And, since we'll be generating a subclass, it can't be final. */ private void validateType(TypeElement type) { ElementKind kind = type.getKind(); @@ -441,6 +441,13 @@ abstract class AutoValueishProcessor extends AbstractProcessor { simpleAnnotationName, simpleAnnotationName); } + if (type.getModifiers().contains(Modifier.FINAL)) { + errorReporter.abortWithError( + type, + "[%sFinal] @%s class must not be final", + simpleAnnotationName, + simpleAnnotationName); + } } /** diff --git a/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java b/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java index cd21ef37..09d4faf9 100644 --- a/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java +++ b/value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java @@ -576,6 +576,29 @@ public class AutoValueCompilationTest { .onLineContaining("interface Baz"); } + @Test + public void autoValueMustNotBeFinal() { + JavaFileObject javaFileObject = + JavaFileObjects.forSourceLines( + "foo.bar.Baz", + "package foo.bar;", + "", + "import com.google.auto.value.AutoValue;", + "", + "@AutoValue", + "public final class Baz {", + " public Baz create() {", + " return new AutoValue_Baz();", + " }", + "}"); + Compilation compilation = + javac().withProcessors(new AutoValueProcessor()).compile(javaFileObject); + assertThat(compilation) + .hadErrorContaining("@AutoValue class must not be final") + .inFile(javaFileObject) + .onLineContaining("class Baz"); + } + @Test public void autoValueMustBeStatic() { JavaFileObject javaFileObject = @@ -603,7 +626,7 @@ public class AutoValueCompilationTest { } @Test - public void autoValueMustBeNotBePrivate() { + public void autoValueMustNotBePrivate() { JavaFileObject javaFileObject = JavaFileObjects.forSourceLines( "foo.bar.Baz", -- cgit v1.2.3 From 000b10c37c94b8f8b3ba1abc35b5d586181be378 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Mon, 13 Dec 2021 19:49:49 -0800 Subject: Add a `` clause to the parent POM for AutoValue and AutoFactory. RELNOTES=n/a PiperOrigin-RevId: 416193787 --- factory/pom.xml | 13 +++++++++++++ value/pom.xml | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/factory/pom.xml b/factory/pom.xml index ff6281b3..922cdbac 100644 --- a/factory/pom.xml +++ b/factory/pom.xml @@ -61,6 +61,19 @@ http://www.google.com + + + sonatype-nexus-snapshots + Sonatype Nexus Snapshots + https://oss.sonatype.org/content/repositories/snapshots/ + + + sonatype-nexus-staging + Nexus Release Repository + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + com.google.auto diff --git a/value/pom.xml b/value/pom.xml index bce8e5f0..1229b004 100644 --- a/value/pom.xml +++ b/value/pom.xml @@ -66,6 +66,19 @@ src/it/gwtserializer + + + sonatype-nexus-snapshots + Sonatype Nexus Snapshots + https://oss.sonatype.org/content/repositories/snapshots/ + + + sonatype-nexus-staging + Nexus Release Repository + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + -- cgit v1.2.3 From 7dfa54165a3da99f41de69ca259282001ddea3e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Tue, 14 Dec 2021 14:07:03 -0800 Subject: Copy the `oss-parent` configuration into `value/pom.xml`. When we stopped using `org.sonatype.oss:oss-parent` we lost this configuration. It turns out to be needed in order to release new versions. This change fixes AutoValue. We will need to make a similar change later for AutoFactory. RELNOTES=n/a PiperOrigin-RevId: 416390801 --- value/pom.xml | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/value/pom.xml b/value/pom.xml index 1229b004..481cb3e4 100644 --- a/value/pom.xml +++ b/value/pom.xml @@ -196,4 +196,56 @@ + + + sonatype-oss-release + + + + org.apache.maven.plugins + maven-source-plugin + 3.2.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.3.1 + + false + + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.0.1 + + + sign-artifacts + verify + + sign + + + + + + + + -- cgit v1.2.3 From f7a8b8042df89742e6b150a166d90c75e7b2f283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Tue, 14 Dec 2021 16:14:36 -0800 Subject: Add a `` section to `auto/value/pom.xml`. RELNOTES=n/a PiperOrigin-RevId: 416419567 --- value/pom.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/value/pom.xml b/value/pom.xml index 481cb3e4..8b1e238d 100644 --- a/value/pom.xml +++ b/value/pom.xml @@ -59,6 +59,21 @@ http://www.google.com + + + eamonnmcmanus + Éamonn McManus + emcmanus@google.com + Google + http://www.google.com + + owner + developer + + -8 + + + annotations processor -- cgit v1.2.3