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

Eclipse JDT Embraces Java 9 – An Insider’s View

Apr 05, 2017

Download

Technology

Dev_Events
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Eclipse JDT Embraces Java 9 – An Insider’s View

ECLIPSE JDT EMBRACES JAVA 9AN INSIDER’S VIEW

MANOJ PALAT, IBM

Page 2: Eclipse JDT Embraces Java 9 – An Insider’s View

ACKNOWLEDGEMENTS

• Stephan Herrmann

• Sasikanth Bharadwaj

• Jay Arthanareeswaran

• Till Brychcy

• Stefan Xenos

• Markus Keller

• Mateusz Matela

• Sergey Prigogin

• Fabian Steeg

• Igor Fedorenko

DevoxxUS 2017

Page 3: Eclipse JDT Embraces Java 9 – An Insider’s View

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

Page 4: Eclipse JDT Embraces Java 9 – An Insider’s View

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

Page 5: Eclipse JDT Embraces Java 9 – An Insider’s View

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

Page 6: Eclipse JDT Embraces Java 9 – An Insider’s View

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;

}

Page 7: Eclipse JDT Embraces Java 9 – An Insider’s View

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

Page 8: Eclipse JDT Embraces Java 9 – An Insider’s View

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

Page 9: Eclipse JDT Embraces Java 9 – An Insider’s View

MODULAR PLATFORM

DevoxxUS 2017

Page 10: Eclipse JDT Embraces Java 9 – An Insider’s View

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

Page 11: Eclipse JDT Embraces Java 9 – An Insider’s View

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)

Page 12: Eclipse JDT Embraces Java 9 – An Insider’s View

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

Page 13: Eclipse JDT Embraces Java 9 – An Insider’s View

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

Page 14: Eclipse JDT Embraces Java 9 – An Insider’s View

DevoxxUS 2017

Page 15: Eclipse JDT Embraces Java 9 – An Insider’s View

DevoxxUS 2017

Page 16: Eclipse JDT Embraces Java 9 – An Insider’s View

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

Page 17: Eclipse JDT Embraces Java 9 – An Insider’s View

DevoxxUS 2017

THANK YOU