Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.0-beta-4
-
None
-
None
-
CVS head, as of Sun, Mar 14, 5pm, CST
Description
The workaround for this bug is that if you are using packages, it looks like you have to put all of you classes in one file and you have to import all of the classes you're defining as well.
This program does not compile unless you comment out the import statement:
package bob
//import bob.a
class a {duh() {println "duh"}}
class b extends a {}
new b().duh()
If you uncomment the line and then try to compile this other program (setting up the class path, etc), it fails with interesting fireworks:
package bob
class c extends bob.a{}
new c().duh()
Here are the stack traces for the respective failures (using groovyc):
==== First program ====
Mar 14, 2004 5:55:21 PM org.codehaus.groovy.ast.ClassNode findClassNode
WARNING: Cannot find class: a due to: java.lang.ClassNotFoundException: a
Mar 14, 2004 5:55:21 PM org.codehaus.groovy.ast.ClassNode findClassNode
WARNING: Cannot find class: a due to: java.lang.ClassNotFoundException: a
Mar 14, 2004 5:55:21 PM org.codehaus.groovy.ast.ClassNode findClassNode
WARNING: Cannot find class: a due to: java.lang.ClassNotFoundException: a
Mar 14, 2004 5:55:21 PM org.codehaus.groovy.ast.ClassNode findClassNode
WARNING: Cannot find class: a due to: java.lang.ClassNotFoundException: a
Mar 14, 2004 5:55:21 PM org.codehaus.groovy.ast.ClassNode findClassNode
WARNING: Cannot find class: a due to: java.lang.ClassNotFoundException: a
Mar 14, 2004 5:55:21 PM org.codehaus.groovy.ast.ClassNode findClassNode
WARNING: Cannot find class: a due to: java.lang.ClassNotFoundException: a
Mar 14, 2004 5:55:21 PM org.codehaus.groovy.ast.ClassNode findClassNode
WARNING: Cannot find class: a due to: java.lang.ClassNotFoundException: a
Mar 14, 2004 5:55:21 PM org.codehaus.groovy.ast.ClassNode findClassNode
WARNING: Cannot find class: a due to: java.lang.ClassNotFoundException: a
Mar 14, 2004 5:55:21 PM org.codehaus.groovy.ast.ClassNode findClassNode
WARNING: Cannot find class: a due to: java.lang.ClassNotFoundException: a
Mar 14, 2004 5:55:21 PM org.codehaus.groovy.ast.ClassNode findClassNode
WARNING: Cannot find class: a due to: java.lang.ClassNotFoundException: a
Mar 14, 2004 5:55:21 PM org.codehaus.groovy.ast.ClassNode findClassNode
WARNING: Cannot find class: a due to: java.lang.ClassNotFoundException: a
Mar 14, 2004 5:55:21 PM org.codehaus.groovy.ast.ClassNode findClassNode
WARNING: Cannot find class: a due to: java.lang.ClassNotFoundException: a
Mar 14, 2004 5:55:21 PM org.codehaus.groovy.ast.ClassNode findClassNode
WARNING: Cannot find class: a due to: java.lang.ClassNotFoundException: a
Mar 14, 2004 5:55:21 PM org.codehaus.groovy.ast.ClassNode findClassNode
WARNING: Cannot find class: a due to: java.lang.ClassNotFoundException: a
Mar 14, 2004 5:55:21 PM org.codehaus.groovy.ast.ClassNode findClassNode
WARNING: Cannot find class: a due to: java.lang.ClassNotFoundException: a
Mar 14, 2004 5:55:22 PM org.codehaus.groovy.ast.ClassNode findClassNode
WARNING: Cannot find class: a due to: java.lang.ClassNotFoundException: a
==== Second program (after uncommenting line) ====
>>> a serious error occurred: groovy/lang/GroovyObject
>>> stacktrace:
java.lang.NoClassDefFoundError: groovy/lang/GroovyObject
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
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:282)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at org.codehaus.groovy.ast.CompileUnit.loadClass(CompileUnit.java:114)
at org.codehaus.groovy.ast.ClassNode.findClassNode(ClassNode.java:446)
at org.codehaus.groovy.ast.ClassNode.getSuperClassNode(ClassNode.java:427)
at org.codehaus.groovy.ast.ClassNode.implementsInteface(ClassNode.java:401)
at org.codehaus.groovy.ast.ClassNode.isDerivedFromGroovyObject(ClassNode.java:388)
at org.codehaus.groovy.classgen.Verifier.visitClass(Verifier.java:111)
at org.codehaus.groovy.tools.Compiler.generateClasses(Compiler.java:333)
at org.codehaus.groovy.tools.Compiler.compile(Compiler.java:250)
at org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:107)
at org.codehaus.groovy.tools.FileSystemCompiler.compile(FileSystemCompiler.java:97)
at org.codehaus.groovy.tools.FileSystemCompiler.main(FileSystemCompiler.java:227)
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:324)
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)