groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Winnebeck, Jason" <>
Subject ShortTypeHandling castToString
Date Tue, 14 Jun 2016 15:29:06 GMT
I came across this method in Groovy 2.4.6 in ShortTypeHandling class, I've never seen it fail
but it doesn't see right to me:

public static String castToString(Object object) {
    if (object==null) return null;
    if (object instanceof Class) return (String) object;
    return object.toString();

How can cast to String work if the object is a Class?


This email message and any attachments are for the sole use of the intended recipient(s).
Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the
intended recipient, please contact the sender by reply email and destroy all copies of the
original message and any attachments.

View raw message