Preventing Runtime Errors at Compile Time

Michael Ernst (University of Washington), Werner Dietl (University of Waterloo)
Java & JVM
Location: D139-140
Average rating: ***..
(3.69, 13 ratings)

Are you tired of null pointer exceptions, unintended side effects, SQL injections, concurrency errors, mistaken equality tests, and other run-time errors that appear during testing or in the field? A pluggable type system can guarantee the absence of these errors, and of many other important bugs.

Are you a software architect who wants to implement custom checks that enforce correct usage and prevent errors? You need a framework that supports you in creating a code checker.

This presentation is aimed at both audiences. Existing language type systems are insufficiently expressive to capture important properties and prevent related bugs. A pluggable type system can give a compile-time guarantee of data properties. We will explain what it is, how to use it, and how to create your own. You can use existing pluggable type-checkers, or you can create a simple new one in 2 minutes.

We will demo the Checker Framework, which enables you to create pluggable type systems for Java. Oracle is adding syntax to Java 8 to better support the Checker Framework, but you can use it with any version of Java. The Checker Framework provides 12 pluggable type systems that are ready to use, including nullness, immutability, and concurrency type-checkers. The tools are freely available at

The presentation will first develop a simple declarative type checker that checks the consistency of method signature strings. The presentation will then discuss the design and usage of more advanced checkers.

The Checker Framework has found hundreds of bugs in over 3 million lines of well-tested open source code, including from Oracle, Google, Apache, etc. Even novices can quickly use or create a pluggable type system.

Prerequisite knowledge for this session: A basic understanding of Java programming is assumed. Attendants are encouraged to come with a laptop computer to participate in hands-on exercises, including analyzing participants’ own code.

Photo of Michael Ernst

Michael Ernst

University of Washington

Michael D. Ernst is an Associate Professor in the Computer Science and Engineering department at the University of Washington. He has been honored as a ``Java Rock Star’’ for a crowd-pleasing JavaOne presentation. He is the specification lead for the Type Annotations language extension (``JSR 308’‘) that will be part of Java 8 - the first non-Sun-employee to be the specification lead for a Java language change. This JSR was awarded ``most innovative JSR’’ by Sun. Ernst’s research aims to make software more reliable, more secure, and easier (and more fun!) to produce. His primary technical interests are in software engineering and related areas, including programming languages, type theory, security, program analysis, bug prediction, testing, and verification. Ernst’s research combines strong theoretical foundations with realistic experimentation, with an eye to changing the way that software developers work. Dr. Ernst was previously a tenured professor at MIT, and before that a researcher at Microsoft Research. More information is available at his homepage.

Photo of Werner Dietl

Werner Dietl

University of Waterloo

Werner Dietl is a post-doctoral research associate at the University of Washington, where he is a member of the programming languages and software engineering groups and collaborates with the architecture group. His research goal is to help software engineers produce high-quality software by enabling them to better understand and structure their software. Previously, he was a research and teaching assistant at the Chair of Programming Methodology, ETH Zurich. More information is available at his homepage.

Comments on this page are now closed.


Chris Pall
07/24/2012 7:37am PDT

In spite of the technical hurdles, this content of this presentation was extremely good and I felt better for being exposed to it. I was inspired to look further and to follow up on the project.

Magnus Runesson
07/23/2012 11:38pm PDT

Very interesting subject that can help solve some of your runtime problems. But as always, it is not a silver bullet. Looking forward to see future progress.

Picture of Bert  Porter
Bert Porter
07/22/2012 3:14pm PDT

I agree that the framework is interesting and could be very useful, and that the tutorial suffered from time lost to classpath issues, etc. This sort of command line compilation and running is rarely done in the professional world. It would have been a much better use of the time if we had a preconfigured eclipse instance to work with. After generating the compiler error, I’d have liked to walk through fixing the error together too. And then look more at writing extensions.

Jeffrey Davison
07/19/2012 4:10pm PDT

While I believe that this Checker framework can be useful (I will try to incorporate it), the presentation needs some work. 1 – provide instructions to the class PRIOR to the time of the class on downloading the required packages. 2 – correct the javac.bat file to not overwrite the bootclasspath. If this had been a painless process, we could have gained much more value. We never did get to the part about integrating this with Eclipse.

Scott Chilcote
07/18/2012 5:04am PDT

This session was informative and helpful, but was also rather frustrating to me primarily due to the lack of internet access during the tutorial. If the presenters had provided a more complete build of the class examples, I would have been able to resolve the classpath issues I was having and would have been able to build the example code successfully. As a professional Java programmer, I have used build systems for years (e.g. Maven) that automatically resolve library references. I am very impressed with the framework they have created, but would also like to see more of the process one would follow in deciding what annotations to add to an existing software project.


For information on exhibition and sponsorship opportunities at the conference, contact Sharon Cordesse at (707) 827-7065 or

View a complete list of OSCON contacts