Grails: “General error during class generation: java.lang.reflect. MalformedParameterizedTypeException”

Use case

Grails: “General error during class generation: java.lang.reflect. MalformedParameterizedTypeException”

Cripes.. how many hours this took me to find the issues behind this error message.
So now that I figured it out I’d better share this to others for less waste of time.

Incident

This is the most important part of the stacktrace I got:

[groovyc] java.lang.reflect.MalformedParameterizedTypeException  
[groovyc]     at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.validateConstructorArguments(ParameterizedTypeImpl.java:42)  
[groovyc]     at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.<init>(ParameterizedTypeImpl.java:35)  
[groovyc]     at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.make(ParameterizedTypeImpl.java:77)  
[groovyc]     at sun.reflect.generics.factory.CoreReflectionFactory.makeParameterizedType(CoreReflectionFactory.java:86)  
[groovyc]     at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:122)  
[groovyc]     at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:31)  
[groovyc]     at sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java:50)  
[groovyc]     at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:120)  
[groovyc]     at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:31)  
[groovyc]     at sun.reflect.generics.repository.FieldRepository.getGenericType(FieldRepository.java:67)  
[groovyc]     at java.lang.reflect.Field.getGenericType(Field.java:223)

That’s all. The error might occure somewhere somehow somewhen, there are no further information provided.

Solution

So the first step I did is trying to figure out where exactly the error occures.

There are two choices to enable the verbose compile mode. Either you set the property grailsSettings.verboseCompile to true, or you do it manually inside the groovy script. In the latter case you have to find the _GrailsCompile.groovy file (/my/installation/path/grails/scripts/_GrailsCompile.groovy) and search for the target “compile”, inside the profile action you might set the property grailsSettings.verboseCompile to true.

Now that the groovyc process displays more information during compiling we get at least a specific class listed in which the error occures. Been there, done that. But still I could not find any hint or any compiler error my IDE might have complained.. But after I looked a bit deeper into the class I found some kind of weired variable declaration:

List<List<String,String> matrices

Well, there are no key-value-pairs a list comes along with. This was the error.

Side note

But the main question I ask myself is why the hell the groovyc output did not tell me what exactly was wrong, no clue, no hint, nothin’.

 

Tagged with: , ,
Posted in Grails, Groovy, Java, Linux
One comment on “Grails: “General error during class generation: java.lang.reflect. MalformedParameterizedTypeException”
  1. This is awesome full blog I like this sort blog. Your work is truly awesome and excessively valuable. I delighted in going to your site. You have made a really great Showing with regards to. Visit my website and get quality service at least cost.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Anti-spam protection

Prove that you are Human by typing the emphasized characters:


Protected by Gab Captcha 2

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>