~/talk

Type Inference: Friend or Foe

Talkat Oracle Code One 2018 · 2018-10-22..10-25· [java]
slides:none on file

Survey of Java type inference traces its history from generics and the diamond operator to Java 10’s introduction of var for local variables and Java 11’s allowance of var in lambda parameters for annotated params. Compiler experiments demonstrate where inference works (locals, foreach, try-with-resources) and where it breaks: cannot infer fields or method params, lambdas need explicit target types, and using var with the diamond operator or refactoring to var can change behavior (remove produced 2,3 vs 1,3). Examples compile, fail, or produce surprising runtime/output differences, and the IDE/compiler diagnostics guide safe use.

AI-written summary · about

  1. 0:00Introduction
  2. 0:35Static Typing
  3. 7:34Lambda Expressions
  4. 10:40Java 8 Limitations
  5. 15:57Type Inference
  6. 25:55Bad Idea
  7. 30:40Benefits
  8. 37:15Notable Types
  9. 41:00Java Leaven
~/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.