You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2015/08/29 02:09:45 UTC

[jira] [Commented] (GROOVY-7564) InvokerHelper verbose printing wrongly escapes backslashes

    [ https://issues.apache.org/jira/browse/GROOVY-7564?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14720822#comment-14720822 ] 

Paul King commented on GROOVY-7564:
-----------------------------------

With my pedantic hat on, I would say I would expect {{InvokerHelper.inspect('a\\b')}} to return {{'a\\b'}}.

The formatXXX methods are to some degree "general purpose" formatting methods that Groovy might use to display objects in a variety of ways. I am not sure we have ever guaranteed that they would always align with what "inspect" should produce. I know that currently one directly calls the other and only uses the verbose flag to half convey the intentions. It might be time to make the intention a bit clearer.

BTW, I am very much in favor of your refactoring efforts. We never finished pushing the safe and maxSize params throughout all of the code and we still do not handle a bunch of edge cases properly as you've no doubt discovered. I would also suggest perhaps making a FormatHelper class and moving all of the formatting related methods into it - leaving deprecated stubs in InvokerHelper for b/w compatibility. I was going to do this at one stage earlier on but we ran out of time to finished the refactoring during a release cycle and backed away.

My comments here are very general but I am happy to work with you to progress some specific parts if that makes sense.

> InvokerHelper verbose printing wrongly escapes backslashes 
> -----------------------------------------------------------
>
>                 Key: GROOVY-7564
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7564
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Thibault Kruse
>            Priority: Minor
>
> Tor reproduce:
> {code}
> groovy:000> InvokerHelper.format('a\\b', true, -1)
> ===> 'a\b'
> {code}
> Should be 
> {code}'a\\b'{code}
> See https://github.com/apache/incubator-groovy/pull/96



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)