Skip to content

Commit

Permalink
Remove @Beta from two methods in Throwables.
Browse files Browse the repository at this point in the history
The methods, `getCausalChain` and `getCauseAs`, have existed for years. They work reliably and we are unlikely to change their APIs.

The remaining two `@Beta` methods, `lazyStackTrace` and `lazyStackTraceIsLazy`, should probably be deprecated in a later step. The optimization they encapsulate no longer works on JDK versions ≥ 9 and has never worked on Android. Meanwhile, JDK 9 introduced the `StackWalker` API which does work and covers the most usual use case of `lazyStackTrace`.

RELNOTES=The `Throwables` methods `getCausalChain` and `getCauseAs` were `@Beta` but are now fully supported.
PiperOrigin-RevId: 422652352
  • Loading branch information
eamonnmcmanus authored and Google Java Core Libraries committed Jan 18, 2022
1 parent 468c68a commit dd462af
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 4 deletions.
2 changes: 0 additions & 2 deletions android/guava/src/com/google/common/base/Throwables.java
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@ public static Throwable getRootCause(Throwable throwable) {
* @return an unmodifiable list containing the cause chain starting with {@code throwable}
* @throws IllegalArgumentException if there is a loop in the causal chain
*/
@Beta // TODO(kevinb): decide best return type
public static List<Throwable> getCausalChain(Throwable throwable) {
checkNotNull(throwable);
List<Throwable> causes = new ArrayList<>(4);
Expand Down Expand Up @@ -330,7 +329,6 @@ public static List<Throwable> getCausalChain(Throwable throwable) {
* ClassCastException}'s cause is {@code throwable}.
* @since 22.0
*/
@Beta
@GwtIncompatible // Class.cast(Object)
@CheckForNull
public static <X extends Throwable> X getCauseAs(
Expand Down
2 changes: 0 additions & 2 deletions guava/src/com/google/common/base/Throwables.java
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@ public static Throwable getRootCause(Throwable throwable) {
* @return an unmodifiable list containing the cause chain starting with {@code throwable}
* @throws IllegalArgumentException if there is a loop in the causal chain
*/
@Beta // TODO(kevinb): decide best return type
public static List<Throwable> getCausalChain(Throwable throwable) {
checkNotNull(throwable);
List<Throwable> causes = new ArrayList<>(4);
Expand Down Expand Up @@ -330,7 +329,6 @@ public static List<Throwable> getCausalChain(Throwable throwable) {
* ClassCastException}'s cause is {@code throwable}.
* @since 22.0
*/
@Beta
@GwtIncompatible // Class.cast(Object)
@CheckForNull
public static <X extends Throwable> X getCauseAs(
Expand Down

0 comments on commit dd462af

Please sign in to comment.