Feedback wanted: switch expression typing

Liam Miller-Cushon cushon at google.com
Wed Mar 28 22:17:10 UTC 2018


Hi Dan,

On Wed, Mar 28, 2018 at 12:38 PM Dan Smith <daniel.smith at oracle.com> wrote:

> If you're able to build OpenJDK with this patch and run it on some
> real-world code, I'd appreciate any insights about what you find.
>

I recorded the number of times each diagnostic was produced as a fraction
of all conditional expressions in Google's codebase:

compiler.note.primitive.conditional.incompatible - 1 in 1400
compiler.note.primitive.conditional.box          - 1 in 2400
compiler.note.primitive.conditional.null         - 1 in 700
compiler.note.primitive.conditional.precision    - 1 in 21000
compiler.note.primitive.conditional.overload     - 1 in 6800

We've found that some fraction of the null / boxing cases are actually
mistakes where the programmer expected the
behaviour they would have gotten from target typing. We've been steering
people away from relying on that behaviour
with static analysis, so my numbers may under-count those diagnostics
relative to other codebases.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20180328/e99cb01b/attachment-0001.html>


More information about the amber-spec-experts mailing list