Tiered attribution for Javac 

Javac's type-checking has been streamlined. Let's first review how type-checking works in Java 8; then we will explore the changes in the modern Java platform.

In Java 8, type-checking of poly expressions is handled by a speculative attribution tool. 

Speculative attribution is a method of type-checking as part of javac's compilation process. It has a significant processing overhead.

Using the speculative attribution approach to type-checking is accurate, but lacks efficiency. These checks include argument position and are exponentially slower when testing in the midst of recursion, polymorphism, nested loops, and Lambda expressions. So, the update was intended to change the type-checking schema to create faster results. The results themselves were not inaccurate with speculative attribution; they were just not generated rapidly.

The new approach, available in Java 9-11, uses a tiered attribution tool. This tool implements a tiered approach for type-checking argument expressions for all method calls. Permissions are also made for method overriding. In order for this new schema to work, new structural types are created for each of the following listed types of method arguments:

  • Lambda expressions
  • Poly expressions
  • Regular method calls
  • Method references
  • Diamond instance creation expressions

The changes to javac are more complex than what has been highlighted in this section. There is no immediate impact to developers, other than a more efficient javac and time saved.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset