[jira] [Commented] (GROOVY-8278) Groovysh: unable to resolve previously declared classes with interpreterMode=true
[ https://issues.apache.org/jira/browse/GROOVY-8278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16126816#comment-16126816 ] Øyvind Stegard commented on GROOVY-8278: Good to know it has already been fixed. I'd update JIRA fix version to 2.5.0 and mark this bug as resolved then. It is not a critical issue. > Groovysh: unable to resolve previously declared classes with > interpreterMode=true > - > > Key: GROOVY-8278 > URL: https://issues.apache.org/jira/browse/GROOVY-8278 > Project: Groovy > Issue Type: Bug > Components: Groovysh >Affects Versions: 2.4.12 > Environment: Linux x86-64, > java version "1.8.0_144" > Java(TM) SE Runtime Environment (build 1.8.0_144-b01) > Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode) >Reporter: Øyvind Stegard > > Classes declared in a Groovysh session cannot be used properly later on when > using {{interpreterMode=true}}. > This fails with error "unable to resolve class C": > {code:java} > :set interpreterMode true > class C { } > instance = new C() > {code} > However, this clunky workaround works: > {code:java} > :set interpreterMode true > class C { } > new C() > instance = _ > assert instance.getClass() == C.class > {code} > Groovysh session showing the issue when {{interpreterMode}} is enabled: > {noformat} > groovysh -d > DEBUG [org.codehaus.groovy.tools.shell.BufferManager] Created new buffer with > index: 0 > DEBUG [org.codehaus.groovy.tools.shell.BufferManager] Buffers reset > DEBUG [org.codehaus.groovy.tools.shell.Parser] Using parser flavor: rigid > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: ? > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :help > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :quit > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :exit > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > import > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :display > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :clear > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :show > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :inspect > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :purge > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :edit > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: . > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :load > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :save > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :record > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :history > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :alias > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :set > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :register > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :doc > DEBUG [org.codehaus.groovy.tools.shell.InteractiveShellRunner] Using history > file: /home/oyvind/.groovy/groovysh.history > DEBUG [org.codehaus.groovy.tools.shell.Groovysh] Terminal > (jline.UnixTerminal@d737b89) > DEBUG [org.codehaus.groovy.tools.shell.Groovysh] Supported: true > DEBUG [org.codehaus.groovy.tools.shell.Groovysh] ECHO: (enabled: > false) > DEBUG [org.codehaus.groovy.tools.shell.Groovysh] H x W: 64 x 115 > DEBUG [org.codehaus.groovy.tools.shell.Groovysh] ANSI: true > Groovy Shell (2.4.12, JVM: 1.8.0_144) > Type ':help' or ':h' for help. > -- > DEBUG [org.codehaus.groovy.tools.shell.CommandsMultiCompleter] Added > completer[1] for command: :help > DEBUG [org.codehaus.groovy.tools.shell.CommandsMultiCompleter] Added > completer[2] for command: ? > DEBUG [org.codehaus.groovy.tools.shell.CommandsMultiCompleter] Added > completer[3] for command: :exit > DEBUG [org.codehaus.groovy.tools.shell.CommandsMultiCompleter] Added > completer[4] for command: :quit > DEBUG [org.codehaus.groovy.tools.shell.CommandsMultiCompleter] Added > completer[5] for command: import > DEBUG [org.codehaus.groovy.tools.shell.CommandsMultiCompleter] Added > completer[6] for command: :display > DEBUG [org.codehaus.groovy.tools.shell.CommandsMultiCompleter] Added > completer[7] for command: :clear > DEBUG
[jira] [Commented] (GROOVY-8278) Groovysh: unable to resolve previously declared classes with interpreterMode=true
[ https://issues.apache.org/jira/browse/GROOVY-8278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16126718#comment-16126718 ] John Wagenleitner commented on GROOVY-8278: --- Looks like this is fixed in 2.5.0 (in beta) by GROOVY-7562 [commit 6b80966a4e|https://github.com/apache/groovy/commit/6b80966a4e50b0e24b86832eaa01be96d2dded3d#diff-3cf65a35f1b86ee676b39d8581fde0cc]. It was noted in GROOVY-7562 that it wasn't merged in 2.4 due to some compatibility concerns. So unless it's critical for 2.4 I'd suggest this be closed with the work-around to be turn off interpreter mode. If critical then with some work the fix might be able to be back-ported to 2.4 and still retain compatibility. > Groovysh: unable to resolve previously declared classes with > interpreterMode=true > - > > Key: GROOVY-8278 > URL: https://issues.apache.org/jira/browse/GROOVY-8278 > Project: Groovy > Issue Type: Bug > Components: Groovysh >Affects Versions: 2.4.12 > Environment: Linux x86-64, > java version "1.8.0_144" > Java(TM) SE Runtime Environment (build 1.8.0_144-b01) > Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode) >Reporter: Øyvind Stegard > > Classes declared in a Groovysh session cannot be used properly later on when > using {{interpreterMode=true}}. > This fails with error "unable to resolve class C": > {code:java} > :set interpreterMode true > class C { } > instance = new C() > {code} > However, this clunky workaround works: > {code:java} > :set interpreterMode true > class C { } > new C() > instance = _ > assert instance.getClass() == C.class > {code} > Groovysh session showing the issue when {{interpreterMode}} is enabled: > {noformat} > groovysh -d > DEBUG [org.codehaus.groovy.tools.shell.BufferManager] Created new buffer with > index: 0 > DEBUG [org.codehaus.groovy.tools.shell.BufferManager] Buffers reset > DEBUG [org.codehaus.groovy.tools.shell.Parser] Using parser flavor: rigid > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: ? > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :help > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :quit > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :exit > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > import > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :display > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :clear > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :show > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :inspect > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :purge > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :edit > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: . > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :load > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :save > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :record > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :history > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :alias > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :set > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :register > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :doc > DEBUG [org.codehaus.groovy.tools.shell.InteractiveShellRunner] Using history > file: /home/oyvind/.groovy/groovysh.history > DEBUG [org.codehaus.groovy.tools.shell.Groovysh] Terminal > (jline.UnixTerminal@d737b89) > DEBUG [org.codehaus.groovy.tools.shell.Groovysh] Supported: true > DEBUG [org.codehaus.groovy.tools.shell.Groovysh] ECHO: (enabled: > false) > DEBUG [org.codehaus.groovy.tools.shell.Groovysh] H x W: 64 x 115 > DEBUG [org.codehaus.groovy.tools.shell.Groovysh] ANSI: true > Groovy Shell (2.4.12, JVM: 1.8.0_144) > Type ':help' or ':h' for help. > -- > DEBUG [org.codehaus.groovy.tools.shell.CommandsMultiCompleter] Added > completer[1] for command: :help > DEBUG [org.codehaus.groovy.tools.shell.CommandsMultiCompleter] Added > completer[2] for command: ? > DEBUG [org.codehaus.groovy.tools.shell.CommandsMultiCompleter] Added > completer[3] for command: :exit > DEBUG
[jira] [Commented] (GROOVY-8278) Groovysh: unable to resolve previously declared classes
[ https://issues.apache.org/jira/browse/GROOVY-8278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16125483#comment-16125483 ] Øyvind Stegard commented on GROOVY-8278: It looks like the problem only occurs with when the setting {{interpreterMode}} is set to {{true}}. It was in my case, and I was unaware that Groovy-shell persisted these options under the "~/.java/.userPrefs/"-folder. So, to reproduce issue: {noformat} @lhs:~$ groovysh Groovy Shell (2.4.12, JVM: 1.8.0_144) Type ':help' or ':h' for help. -- groovy:000> :show preferences No preferences are set groovy:000> :set interpreterMode true groovy:000> class C { } ===> true groovy:000> instance = new C() script15027045639421703884630.groovy: 1: unable to resolve class C @ line 1, column 12. instance = new C() ^ groovy:000> {noformat} I've updated the bug title to reflect this important detail. > Groovysh: unable to resolve previously declared classes > --- > > Key: GROOVY-8278 > URL: https://issues.apache.org/jira/browse/GROOVY-8278 > Project: Groovy > Issue Type: Bug > Components: Groovysh >Affects Versions: 2.4.12 > Environment: Linux x86-64, > java version "1.8.0_144" > Java(TM) SE Runtime Environment (build 1.8.0_144-b01) > Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode) >Reporter: Øyvind Stegard > > Classes declared in a Groovysh session cannot be used properly later on. > This fails with error "unable to resolve class C": > {code:java} > class C { } > instance = new C() > {code} > However, this clunky workaround works: > {code:java} > class C { } > new C() > instance = _ > assert instance.getClass() == C.class > {code} > Groovysh session showing the issue: > {noformat} > groovysh -d > DEBUG [org.codehaus.groovy.tools.shell.BufferManager] Created new buffer with > index: 0 > DEBUG [org.codehaus.groovy.tools.shell.BufferManager] Buffers reset > DEBUG [org.codehaus.groovy.tools.shell.Parser] Using parser flavor: rigid > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: ? > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :help > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :quit > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :exit > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > import > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :display > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :clear > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :show > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :inspect > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :purge > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :edit > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: . > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :load > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :save > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :record > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :history > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :alias > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :set > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :register > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :doc > DEBUG [org.codehaus.groovy.tools.shell.InteractiveShellRunner] Using history > file: /home/oyvind/.groovy/groovysh.history > DEBUG [org.codehaus.groovy.tools.shell.Groovysh] Terminal > (jline.UnixTerminal@d737b89) > DEBUG [org.codehaus.groovy.tools.shell.Groovysh] Supported: true > DEBUG [org.codehaus.groovy.tools.shell.Groovysh] ECHO: (enabled: > false) > DEBUG [org.codehaus.groovy.tools.shell.Groovysh] H x W: 64 x 115 > DEBUG [org.codehaus.groovy.tools.shell.Groovysh] ANSI: true > Groovy Shell (2.4.12, JVM: 1.8.0_144) > Type ':help' or ':h' for help. > -- > DEBUG [org.codehaus.groovy.tools.shell.CommandsMultiCompleter] Added > completer[1] for command: :help > DEBUG [org.codehaus.groovy.tools.shell.CommandsMultiCompleter] Added > completer[2] for command: ? > DEBUG
[jira] [Commented] (GROOVY-8278) Groovysh: unable to resolve previously declared classes
[ https://issues.apache.org/jira/browse/GROOVY-8278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16125027#comment-16125027 ] John Wagenleitner commented on GROOVY-8278: --- I am not able to reproduce the issue. Do you have any [profile scripts|http://www.groovy-lang.org/groovysh.html#GroovyShell-UserProfileScriptsandState] that might run or some custom preferences (:show preferences)? {code} ~/projects/ASF/groovy (master)$ ~/java/groovy-2.4.12/bin/groovysh Groovy Shell (2.4.12, JVM: 1.8.0_144) Type ':help' or ':h' for help. --- groovy:000> class C { } ===> true groovy:000> instance = new C() ===> C@51549490 groovy:000> :show preferences No preferences are set groovy:000> :exit {code} > Groovysh: unable to resolve previously declared classes > --- > > Key: GROOVY-8278 > URL: https://issues.apache.org/jira/browse/GROOVY-8278 > Project: Groovy > Issue Type: Bug > Components: Groovysh >Affects Versions: 2.4.12 > Environment: Linux x86-64, > java version "1.8.0_144" > Java(TM) SE Runtime Environment (build 1.8.0_144-b01) > Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode) >Reporter: Øyvind Stegard > > Classes declared in a Groovysh session cannot be used properly later on. > This fails with error "unable to resolve class C": > {code:java} > class C { } > instance = new C() > {code} > However, this clunky workaround works: > {code:java} > class C { } > new C() > instance = _ > assert instance.getClass() == C.class > {code} > Groovysh session showing the issue: > {noformat} > groovysh -d > DEBUG [org.codehaus.groovy.tools.shell.BufferManager] Created new buffer with > index: 0 > DEBUG [org.codehaus.groovy.tools.shell.BufferManager] Buffers reset > DEBUG [org.codehaus.groovy.tools.shell.Parser] Using parser flavor: rigid > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: ? > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :help > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :quit > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :exit > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > import > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :display > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :clear > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :show > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :inspect > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :purge > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :edit > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: . > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :load > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :save > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :record > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :history > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :alias > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :set > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :register > DEBUG [org.codehaus.groovy.tools.shell.CommandRegistry] Registered command: > :doc > DEBUG [org.codehaus.groovy.tools.shell.InteractiveShellRunner] Using history > file: /home/oyvind/.groovy/groovysh.history > DEBUG [org.codehaus.groovy.tools.shell.Groovysh] Terminal > (jline.UnixTerminal@d737b89) > DEBUG [org.codehaus.groovy.tools.shell.Groovysh] Supported: true > DEBUG [org.codehaus.groovy.tools.shell.Groovysh] ECHO: (enabled: > false) > DEBUG [org.codehaus.groovy.tools.shell.Groovysh] H x W: 64 x 115 > DEBUG [org.codehaus.groovy.tools.shell.Groovysh] ANSI: true > Groovy Shell (2.4.12, JVM: 1.8.0_144) > Type ':help' or ':h' for help. > -- > DEBUG [org.codehaus.groovy.tools.shell.CommandsMultiCompleter] Added > completer[1] for command: :help > DEBUG [org.codehaus.groovy.tools.shell.CommandsMultiCompleter] Added > completer[2] for command: ? > DEBUG [org.codehaus.groovy.tools.shell.CommandsMultiCompleter] Added > completer[3] for command: :exit > DEBUG [org.codehaus.groovy.tools.shell.CommandsMultiCompleter] Added > completer[4] for command: :quit > DEBUG