[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GitHub] brooklyn-server pull request #982: Improve coercions esp with generics

Github user aledsage commented on a diff in the pull request:

    --- Diff: utils/common/src/main/java/org/apache/brooklyn/util/guava/Maybe.java ---
    @@ -501,6 +501,6 @@ public boolean equals(Object obj) {
         /** Finds the {@link Absent#getException()} if {@link #isAbsent()}, or null */
         public static RuntimeException getException(Maybe<?> t) {
    -        return ((Maybe.Absent<?>)t).getException();
    +        return t instanceof Maybe.Absent ? ((Maybe.Absent<?>)t).getException() : null;
    --- End diff --
    As per earlier comment, I'd leave it as throwing an exception if you try to get the exception of a `present`.