Abstract
AI
AI
NullPointerExceptions (NPEs) are a common source of crashes in Java applications, which can be mitigated through pluggable type checking. This paper introduces a novel approach to automatically infer nullability type qualifiers, streamlining the adoption of type-based nullness checking in existing code bases. A tool, N A A, has been developed that effectively reduces NPEs by substantially lowering the number of reported type checking errors while enabling optimization techniques to support large-scale Java programs.
References (42)
- 777 204 (-73.7%) 184 (-76.3%) 77 (-90.1%) Game Engine LitiEngine 30.1K 480 468 (-2.5%) 191 (-60.2%) 184 (-61.7%)
- LibGdx 92.1K 1549 2314 (+49.4%) 516 (-66.7%) 442 (-71.5%) Libraries MPAndroid 16.1K 174 489 (+181.0%) 64 (-63.2%) 53 (-69.5%)
- Eureka 8.0K 74 70 (-5.4%) 31 (-58.1%) 25 (-66.2%) Retrofit 3.6K 26 13 (-50.0%) 13 (-50.0%) 13 (-50.0%) Compiler Tools Jadx 39.8K 493 865 (+75.5%) 132 (-73.2%) 124 (-74.8%) WALA:Util 19.5K 190 294 (+54.7%) 88 (-53.6%) 76 (-60.0%) Network Library Zuul 15.2K 204 43 (-78.9%) 31 (-84.8%) 23 (-88.7%)
- 9 (-80.9%) T7 5.9K 35 28 (-20.0%) 21 (-40.0%) 19 (-45.7%) T8 14.8K 301 166 (-44.9%) 91 (-69.8%) 76 (-74.8%)
- REFERENCES
- ActivityLifecycle 2022. The Activity Lifecycle. https://developer.android.com/ guide/components/activities/activity-lifecycle. Accessed: 2022-04-12.
- Alfred V. Aho, Monica S. Lam, Ravi Sethi, and Jeffrey D. Ullman. 2006. Compil- ers: Principles, Techniques, and Tools (2nd Edition). Addison-Wesley Longman Publishing Co., Inc., USA.
- Johannes Bader, Andrew Scott, Michael Pradel, and Satish Chandra. 2019. Getafix: Learning to Fix Bugs Automatically. Proc. ACM Program. Lang. 3, OOPSLA, Article 159 (oct 2019), 27 pages. https://doi.org/10.1145/3360585
- Subarno Banerjee, Lazaro Clapp, and Manu Sridharan. 2019. NullAway: Practical Type-based Null Safety for Java. In Proceedings of the 2019 27th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering (ESEC/FSE). https://doi.org/10.1145/3338906.3338919
- Berkay Berabi, Jingxuan He, Veselin Raychev, and Martin T. Vechev. 2021. TFix: Learning to Fix Coding Errors with a Text-to-Text Transformer. In Proceedings of the 38th International Conference on Machine Learning, ICML 2021, 18-24 July 2021, Virtual Event (Proceedings of Machine Learning Research, Vol. 139), Marina Meila and Tong Zhang (Eds.). PMLR, 780-791. http://proceedings.mlr.press/ v139/berabi21a.html
- John Peter Campora, Sheng Chen, Martin Erwig, and Eric Walkingshaw. 2018. Migrating Gradual Types. Proc. ACM Program. Lang. 2, POPL, Article 15 (2018), 29 pages. https://doi.org/10.1145/3158103
- CFInference 2022. Checker Framework Inference. https://github.com/opprop/ checker-framework-inference. Accessed: 2022-04-02.
- DaikonNullable 2022. Daikon AnnotateNullable support. http://plse.cs. washington.edu/daikon/download/doc/daikon.html#AnnotateNullable. Ac- cessed: 2022-04-12.
- Werner Dietl, Stephanie Dietzel, Michael D. Ernst, Kıvanç Muşlu, and Todd Schiller. 2011. Building and using pluggable type-checkers. In ICSE 2011, Pro- ceedings of the 33rd International Conference on Software Engineering. Waikiki, Hawaii, USA, 681-690. https://doi.org/10.1145/1985793.1985889
- Eradicate 2022. Infer : Eradicate. https://fbinfer.com/docs/checker-eradicate Accessed: 2022-04-07.
- Michael D. Ernst, Jeff H. Perkins, Philip J. Guo, Stephen McCamant, Carlos Pacheco, Matthew S. Tschantz, and Chen Xiao. 2007. The Daikon system for dynamic detection of likely invariants. Science of Computer Programming 69, 1-3 (Dec. 2007), 35-45. https://doi.org/10.1016/j.scico.2007.01.015
- ErrorProne 2022. Error Prone. http://errorprone.info/ Accessed: 2022-04-07.
- Jeffrey S. Foster, Manuel Fähndrich, and Alexander Aiken. 1999. A Theory of Type Qualifiers. In Proceedings of the 1999 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), Atlanta, Georgia, USA, May 1-4, 1999. 192-203. https://doi.org/10.1145/301618.301665
- Gradle 2022. Gradle Build Tool. https://gradle.org. Accessed: 2022-04-03.
- Vincent J. Hellendoorn, Christian Bird, Earl T. Barr, and Miltiadis Allamanis. 2018. Deep Learning Type Inference. In Proceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering (Lake Buena Vista, FL, USA) (ESEC/FSE 2018). Association for Computing Machinery, New York, NY, USA, 152-162. https://doi.org/10.1145/3236024.3236051
- David Hovemeyer, Jaime Spacco, and William Pugh. 2005. Evaluating and Tun- ing a Static Analysis to Find Null Pointer Bugs. In Proceedings of the 6th ACM SIGPLAN-SIGSOFT Workshop on Program Analysis for Software Tools and Engi- neering (Lisbon, Portugal) (PASTE '05). Association for Computing Machinery, New York, NY, USA, 13-19. https://doi.org/10.1145/1108792.1108798
- Thore Husfeldt. 2015. Graph colouring algorithms. https://doi.org/10.48550/ ARXIV.1505.05825 arXiv pre-print 1505.05825.
- Martin Kellogg, Daniel Daskiewicz, Loi Ngo Duc Nguyen, Muyeed Ahmed, and Michael D. Ernst. 2023. Pluggable type inference for free. In ASE 2023: Proceedings of the 38th Annual International Conference on Automated Software Engineering.
- Kotlin 2022. Kotlin Programming Language. https://kotlinlang.org/. Accessed: 2022-04-07.
- Alexey Loginov, Eran Yahav, Satish Chandra, Stephen Fink, Noam Rinetzky, and Mangala Nanda. 2008. Verifying Dereference Safety via Expanding-Scope Analy- sis. In Proceedings of the 2008 International Symposium on Software Testing and Analysis (Seattle, WA, USA) (ISSTA '08). Association for Computing Machinery, New York, NY, USA, 213-224. https://doi.org/10.1145/1390630.1390657
- Calvin Loncaric, Satish Chandra, Cole Schlesinger, and Manu Sridharan. 2016. A Practical Framework for Type Inference Error Explanation. SIGPLAN Not. 51, 10 (oct 2016), 781-799. https://doi.org/10.1145/3022671.2983994
- Ravichandhran Madhavan and Raghavan Komondoor. 2011. Null dereference ver- ification via over-approximated weakest pre-conditions analysis. In Proceedings of the 26th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2011, part of SPLASH 2011, Port- land, OR, USA, October 22 -27, 2011. 1033-1052. https://doi.org/10.1145/2048066. 2048144
- Zeina Migeed and Jens Palsberg. 2020. What is Decidable about Gradual Types? Proc. ACM Program. Lang. 4, POPL, Article 29 (2020), 29 pages. https://doi.org/ 10.1145/3371097
- Nachiappan Nagappan and Thomas Ball. 2005. Use of relative code churn mea- sures to predict system defect density. In 27th International Conference on Soft- ware Engineering (ICSE 2005), 15-21 May 2005, St. Louis, Missouri, USA, Gruia- Catalin Roman, William G. Griswold, and Bashar Nuseibeh (Eds.). ACM, 284-292. https://doi.org/10.1145/1062455.1062514
- NAHandlers 2022. NullAway handler implementations. https://github.com/uber/ NullAway/tree/master/nullaway/src/main/java/com/uber/nullaway/handlers. Accessed: 2022-04-07.
- Matthew M. Papi, Mahmood Ali, Telmo Luis Correa Jr., Jeff H. Perkins, and Michael D. Ernst. 2008. Practical pluggable types for Java. In ISSTA 2008, Proceed- ings of the 2008 International Symposium on Software Testing and Analysis. Seattle, WA, USA, 201-212. https://doi.org/10.1145/1390630.1390656
- Zvonimir Pavlinovic, Tim King, and Thomas Wies. 2014. Finding Minimum Type Error Sources. In Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages and Applications (OOPSLA) (Portland, Oregon, USA) (OOPSLA '14). Association for Computing Machinery, New York, NY, USA, 525-542. https://doi.org/10.1145/2660193.2660230
- Luna Phipps-Costin, Carolyn Jane Anderson, Michael Greenberg, and Arjun Guha. 2021. Solver-Based Gradual Type Migration. Proc. ACM Program. Lang. 5, OOPSLA, Article 111 (oct 2021), 27 pages. https://doi.org/10.1145/3485488
- Artem Pianykh, Ilya Zorin, and Dmitry Lyubarskiy. 2023. Retrofitting null-safety onto Java at Meta. https://engineering.fb.com/2022/11/22/developer-tools/meta- java-nullsafe/ Accessed: 2023-02-01.
- Benjamin C. Pierce. 2002. Types and Programming Languages (1st ed.). The MIT Press.
- Rachel Potvin and Josh Levenberg. 2016. Why Google Stores Billions of Lines of Code in a Single Repository. Commun. ACM 59, 7 (jun 2016), 78-87. https: //doi.org/10.1145/2854146
- Michael Pradel, Georgios Gousios, Jason Liu, and Satish Chandra. 2020. Type- Writer: Neural Type Prediction with Search-Based Validation. In Proceedings of the 28th ACM Joint Meeting on European Software Engineering Conference and Sympo- sium on the Foundations of Software Engineering. Association for Computing Ma- chinery, New York, NY, USA, 209-220. https://doi.org/10.1145/3368089.3409715
- Swift 2022. Swift Programming Language. https://swift.org/. Accessed: 2022-04- 07.
- Mohsen Vakilian, Amarin Phaosawasdi, Michael D. Ernst, and Ralph E. Johnson. 2015. Cascade: A Universal Programmer-Assisted Type Qualifier Inference Tool. In Proceedings of the 37th International Conference on Software Engineering - Volume 1 (Florence, Italy) (ICSE '15). IEEE Press, 234-245.
- WALA 2023. T.J. Watson Libraries for Analysis (WALA). http://wala.sourceforge. net.
- Tongtong Xiang, Jeff Y. Luo, and Werner Dietl. 2020. Precise inference of expres- sive units of measurement types. Proc. ACM Program. Lang. 4, OOPSLA (2020), 142:1-142:28. https://doi.org/10.1145/3428210
- Danfeng Zhang, Andrew C. Myers, Dimitrios Vytiniotis, and Simon Peyton-Jones. 2017. SHErrLoc: A Static Holistic Error Locator. ACM Trans. Program. Lang. Syst. 39, 4, Article 18 (aug 2017), 47 pages. https://doi.org/10.1145/3121137