Hi,So I've finally solved the dilemma with Parameterized types being erased, and I think I've also inadvertently solved your general issue with resolving default constructors.
Basically, I depend on the scalap.jar, which is easy enough to add to a sbt Project definition, and I retrofited some of the command-line tools to be more usable in an in-app context, to return a "ClassSignature" case class instead of printing to System.out.
..the latter one was a pre-existing combinator-parser, the first one the new I created for this purpose.
I just finished this, so the code might still need a bit of cleaning up and prettifying, but for now, it seems to work and might give you an idea of how to solve some of your headaches.
Regards
Wille Faler
Let me know if/when you find a solution, I'm interested !
2011/4/10 Wille Faler
<wille...@gmail.com>
Thanks for all the input Paul, I might have found a solution that is workable, though at the cost of making scalap.jar a dependency of any project that wants to use this.
Basically, I looked at the Main.scala for the scalap.jar and tried to extract and slightly change the code where needed. I've got a rough gist of it here:
This is just a spike to see that it works, so might still be fragile, but from what I can see, it should work as a workaround - just get the signature, parse the resulting String and work out the generic types.
Not sure if this comes with a performance penalty, but time will tell..
Wille Faler
2011/4/10 Paul Phillips
<pa...@improving.org>
On 4/9/11 6:56 PM, Maxime Lévesque wrote:
Recently someone contributed a patch to "guess" the type inside the
Option, so the user only has to declare :
class Student(val name: String, val lastName: String, val age:
Option[Int], val gender: Int, val addressId: Option[Int])
Oh yeah, I just remembered that's how this works.
https://github.com/paulp/optional
Anyway, you guys don't need to convince me that this sucks. What you need to do is solve the problem better. I'm not a magician, and if it's a choice between eclipse working and reflection conveniences working, eclipse is going to win. I simply cannot table every other facet of the distribution to dive into this issue again. You guys are enthusiastically encouraged to research the situation and assemble a convincing argument that the boxed types can be used without breaking things.