Local variable type inference: Friend or foe?

День 2 /  / Зал 2  /  EN / Для практикующих инженеров  /  bestpractices,var

Комментарий Программного комитета:

Тема свежая, интересная, вокруг нее сейчас много споров. Этот доклад прольет свет на ее преимущества и недостатки, на то, где она может пригодиться, а где нет.

Local variable type inference was introduced as a new Java language feature in Java SE 10. Gone are the days of explicitly having to define the type of a variable; let the compiler do it for you with the magic of var!

At first sight, this looks like a small change that will eliminate unnecessary boilerplate code and reduce how much typing (on the keyboard) is required to maintain strong typing (of the language). However, as with many features, there are some unexpected nuances as well as both good and bad use cases.

In this session, we'll explain the fundamentals of local variable type inference. We'll then take a series of examples of the use of var and discuss the technical merits of each case.



Simon Ritter
Azul Systems

Simon Ritter is the Deputy CTO of Azul Systems. He has been in the IT business since 1984 and holds a Bachelor of Science degree in Physics from Brunel University in the U.K.

Simon joined Sun Microsystems in 1996 and started working with Java technology from JDK 1.0; he has spent time working in both Java development and consultancy. Having moved to Oracle as a part of the Sun acquisition, he managed the Java Evangelism team for the core Java platform, Java for client applications and embedded Java. Now at Azul, he continues to help people understand Java as well as Azul's JVM technologies and products. Simon has twice been awarded a Java Rockstar status at JavaOne and is a Java Champion. He currently represents Azul on the JCP Executive Committee and on the Java SE Expert Group (JSR 379 and JSR 383).

Контакты