A new engineer went to JJUG ~ "Java SE 10 / JDK 10 release special feature" (2018/03/26 (Monday)) ~

JJUG Night Seminar "Java SE 10 / JDK 10 Release Special" (Monday, March 26, 2018)

JDK release model announcement

Mark Reinhold will come to Japan for a basic lecture at the next Java Day Tokyo! .. Registration site will open soon!

Review of JDK new release model

Thank you for JDK10 Local variable type inference David Buck

-@Davidbuckjp --How to fix JVM bugs

Current location

--JDK 9 released on September 21, 2017

Type inference of local variables


Arraylist<String> list = new ArrayList<>();
Stream<String> stream = list.stream();

//Will come to call like this
var list = new new ArrayList<>();
var stream = = list.stream();

** Note that type inference is not dynamically typed !!! **

Why now?

--Java emphasized readability over writeability --In the past, there were many line breaks --Var makes it shorter and easier to read. Only the declaration disappears. --Same for other languages C ++ ... auto, Scala ... var / val Go ...: =

Why only local variables?

--The influence of Field and method arguments is because it spans multiple files. Local variables are completed in one file. I don't want to see another file for type inference.

How to use

--There are various restrictions other than using var --Restrictions --Initialization is required --Array parentheses are not available --Low number declarations are prohibited --Array literal --null initialization --Poly expression that cannot be resolved

--Can be expressed in the Denotable types () language. -> Cannot be represented by java

var hogehoge = new Object() {
    public void say(){~}
}

hogehoge.say();

What is var?

--Reserved words? Keywords? --const and goto are reserved words but not keywords --Keywords ... expressions that mean something in the language --Reserved words ... can't be used --var cannot be used as a class or interface. Expected that there would be no class for lowercase var ... --Can be used as variable name or field name

int var = 1; ... ok

class var {

}... ng

var var = var();Compile passes! 

How to code?

--Released OPEN JDK style guide ――I'm writing when to use var

  1. Readability rather than writeability, use only when using var makes it easier to read
  2. When you can understand with local code
  3. Don't rely on tools such as IDEs, don't say it's okay because you can see it by hovering over it!
  4. It was a trade-off to explicitly declare the type, and the policy was to use lambda expressions and not use anonymous inner classes. But this time it's not the case. Writing all local variables in var is different

――How to use? Guidelines

  1. Use variable names that represent useful information
  2. Limit the scope of local variables
  3. Consider using var if you know the type only from the initialization
  4. Use var to decompose consecutive calls (often in Stream)
  5. You don't have to worry about interface programming (programming to the interface)
    var List = new ArrayList<>();
    
  6. Be careful when using with the diamond operator and generic method.
  7. Be careful when using with literals.

Other

--There are few other new features of java10, because it is a short term --Garbage Collector Interface JIT, GC, HosSpotRuntime JIT and GC were involved. The JDK has separate GC and JIT interfaces --Can you use full GC with Parallel Full GC for G1 G1? --thread local hondshakes Each thread refers to itself There is no need to stop another thread when you want to stop one thread. --jacac -h ... You can create a header file at the same time as creating a class file. --Added character code of de_DE_EURO German, Euro --Heap Allocation on Alternative Memory Device I want to use java for the memory here! --About JIT compiler

NTT OSS Center Yuji Kubota Kishida "How will java 10 change our lives?"

Yushi Kubota Kishida-san

12 new features

--Docker has more useful APIs --Disadvantages ... The cost of updating is high --Move and see with java 10 --Compile with Java 10 --Try using jdeps jdeprscan ... Check if you are using the internal API or deprecated API, and correct / update.

Information gathering of java10

--See new feature JEP AppCDS @ OpenJDK --API changes See JSR --See the incompatible release --JEP310: Application Class Data Sharing Used for batches, running in large numbers in containers

Commercial features of the Oracle JDK

  1. AppCDS
  2. Resource Management
  3. Java Flight Recorder
  4. Java Misson Control

--Full GC of G1 GC, which was a single thread execution, is parallelized ... Since it is a last resort, the situation of abuse itself is not good.

Incompatibility

--forRemoval = true will be removed after the next version

Improvements for Docker containers

--Fixed the problem that the container was not recognized and the installation and operation was performed based on the number of CPUs and memory of the host-> Docker's memory is allocated only this, but the JVM is looking at the machine, so it is allocated It uses more memory! CPU is the same --The amount of system memory used for Hepi has been made flexible ... The notation has been changed to%. Easy to understand --Improved to be able to attach to processes on the container from the host

API

javadoc -The annotation @Summary was created. The summary is sure to be applied. --Company notation and license display that the header and footer can do --Override-methods --policytool removed --javah deleted java -h

That, impression

――What I thought I had to remember from now on --JVM, JIT compiler, GC ――I thought I had to remember the lambda expression --swing and AWT ――I could feel the confidence that the speakers are familiar with java. --Keep in mind that JDK10 cannot be released immediately, and that you should prepare for JDK11. --The story of finding a bug in Java JDK 10 ... Kishida Hatena --Production should use Long time Record after all --You can go to the bug report once you submit it to ML. ――If the threshold is high, you may want to tweet on Twitter. --java8-> 9 transfer is very incompatible. It seems that it became a compatible book of about 350p.

--There is such an HP JJUG (I first learned that it is Jay Jug) JJUG's HP

Recommended Posts

A new engineer went to JJUG ~ "Java SE 10 / JDK 10 release special feature" (2018/03/26 (Monday)) ~
[* Java *] I went to JJUG CCC 2017 Fall
Send me a roadmap to becoming a full-fledged Java engineer
[Java] How to start a new line with StringBuilder
Java 12 new feature summary
Java 13 new feature summary
Java 10 new feature summary
Java 14 new feature summary