17
ECLIPSE JDT EMBRACES JAVA 9 AN INSIDER’S VIEW MANOJ PALAT, IBM

Eclipse JDT Embraces Java 9 – An Insider’s View

Embed Size (px)

Citation preview

ECLIPSE JDT EMBRACES JAVA 9AN INSIDER’S VIEW

MANOJ PALAT, IBM

ACKNOWLEDGEMENTS

• Stephan Herrmann

• Sasikanth Bharadwaj

• Jay Arthanareeswaran

• Till Brychcy

• Stefan Xenos

• Markus Keller

• Mateusz Matela

• Sergey Prigogin

• Fabian Steeg

• Igor Fedorenko

DevoxxUS 2017

AGENDA

• Java 9 Features from JDT Perspective

• General introduction to the feature

• changes in JDT for the feature

• Current status of the implementation

• Demo

• Eclipse launch with JDK 9 (ea-159)

• Eclipse/JDT Architecture

• What’s new in Java 9 – high level

• Module Concepts

• IDE (Migrating + other features)

• Command Line Compiler

• Milling Project Coin

• References/Resources

• Future Work

DevoxxUS 2017

ECLIPSE/JDT ARCHITECTURE

DevoxxUS 2017

ECLIPSE JAVA COMPILER

JAVA MODEL

• Model from Project• CU, Type, Methods• Lightweight - views

BatchCompiler

JAVA SEARCH

• Declarations• References• Hierarchy

DOM AST

• Fine grained• Statements, identifiers• Fully resolved

JAVA DEVELOPMENT TOOLS (JDT) UI

KEY CHANGES IN JAVA /JDK 9

• JEP 261 : Java Platform Module System (JSR 376)

• Link time phase – jlink

• Module path options (javac, jlink, and java)

• Modular jar file

• Jmod format

• JEP 200: The Modular JDK

• JEP 220: Modular Runtime Images

• JEP 260: Encapsulate internal APIs

• jdeps –jdkinternals

• JEP 223: New Version String Scheme

• $MAJOR.$MINOR.$SECURITY.$PATCH

• JEP 213: Milling Project Coin

• A few small changes

DevoxxUS 2017

second

DevoxxUS 2017

first

pack21, pack22

pack23.internal

third zfourth

Identify the module

Dependence

Readability

Accessibility

Implied Readability

Module Graph

pack21, pack22

MODULES

pack31

// module-info.java module first {

requires second;}

module second {exports pack21, pack22;requires zfourth;requires transitive third;

}

MODULE-INFO. JAVA -> MODULE-INFO.CLASS

• attribute_name_index

• explicit module info

• requires table – requires_index

• exports table

• exports_to_count

• internal Packages

DevoxxUS 2017

Modular Run-Time Images

• Source modules

• Jar files

• New Format!• All in one big (+ couple more) Jimage (or)

• Individual JMOD files

• Format of the archive probably will remain internal

• Java.nio based File system provider (jrt-fs)• Works with JRE 8 and above

DevoxxUS 2017

MODULAR PLATFORM

DevoxxUS 2017

COMPILER CHANGES

Enhancements

• New keywords recognition

• Error reporting as per jls at various levels

• Implicit accessibility checks

• Translating into class file

• Reading the new class attributes

• Fishing out info from binary format -jrtfs

• Module-path and command line changes

Demo

• Source modules (--module-source-path)

• Binary modules (-mp)

• Target JDK -system

• Error reporting

DevoxxUS 2017

ECLIPSE IDE: JDT CHANGES/DEMO

• Package Explorer

• Java Model

• DOM

• Content Assist

• Search

• Quick Fix

DevoxxUS 2017

• One Module in a Project

• Support for JDK 9 addition

• Reading the new format – Lookup

• Module Dependency Capture

• Migrating existing code to Java 9 (not very proud)

MILLING PROJECT COIN

• Allow @SafeVargs on private instance methods. (9.6.4.7)

• Allow effectively-final variables to be used as resources in the try-with-resources statement. (14.20.3)

• Allow diamond with anonymous classes if the argument type of the inferred type is denotable.

• Complete the removal, begun in Java SE 8, of underscore from the set of legal identifier names.

• Add support for private interface methods.

DevoxxUS 2017

USEFUL LINKS

Install Options

• Marketplace: https://marketplace.eclipse.org/content/java-9-support-beta-oxygen

• Y-Build Page: http://download.eclipse.org/eclipse/downloads/YIndex.php

• P-Build (Update Site): http://download.eclipse.org/eclipse/updates/4.6-P-builds

References

• JDT/Core Java 9 Enhancement Tracker Root: https://bugs.eclipse.org/bugs/show_bug.cgi?id=457413

• State of the module System: http://openjdk.java.net/projects/jigsaw/spec/sotms/

• Milling Project Coin: http://openjdk.java.net/jeps/213

DevoxxUS 2017

DevoxxUS 2017

DevoxxUS 2017

DEMO

• Installation Options

• Java Model JDK9 Modules Display

• Migration Helper

• A simple module-info.java file

• Content Assist

• Dependency of two modules

• Error displays

• Eff. Final Try Statement

• Command Line Options

DevoxxUS 2017

DevoxxUS 2017

THANK YOU