A conference talk exploring tricky edge cases in modern Java features, structured as interactive puzzles. Topics covered include exhaustiveness rules for switch expressions vs switch statements vs enhanced switch statements, primitives in pattern matching (JDK 23+), pattern dominance with primitive and wrapper class mixing, guarded patterns and their compilation rules, and Unicode identifier quirks. Key takeaways: switch expressions must be exhaustive while classic switch statements need not be; enhanced switch statements (using new syntax) also enforce exhaustiveness; mixing primitives and wrapper classes in the same switch leads to confusing and sometimes broken behavior; constant case labels take priority over guarded patterns; and Unicode soft hyphens and end-of-file characters can produce surprising compiler behavior.
Sort: