Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Generics cause codegen to fail #522
I have a project that I'm trying to use querydsl with and it is failing to generate code for some classes in the hierarchy. I have tracked down the issue to a specific situation that is not dealt with correctly and have created a small project that demonstrates the issue (but I don't know how to attach the project to this issue).
Basically the problem occurs when you have a class hierarchy like this:
The problem occurs when copying properties from the superclass to the subclass, specifically in this method:
When copying the t property to GenericBaseSubclass a newType is returned. The type passed in is a TypeExtends, the newType is a SimpleType. However, the "if (!newType.equals(type))" is false (I guess because the two types are for the same class, AnotherClass) and therefore the copied property has a TypeExtends as it's type.
The code then moves onto copying properties from GenericBaseSubclass to Subclass. When trying to copying the t property the code tries to resolve the newType again but this time it fails. The reason is that it things the TypeExtends should have a generic parameter on the class GenericBaseSubclass but it doesn't. What should have happened is that the SimpleType should have been used when the property was copied and then everything would have worked correctly (at least that is my analysis).
I tried to fork the querydsl source and test my fix but I haven't been able to get the project to build using maven, so I'll have to leave it with you to fix and provide a new version.