aboutsummaryrefslogtreecommitdiff
path: root/value/src/test/java/com/google
diff options
context:
space:
mode:
authorÉamonn McManus <emcmanus@google.com>2021-04-08 09:13:55 -0700
committerGoogle Java Core Libraries <java-libraries-firehose+copybara@google.com>2021-04-08 09:14:28 -0700
commitea0a418bed3a099c989c41f278a6937b1de9f4e2 (patch)
treed03a810e9aa8349ec3669c3647c24fafc672b981 /value/src/test/java/com/google
parentb8257718e73a2b051a67a96626d9785f353bf34a (diff)
downloadauto-ea0a418bed3a099c989c41f278a6937b1de9f4e2.tar.gz
Allow an AutoBuilder builder to call static methods.
Up until now, `@AutoBuilder` builders, like `@AutoValue.Builder` builders, only ever invoked constructors from their `build()` method. But AutoBuilder is specified to apply also to static methods. This introduces a new distinction which we did not have before, between the type containing the executable to invoke (up until now always a constructor) and the type that that executable produces (which for a constructor was obviously the same type). RELNOTES=n/a PiperOrigin-RevId: 367442955
Diffstat (limited to 'value/src/test/java/com/google')
-rw-r--r--value/src/test/java/com/google/auto/value/processor/AutoValueCompilationTest.java9
1 files changed, 7 insertions, 2 deletions
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 4a87282b..e20eb448 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
@@ -1866,10 +1866,15 @@ public class AutoValueCompilationTest {
.withProcessors(new AutoValueProcessor(), new AutoValueBuilderProcessor())
.compile(javaFileObject);
assertThat(compilation)
- .hadErrorContaining(
- "Method matches a property of foo.bar.Baz but has return type T instead of U")
+ .hadErrorContainingMatch(
+ "Method matches a property of foo\\.bar\\.Baz<T, ?U> but has return type T instead of"
+ + " U")
.inFile(javaFileObject)
.onLineContaining("T blam()");
+ // The <T, ?U> is because we're depending on TypeMirror.toString(), and the JDK actually spells
+ // this as <T,U> with no space. While it's not completely sound to expect a given string from
+ // TypeMirror.toString(), in practice it's hard to imagine that it would be anything other
+ // than "foo.bar.Baz<T,U>" or "foo.bar.Baz<T, U>" given the specification.
}
@Test