Different behaviour between ECJ and javac for generic type inference#4990
Different behaviour between ECJ and javac for generic type inference#4990snjeza wants to merge 1 commit into
Conversation
|
Some background analysis: Adding a same-bound In that bug the fallback was added to prevent that inference would get stuck, i.e., simply not make any progress for an ivar without suitable upper nor lower bounds. OTOH, not having any bound in some cases seems to be a bug introduced in 550a751 (no bugzilla reference). @srikanth-sankaran fyi. But the test case discussed here would not benefit from resolving the above wrinkles. When I look the simplicity of the spec implemented here:
... and compare this with the complexity of the proposed fix, I'm afraid we might be looking in the wrong place. |
|
I just tried this example against work in progress in #5004 and this is what I get Given that this matches to what javac answers, perhaps we don't need a specific fix for this test case :) |
Same result with #5129 (with plans to improve the error message via #5078 ). With this we are done. Thanks anyway, @snjeza for your efforts. |
Fixes #3351
Related to #4838 (comment)
I have created a simpler class to reproduce the issue.
The IDEA editor also doesn’t report any error in these cases.
If the class is tried to be run, IDEA will report an error when the
javaccompiler is used.The InferenceContext18.resolve() method will add the
V = java.lang.Objectbound if it cannot resolve some inference variable.The PR tries to postpone or skip this decision unless there is a bound that: