
This
preview
has intentionally blurred sections.
Sign up to view the full version.


This
preview
has intentionally blurred sections.
Sign up to view the full version.


Unformatted text preview: Nullness Analysis of Java Source Code Master's thesis Arnout F.M. Engelen <[email protected]> Research number: 548 10th August 2006 2 Contents 1 Introduction 7 2 Background 11 2.1 Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.1.1 Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.1.2 Bias and propagation . . . . . . . . . . . . . . . . . . . . 12 2.1.3 Assumptions about external code . . . . . . . . . . . . . . 12 2.2 Java Modeling Language . . . . . . . . . . . . . . . . . . . . . . . 12 2.2.1 Nullity modi ers and invariants . . . . . . . . . . . . . . . 13 2.2.2 More complicated speci cations . . . . . . . . . . . . . . . 14 2.2.3 Non-null by default . . . . . . . . . . . . . . . . . . . . . . 14 2.3 Type systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.3.1 Di erent approaches to possibly-null values . . . . . . . . 15 2.3.1.1 Traditional (nullable) pointers . . . . . . . . . . 15 2.3.1.2 References with nullness information . . . . . . . 15 2.3.1.3 Functional `Maybe' types . . . . . . . . . . . . . 18 2.3.2 Type Inference . . . . . . . . . . . . . . . . . . . . . . . . 19 2.4 Program Veri cation . . . . . . . . . . . . . . . . . . . . . . . . . 19 2.4.1 Program Veri cation and Type Systems . . . . . . . . . . 20 2.4.2 Program Veri cation and Testing . . . . . . . . . . . . . . 20 3 Existing nullness analysis tools 21 3.1 Nullness checkers . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 3.1.1 Eclipse and IntelliJ IDEA . . . . . . . . . . . . . . . . . . 22 3.1.2 JastAdd Non-Null Checker . . . . . . . . . . . . . . . . . 23 3.1.3 ESC/Java . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 3.1.4 Spec# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 3.1.5 FindBugs . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 3.2 Annotation Assistants . . . . . . . . . . . . . . . . . . . . . . . . 27 3.2.1 JastAdd Nullness Inferrer . . . . . . . . . . . . . . . . . . 27 3.2.1.1 Example . . . . . . . . . . . . . . . . . . . . . . 29 3.2.2 Houdini . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 3.2.2.1 Example . . . . . . . . . . . . . . . . . . . . . . 34 3.2.3 CANAPA . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 3.2.3.1 Example . . . . . . . . . . . . . . . . . . . . . . 37 3.2.4 Julia . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 3.2.5 Daikon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 3 4 CONTENTS 4 Requirements and design considerations 41 4.1 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 4.2 Design considerations . . . . . . . . . . . . . . . . . . . . . . . . 42 4.2.1 Code external to the analysis . . . . . . . . . . . . . . . . 42 4.2.2 Limits of type-based approaches . . . . . . . . . . . . . . 42 4.2.2.1 Combining type- and logic-based analysis . . . . 44 4.2.2.2 Nullness type inference . . . . . . . . . . . . . . 45 4.2.3 Impact of incorrectly inferred annotations . . . . . . . . .Impact of incorrectly inferred annotations ....
View
Full Document
- Spring '11
- DavidNotikin
- ........., Type system, type systems, ESC/Java
-
Click to edit the document details