Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
When executing the code:
#! /usr/bin/env groovy import groovy.sql.DataSet import groovy.sql.Sql @Grab ( 'org.xerial:sqlite-jdbc:3.7.2' ) @GrabConfig ( systemClassLoader = true ) def database final words = [ ] try { database = Sql.newInstance ( 'jdbc:sqlite:database.db' , 'org.sqlite.JDBC' ) final wordsTable = new DataSet ( database , 'words' ) ( 0 ..< 4 ).each { i -> words << wordsTable.findAll ( { j , item -> item.id == j }.curry ( i ) ).firstRow ( ).word } } finally { database?.close ( ) } println words.join ( '' )
the result is the error:
Caught: groovy.lang.GroovyRuntimeException: Could not find the ClassNode for MetaClass: groovy.lang.MetaClassImpl@6c1826dc[class org.codehaus.groovy.runtime.CurriedClosure]
groovy.lang.GroovyRuntimeException: Could not find the ClassNode for MetaClass: groovy.lang.MetaClassImpl@6c1826dc[class org.codehaus.groovy.runtime.CurriedClosure]
which doesn't really tell the programmer anything useful about the executed code they wrote.
Issue Links
- relates to
-
GROOVY-5377
CLONE - Incomprehensible Error Message Passing Partial Evaluated Lambda Function (improved error message for normal closure not on classpath case)
-
Activity
Paul King
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Link |
This issue relates to |
The exception means it could not find a source file which is needed, because findAll works on the source level and for that the source needs to be re-evaluated. Now here it is Closure on which curry was used. I think DataSet#findAll might be able to support this. It is not so easy to do, but possible.
So this issue contains again of two things
(i) a RFE to support CurriedClosure
(ii) a bug report for a better error message. In this case it should then check for CurriedClosure and tell it is not supported, instead of that cryptic message, which also does sound wrong. It should say at least something like "Could not find ClassNode for Class CurriedClosure" and leave MetaClass out of this.