groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MG <mg...@arscreat.com>
Subject @CompileStatic - Groovyc: Expected parameter of type java.lang.Object but got java.lang.Class
Date Fri, 15 Dec 2017 01:57:36 GMT
I got a strange @CompileStatic build error today, of which i am not sure 
whether it is expected behavior with a confusing error message, or an 
error in Groovy, so I post it here for comments before creating a ticket:

@CompileStatic*
class *GroovyReflection {
*  /**
*    throws:*
*    Error:(20, 104) Groovyc: Expected parameter of type 
java.lang.Object but got java.lang.Class*
*    Error:(20, 119) Groovyc: [Static type checking] - Cannot find 
matching method 
at.gv.bmlv.groovyutil.reflection.GroovyReflectionClass#createFromClass(java.lang.Object).
     Please check if the declared type is right and if the method exists.*
*  */*
*  final *Map<Class, GroovyReflectionClass> *classToReflectionClassMap 
*= [:].withDefault { *
     final *Class clazz -> GroovyReflectionClass./createFromClass/(clazz)
   }

*  // works*
*  final *Map<Class, GroovyReflectionClass> *classToReflectionClassMap 
*= ([:] *as *Map<Class, GroovyReflectionClass>).withDefault {
***final *Class clazz -> GroovyReflectionClass./createFromClass/(clazz)
   }
}

Cheers,
mg





Mime
View raw message