Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-666

JDK 1.5 problem

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • None
    • 1.0-beta-9
    • None
    • Debian GNU/Linux Sarge, kernel 2.6.9, Sun JDK 1.5, groovy 1.0-beta-7

    Description

      The script:

      #! /usr/bin/env groovy

      expectedPrompts = [
      "Enter length of first side: ",
      "Enter length of second side: ",
      "Enter length of third side: "
      ]

      results in the following output when executed:

      Exception in thread "main" java.lang.ClassFormatError: Invalid index 1 in LocalVariableTable in class file testIt
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
      at groovy.lang.GroovyClassLoader.access$100(GroovyClassLoader.java:81)
      at groovy.lang.GroovyClassLoader$ClassCollector.onClassNode(GroovyClassLoader.java:505)
      at groovy.lang.GroovyClassLoader$ClassCollector.call(GroovyClassLoader.java:515)
      at org.codehaus.groovy.control.CompilationUnit$5.call(CompilationUnit.java:604)
      at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:844)
      at org.codehaus.groovy.control.CompilationUnit.classgen(CompilationUnit.java:540)
      at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:446)
      at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:244)
      at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:163)
      at groovy.lang.GroovyShell$2.run(GroovyShell.java:220)
      at java.security.AccessController.doPrivileged(Native Method)
      at groovy.lang.GroovyShell.run(GroovyShell.java:218)
      at groovy.lang.GroovyShell.run(GroovyShell.java:165)
      at groovy.ui.GroovyMain.processOnce(GroovyMain.java:385)
      at groovy.ui.GroovyMain.run(GroovyMain.java:251)
      at groovy.ui.GroovyMain.process(GroovyMain.java:234)
      at groovy.ui.GroovyMain.main(GroovyMain.java:136)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.codehaus.classworlds.Launcher.launchStandard(Launcher.java:410)
      at org.codehaus.classworlds.Launcher.launch(Launcher.java:344)
      at org.codehaus.classworlds.Launcher.main(Launcher.java:461)

      but if I add the line:

      expectedPrompts.each

      { println it }

      after the list declaration then the script works fine.


      Also the script:

      #! /usr/bin/env groovy

      "ant".execute()

      works fine but the script:

      #! /usr/bin/env groovy

      //expectedPrompts = [
      // "Enter length of first side: ",
      // "Enter length of second side: ",
      // "Enter length of third side: "
      // ]

      //outputIntroducers = [
      // "Perimeter is: ",
      // "Area is: "
      // ]

      //testTuples = [
      // ["0.0", "0.0", "0.0", "0.0", "0.0"],
      // ["0.0", "1.0", "1.0", "2.0", "0.0"],
      // ["1.0", "1.0", "2.0", "4.0", "0.0"],
      // ["1.0", "1.0", "1.0", "3.0", "0.433012"],
      // ["3.0", "4.0", "5.0", "12.0", "6.0"],
      // ["-1.0", "-1.0", "-1.0", "-", "-"],
      // ["1.0", "1.0", "3.0", "-", "-"],
      // ["1.0E1000", "1.0E1000", "1.0E1000", "Infinity", "NaN"]
      // ]

      // expectedPrompts.each { println it }

      antProcess = "ant".execute()

      // antProcess.in.eachLine

      { println it }

      results in:

      Exception in thread "main" java.lang.ClassFormatError: Invalid index 1 in LocalVariableTable in class file testIt
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
      at groovy.lang.GroovyClassLoader.access$100(GroovyClassLoader.java:81)
      at groovy.lang.GroovyClassLoader$ClassCollector.onClassNode(GroovyClassLoader.java:505)
      at groovy.lang.GroovyClassLoader$ClassCollector.call(GroovyClassLoader.java:515)
      at org.codehaus.groovy.control.CompilationUnit$5.call(CompilationUnit.java:604)
      at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:844)
      at org.codehaus.groovy.control.CompilationUnit.classgen(CompilationUnit.java:540)
      at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:446)
      at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:244)
      at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:163)
      at groovy.lang.GroovyShell$2.run(GroovyShell.java:220)
      at java.security.AccessController.doPrivileged(Native Method)
      at groovy.lang.GroovyShell.run(GroovyShell.java:218)
      at groovy.lang.GroovyShell.run(GroovyShell.java:165)
      at groovy.ui.GroovyMain.processOnce(GroovyMain.java:385)
      at groovy.ui.GroovyMain.run(GroovyMain.java:251)
      at groovy.ui.GroovyMain.process(GroovyMain.java:234)
      at groovy.ui.GroovyMain.main(GroovyMain.java:136)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.codehaus.classworlds.Launcher.launchStandard(Launcher.java:410)
      at org.codehaus.classworlds.Launcher.launch(Launcher.java:344)
      at org.codehaus.classworlds.Launcher.main(Launcher.java:461)

      Attachments

        Activity

          People

            russel Dr. Russel Winder
            russel Dr. Russel Winder
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: