+ All Categories
Home > Documents > JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair...

JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair...

Date post: 14-Aug-2020
Category:
Upload: others
View: 1 times
Download: 0 times
Share this document with a friend
38
Stephan Herrmann JDT embraces Java™ 9 An insider's view J D T Simply Retail.
Transcript
Page 1: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

Stephan Herrmann

JDT embraces Java™ 9—

An insider's view

JDT

Simply Retail.

Page 2: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

2

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

JDT embraces Java™ 9

A Play in 4 Acts

Page 3: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

3

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 1

What is Jigsaw all about?

That's simple and easy!That's simple and easy!

Page 4: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

4

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Simple: Module Syntax vs. OSGi Manifest

module org.m1 { …

requires org.m2;

requires transitive org.m3;

exports org.pack1;

exports org.pack2 to org.m2;

provides org.Ifc with org.Impl;

uses org.Ifc;

Bundle-SymbolicName: org.m1

Require-Bundle: org.m2

org.m3;visibility:=reexport

Export-Package: org.pack1

org.pack2;x-friends=”org.m2”

service.xml

module-info.java MANIFEST.MF

<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="IMyService"> <implementation class="org.Impl"/> <service> <provide interface="org.Ifc"/> </service></scr:component>

Page 5: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

5

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 1: That's simple and easy!

DEMO: Modules in Eclipse(YourProject > Configure > Create module-info.java)

Page 6: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

6

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 2

A closer look at module-info–

from a tool smith's perspective

Expect a slightsense of surpriseExpect a slight

sense of surprise

Page 7: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

7

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 2: Something's weird

JDT API (1):

org.eclipse.jdt.core.ToolFactory.createScanner(..)

org.eclipse.jdt.core.compiler.IScanner

● void resetTo(int startPosition, int endPosition)

● int getNextToken()

org.eclipse.jdt.core.compiler.ITerminalSymbols.TokenNameIdentifier

In Java 9 this API is beyond repair

restricted keywords:● “keywords that are keywords when they are keywords, else identifiers” [my words]

● classification keyword / identifier happens after parsing

Is module-info.class a “real” class file?

Page 8: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

8

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 2: Something's weird

JDT API (1):

org.eclipse.jdt.core.ToolFactory.createScanner(..)

org.eclipse.jdt.core.compiler.IScanner

● void resetTo(int startPosition, int endPosition)

● int getNextToken()

org.eclipse.jdt.core.compiler.ITerminalSymbols.TokenNameIdentifier

In Java 9 this API is beyond repair

restricted keywords:● “keywords that are keywords when they are keywords, else identifiers” [my words]

● classification keyword / identifier happens after parsing

Is module-info.class a “real” class file?

import to.uses;import to.module;import to.to;

module module { requires requires; exports to to exports; uses module; provides uses with to; requires transitive;}

import to.uses;import to.module;import to.to;

module module { requires requires; exports to to exports; uses module; provides uses with to; requires transitive;}

technically clean solution exists:^

but has been rejected

Page 9: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

9

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 2: Something's weird

JDT API (1):

org.eclipse.jdt.core.ToolFactory.createScanner(..)

org.eclipse.jdt.core.compiler.IScanner

● void resetTo(int startPosition, int endPosition)

● int getNextToken()

org.eclipse.jdt.core.compiler.ITerminalSymbols.TokenNameIdentifier

In Java 9 this API is beyond repair

restricted keywords:● “keywords that are keywords when they are keywords, else identifiers” [my words]

● classification keyword / identifier happens after parsing

should we remove this API (and break all clients of JDT)?

just hope that nobody will use it for module-info.java?

mmh,

Is module-info.java “real” Java?

mmh,

Is module-info.java “real” Java?Is module-info.class a “real” class file?

Page 10: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

10

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 2: Something's weird

JDT API (2):

org.eclipse.jdt.core.IClassFile.getType()

● will never answer null

● unless the class file is module-info.class!

clients need to know the difference:

● org.eclipse.jdt.core.IOrdinaryClassFile

● org.eclipse.jdt.core.IModularClassFile

@Deprecated

Page 11: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

11

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 2.5: Something's weird

Another damaged API

Page 12: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

12

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 2.5: Something's weird

JDT API (3):

org.eclipse.jdt.core.IClasspathContainer

● e.g., JRE System Library

● resolves to n IClasspathEntry;s

● each resolved entry representing a library or project, here: jar

Page 13: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

13

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 2.5: Something's weird

JDT API (3):

org.eclipse.jdt.core.IClasspathContainer

● e.g., JRE System Library

● resolves to n IClasspathEntry;s

● each resolved entry representing a library or project, here: jar

Format changed:

no longer uses jars

Format changed:

no longer uses jars

Page 14: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

14

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 2.5: Something's weird

JDT API (3):

org.eclipse.jdt.core.IClasspathContainer

● e.g., JRE System Library

● resolves to n IClasspathEntry;s

● each resolved entry representing a library or project, here: jar

org.eclipse.jdt.core.IJavaProject.findPackageFragmentRoots(IClasspathEntry)

● still works ☺

● returns IPackageFragmentRoot[] even for single resolved JRE entry

● each IPackageFragmentRoot corresponds to one module

Format changed:

no longer uses jars

Format changed:

no longer uses jars

Page 15: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

15

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 2: Something's weird

End of Act 2

Page 16: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

16

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 3

There is complexity—

Questions:What is the meaning of a.b.C1?Is the reference a.b.C1 legal?

Does Java 9 support split packages?

Page 17: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

17

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 3: Characters

JPMS

Java Language Specification (JLS)

everything that a compiler engineer needs to know (?)

Java Virtual Machine Specification (JVMS)

the fine print (class file format)

JEP 261 (“Module System”)

see here for command line options

JDK API Documentation

find here the platform aspect of Jigsaw

Page 18: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

18

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 3: Concepts

How we want to see the world:

Module 1

package a

C1 C2C0

package a.b

C1 C3

Module 2

package a.c

C1 C2

package a.b

C1 C4

requires

Page 19: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

19

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 3: Realization

This is the world according to JLS:

Module 1 Module 2

C1

CU1

C0

associated with

CU2

C2

package a

declarespackage a.bis member

within

CU1

C1

CU1

C1

package a.c

CU2

C2

requires

exports

Page 20: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

20

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 3: unnecessary complexity

Containment

module

package

class

Independent

packages among each other

Module 1

package aC1 C2C0

package a.bC1 C3

Module 2

package a.cC1 C2

package a.bC1 C4

requires

Emulation by indirect relations

cu is associated to module

cu declares package

cu contains class

Containment

package

sub-package

Mod-ule 1

Mod-ule 2C1

C0

CU1

C2CU2

package apackage a.b

C1CU1 CU1

C1

package a.c

C2CU2

requires

Page 21: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

21

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 3: Putting it to work

Inside Module2, what does a.b.C1 mean?

a.b.C1 is found in the CU1 associated with Module2 ✔

package a.b is uniquely visible from Module2 ✔

Module 1 Module 2

C1

CU1

C0CU2

C2

package apackage a.b

CU1

C1

CU1

C1

package a.c

CU2

C2

requires

Page 22: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

22

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 3: Putting it to work

Inside Module2, what does a.b.C1 mean?

package a.b is not uniquely visible, could be from Module1 or from Module2

this configuration is illegal

Module 1 Module 2

C1

CU1

C0CU2

C2

package apackage a.b

CU1

C1

CU1

C1

package a.c

CU2

C2

requires

CUX

X

Page 23: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

23

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 3: Legal but broken

Module 1 Module 2

C1

CU1

C0CU2

C2

package apackage a.b

CU1

C1

CU1

C1

package a.c

CU2

C2

requires

$ java -m Module2Error occurred during initialization of boot layerjava.lang.LayerInstantiationException: Package a.b in both module Module1 and module Module2$ _

Need a Layer implementationthat is capable of classloader-based isolation.

Need a Layer implementationthat is capable of classloader-based isolation.

Page 24: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

24

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 3: Legal but asking for trouble

API LeakAPI mentions a type, which the client cannot mention

legal

new complexity in the implementation

put overloading and inheritance in the mix: infinite supply of new Java puzzlers

Module 1 Module 2

C1

CU1

C0CU2

C2

package apackage a.b

CU1

C1

CU1

C1

package a.c

CU2

C2

requires

public void doSomething(a.b.C1 arg) { … }public void doSomething(a.b.C1 arg) { … }

Missed Opportunity● API leaks should be illegal● Or method should be unmentionable for clients

Missed Opportunity● API leaks should be illegal● Or method should be unmentionable for clients

Page 25: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

25

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 3: summary encapsulation

Split packages

concealed: legal● but no promise that the runtime can handle it

● need a capable Layer implementation

merging a package (like fragment & host bundle) is illegal● even if no class-level conflict is involved

API leaks

JLS is silent

compilers issue warnings● attempts to coordinate warnings had little effect

Page 26: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

26

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 3: State of the Specification

2 Implementations & 1 Specification

JLS should be “boss”

Work on ecj is QA for Java

Put JLS to the center of every bug discussion

JLS 9

Quality

Time

spec

ecjdeviation

bugs

bug?

bug?javac

Page 27: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

28

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 3: There is Complexity

End of Act 3

A simple surfacerealized by complexity

Page 28: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

29

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 4

There's a lot more

Page 29: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

30

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Sun Shine & Roses?

http://openjdk.java.net/projects/jigsaw/spec/issues/Module declarations: #ModuleNameSyntax · #ModuleNameCharacters · #CompileTimeDependences · #ModuleAnnotations ✔ ✔ ✔

· #ModuleDeprecation · #ExportAnnotation · #✔ ✔ ✔ CompilationWithConcealedPackages ? · #ResolutionAtCompileTime ? · #RestrictedKeywords ?

Module artifacts: #MultiModuleExecutableJARs · #MultiModuleJARs · #ReifiedModuleGraphs · #AddExportsInManifest ✔ ✔ ✔ ✔

Module descriptors: #ClassFileModuleName · #ClassFileAccPublic · #ClassFileAccModule · #StandardModuleAttributes ✔ ✔ ✔ ✔

Automatic modules: #CustomizableAutomaticModuleNameMapping · #ModuleNameInManifest · #AutomaticModuleNames ✔ ✔ ✔

Module graphs: #CyclicDependences · #MutableConfigurations · #LazyConfigurationAndInstantiation ✔ ✔ ✔

Services: #ServiceLoaderEnhancements ✔

Reflection: #ClassFilesAsResources · #ResourceEncapsulation · #ResourceExistenceAndSize · ✔ ✔ ✔#ReflectiveAccessToNonExportedTypes · #AwkwardStrongEncapsulation · #ReflectionWithoutReadability · ✔ ✔ ✔#ReadabilityAddedByLayerCreator · #IndirectQualifiedReflectiveAccess · #MoveModuleAndLayerClasses ✔ ✔ ✔

Class loaders: #AvoidConcealedPackageConflicts · #PlatformClassLoader · #ClassLoaderNames ✔ ✔ ✔

Versioning: #StaticLayerConfiguration · #MultipleModuleVersions · #VersionsInModuleNames · #VersionedDependences · ✔ ✔ ✔ ✔#VersionSyntax · #ModuleIdentifiers ✔ ✔

Layers: #NonHierarchicalLayers · #DiscardableModules · #LayerPrimitives ✔ ✔ ✔

Tooling: #BootstrapClassLoaderSearchInJVMTI · #ReflectiveAccessByInstrumentationAgents ✔ ✔

#AwkwardStrongEncapsulation

Page 30: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

31

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Sun Shine & Roses?

http://openjdk.java.net/projects/jigsaw/spec/issues/Module declarations: #ModuleNameSyntax · #ModuleNameCharacters · #CompileTimeDependences · #ModuleAnnotations ✔ ✔ ✔

· #ModuleDeprecation · #ExportAnnotation · #✔ ✔ ✔ CompilationWithConcealedPackages ? · #ResolutionAtCompileTime ? · #RestrictedKeywords ?

Module artifacts: #MultiModuleExecutableJARs · #MultiModuleJARs · #ReifiedModuleGraphs · #AddExportsInManifest ✔ ✔ ✔ ✔

Module descriptors: #ClassFileModuleName · #ClassFileAccPublic · #ClassFileAccModule · #StandardModuleAttributes ✔ ✔ ✔ ✔

Automatic modules: #CustomizableAutomaticModuleNameMapping · #ModuleNameInManifest · #AutomaticModuleNames ✔ ✔ ✔

Module graphs: #CyclicDependences · #MutableConfigurations · #LazyConfigurationAndInstantiation ✔ ✔ ✔

Services: #ServiceLoaderEnhancements ✔

Reflection: #ClassFilesAsResources · #ResourceEncapsulation · #ResourceExistenceAndSize · ✔ ✔ ✔#ReflectiveAccessToNonExportedTypes · #AwkwardStrongEncapsulation · #ReflectionWithoutReadability · ✔ ✔ ✔#ReadabilityAddedByLayerCreator · #IndirectQualifiedReflectiveAccess · #MoveModuleAndLayerClasses ✔ ✔ ✔

Class loaders: #AvoidConcealedPackageConflicts · #PlatformClassLoader · #ClassLoaderNames ✔ ✔ ✔

Versioning: #StaticLayerConfiguration · #MultipleModuleVersions · #VersionsInModuleNames · #VersionedDependences · ✔ ✔ ✔ ✔#VersionSyntax · #ModuleIdentifiers ✔ ✔

Layers: #NonHierarchicalLayers · #DiscardableModules · #LayerPrimitives ✔ ✔ ✔

Tooling: #BootstrapClassLoaderSearchInJVMTI · #ReflectiveAccessByInstrumentationAgents ✔ ✔

#AwkwardStrongEncapsulation

“kill switch:”

–permit-illegal-access

Page 31: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

32

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Sun Shine & Roses?

http://openjdk.java.net/projects/jigsaw/spec/issues/Module declarations: #ModuleNameSyntax · #ModuleNameCharacters · #CompileTimeDependences · #ModuleAnnotations ✔ ✔ ✔

· #ModuleDeprecation · #ExportAnnotation · #✔ ✔ ✔ CompilationWithConcealedPackages ? · #ResolutionAtCompileTime ? · #RestrictedKeywords ?

Module artifacts: #MultiModuleExecutableJARs · #MultiModuleJARs · #ReifiedModuleGraphs · #AddExportsInManifest ✔ ✔ ✔ ✔

Module descriptors: #ClassFileModuleName · #ClassFileAccPublic · #ClassFileAccModule · #StandardModuleAttributes ✔ ✔ ✔ ✔

Automatic modules: #CustomizableAutomaticModuleNameMapping · #ModuleNameInManifest · #AutomaticModuleNames ✔ ✔ ✔

Module graphs: #CyclicDependences · #MutableConfigurations · #LazyConfigurationAndInstantiation ✔ ✔ ✔

Services: #ServiceLoaderEnhancements ✔

Reflection: #ClassFilesAsResources · #ResourceEncapsulation · #ResourceExistenceAndSize · ✔ ✔ ✔#ReflectiveAccessToNonExportedTypes · #AwkwardStrongEncapsulation · #ReflectionWithoutReadability · ✔ ✔ ✔#ReadabilityAddedByLayerCreator · #IndirectQualifiedReflectiveAccess · #MoveModuleAndLayerClasses ✔ ✔ ✔

Class loaders: #AvoidConcealedPackageConflicts · #PlatformClassLoader · #ClassLoaderNames ✔ ✔ ✔

Versioning: #StaticLayerConfiguration · #MultipleModuleVersions · #VersionsInModuleNames · #VersionedDependences · ✔ ✔ ✔ ✔#VersionSyntax · #ModuleIdentifiers ✔ ✔

Layers: #NonHierarchicalLayers · #DiscardableModules · #LayerPrimitives ✔ ✔ ✔

Tooling: #BootstrapClassLoaderSearchInJVMTI · #ReflectiveAccessByInstrumentationAgents ✔ ✔

#AwkwardStrongEncapsulation

“kill switch:”

–permit-illegal-access

–illegal-access={permit,warn,debug,deny}

Page 32: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

33

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 4: Options

Let's map command line optionsto UI

Page 33: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

34

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 4: Options

“Is modular”

Edit: enter the rabbit hole

Page 34: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

35

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 4: Options

“Is modular”

Edit: enter the rabbit hole

Contents

what you ask for

what you get

--limit-modules

default as per JEP 261

Page 35: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

36

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 4: Options

“Is modular”

Edit: enter the rabbit hole

Contents

what you ask for

what you get

--limit-modules

default as per JEP 261

Details

--add-exports

--add-reads (rarely needed)

--patch-module (careful!)

Page 36: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

37

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Act 4: Options

“Is modular”

Edit: enter the rabbit hole

Contents

what you ask for

what you get

--limit-modules

default as per JEP 261

Details

--add-exports

--add-reads (rarely needed)

--patch-module (careful!)

Power switch

Page 37: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

38

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Epilogue

Act 4: Modifying Encapsulation?

“Gradual Encapsulation” [Herrmann 2008]● encapsulation should be your friend

● sometimes it's your enemy

● technology vs. stakeholders

● enforcement & negotiation

Act 3: Isolation?

Separate namespace per module?● partly achieved / emulated

● several opportunities missed

Act 2: Compatibility?

Java 9 is disruptive● against frameworks and applications

● against tools

Page 38: JD JDT embraces Java™ 9 T - EclipseCon 2020€¦ · In Java 9 this API is beyond repair restricted keywords: “keywords that are keywords when they are keywords, else identifiers”

39

JDT

Stephan Herrmann @EclipseCon Europe 2017 – published under the EPL

Epilogue

Act 4: Modifying Encapsulation?

“Gradual Encapsulation” [Herrmann 2008]● encapsulation should be your friend

● sometimes it's your enemy

● technology vs. stakeholders

● enforcement & negotiation

Act 3: Isolation?

Separate namespace per module?● partly achieved / emulated

● several opportunities missed

Act 2: Compatibility?

Java 9 is disruptive● against frameworks and applications

● against tools

@NonNullByDefaultmodule org.eclipse.mymodule { …}

@NonNullByDefaultmodule org.eclipse.mymodule { …}

coming soon:coming soon:


Recommended