Wildcards need witness protection
Kevin Bierhoff
Abstract
In this paper, we show that the unsoundness discovered by Amin and Tate (2016) in Java’s wildcards is avoidable, even in the absence of a nullness-aware type system. The key insight of this paper is that soundness in type systems that implicitly introduce existential types through subtyping hinges on still making sure there are suitable witness types when introducing existentially quantified type variables. To show that this approach is viable, this paper formalizes a core calculus and proves it sound. We used a static analysis based on our approach to look for potential issues in a vast corpus of Java code and found none (with 1 false positive). This confirms both that Java's unsoundness has minimal practical consequence, and that our approach can avoid it entirely with minimal false positives.
Ask about this paper
Ask your agent about it.
Lune has read the top-tier papers around this one, so every answer names the papers it rests on.
Related papers
- Practical Inference of Nullability TypesNima Karimipour, Justin Pham, Lazaro Clapp, Manu SridharanFSE 2023 · 6 citations
- ιDOT: a DOT calculus with object initializationIfaz Kabir, Yufeng Li, Ondrej LhotákOOPSLA 2020 · 3 citations
- Decidable Subtyping of Existential Types for JuliaJulia Belyakova, Benjamin Chung, Ross Tate, Jan VitekPLDI 2024 · 2 citations
- Knowing when to ask: sound scheduling of name resolution in type checkers derived from declarative specificationsArjen Rouvoet, Hendrik van Antwerpen, Casper Bach Poulsen, Robbert Krebbers et al.OOPSLA 2020 · 9 citations
- Relational nullable types with Boolean unificationMagnus Madsen, Jaco van de PolOOPSLA 2021 · 9 citations
