2019
DOI: 10.1145/3360584
|View full text |Cite
|
Sign up to set email alerts
|

Casting about in the dark: an empirical study of cast operations in Java programs

Abstract: The main goal of a static type system is to prevent certain kinds of errors from happening at run time. A type system is formulated as a set of constraints that gives any expression or term in a program a well-defined type. Yet mainstream programming languages are endowed with type systems that provide the means to circumvent their constraints through casting. We want to understand how and when developers escape the static type system to use dynamic typing. We empirically study how casting is used by developer… Show more

Help me understand this report

Search citation statements

Order By: Relevance

Paper Sections

Select...
2
1
1
1

Citation Types

1
5
0

Year Published

2020
2020
2023
2023

Publication Types

Select...
5
2
1

Relationship

0
8

Authors

Journals

citations
Cited by 11 publications
(6 citation statements)
references
References 70 publications
1
5
0
Order By: Relevance
“…Winther [2011] studied the safety of type casts and found that a quarter of them were guarded with type checks to ensure their validity of type casts against run-time errors. This was corroborated in a later study by Mastrangelo et al [2019] on the classification of patterns for type casting. A study of implicit casting in JavaScript [Pradel and Sen 2015] found most implicit casts to be harmless and useful, implying that developers use them judiciously.…”
Section: Introductionsupporting
confidence: 71%
See 1 more Smart Citation
“…Winther [2011] studied the safety of type casts and found that a quarter of them were guarded with type checks to ensure their validity of type casts against run-time errors. This was corroborated in a later study by Mastrangelo et al [2019] on the classification of patterns for type casting. A study of implicit casting in JavaScript [Pradel and Sen 2015] found most implicit casts to be harmless and useful, implying that developers use them judiciously.…”
Section: Introductionsupporting
confidence: 71%
“…A study of implicit casting in JavaScript [Pradel and Sen 2015] found most implicit casts to be harmless and useful, implying that developers use them judiciously. Mastrangelo et al [2019] performed a study of how developers use type casts in Java and found 26 usage patterns for type casts. Importantly, they discovered that half of the casts inspected by them were not guarded locally which could potentially cause run-time errors.…”
Section: Introductionmentioning
confidence: 99%
“…Specifically, Jin et al [2012] have manually analyzed 110 real-world performance bugs, Di Franco et al [2017] analyzed 269 bugs in numerical libraries, Leesatapornwongsa et al [2016], and Bagherzadeh et al [2020] analyzed 104 and 186 concurrency bugs in distributed and actor-based systems respectively. Theoretically, as in the work of Mastrangelo et al [2019], we can presume that using a random sample of 320 bugs, there is a probability of (1 − 0.01) 320 ≃ 0.04 = 4% of missing a category whose relative frequency is at least 1%, and a probability of (1 − 0.015) 320 ≃ 0.008 = 0.8% of missing a category whose relative frequency is at least 1.5%. Note that in practice, as we were examining bugs in iterations, we observed that it was easy to categorize bugs coming from the third or the fourth iteration, as most of these bugs fitted well in one of the resulting categories.…”
Section: Threats To Validitymentioning
confidence: 96%
“…Our analysis on test case characteristics does not provide information about the behavioral characteristics of each test case. For example, our analysis gives the frequency of casts, but it does not offer details about how and where a cast is used [Mastrangelo et al 2019]. However, we argue that future testing techniques can still take advantage of our findings to produce interesting programs by considering features that are more likely to trigger bugs, and combining these features in divergent ways (see Section 4.2).…”
Section: Language Featuresmentioning
confidence: 99%
“…Mastrangelo et al [19] surveyed different uses of casts in Java, finding that 8.7% of methods contain casts, of which 50% of which are not locally protected against errors. Polymorphism in C code has been studied by Hackett and Aiken [10] and is especially prevalent in systems code.…”
Section: Motivationmentioning
confidence: 99%