持つ:
class Task {
Integer code
String name
}
def classDefinition = """
package untitled24
class TasksCommand {
List tasks = [].withDefault { new Task() }
}
TasksCommand
"""
def shell = new GroovyShell(this.class.classLoader)
Class<?> definedClass = shell.evaluate(classDefinition)
実行結果は次のとおりです。
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script1.groovy: 5: unable to resolve class Task
@ line 5, column 47.
List tasks = [].withDefault { new Task()
^
何か案が?(groovy バージョンは 1.8.8)