groovy
  1. groovy
  2. GROOVY-4220

Groovy-all-jdk14-1.6.8 fails on Java 1.4 (java/util/concurrent/locks/AbstractQueuedSynchronizer)

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.6.7, 1.6.8
    • Fix Version/s: 1.6.9
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      groovy-all-jdk14-1.6.8.jar fails on Java 1.4.

      The following Java code shows the problem:

      GroovyClassLoader loader = new GroovyClassLoader();
      loader.parseClass("");
      

      This produces the following stack trace:

      java.lang.NoClassDefFoundError: java/util/concurrent/locks/AbstractQueuedSynchronizer
      	at java.lang.ClassLoader.defineClass0(Native Method)
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
      	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
      	at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
      	at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
      	at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
      	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
      	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
      	at java.lang.ClassLoader.defineClass0(Native Method)
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
      	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
      	at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
      	at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
      	at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
      	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
      	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
      	at groovyjarjarbackport.java.util.concurrent.ConcurrentHashMap.<init>(ConcurrentHashMap.java:602)
      	at groovyjarjarbackport.java.util.concurrent.ConcurrentHashMap.<init>(ConcurrentHashMap.java:653)
      	at groovyjarjarretroruntime.impl.WeakIdentityTable.<init>(WeakIdentityTable.java:42)
      	at groovyjarjarretroruntime.java.lang.Enum_$1.<init>(Enum_.java:49)
      	at groovyjarjarretroruntime.java.lang.Enum_.<clinit>(Enum_.java:47)
      	at org.codehaus.groovy.transform.ASTTransformationVisitor.addPhaseOperations(ASTTransformationVisitor.java:160)
      	at org.codehaus.groovy.control.CompilationUnit.<init>(CompilationUnit.java:180)
      	at org.codehaus.groovy.control.CompilationUnit.<init>(CompilationUnit.java:117)
      	at groovy.lang.GroovyClassLoader.createCompilationUnit(GroovyClassLoader.java:444)
      	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:267)
      	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:250)
      	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:245)
      	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:206)
      	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:216)
      

        Activity

        Hide
        Paul King added a comment -

        This is kind of a known issue which I thought we had fixed in the early days of 1.6:
        http://groovy.markmail.org/thread/vx3xetircpvcgu2z
        Maybe there has been a regression or the change was never actually checked in - it surprises me though as the Retro test suite passes fine.

        Show
        Paul King added a comment - This is kind of a known issue which I thought we had fixed in the early days of 1.6: http://groovy.markmail.org/thread/vx3xetircpvcgu2z Maybe there has been a regression or the change was never actually checked in - it surprises me though as the Retro test suite passes fine.
        Hide
        SebbASF added a comment -

        Perhaps you can add that code to the test suite?

        Show
        SebbASF added a comment - Perhaps you can add that code to the test suite?
        Hide
        Paul King added a comment -

        I bumped the version of retrotranslator from 1.2.7 -> 1.2.9 and the problem goes away for me. It would be great if you could also verify you have no problems with the version of groovy produced by one of the CI builds.

        Show
        Paul King added a comment - I bumped the version of retrotranslator from 1.2.7 -> 1.2.9 and the problem goes away for me. It would be great if you could also verify you have no problems with the version of groovy produced by one of the CI builds.
        Hide
        Paul King added a comment -

        And there is now also a jar in the snapshots repo you can check against too:
        http://snapshots.repository.codehaus.org/org/codehaus/groovy/groovy-all-jdk14/1.6.9-SNAPSHOT/

        Show
        Paul King added a comment - And there is now also a jar in the snapshots repo you can check against too: http://snapshots.repository.codehaus.org/org/codehaus/groovy/groovy-all-jdk14/1.6.9-SNAPSHOT/
        Hide
        SebbASF added a comment -

        Just tried using groovy-all-jdk14-1.6.9-20100527.234947-1.jar (MD5 396825d192142c7b5429cefe52614896) using the code snippet posted originally, and I still get the same error:

        java.lang.NoClassDefFoundError: java/util/concurrent/locks/AbstractQueuedSynchronizer
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
        at groovyjarjarbackport.java.util.concurrent.ConcurrentHashMap.<init>(ConcurrentHashMap.java:602)
        at groovyjarjarbackport.java.util.concurrent.ConcurrentHashMap.<init>(ConcurrentHashMap.java:653)
        at groovyjarjarretroruntime.impl.WeakIdentityTable.<init>(WeakIdentityTable.java:42)
        at groovyjarjarretroruntime.java.lang.Enum_$1.<init>(Enum_.java:49)
        at groovyjarjarretroruntime.java.lang.Enum_.<clinit>(Enum_.java:47)
        at org.codehaus.groovy.transform.ASTTransformationVisitor.addPhaseOperations(ASTTransformationVisitor.java:160)
        at org.codehaus.groovy.control.CompilationUnit.<init>(CompilationUnit.java:180)
        at org.codehaus.groovy.control.CompilationUnit.<init>(CompilationUnit.java:117)
        at groovy.lang.GroovyClassLoader.createCompilationUnit(GroovyClassLoader.java:444)
        at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:267)
        at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:250)
        at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:245)
        at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:206)
        at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:216)
        at Groovy.main(Groovy.java:4)
        Exception in thread "main"

        Show
        SebbASF added a comment - Just tried using groovy-all-jdk14-1.6.9-20100527.234947-1.jar (MD5 396825d192142c7b5429cefe52614896) using the code snippet posted originally, and I still get the same error: java.lang.NoClassDefFoundError: java/util/concurrent/locks/AbstractQueuedSynchronizer at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at groovyjarjarbackport.java.util.concurrent.ConcurrentHashMap.<init>(ConcurrentHashMap.java:602) at groovyjarjarbackport.java.util.concurrent.ConcurrentHashMap.<init>(ConcurrentHashMap.java:653) at groovyjarjarretroruntime.impl.WeakIdentityTable.<init>(WeakIdentityTable.java:42) at groovyjarjarretroruntime.java.lang.Enum_$1.<init>(Enum_.java:49) at groovyjarjarretroruntime.java.lang.Enum_.<clinit>(Enum_.java:47) at org.codehaus.groovy.transform.ASTTransformationVisitor.addPhaseOperations(ASTTransformationVisitor.java:160) at org.codehaus.groovy.control.CompilationUnit.<init>(CompilationUnit.java:180) at org.codehaus.groovy.control.CompilationUnit.<init>(CompilationUnit.java:117) at groovy.lang.GroovyClassLoader.createCompilationUnit(GroovyClassLoader.java:444) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:267) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:250) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:245) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:206) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:216) at Groovy.main(Groovy.java:4) Exception in thread "main"
        Hide
        Paul King added a comment - - edited

        How did you do your test?

        Might be useful if you try this:
        java -cp groovy-all-jdk14-1.6.9-20100527.234947-1.jar groovy.ui.Console

        Then cut and paste above lines into console, then run the script.

        Show
        Paul King added a comment - - edited How did you do your test? Might be useful if you try this: java -cp groovy-all-jdk14-1.6.9-20100527.234947-1.jar groovy.ui.Console Then cut and paste above lines into console, then run the script.
        Hide
        SebbASF added a comment -

        === Groovy.java ===
        public class Groovy {
        public static void main(String[] args)

        { groovy.lang.GroovyClassLoader loader = new groovy.lang.GroovyClassLoader(); loader.parseClass(""); }

        }

        set CLASSPATH=groovy-all-jdk14-1.6.9-20100527.234947-1.jar;.

        javac Groovy.java

        java Groovy

        Using:
        java version "1.4.2_19"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_19-b04)
        Java HotSpot(TM) Client VM (build 1.4.2_19-b04, mixed mode)

        Show
        SebbASF added a comment - === Groovy.java === public class Groovy { public static void main(String[] args) { groovy.lang.GroovyClassLoader loader = new groovy.lang.GroovyClassLoader(); loader.parseClass(""); } } set CLASSPATH=groovy-all-jdk14-1.6.9-20100527.234947-1.jar;. javac Groovy.java java Groovy Using: java version "1.4.2_19" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_19-b04) Java HotSpot(TM) Client VM (build 1.4.2_19-b04, mixed mode)
        Hide
        SebbASF added a comment -

        Also:

        > java -cp groovy-all-jdk14-1.6.9-20100527.234947-1.jar groovy.ui.Console
        Exception in thread "main" java.lang.NoClassDefFoundError: java/util/concurrent/locks/AbstractQueuedSynchronizer
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
        at groovyjarjarbackport.java.util.concurrent.ConcurrentHashMap.<init>(ConcurrentHashMap.java:602)
        at groovyjarjarbackport.java.util.concurrent.ConcurrentHashMap.<init>(ConcurrentHashMap.java:653)
        at org.codehaus.groovy.runtime.GroovyCategorySupport$MyThreadLocal.<init>(GroovyCategorySupport.java:235)
        at org.codehaus.groovy.runtime.GroovyCategorySupport$MyThreadLocal.<init>(GroovyCategorySupport.java:233)
        at org.codehaus.groovy.runtime.GroovyCategorySupport.<clinit>(GroovyCategorySupport.java:150)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.<init>(AbstractCallSite.java:46)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.<init>(CallSiteArray.java:35)
        at groovy.ui.Console.$createCallSiteArray(Console.groovy)
        at groovy.ui.Console.$getCallSiteArray(Console.groovy)
        at groovy.ui.Console.<clinit>(Console.groovy:69)

        Show
        SebbASF added a comment - Also: > java -cp groovy-all-jdk14-1.6.9-20100527.234947-1.jar groovy.ui.Console Exception in thread "main" java.lang.NoClassDefFoundError: java/util/concurrent/locks/AbstractQueuedSynchronizer at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:539) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123) at java.net.URLClassLoader.defineClass(URLClassLoader.java:251) at java.net.URLClassLoader.access$100(URLClassLoader.java:55) at java.net.URLClassLoader$1.run(URLClassLoader.java:194) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:187) at java.lang.ClassLoader.loadClass(ClassLoader.java:289) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274) at java.lang.ClassLoader.loadClass(ClassLoader.java:235) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at groovyjarjarbackport.java.util.concurrent.ConcurrentHashMap.<init>(ConcurrentHashMap.java:602) at groovyjarjarbackport.java.util.concurrent.ConcurrentHashMap.<init>(ConcurrentHashMap.java:653) at org.codehaus.groovy.runtime.GroovyCategorySupport$MyThreadLocal.<init>(GroovyCategorySupport.java:235) at org.codehaus.groovy.runtime.GroovyCategorySupport$MyThreadLocal.<init>(GroovyCategorySupport.java:233) at org.codehaus.groovy.runtime.GroovyCategorySupport.<clinit>(GroovyCategorySupport.java:150) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.<init>(AbstractCallSite.java:46) at org.codehaus.groovy.runtime.callsite.CallSiteArray.<init>(CallSiteArray.java:35) at groovy.ui.Console.$createCallSiteArray(Console.groovy) at groovy.ui.Console.$getCallSiteArray(Console.groovy) at groovy.ui.Console.<clinit>(Console.groovy:69)
        Hide
        SebbASF added a comment -

        Note that not all of the class files in the jar have been updated recently.

        In particular, groovyjarjarbackport.java.util.concurrent.ConcurrentHashMap is dated 2007-06-14.
        Only groovyjarjarbackport.java.util.concurrent.locks.ReentrantLock is dated 2010-05-28 - all the other classes in groovyjarbackport are dated 2007-06-14.
        Looks like the build may have failed to apply retroweaver to all the relevant classes in the jar.

        Show
        SebbASF added a comment - Note that not all of the class files in the jar have been updated recently. In particular, groovyjarjarbackport.java.util.concurrent.ConcurrentHashMap is dated 2007-06-14. Only groovyjarjarbackport.java.util.concurrent.locks.ReentrantLock is dated 2010-05-28 - all the other classes in groovyjarbackport are dated 2007-06-14. Looks like the build may have failed to apply retroweaver to all the relevant classes in the jar.
        Hide
        Paul King added a comment -

        ok, will look into it further ...

        Show
        Paul King added a comment - ok, will look into it further ...
        Show
        Paul King added a comment - How about this version - Roshan applied another fix: http://snapshots.repository.codehaus.org/org/codehaus/groovy/groovy-all-jdk14/1.6.9-SNAPSHOT/groovy-all-jdk14-1.6.9-20100615.074507-2.jar
        Hide
        Guillaume Laforge added a comment -

        SebbASF, as soon as you give us your feedback that everything's okay now, we should be able to make a release for 1.6.9.
        Thanks in advance for your feedback.

        Also, please notice going forward, it may be the last version of the 1.6.x branch, so also the last version of Groovy being compatible with JDK 1.4.
        So if you can consider moving to a newer JDK, that would be a good thing – JDK 1.5 is even already End-of-life'd!

        Show
        Guillaume Laforge added a comment - SebbASF, as soon as you give us your feedback that everything's okay now, we should be able to make a release for 1.6.9. Thanks in advance for your feedback. Also, please notice going forward, it may be the last version of the 1.6.x branch, so also the last version of Groovy being compatible with JDK 1.4. So if you can consider moving to a newer JDK, that would be a good thing – JDK 1.5 is even already End-of-life'd!
        Hide
        SebbASF added a comment -

        java -cp groovy-all-jdk14-1.6.9-20100615.074507-2.jar groovy.ui.Console

        works on

        java -version
        java version "1.4.2_19"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_19-b04)
        Java HotSpot(TM) Client VM (build 1.4.2_19-b04, mixed mode)

        So I think you have fixed the problem - thanks!

        Show
        SebbASF added a comment - java -cp groovy-all-jdk14-1.6.9-20100615.074507-2.jar groovy.ui.Console works on java -version java version "1.4.2_19" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_19-b04) Java HotSpot(TM) Client VM (build 1.4.2_19-b04, mixed mode) So I think you have fixed the problem - thanks!
        Hide
        Guillaume Laforge added a comment -

        Great news, SebbASF, thank you for your feedback and testing this snapshot.
        Now, time to find a suitable date for the release.

        Show
        Guillaume Laforge added a comment - Great news, SebbASF, thank you for your feedback and testing this snapshot. Now, time to find a suitable date for the release.

          People

          • Assignee:
            Paul King
            Reporter:
            SebbASF
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: