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

groovyc ant task generates invalid class name with IBM jdk and some build.xml paths

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6.3
    • 1.6.4, 1.7-beta-1
    • Ant integration
    • Intel/PPC Linux, IBM JDK any recent version, groovy >= 1.6.0, ant >= 1.7.0

    Description

      The way the groovyc ant task generates a class name for embedded Groovy from the path of the build.xml file causes errors to be reported when running with IBM's JDK when the path name follows a certain pattern. Here's a specific recipe for reproducing the problem.

      Environment:

      JAVA_HOME=.../ibm-java-i386-60
      ANT_HOME=.../apache-ant-1.7.1
      GROOVY_HOME=.../groovy-1.6.3
      

      Put this build.xml in /tmp/a-1.1/build.xml:

      <project>
       <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy"/>
       <groovy>println 'hello'</groovy>
       <target name="all"/>
      </project>
      

      Run

      $ANT_HOME/bin/ant -lib $GROOVY_HOME/embeddable/groovy-all-1.6.3.jar
      

      This is the output:

      Buildfile: build.xml
      
      BUILD FAILED
      java.lang.ClassFormatError: JVMCFRE068 class name is invalid; class=embedded_script_in__tmp_a_1/1_build, offset=0
      	at java.lang.ClassLoader.defineClassImpl(Native Method)
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:265)
      	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:69)
      	at groovy.lang.GroovyClassLoader.access$200(GroovyClassLoader.java:54)
      	at groovy.lang.GroovyClassLoader$ClassCollector.createClass(GroovyClassLoader.java:468)
      	at groovy.lang.GroovyClassLoader$ClassCollector.onClassNode(GroovyClassLoader.java:485)
      	at groovy.lang.GroovyClassLoader$ClassCollector.call(GroovyClassLoader.java:489)
      	at org.codehaus.groovy.control.CompilationUnit$10.call(CompilationUnit.java:727)
      	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:924)
      	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:462)
      	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:278)
      	at groovy.lang.GroovyShell.parseClass(GroovyShell.java:590)
      	at groovy.lang.GroovyShell.parse(GroovyShell.java:602)
      	at groovy.lang.GroovyShell.parse(GroovyShell.java:582)
      	at groovy.lang.GroovyShell.parse(GroovyShell.java:629)
      	at org.codehaus.groovy.ant.Groovy.parseAndRunScript(Groovy.java:413)
      	at org.codehaus.groovy.ant.Groovy.execGroovy(Groovy.java:404)
      	at org.codehaus.groovy.ant.Groovy.execute(Groovy.java:279)
      	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
      	at java.lang.reflect.Method.invoke(Method.java:599)
      	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
      	at org.apache.tools.ant.Task.perform(Task.java:348)
      	at org.apache.tools.ant.Target.execute(Target.java:357)
      	at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:142)
      	at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:93)
      	at org.apache.tools.ant.Main.runBuild(Main.java:743)
      	at org.apache.tools.ant.Main.startAnt(Main.java:217)
      	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
      	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
      
      Total time: 1 second
      

      Observe the class name "embedded_script_in__tmp_a_1/1_build", which contains a / where the . used to be. IBM's JDK doesn't like this, and I have a feeling it's probably right, though I haven't checked the spec.

      I observed this in an environment that was using groovy 1.6.0, ant 1.7.0, and version 1.5.0 of IBM's JDK, but I reproduced it with the latest version of each package.

      Attachments

        Activity

          People

            paulk Paul King
            ejb@ql.org Jay Berkenbilt
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: