Intellij from Microsoft JDConf

Speaker: Trisha Gee – @trisha_gee

A note on speaking quickly: this wasn’t specific to Trisha, but she mentioned it. A 25 minute talk doesn’t mean take a 30-45 minute talk and talk faster. It means have less content. Luckily, Trisha could refer to Venkat’s talk and actually have less content.

In any case, I learned new stuff for IntelliJ, so that’s good. And nice seeing two live demos (Venkat and Trisha) in a row.

  • Supports next version of Java (before released)
  • Modern Java is anything in Java 9 or higher because majority still on Java 8
  • Have two options: LTS (currently Java 11) or latest (currently Java 15)
  • Can choose version of Java for project including preview features version for most recent version of Java
  • Showed refactoring to replace reference with “var”.
    • And how to customize so doesn’t warn on every opportunity.
    • Weak warning = gray out each refactoring opportunity.
    • Inlay hints – can turn off hints for specific things like implicit types
    • Won’t allow you do to the refactoring if changes the meaning. (Ex: when would change List<String> to List<Object>
  • Convenience factory methods for collections
    • Offers to replace Collections.unmodifiableXX() with List.of, Set.of(), Map.of
    • Highlight code and alt-enter to see formatting options that apply to that code
    • Java 11 has Collectors.toUnmodifiableList() and Optional.isEmpty()
  • Java 15 – Switch expressions
    • Can refactor existing code to enhanced switch and make shorter
    • Can merge branches
  • Java 15 – Text blocks
    • Can refactor the mess of concatenation and \n into text block
    • Can “inject” javascript or json to validate and autocomplete the embedded text

Modern Java from Microsoft JDConf

Speaker: Venkat Subramaniam – @venkat_s

I was curious to see Venkat speak for only 25 minutes! It’s like he can speak to expand/shrink to available time. (Note: I added the version numbers since these features aren’t on the latest LTS). It was a normal “Textmate” live talk

  • Reduce ceremony
  • Java 14 – Pattern matching with instanceof. – Can use variable inside of instance of as if it were cast
  • Java 14 – Switch expression – automatic breaks, multiple matches, multiline cases, return values. Leading us to pattern matching in future
  • Java 14 – Multiline text blocks – don’t need to escape, multi line strings, smart indentation. Can use \s if want to preserve whitespace at beginning of next line
  • Java 16 – Records – data classes. Automatic getter (field name not getX), implicit equals() method based on all fields. Can still write constructor manually if want validation, immutable, can use as a Tuple. Even locally within a lass if that’s the scope you need. In future, pattern matching
  • Future: Sealed classes (preview feature in Java 15). Use “permits” to list what classes are allowed to extend