RFR 8195293: Issue more comprehensive warnings for use of "var" in earlier source versions
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Thu Jun 14 18:25:53 UTC 2018
Hi,
this is a followup of the issue fixed by Joe some time ago [1]. The goal
is to issue warnings when programs are using 'var' and -source < 10. The
original fix made by Joe detects a subset of the cases - more
specifically it doesn't detect uses in type positions. This fix, which
was briefly discussed back then - but dropped because of the risk (we
were at a fairly late stage of the release cycle), resolves that
problem. It is somewhat convoluted as it needs to avoid generating the
same warning multiple times.
As you can see from the golden test output, the compiler now warns about
a lot more uses of 'var' than before.
Note that I've also fixed a resource key which is using a diag argument
simply to say ''var'', which can and should be hardwired in the resource
file, instead of having the compiler passing strings around.
Cheers
Maurizio
[1] -
http://mail.openjdk.java.net/pipermail/compiler-dev/2018-January/011518.html
More information about the compiler-dev
mailing list