Groovy Dataset Issue
cebmailbox-trijug-/[email protected]
| Newsgroups | gmane.org.user-groups.trijug.juglist |
|---|---|
| Message-ID | <[email protected]> |
Does anyone else have problem using the findAll method on a Groovy DataSet from within the groovyConsole?
Eg: (from GINA page: 342)
Everything works up to this point:
youngsters = athleteSet.findAll { it.dateOfBirth > '1970-1-1' }
youngsters.each { println it.firstname }
Gives:
Exception thrown: groovy.lang.GroovyRuntimeException: Could not find the ClassNode for MetaClass: org.codehaus.groovy.runtime.metaclass.ClosureMetaClass@1f9eba0[class Script13$_run_closure6]
I've traced the problem to a method on the DataSet class:
private void visit(Closure closure, CodeVisitorSupport visitor) {
if (closure != null) {
ClassNode classNode = closure.getMetaClass().getClassNode();
if (classNode == null) {
throw new GroovyRuntimeException(
"Could not find the ClassNode for MetaClass: " + closure.getMetaClass());
}
List methods = classNode.getDeclaredMethods("doCall");
if (!methods.isEmpty()) {
MethodNode method = (MethodNode) methods.get(0);
if (method != null) {
Statement statement = method.getCode();
if (statement != null) {
statement.visit(visitor);
}
}
}
}
}
That's where I get stuck. Is it that it cannot find a class node for the closure that is my script running in the groovyConsole?
(BTW, it all works when I formally create a class, compile it, and call it from another class...like normal Java.)
_______________________________________________
Juglist mailing list
[email protected]
http://trijug.org/mailman/listinfo/juglist_trijug.org