Skip to content

Commit 45782bd

Browse files
cpovirkGoogle Java Core Libraries
authored and
Google Java Core Libraries
committedFeb 6, 2024
Remove temporary type parameters.
This will break most users who static import both `Truth.assertThat` and `Truth8.assertThat`. The fix is usually as simple as replacing every reference to `Truth8` with a reference to `Truth`. But we'll post some additional migration information as part of the release notes, as we've already done for [1.3.0](https://github.com/google/truth/releases/tag/v1.3.0) and [1.4.0](https://github.com/google/truth/releases/tag/v1.4.0). (The type parameters existed to avoid that static import conflict. However, the type parameters also _cause other static import conflicts_, so we don't want them in place in the long term.) This is one of the remaining loose ends of #746. RELNOTES=Removed temporary type parameters from `Truth.assertThat(Stream)` and `Truth.assertThat(Optional)`. This can create build errors, which you can fix by replacing all your references to `Truth8` with references to `Truth`. PiperOrigin-RevId: 604754613
1 parent b5cd4a0 commit 45782bd

File tree

1 file changed

+2
-2
lines changed
  • core/src/main/java/com/google/common/truth

1 file changed

+2
-2
lines changed
 

‎core/src/main/java/com/google/common/truth/Truth.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ public static TableSubject assertThat(@Nullable Table<?, ?, ?> actual) {
265265
"Java7ApiChecker", // no more dangerous than wherever the user got the Optional
266266
"NullableOptional", // Truth always accepts nulls, no matter the type
267267
})
268-
public static <T> OptionalSubject assertThat(@Nullable Optional<T> actual) {
268+
public static OptionalSubject assertThat(@Nullable Optional<?> actual) {
269269
return assert_().that(actual);
270270
}
271271

@@ -297,7 +297,7 @@ public static OptionalDoubleSubject assertThat(@Nullable OptionalDouble actual)
297297
* @since 1.4.0 (present in {@link Truth8} since before 1.0)
298298
*/
299299
@SuppressWarnings("Java7ApiChecker") // no more dangerous than wherever the user got the Stream
300-
public static <T extends @Nullable Object> StreamSubject assertThat(@Nullable Stream<T> actual) {
300+
public static StreamSubject assertThat(@Nullable Stream<?> actual) {
301301
return assert_().that(actual);
302302
}
303303

0 commit comments

Comments
 (0)
Please sign in to comment.