8

Click here to load reader

Handle the billion-dollar mistake in Java

  • Upload
    bmathus

  • View
    245

  • Download
    1

Embed Size (px)

DESCRIPTION

Slides associated with the EclipseCon session: https://www.eclipsecon.org/france2014/session/handle-billion-dollar-mistake-java-help-tools-understand-your-code Note: the session was essentially code-based, so the slides may not be really useful taken alone.

Citation preview

Page 1: Handle the billion-dollar mistake in Java

Handle The Billion-Dollar Mistake In Java

Help tools understand your code

Baptiste Mathus – MiPih

EclipseCon France 2014

Page 2: Handle the billion-dollar mistake in Java

Baptiste Mathus - EclipseCon France 2014 - @bmathus

http://batmat.net

Page 3: Handle the billion-dollar mistake in Java

Agenda

•Null – a billion-dollar mistake?

•@Nonnull, @Nullable… @WTF?

•Tooling

•Alternatives

Baptiste Mathus - EclipseCon France 2014 - @bmathus

Page 4: Handle the billion-dollar mistake in Java

The null concept: a billion-dollar mistake?

His creator, Sir Charles Antony Richard Hoare, says yes! :-)

[...] languages designs is serious scientific engineering activity. And we should begin to take responsibility for the mistakes our users make in the use of our languages.

– Tony Hoare

Baptiste Mathus - EclipseCon France 2014 - @bmathus

Page 5: Handle the billion-dollar mistake in Java

Baptiste Mathus - EclipseCon France 2014 - @bmathusUnexpected…

Page 6: Handle the billion-dollar mistake in Java

JSR305 : Annotations for software detections

Why @Nonnull… annotations?

« they express design decisions that may be implicit, or described in documentation, but not easily available to tools »

Baptiste Mathus - EclipseCon France 2014 - @bmathus

Page 7: Handle the billion-dollar mistake in Java

Code talks, slides walks…

Baptiste Mathus - EclipseCon France 2014 - @bmathus

Page 8: Handle the billion-dollar mistake in Java

References• Null References: The Billion Dollar Mistake

• http://www.infoq.com/presentations/Null-References-The-Billion-Dollar-Mistake-Tony-Hoare

• Eclipse Help For Using Null Analysis• http://eclip.se/2f

• JSR 308: Annotations on Java Types• https://www.jcp.org/en/jsr/detail?id=308

• To go further: the Checker Framework• http://types.cs.washington.edu/checker-framework/

• Experiment: runtime report of non-compliant calls (WIP)• https://github.com/Batmat/jsr305reporter

Baptiste Mathus - EclipseCon France 2014 - @bmathus