querydsl / codegen

Java/Scala Code generation tool
Apache License 2.0
23 stars 22 forks source link

Fix AbstractEvaluatorFactory.toId() not taking into account constants' types #9

Closed mcuelenaere closed 11 years ago

mcuelenaere commented 11 years ago

AbstractEvaluatorFactory ignored the types of constants when generating a classname. As these generated classes get cached, this could result in stack traces like these:

java.lang.IllegalArgumentException: Can not set com.mysema.codegen.ComplexEvaluationTest$SuperCat field Q_0606084786_65821278_65821278.a1 to com.mysema.codegen.support.Cat
    at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:164)
    at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:168)
    at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81)
    at java.lang.reflect.Field.set(Field.java:680)
    at com.mysema.codegen.AbstractEvaluatorFactory.createEvaluator(AbstractEvaluatorFactory.java:86)
timowest commented 11 years ago

Thanks for the patch!