Cheers,
Peter
The test classes include some code that tries to "prove" that (by
passing the type checks of the compiler) the thing they are testing is
correct.
For example, if a method tests that GenericTypeReflector can see that
X is a supertype of Y, it not only asserts the result of the
GenericTypeReflector call, it also creates variables of type X and Y,
and assigns them to eachother.
In other words, it checks that Gentyref's type checking agrees with
the compiler's type checking.
In some cases I've commented out the compiler-checking part when
either the JDK 6 compiler or my Eclipse won't compile it.
Or I've worked around them, like in the particularly tricky
AbstractGenericsReflectorTest.testUExtendsListOfExtT: holding the
compiler's hand step by step to show it one type is a supertype of
another.
But I have to draw the line somewhere, and JDK 5 (because of its bugs)
is on the wrong side of that line.
The advantage is that there's an extra insurance that it's doing the
right thing. The disadvantage is that it pushes the limits of the
compiler, and compiler bugs in the corner cases it tests cause the
tests not to compile. I find that a price worth paying.
I'd even say that exposing these shortcomings in compilers is an extra
feature of the tests ;-)
And to be clear nobody reading this misunderstands:
This does not mean the Gentyref library itself has any problems
(compiling or running) with JDK 5.
Even the tests should *run* fine with JDK 5, just not compile with it.
Thanks anyways for the heads up Peter,
Wouter.
Looks like a compiler bug. I opened a bug for it at oracle:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7003595
And worked around it in gentyref.
(http://code.google.com/p/gentyref/issues/detail?id=15)
Regards,
Wouter.