eric-milles edited a comment 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. This is the literal equivalent of "expr as Type" in source. `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: [email protected]
