You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by GitBox <gi...@apache.org> on 2020/08/09 13:43:01 UTC

[GitHub] [groovy] eric-milles commented on pull request #1339: Support coerce for @NamedVariant

eric-milles commented on pull request #1339:
URL: https://github.com/apache/groovy/pull/1339#issuecomment-671053663


   Instead of calling the `asType` method, you can wrap the expression in a `CastExpression` with coerce set to true.  The compiler will take care of the rest.  `GeneralUtils#castX` will create the `CastExpression` and you can then call `setCoerce(true)` or you could go the extra mile and add an `asX` factory method to GeneralUtils that performs these steps.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org