Skip to content

Commit

Permalink
Remove temporary type parameters.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cpovirk authored and Google Java Core Libraries committed Feb 6, 2024
1 parent b5cd4a0 commit 45782bd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/main/java/com/google/common/truth/Truth.java
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public static TableSubject assertThat(@Nullable Table<?, ?, ?> actual) {
"Java7ApiChecker", // no more dangerous than wherever the user got the Optional
"NullableOptional", // Truth always accepts nulls, no matter the type
})
public static <T> OptionalSubject assertThat(@Nullable Optional<T> actual) {
public static OptionalSubject assertThat(@Nullable Optional<?> actual) {
return assert_().that(actual);
}

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

Expand Down

0 comments on commit 45782bd

Please sign in to comment.