[
https://issues.apache.org/jira/browse/GROOVY-10428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17462893#comment-17462893
]
Paul King edited comment on GROOVY-10428 at 12/20/21, 11:51 PM:
----------------------------------------------------------------
GString's now have a default inspect which more closely follows the intention
of inspect rather than just falling back onto toString(). This is breaking if
anyone is relying on that format.
So the following is now true:
{code}
def gs = "foo${1+1}"
assert gs.inspect() == /"foo2"/
{code}
So the result is quoted just like for {{String}}. If not wanting the quotes,
just use {{toString}} instead.
was (Author: paulk):
GString's now have a default inspect which more closely follows the intention
of inspect rather than just falling back onto toString(). This is breaking if
anyone is relying on that format.
So the following is now true:
{code}
def gs = "foo${1+1}"
assert gs.inspect() == /"foo2"/
{code}
So the result is quoted just like for {{String}}s. If not wanting the quotes,
just use {{toString}} instead.
> Refactor: split formatting methods out of InvokerHelper (allow separate
> control of escapeBackslashes)
> -----------------------------------------------------------------------------------------------------
>
> Key: GROOVY-10428
> URL: https://issues.apache.org/jira/browse/GROOVY-10428
> Project: Groovy
> Issue Type: Task
> Reporter: Paul King
> Assignee: Paul King
> Priority: Major
> Labels: breaking
> Fix For: 4.0.0-rc-2
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> InvokerHelper is primarily a grab bag of functionality associated with
> invoking methods. It also has numerous methods for formatting. Originally
> there were only a few such methods but the number has grown over time and
> additionally functionality would prove useful. It probably makes sense to
> split these to avoid abuse of the single responsibility principle.
> Existing methods will remain and be deprecated. New functionality will only
> go in the new class.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)