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 2022/07/04 04:16:00 UTC

[jira] [Comment Edited] (GROOVY-6871) Running :show all command throws StackOverflowError

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

Paul King edited comment on GROOVY-6871 at 7/4/22 4:15 AM:
-----------------------------------------------------------

We haven't progressed detecting printing mutually recursive structures yet. I implemented a workaround for this case in the meantime. It simply avoids including the '\_' value in the variables returned by {{:show all}} and substitutes a '\_' placeholder instead as shown here:

{noformat}
Groovy Shell (5.0.0-SNAPSHOT, JVM: 17.0.2)
Type ':help' or ':h' for help.
-------------------------------------------------------------------------------
groovy:000> :show all
No variables defined
No classes have been loaded
No custom imports have been defined
No preferences are set
===> [null, null, null, null]
groovy:000> :show all
Variables:
  _ = [null, null, null, null]
No classes have been loaded
No custom imports have been defined
No preferences are set
===> [[_:_], null, null, null]
groovy:000> :show all
Variables:
  _ = [[_:_], null, null, null]
No classes have been loaded
No custom imports have been defined
No preferences are set
===> [[_:_], null, null, null]
groovy:000> :show all
Variables:
  _ = [[_:_], null, null, null]
No classes have been loaded
No custom imports have been defined
No preferences are set
===> [[_:_], null, null, null]
groovy:000>
{noformat}


was (Author: paulk):
We haven't progressed detecting printing mutually recursive structures yet. I implemented a workaround for this case in the meantime. It simply avoids including the '_' value in the variables returned by {{:show all}} and substitutes a '_' placeholder instead as shown here:

{noformat}
Groovy Shell (5.0.0-SNAPSHOT, JVM: 17.0.2)
Type ':help' or ':h' for help.
-------------------------------------------------------------------------------
groovy:000> :show all
No variables defined
No classes have been loaded
No custom imports have been defined
No preferences are set
===> [null, null, null, null]
groovy:000> :show all
Variables:
  _ = [null, null, null, null]
No classes have been loaded
No custom imports have been defined
No preferences are set
===> [[_:_], null, null, null]
groovy:000> :show all
Variables:
  _ = [[_:_], null, null, null]
No classes have been loaded
No custom imports have been defined
No preferences are set
===> [[_:_], null, null, null]
groovy:000> :show all
Variables:
  _ = [[_:_], null, null, null]
No classes have been loaded
No custom imports have been defined
No preferences are set
===> [[_:_], null, null, null]
groovy:000>
{noformat}

> Running :show all command throws StackOverflowError
> ---------------------------------------------------
>
>                 Key: GROOVY-6871
>                 URL: https://issues.apache.org/jira/browse/GROOVY-6871
>             Project: Groovy
>          Issue Type: Bug
>          Components: Groovysh
>    Affects Versions: 2.3.2, 2.4.0-beta-1
>         Environment: Windows 7
>            Reporter: Alexandre Rafalovitch
>            Assignee: Paul King
>            Priority: Minor
>              Labels: StackOverflowError
>             Fix For: 5.0.0-alpha-1, 4.0.4
>
>
> {quote}
> E:\Downloads\groovy-2.4.0-beta-1>bin\groovysh
> Groovy Shell (2.4.0-beta-1, JVM: 1.7.0_25)
> Type ':help' or ':h' for help.
> -----------------------------------------------------------
> groovy:000> :show all
> No variables defined
> No classes have been loaded
> No custom imports have been defined
> No preferences are set
> ===> [null, null, null, null]
> groovy:000> :show all
> Variables:
>   _ = [null, null, null, null]
> No classes have been loaded
> No custom imports have been defined
> No preferences are set
> ===> [[_:[null, null, null, null]], null, null, null]
> groovy:000> :show all
> Variables:
> ERROR java.lang.StackOverflowError:
> null
> groovy:000> :show all
> Variables:
> ERROR java.lang.StackOverflowError:
> null
> groovy:000>
> {quote}
> Can also be triggered faster by starting a recording session.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)