~/talk

Java Method-Local Inner Classes are Unsound

Talkat UNSOUND 2024 · on Sunday, 2024-10-20· [java]
links:none on file
links:none on file
links:none on file
slides:none on file

Claim: Java’s combination of method-local inner classes plus erased generics and class-based visibility lets a non-generic local class implicitly tied to a method type parameter escape one invocation and be reused under a different instantiation, producing a value typed as Foo<String> that actually contains an Integer and later throws ClassCastException. JVM erasure makes instanceof and casts succeed (no compiler warnings), raw types and overload-driven checkcasts mask the error, and languages like Scala/Kotlin mitigate it by warning or rejecting such checks.

AI-written summary · about

  1. 0:00Method-local inner classes
  2. 1:47What is a method-local inner class
  3. 3:13Java generics interaction
  4. 4:20Unsoundness example
  5. 11:06Simpler unsoundness example
  6. 12:08JVM bytecode analysis
  7. 14:54Other JVM languages
  8. 18:22Core issue and solutions
  9. 20:07Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.