~/talk

Fun with var in Java 11

Talkat J-Fall 2018 · on Thursday, 2018-11-08· [java]
slides:none on file

Live coding proves var in Java 10/11 infers local types into bytecode but only for local variables, for-loop and try-with-resources, not for fields or method signatures; the compiler infers types strictly from the right‑hand side so requires right‑hand side type (no lambdas or array initializers without a target). Demos show generics + var producing ad hoc intersection types via generics that let a Scanner act as Closeable+Iterator, and a trait-style lambda trick that compiles but breaks equals/hashCode and collections, so it works but has dangerous refactoring and correctness trade‑offs.

AI-written summary · about

  1. 0:00Start
  2. 4:25Try Block
  3. 6:43Poly Expression
  4. 8:39What Could the Compiler Do Instead
  5. 12:28Readability
  6. 14:16Style Guidelines
  7. 17:04Motivation
  8. 17:51Intersection Types
  9. 18:14Intersection Type
  10. 19:05Use the Code Snippets
  11. 26:41General Use Case
  12. 32:19Create a Function Interface
  13. 32:39Function Interface
  14. 33:02Overwrite Methods
  15. 43:20Ad Hoc Fields and Methods
  16. 48:41Records
~/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.