Changes in Java 11

change point

Java 11 was released on September 25, 2018.

Below is the JEP in Java 11.

Release model from JDK9

From JDK9 onwards, the release model has been changed to feature releases every 6 months (March and September). In addition, vulnerability countermeasures and bug fixes have been fixed so that they can be addressed four times a year in January, April, July, and October. Regarding binary provision Until now, binaries were provided free of charge by Oracle, but after 9 the free binaries will be provided by OpenJDK. Oracle JDK 9 or later will be charged. Also, before 8, there was a technical difference between Oracle JDK and OpenJDK, but this has disappeared.

LTS After JDK11 Oracle JDK will be released once every three years. Paid support for Oracle Provides security updates for a minimum of 8 years. In addition, after JDK11, it will be available free of charge for development, testing, prototyping, and demo applications.

Java is still free (other, not related to JDK)

A Japanese document called Java Is Still Free written by dozens of Java champions regarding Java support and updates has been released. It was.

JEP that seems to have a big impact on coding

JEP181 Nest-Based Access Control Until Java10, the code that called the private method of the outer class from the inner class was a strange bytecode output.

Let's take a look at the following code in JDK10.

Outer.java


public class Outer {
    private int i = 0;
    
    public class Inner {
        public int i() {
            return i;
        }
    }
}

After compiling, try disassembling the class files.

python


$ javap -p -c Outer\$Inner
Compiled from "Outer.java"
public class Outer$Inner {
  final Outer this$0;

  public Outer$Inner(Outer);
    Code:
       0: aload_0
       1: aload_1
       2: putfield      #1                  // Field this$0:LOuter;
       5: aload_0
       6: invokespecial #2                  // Method java/lang/Object."<init>":()V
       9: return

  public int i();
    Code:
       0: aload_0
       1: getfield      #1                  // Field this$0:LOuter;
       4: invokestatic  #3                  // Method Outer.access$000:(LOuter;)I
       7: ireturn
}

Next, compile the same code with JDK11 and disassemble it.

python


$ javap -p -c Outer\$Inner
Compiled from "Outer.java"
public class Outer$Inner {
  final Outer this$0;

  public Outer$Inner(Outer);
    Code:
       0: aload_0
       1: aload_1
       2: putfield      #1                  // Field this$0:LOuter;
       5: aload_0
       6: invokespecial #2                  // Method java/lang/Object."<init>":()V
       9: return

  public int i();
    Code:
       0: aload_0
       1: getfield      #1                  // Field this$0:LOuter;
       4: getfield      #3                  // Field Outer.i:I
       7: ireturn
}

If you compiled with JDK10, the Inner class will call Outer's static method access $ 000. In JDK11, the Inner class calls the Outer class Outer.i directly instead of the access $ 000 method.

A video about this is available at the JVM Language Summit 2018.

JEP309 Dynamic Class-File Constants Extends the Java class file format to support dynamic constants. Until Java10, only Strings with primitives and literals could be stored in the Constant Pool, but other strings can now be handled in the Constant Pool. The advantage of dynamic constants seems to be that they give you more freedom in your language and compiler, and more freedom in your bytecode constants.

A video about this is available at the JVM Language Summit 2018.

JEP320 Remove the Java EE and CORBA Modules The JavaEE and CORBA modules have been removed. Targets are CORBA, JAXB, JAX-WS, Common Activation Framework, and JTA. These surrogate modules are as follows.

The reason for the deletion seems to be that the difference in development speed cannot keep up with the speed of Java SE. It seems that it will be developed as Jakarta EE in the future.

JEP321 HTTP Client (Standard) The HTTP Client API has been standardized. Asynchronous support, HTTP / 2 support. The module name is java.net.http.

A video about this has been released.

JEP323 Local-Variable Syntax for Lambda Parameters You can now use var with lambda parameters as well as local variable type inference introduced in Java 10. You can now add more annotations. A video about this has been released.

Recommended Posts

Changes in Java 11
Changes in Mockito 2
Partization in Java
Changes in mybatis-spring-boot-starter 2.0
Changes in mybatis-spring-boot-starter 2.1
Changes in mybatis-spring-boot-starter 1.3
Rock-paper-scissors in Java
Changes in mybatis-spring-boot-starter 1.2
Pi in Java
FizzBuzz in Java
[java] sort in list
Read JSON in Java
Interpreter implementation in Java
Make Blackjack in Java
Rock-paper-scissors app in Java
Constraint programming in Java
Put java8 in centos7
Changes from Java 8 to Java 11
NVL-ish guy in Java
Combine arrays in Java
"Hello World" in Java
Callable Interface in Java
Azure functions in java
Format XML in Java
Simple htmlspecialchars in Java
Boyer-Moore implementation in Java
Hello World in Java
Use OpenCV in Java
webApi memorandum in java
Type determination in Java
Ping commands in Java
Various threads in java
Heapsort implementation (in java)
Zabbix API in Java
ASCII art in Java
Compare Lists in Java
POST JSON in Java
Express failure in Java
Create JSON in Java
Date manipulation in Java 8
What's new in Java 8
Changes in JUnit5M4-> M5
Use PreparedStatement in Java
What's new in Java 9,10,11
Parallel execution in Java
Initializing HashMap in Java
Try using RocksDB in Java
Read binary files in Java 1
Get EXIF information in Java
Save Java PDF in Excel
[Neta] Sleep Sort in Java
Java history in this world
Let Java segfault in 6 lines
Try calling JavaScript in Java
Try developing Spresense in Java (1)
Try functional type in Java! ①
I made roulette in Java.
Create hyperlinks in Java PowerPoint
Refactoring: Make Blackjack in Java
Write flyway callbacks in Java
Topic Analysis (LDA) in Java