Abstract:NullPointerExceptions (NPEs) are a key source of crashes in modern Java programs. Previous work has shown how such errors can be prevented at compile time via code annotations and pluggable type checking. However, such systems have been difficult to deploy on large-scale software projects, due to significant build-time overhead and / or a high annotation burden. This paper presents NullAway, a new type-based null safety checker for Java that overcomes these issues. NullAway has been carefully engineered for lo… Show more
“…PiranhaJava is used to refactor stale feature flag related code in Java applications, specifically those targeting the Android platform. It is implemented in Java on top of Errorprone [3] as an Errorprone plugin [3,9]. We handle the basic cleanup, without deep cleaning of methods and fields.…”
Feature flags are commonly used in mobile app development and can introduce technical debt related to deleting their usage from the codebase. This can adversely affect the overall reliability of the apps and increase their maintenance complexity. Reducing this debt without imposing additional overheads on the developers necessitates the design of novel tools and automated workflows. In this paper, we describe the design and implementation of Piranha, an automated code refactoring tool which is used to automatically generate differential revisions (a.k.a diffs) to delete code corresponding to stale feature flags. Piranha takes as input the name of the flag, expected treatment behavior, and the name of the flag's author. It analyzes the ASTs of the program to generate appropriate refactorings which are packaged into a diff. The diff is assigned to the author of the flag for further processing, who can land it after performing any additional refactorings. We have implemented Piranha to delete code in Objective-C, Java, and Swift programs, and deployed it to handle stale flags in multiple Uber apps. We present our experiences with the deployment of Piranha from Dec 2017 to May 2019, including the following highlights: (a) generated code cleanup diffs for 1381 flags (17% of total flags), (b) 65% of the diffs landed without any changes, (c) over 85% of the generated diffs compile and pass tests successfully, (d) around 80% of the diffs affect more than one file, (e) developers process more than 88% of the generated diffs, (f) 75% of the generated diffs are processed within a week, and (g) Piranha diffs have been interacted with by~200 developers across Uber.
“…PiranhaJava is used to refactor stale feature flag related code in Java applications, specifically those targeting the Android platform. It is implemented in Java on top of Errorprone [3] as an Errorprone plugin [3,9]. We handle the basic cleanup, without deep cleaning of methods and fields.…”
Feature flags are commonly used in mobile app development and can introduce technical debt related to deleting their usage from the codebase. This can adversely affect the overall reliability of the apps and increase their maintenance complexity. Reducing this debt without imposing additional overheads on the developers necessitates the design of novel tools and automated workflows. In this paper, we describe the design and implementation of Piranha, an automated code refactoring tool which is used to automatically generate differential revisions (a.k.a diffs) to delete code corresponding to stale feature flags. Piranha takes as input the name of the flag, expected treatment behavior, and the name of the flag's author. It analyzes the ASTs of the program to generate appropriate refactorings which are packaged into a diff. The diff is assigned to the author of the flag for further processing, who can land it after performing any additional refactorings. We have implemented Piranha to delete code in Objective-C, Java, and Swift programs, and deployed it to handle stale flags in multiple Uber apps. We present our experiences with the deployment of Piranha from Dec 2017 to May 2019, including the following highlights: (a) generated code cleanup diffs for 1381 flags (17% of total flags), (b) 65% of the diffs landed without any changes, (c) over 85% of the generated diffs compile and pass tests successfully, (d) around 80% of the diffs affect more than one file, (e) developers process more than 88% of the generated diffs, (f) 75% of the generated diffs are processed within a week, and (g) Piranha diffs have been interacted with by~200 developers across Uber.
“…Hubert et al [2008] present a constraint-based static analysis to infer non-null annotations. Banerjee et al [2019] presents NullAway, a tool to find NullPointerExceptions . NullAway, unlike other similar tools, does not aim for soundness, but rather for a reduction of spurious warnings reported by the tool.…”
Section: Nullable Type Systemsmentioning
confidence: 99%
“…A nullable type system prevents such crashes or undefined behavior by tracking, for every expression, whether it may evaluate to null [Banerjee et al 2019;Fähndrich and Xia 2007;Nieto et al 2020b;Summers and Müller 2011]. If an expression is nullable then the programmer must explicitly check for null before the result of the expression can be used.…”
We present a simple, practical, and expressive relational nullable type system. A relational nullable type system captures whether an expression may evaluate to null based on its type, but also based on the type of other related expressions. The type system extends the Hindley-Milner type system with Boolean constraints, supports parametric polymorphism, and preserves principal types modulo Boolean equivalence. We show how to support full Hindley-Milner style type inference with an extension of Algorithm W.
We conduct a preliminary study of open source projects showing that there is a need for relational nullable type systems across a wide range of programming languages. The most important findings from the study are: (i) programmers use programming patterns where the nullability of one expression depends on the nullability of other related expressions, (ii) such invariants are commonly enforced with run-time exceptions, and (iii) reasoning about these programming patterns requires not only knowledge of when an expression may evaluate to null, but also when it may evaluate to a non-null value. We incorporate these observations in the design of the proposed relational nullable type system.
“…NullAway (Banerjee et al, 2019) is a type-based null safety checker for Java programs. It uses annotations and pluggable type checking to check the safety of variables.…”
Null dereference is a common type of runtime failure in Java programs, and it is necessary to verify whether a dereference in the program is safe. However, previous works often have redundant path exploration and high false positive rate. In this paper, we propose a merged null dereference verification (MNDV) approach. MNDV employs a backward, path‐sensitive inter‐procedural analysis technique to verify a given dereference as safe or potentially unsafe. It uses a branch merging strategy to remove redundant paths, and a method call's relevance to the null references is checked to determine whether it is necessary to explore the internal codes of the method. We have evaluated the approach in some standard benchmark programs. Compared with some existing approaches, our approach reduces false alarm rate and effectively reduce time and memory consumption.
scite is a Brooklyn-based organization that helps researchers better discover and understand research articles through Smart Citations–citations that display the context of the citation and describe whether the article provides supporting or contrasting evidence. scite is used by students and researchers from around the world and is funded in part by the National Science Foundation and the National Institute on Drug Abuse of the National Institutes of Health.