Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
3.0.6
-
None
Description
This appears to be distinct from GROOVY-9798 though appearing in similar circumstances.
When using static compilation (only; @TypeChecked works fine), using a method reference as a parameter expecting a Function results in a compiler error:
Error occurred while calling a method on a Groovy class from classpath.: InvocationTargetException: BUG! exception in phase 'class generation' in source unit '/home/christopher/gnomes/src/main/groovy/com/example/gnomes/GnomeController.groovy' ClassNode#getTypeClass for com.example.gnomes.Gnome called before the type class is set
This error occurs both when using static GnomeDto from(Gnome g) as GnomeDto::from (correctly marked as a static reference in Eclipse, in case relevant) and when using GnomeDto toDto() as Gnome::toDto. In both cases explicitly adding as Function to the method reference resolves the problem.