groovy
  1. groovy
  2. GROOVY-5163

IncompatibleClassChangeError when running groovysh

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.4
    • Fix Version/s: 1.8.6, 2.0-beta-3
    • Component/s: Groovysh
    • Labels:
      None
    • Environment:
      Mac Java 6
    • Number of attachments :
      0

      Description

      Wondering if this bug is new in Groovy 1.8.4; it seems it work better in 1.8.2.

      The problem is that groovysh is throwing IncompatibleClassChangeError in a few cases:
      import com.not.Found // import that doesn't resolve to class
      show // command doesn't run at all
      purge // command doesn't run at all

      Groovy 1.8.4 appears to be working well, otherwise.

      Please let me know if you need further info. It seems reproducible, here.

      Thanks!
      John

        Activity

        Hide
        Serge Sozonoff added a comment -

        Hi,

        I would just like to confirm that I am seeing the same.

        1.8.2 seems to work.

        Thanks,
        Serge

        Show
        Serge Sozonoff added a comment - Hi, I would just like to confirm that I am seeing the same. 1.8.2 seems to work. Thanks, Serge
        Hide
        John Wagenleitner added a comment -

        I think this is related to GROOVY-4838. Jdk 7 added a protected constructor to the Exception class. For Groovy 1.8.4, it works for me if I use jdk7 to run groovysh but I get the IncompatibleClassChangeError if I run with jdk6.

        ~/java/groovy-1.8.4$ bin/groovysh 
        Groovy Shell (1.8.4, JVM: 1.7.0_02)
        Type 'help' or '\h' for help.
        -----------------------------------------------------------------------------------------------------------------------
        groovy:000> import com.not.Found
        ERROR org.codehaus.groovy.tools.shell.CommandException:
        Invalid import definition: 'import com.not.Found'; reason: startup failed:
        script1326865167473423932601.groovy: 1: unable to resolve class com.not.Found
         @ line 1, column 1.
           import com.not.Found
           ^
        
        1 error
        
                at java_lang_Runnable$run.call (Unknown Source)
        groovy:000> 
        

        My guess this is happening because org.codehaus.groovy.tools.shell.CommandException is a Groovy class and v1.8.4 was compiled with jdk7.

        If I build from source using jdk7, then I get the IncompatibleClassChangeError when running groovysh with jdk6. Same occurs when building using jdk6 and running with jdk7.

        Show
        John Wagenleitner added a comment - I think this is related to GROOVY-4838 . Jdk 7 added a protected constructor to the Exception class. For Groovy 1.8.4, it works for me if I use jdk7 to run groovysh but I get the IncompatibleClassChangeError if I run with jdk6. ~/java/groovy-1.8.4$ bin/groovysh Groovy Shell (1.8.4, JVM: 1.7.0_02) Type 'help' or '\h' for help. ----------------------------------------------------------------------------------------------------------------------- groovy:000> import com.not.Found ERROR org.codehaus.groovy.tools.shell.CommandException: Invalid import definition: ' import com.not.Found'; reason: startup failed: script1326865167473423932601.groovy: 1: unable to resolve class com.not.Found @ line 1, column 1. import com.not.Found ^ 1 error at java_lang_Runnable$run.call (Unknown Source) groovy:000> My guess this is happening because org.codehaus.groovy.tools.shell.CommandException is a Groovy class and v1.8.4 was compiled with jdk7. If I build from source using jdk7, then I get the IncompatibleClassChangeError when running groovysh with jdk6. Same occurs when building using jdk6 and running with jdk7.
        Hide
        John Wagenleitner added a comment -

        I have added a github pull request for this issue, https://github.com/groovy/groovy-core/pull/16.

        Show
        John Wagenleitner added a comment - I have added a github pull request for this issue, https://github.com/groovy/groovy-core/pull/16 .

          People

          • Assignee:
            CÚdric Champeau
            Reporter:
            John Bito
          • Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: