RFR 8144903: JShell: determine incorrectly the type of the expression which is array type of captured type
ShinyaYoshida
bitterfoxc at gmail.com
Thu Dec 10 14:15:07 UTC 2015
Hi Maurizio and Robert,
Thank you for a lot of advice and comments!
Now I agreed.
It is difficult( or impossible) to determine the completely "right" type
from bound.
And when I work hard around that, the work wouldn't bring benefit what is
worth the working to us.
I'd like propose the fix based on webrev.02:
http://cr.openjdk.java.net/~shinyafox/kulla/8144903/webrev.03/
In this patch:
1. Fix 8144903(this issue)
2. Use always wildcard instead of upper bound
3. In visitWildcardType, if it is top-level type and it doesn't have
extends bound, return "Object"
4. In TypePrinter, "Object" appears sometimes so I declare 'private static
final String OBJECT = "Object"' and use it instead of the literal.
5. Add & modify some tests
Could you review this?
Best Regards,
shinyafox(Shinya Yoshida)
2015-12-10 19:32 GMT+09:00 Maurizio Cimadamore <
maurizio.cimadamore at oracle.com>:
>
>
> On 10/12/15 03:07, Robert Field wrote:
>
> public static Object $2;
>
> otherwise the generated code will break.
>
> What do you mean by this? How is using Object breaking the generated code?
> Seems to me you have just widened the type of a variable storing an
> expression - that ought to work; the only problem here is user
> expectations: if the user is expecting to pass this to a method accepting a
> CharSequence he/she will be disappointed. But how big of a problem is this?
> And, as I pointed out elsewhere, no general solution exists for this.
>
> Maurizio
>
More information about the kulla-dev
mailing list