brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neykov <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #488: Get ready for compiling with JDK 1.8 / Ja...
Date Fri, 16 Dec 2016 16:50:16 GMT
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/488#discussion_r92845427
  
    --- Diff: utils/common/src/main/java/org/apache/brooklyn/util/javalang/coerce/EnumTypeCoercions.java
---
    @@ -70,11 +70,11 @@ public E apply(String input) {
         }
         
         @SuppressWarnings({ "unchecked", "rawtypes" })
    -    public static <T> Maybe<T> tryCoerceUntyped(String input, Class<T>
targetType) {
    +    public static Maybe tryCoerceUntyped(String input, Class targetType) {
             if (input==null) return null;
             if (targetType==null) return Maybe.absent("Null enum type");
             if (!targetType.isEnum()) return Maybe.absent("Type '"+targetType+"' is not an
enum");
    -        return tryCoerce(input, (Class<Enum>)targetType);
    +        return tryCoerce(input, targetType);
    --- End diff --
    
    I'd keep the generics as is and add a cast to `(Maybe<T>) ` of the return value
(insert before `tryCoerce`).
    Credit to Eclipse's quick fix for this one :).



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message