SlideShare ist ein Scribd-Unternehmen logo
1 von 42
Downloaden Sie, um offline zu lesen
Evolving
            the
Java Programming Language


         Neal Gafter
Overview


The Challenge of Evolving a Language
Design Principles
Design Goals
JDK7 and JDK8
Challenge: Evolving a Language


“What is it like trying to extend a mature lan-
  guage?” -Brian Goetz
Challenge: Evolving a Language


“What is it like trying to extend a mature lan-
  guage?”

ma-ture: adjective
1. having completed natural growth and de-
   velopment.
2. completed, perfected, or elaborated in full.
3. (of an industry, technology, market, etc.) no
   longer developing or expanding.
Challenge: Evolving a Language


Q: What is it like trying to extend a mature
  language?


A: It is impossible, by definition.
Challenge: Evolving a Language


Q: What is it like trying to extend a widely de-
  ployed language?

A: Language change is influenced by existing
  code and APIs.
Existing APIs affect change



Support retrofitting existing APIs:
  With compatible behavior
Existing APIs affect change



Support retrofitting existing APIs:
  With compatible behavior

  Consistent with existing design
    Don't expose, create design flaws
Existing APIs affect change


Some case studies:

  Generics (vs erasure)
  Wildcards (vs declaration-site variance)
  Autoboxing, unboxing (vs wrappers)
  Varargs (vs overloading)
  For-each (vs Iterator)
Generics (vs erasure)




Adding reified generics is compatible
May not allow retrofitting existing code
 Collection
 WeakReference
Wildcards (vs declaration-site
           variance)

There is a simpler alternative to wildcards:
  declaration-site variance

  'wildcards' appear on type definitions
  Use sites much simpler
  Can retrofit most APIs
    but not Collection
Autoboxing, unboxing


Type systems form a lattice

       Object
     /        
Number Runnable
   |           /
Integer /
           /
       null
Autoboxing, unboxing


Adding conversions can break the lattice

long <----------> Long
  |                 |
  |                 |
int <----------> Integer

Existing boxed types don't have this relation.
Autoboxing, unboxing


Solutions

  Introduce new boxing interfaces; or
  Patchwork specification
for-each (vs iterator)



Iterator has a vestigal remove method.
Introduce java.lang.Iterator without it?
Cannot retrofit Collection
 without requiring recompile

 (existing implementations don't implement
 iterator() that returns the new type)
Design Principles
Design Principles


Encourage desirable practices (that might
not otherwise be followed) my making them
easy
 synchronized
 Annotations isolate configuration data
 Generics for typesafe APIs
Design Principles


Encourage desirable practices
Isolate language from specific APIs
Design Principles


Encourage desirable practices
Isolate language from specific APIs
Prefer reading over writing
 clarity over conciseness
Design Principles


Encourage desirable practices
Isolate language from specific APIs
Prefer reading over writing
Prefer static typing
Design Principles


Encourage desirable practices
Isolate language from specific APIs
Prefer reading over writing
Prefer static typing
Remain backward compatible
Short-term design Goals


Regularize Existing Language
 Improve diagnostics vs generics
 Fix type inference
 String switch
 Limited operator overloading
 Improved catch clauses
Modularity
Improve Diagnostics vs Generics

interface Box<T> {
    T get();
    void put(T t);
}
class Tmp {
    static void test(Box<? extends Number> box) {
        box.put(box.get());
    }
}

Error: put(capture#417 of ? extends java.lang.Number)
   in Box<capture#417 of ? extends java.lang.Number>
   cannot be applied to (java.lang.Number)
        box.put(box.get());
           ^
Improve Diagnostics vs Generics

interface Box<T> {
    T get();
    void put(T t);
}
class Tmp {
    static void test(Box<? extends Number> box) {
        box.put(box.get());
    }
}

Error: cannot call put(T) as a member of in Box<? ex-
   tends java.lang.Number>
        box.put(box.get());
           ^
Fix Type Inference: constructors


  Today:

Map<String, List<String>> anagrams
 = new HashMap<String,
 List<String>>();
Fix Type Inference: constructors


  Proposed:

Map<String, List<String>> anagrams
 = new HashMap<>();
Fix Type Inference: arguments


  Today:

public <E> Set<E> emptySet() { … }
void timeWaitsFor(Set<Man> people) { … }

// * Won't compile!
timeWaitsFor(Collections.emptySet());
Fix Type Inference: arguments


  Today:

public <E> Set<E> emptySet() { … }
void timeWaitsFor(Set<Man> people) { … }

// OK
timeWaitsFor(Collections.<Man>emptySet());
Fix Type Inference: arguments


  Proposed:

public <E> Set<E> emptySet() { … }
void timeWaitsFor(Set<Man> people) { … }

// OK
timeWaitsFor(Collections.emptySet());
String Switch


   Today

static boolean booleanFromString(String s) {
    if (s.equals(quot;truequot;)) {
        return true;
    } else if (s.equals(quot;falsequot;)) {
        return false;
    } else {
        throw new IllegalArgumentException(s);
    }
}
String Switch


   Proposed

static boolean booleanFromString(String s) {
    switch(s) {
      case quot;truequot;:
        return true;
      case quot;falsequot;:
        return false;
      default:
        throw new IllegalArgumentException(s);
    }
}
Limited Operator Overloading


   Today

enum Size { SMALL, MEDIUM, LARGE }

if (mySize.compareTo(yourSize) >= 0)
    System.out.println(“You can wear my pants.”);
Limited Operator Overloading


   Proposed


enum Size { SMALL, MEDIUM, LARGE }

if (mySize > yourSize)
    System.out.println(“You can wear my pants.”);
Improved Catch Clauses: multi


   Today:

try {
    return klass.newInstance();
} catch (InstantiationException e) {
    throw new AssertionError(e);
} catch (IllegalAccessException e) {
    throw new AssertionError(e);
}
Improved Catch Clauses: multi


   Proposed:

try {
    return klass.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
    throw new AssertionError(e);
}
Improved Catch Clauses: rethrow


   Today:

try {
  doable.doit(); // Throws several types
} catch (Throwable ex) {
  logger.log(ex);
  throw ex; // Error: Throwable not declared
}
Improved Catch Clauses: rethrow


   Proposed:

try {
  doable.doit(); // Throws several types
} catch (final Throwable ex) {
  logger.log(ex);
  throw ex; // OK: Throws the same several types
}
Others?


Properties?
Serialization annotations?
Long-term goals


Regularize Existing Language
 Reification
 Further Generics simplification

Concurrency support
 Immutable data
 Control Abstraction
 Closures
 Actors, etc.
JDK7


jsrs 277 + 294 (modularity)
Maintenance review of jsr14
“Small” language issues
Possibly jsr308

(limited by time, resources)
JDK8


  Reification
  Control Abstraction



Further out: Immutable data, pattern match-
 ing, further operator overloading?
Q&A

Weitere ähnliche Inhalte

Was ist angesagt?

Introduction to Google Guice
Introduction to Google GuiceIntroduction to Google Guice
Introduction to Google GuiceKnoldus Inc.
 
MongoDB Stitch Tutorial
MongoDB Stitch TutorialMongoDB Stitch Tutorial
MongoDB Stitch TutorialMongoDB
 
GWT integration with Vaadin
GWT integration with VaadinGWT integration with Vaadin
GWT integration with VaadinPeter Lehto
 
Web前端标准在各浏览器中的实现差异
Web前端标准在各浏览器中的实现差异Web前端标准在各浏览器中的实现差异
Web前端标准在各浏览器中的实现差异Open Party
 
Angular JS2 Training Session #1
Angular JS2 Training Session #1Angular JS2 Training Session #1
Angular JS2 Training Session #1Paras Mendiratta
 
Angular training-course-syllabus
Angular training-course-syllabus Angular training-course-syllabus
Angular training-course-syllabus Training Institute
 
GraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learnedGraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learnedMarcinStachniuk
 
Binding business data to vaadin components
Binding business data to vaadin componentsBinding business data to vaadin components
Binding business data to vaadin componentsPeter Lehto
 
GraphQL - Piękne API w Twojej Aplikacji - KrakowGraphAcademy
GraphQL - Piękne API w Twojej Aplikacji - KrakowGraphAcademyGraphQL - Piękne API w Twojej Aplikacji - KrakowGraphAcademy
GraphQL - Piękne API w Twojej Aplikacji - KrakowGraphAcademyMarcinStachniuk
 
Techlunch - Dependency Injection with Vaadin
Techlunch - Dependency Injection with VaadinTechlunch - Dependency Injection with Vaadin
Techlunch - Dependency Injection with VaadinPeter Lehto
 
Dependency Injections in Kotlin
Dependency Injections in KotlinDependency Injections in Kotlin
Dependency Injections in KotlinEatDog
 
Typed? Dynamic? Both! Cross-platform DSLs in C#
Typed? Dynamic? Both! Cross-platform DSLs in C#Typed? Dynamic? Both! Cross-platform DSLs in C#
Typed? Dynamic? Both! Cross-platform DSLs in C#Vagif Abilov
 
Legacy Code and Refactoring Workshop - Session 1 - October 2019
Legacy Code and Refactoring Workshop - Session 1 - October 2019Legacy Code and Refactoring Workshop - Session 1 - October 2019
Legacy Code and Refactoring Workshop - Session 1 - October 2019Paulo Clavijo
 
What's new and noteworthy in Java EE 8?
What's new and noteworthy in Java EE 8?What's new and noteworthy in Java EE 8?
What's new and noteworthy in Java EE 8?gedoplan
 

Was ist angesagt? (18)

Introduction to Google Guice
Introduction to Google GuiceIntroduction to Google Guice
Introduction to Google Guice
 
MongoDB Stitch Tutorial
MongoDB Stitch TutorialMongoDB Stitch Tutorial
MongoDB Stitch Tutorial
 
GWT integration with Vaadin
GWT integration with VaadinGWT integration with Vaadin
GWT integration with Vaadin
 
Web前端标准在各浏览器中的实现差异
Web前端标准在各浏览器中的实现差异Web前端标准在各浏览器中的实现差异
Web前端标准在各浏览器中的实现差异
 
Vaadin 8 and 10
Vaadin 8 and 10Vaadin 8 and 10
Vaadin 8 and 10
 
Angular JS2 Training Session #1
Angular JS2 Training Session #1Angular JS2 Training Session #1
Angular JS2 Training Session #1
 
Angular training-course-syllabus
Angular training-course-syllabus Angular training-course-syllabus
Angular training-course-syllabus
 
Think jQuery
Think jQueryThink jQuery
Think jQuery
 
GraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learnedGraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learned
 
Binding business data to vaadin components
Binding business data to vaadin componentsBinding business data to vaadin components
Binding business data to vaadin components
 
GraphQL - Piękne API w Twojej Aplikacji - KrakowGraphAcademy
GraphQL - Piękne API w Twojej Aplikacji - KrakowGraphAcademyGraphQL - Piękne API w Twojej Aplikacji - KrakowGraphAcademy
GraphQL - Piękne API w Twojej Aplikacji - KrakowGraphAcademy
 
Graphql, REST and Apollo
Graphql, REST and ApolloGraphql, REST and Apollo
Graphql, REST and Apollo
 
Techlunch - Dependency Injection with Vaadin
Techlunch - Dependency Injection with VaadinTechlunch - Dependency Injection with Vaadin
Techlunch - Dependency Injection with Vaadin
 
Dependency Injections in Kotlin
Dependency Injections in KotlinDependency Injections in Kotlin
Dependency Injections in Kotlin
 
Typed? Dynamic? Both! Cross-platform DSLs in C#
Typed? Dynamic? Both! Cross-platform DSLs in C#Typed? Dynamic? Both! Cross-platform DSLs in C#
Typed? Dynamic? Both! Cross-platform DSLs in C#
 
Legacy Code and Refactoring Workshop - Session 1 - October 2019
Legacy Code and Refactoring Workshop - Session 1 - October 2019Legacy Code and Refactoring Workshop - Session 1 - October 2019
Legacy Code and Refactoring Workshop - Session 1 - October 2019
 
WCF - In a Week
WCF - In a WeekWCF - In a Week
WCF - In a Week
 
What's new and noteworthy in Java EE 8?
What's new and noteworthy in Java EE 8?What's new and noteworthy in Java EE 8?
What's new and noteworthy in Java EE 8?
 

Andere mochten auch

fotos de anti tuning
fotos de anti tuningfotos de anti tuning
fotos de anti tuningEducentro
 
Google G Data Reading And Writing Data On The Web
Google G Data Reading And Writing Data On The WebGoogle G Data Reading And Writing Data On The Web
Google G Data Reading And Writing Data On The WebQConLondon2008
 
Google G Data Reading And Writing Data On The Web 1
Google G Data Reading And Writing Data On The Web 1Google G Data Reading And Writing Data On The Web 1
Google G Data Reading And Writing Data On The Web 1QConLondon2008
 
14147503 Intentions Interfaces Making Patterns Concrete
14147503 Intentions Interfaces Making Patterns Concrete14147503 Intentions Interfaces Making Patterns Concrete
14147503 Intentions Interfaces Making Patterns ConcreteQConLondon2008
 

Andere mochten auch (6)

fotos de anti tuning
fotos de anti tuningfotos de anti tuning
fotos de anti tuning
 
Google G Data Reading And Writing Data On The Web
Google G Data Reading And Writing Data On The WebGoogle G Data Reading And Writing Data On The Web
Google G Data Reading And Writing Data On The Web
 
Google G Data Reading And Writing Data On The Web 1
Google G Data Reading And Writing Data On The Web 1Google G Data Reading And Writing Data On The Web 1
Google G Data Reading And Writing Data On The Web 1
 
14147503 Intentions Interfaces Making Patterns Concrete
14147503 Intentions Interfaces Making Patterns Concrete14147503 Intentions Interfaces Making Patterns Concrete
14147503 Intentions Interfaces Making Patterns Concrete
 
Agile Mashups
Agile MashupsAgile Mashups
Agile Mashups
 
A Tale Of Two Systems
A Tale Of Two SystemsA Tale Of Two Systems
A Tale Of Two Systems
 

Ähnlich wie Evolving The Java Language

Neal Gafter Java Evolution
Neal Gafter Java EvolutionNeal Gafter Java Evolution
Neal Gafter Java Evolutiondeimos
 
Polyglot Programming in the JVM
Polyglot Programming in the JVMPolyglot Programming in the JVM
Polyglot Programming in the JVMAndres Almiray
 
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningJava 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningCarol McDonald
 
Polyglot Programming @ Jax.de 2010
Polyglot Programming @ Jax.de 2010Polyglot Programming @ Jax.de 2010
Polyglot Programming @ Jax.de 2010Andres Almiray
 
GTAC Boosting your Testing Productivity with Groovy
GTAC Boosting your Testing Productivity with GroovyGTAC Boosting your Testing Productivity with Groovy
GTAC Boosting your Testing Productivity with GroovyAndres Almiray
 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Guillaume Laforge
 
Javaone2008 Bof 5101 Groovytesting
Javaone2008 Bof 5101 GroovytestingJavaone2008 Bof 5101 Groovytesting
Javaone2008 Bof 5101 GroovytestingAndres Almiray
 
Boosting Your Testing Productivity with Groovy
Boosting Your Testing Productivity with GroovyBoosting Your Testing Productivity with Groovy
Boosting Your Testing Productivity with GroovyJames Williams
 
Introduction To Groovy 2005
Introduction To Groovy 2005Introduction To Groovy 2005
Introduction To Groovy 2005Tugdual Grall
 
Java 7 new features
Java 7 new featuresJava 7 new features
Java 7 new featuresShivam Goel
 
Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007Guillaume Laforge
 
Not your father's tests
Not your father's testsNot your father's tests
Not your father's testsSean P. Floyd
 
JavaParser - A tool to generate, analyze and refactor Java code
JavaParser - A tool to generate, analyze and refactor Java codeJavaParser - A tool to generate, analyze and refactor Java code
JavaParser - A tool to generate, analyze and refactor Java codeFederico Tomassetti
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to javaciklum_ods
 
Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)David McCarter
 
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...Guillaume Laforge
 

Ähnlich wie Evolving The Java Language (20)

Neal Gafter Java Evolution
Neal Gafter Java EvolutionNeal Gafter Java Evolution
Neal Gafter Java Evolution
 
Polyglot Programming in the JVM
Polyglot Programming in the JVMPolyglot Programming in the JVM
Polyglot Programming in the JVM
 
Svcc Groovy Testing
Svcc Groovy TestingSvcc Groovy Testing
Svcc Groovy Testing
 
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, TuningJava 5 6 Generics, Concurrency, Garbage Collection, Tuning
Java 5 6 Generics, Concurrency, Garbage Collection, Tuning
 
Polyglot Programming @ Jax.de 2010
Polyglot Programming @ Jax.de 2010Polyglot Programming @ Jax.de 2010
Polyglot Programming @ Jax.de 2010
 
What's New in Groovy 1.6?
What's New in Groovy 1.6?What's New in Groovy 1.6?
What's New in Groovy 1.6?
 
Java Generics
Java GenericsJava Generics
Java Generics
 
GTAC Boosting your Testing Productivity with Groovy
GTAC Boosting your Testing Productivity with GroovyGTAC Boosting your Testing Productivity with Groovy
GTAC Boosting your Testing Productivity with Groovy
 
Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008Groovy Introduction - JAX Germany - 2008
Groovy Introduction - JAX Germany - 2008
 
Javaone2008 Bof 5101 Groovytesting
Javaone2008 Bof 5101 GroovytestingJavaone2008 Bof 5101 Groovytesting
Javaone2008 Bof 5101 Groovytesting
 
Boosting Your Testing Productivity with Groovy
Boosting Your Testing Productivity with GroovyBoosting Your Testing Productivity with Groovy
Boosting Your Testing Productivity with Groovy
 
Introduction To Groovy 2005
Introduction To Groovy 2005Introduction To Groovy 2005
Introduction To Groovy 2005
 
Java 7 new features
Java 7 new featuresJava 7 new features
Java 7 new features
 
Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007Groovy Update - JavaPolis 2007
Groovy Update - JavaPolis 2007
 
Not your father's tests
Not your father's testsNot your father's tests
Not your father's tests
 
JavaParser - A tool to generate, analyze and refactor Java code
JavaParser - A tool to generate, analyze and refactor Java codeJavaParser - A tool to generate, analyze and refactor Java code
JavaParser - A tool to generate, analyze and refactor Java code
 
Clojure And Swing
Clojure And SwingClojure And Swing
Clojure And Swing
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to java
 
Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)Back-2-Basics: .NET Coding Standards For The Real World (2011)
Back-2-Basics: .NET Coding Standards For The Real World (2011)
 
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
 

Mehr von QConLondon2008

J Ruby Power On The Jvm
J Ruby Power On The JvmJ Ruby Power On The Jvm
J Ruby Power On The JvmQConLondon2008
 
Market Risk System Bnp Paribas
Market Risk System Bnp ParibasMarket Risk System Bnp Paribas
Market Risk System Bnp ParibasQConLondon2008
 
The Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryThe Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryQConLondon2008
 
Application Services On The Web Sales Forcecom
Application Services On The Web Sales ForcecomApplication Services On The Web Sales Forcecom
Application Services On The Web Sales ForcecomQConLondon2008
 
Rest Reuse And Serendipity
Rest Reuse And SerendipityRest Reuse And Serendipity
Rest Reuse And SerendipityQConLondon2008
 

Mehr von QConLondon2008 (6)

J Ruby Power On The Jvm
J Ruby Power On The JvmJ Ruby Power On The Jvm
J Ruby Power On The Jvm
 
Market Risk System Bnp Paribas
Market Risk System Bnp ParibasMarket Risk System Bnp Paribas
Market Risk System Bnp Paribas
 
The Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J QueryThe Dom Scripting Toolkit J Query
The Dom Scripting Toolkit J Query
 
Application Services On The Web Sales Forcecom
Application Services On The Web Sales ForcecomApplication Services On The Web Sales Forcecom
Application Services On The Web Sales Forcecom
 
Managers In Scrum
Managers In ScrumManagers In Scrum
Managers In Scrum
 
Rest Reuse And Serendipity
Rest Reuse And SerendipityRest Reuse And Serendipity
Rest Reuse And Serendipity
 

Kürzlich hochgeladen

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 

Kürzlich hochgeladen (20)

Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 

Evolving The Java Language

  • 1. Evolving the Java Programming Language Neal Gafter
  • 2. Overview The Challenge of Evolving a Language Design Principles Design Goals JDK7 and JDK8
  • 3. Challenge: Evolving a Language “What is it like trying to extend a mature lan- guage?” -Brian Goetz
  • 4. Challenge: Evolving a Language “What is it like trying to extend a mature lan- guage?” ma-ture: adjective 1. having completed natural growth and de- velopment. 2. completed, perfected, or elaborated in full. 3. (of an industry, technology, market, etc.) no longer developing or expanding.
  • 5. Challenge: Evolving a Language Q: What is it like trying to extend a mature language? A: It is impossible, by definition.
  • 6. Challenge: Evolving a Language Q: What is it like trying to extend a widely de- ployed language? A: Language change is influenced by existing code and APIs.
  • 7. Existing APIs affect change Support retrofitting existing APIs: With compatible behavior
  • 8. Existing APIs affect change Support retrofitting existing APIs: With compatible behavior Consistent with existing design Don't expose, create design flaws
  • 9. Existing APIs affect change Some case studies: Generics (vs erasure) Wildcards (vs declaration-site variance) Autoboxing, unboxing (vs wrappers) Varargs (vs overloading) For-each (vs Iterator)
  • 10. Generics (vs erasure) Adding reified generics is compatible May not allow retrofitting existing code Collection WeakReference
  • 11. Wildcards (vs declaration-site variance) There is a simpler alternative to wildcards: declaration-site variance 'wildcards' appear on type definitions Use sites much simpler Can retrofit most APIs but not Collection
  • 12. Autoboxing, unboxing Type systems form a lattice Object / Number Runnable | / Integer / / null
  • 13. Autoboxing, unboxing Adding conversions can break the lattice long <----------> Long | | | | int <----------> Integer Existing boxed types don't have this relation.
  • 14. Autoboxing, unboxing Solutions Introduce new boxing interfaces; or Patchwork specification
  • 15. for-each (vs iterator) Iterator has a vestigal remove method. Introduce java.lang.Iterator without it? Cannot retrofit Collection without requiring recompile (existing implementations don't implement iterator() that returns the new type)
  • 17. Design Principles Encourage desirable practices (that might not otherwise be followed) my making them easy synchronized Annotations isolate configuration data Generics for typesafe APIs
  • 18. Design Principles Encourage desirable practices Isolate language from specific APIs
  • 19. Design Principles Encourage desirable practices Isolate language from specific APIs Prefer reading over writing clarity over conciseness
  • 20. Design Principles Encourage desirable practices Isolate language from specific APIs Prefer reading over writing Prefer static typing
  • 21. Design Principles Encourage desirable practices Isolate language from specific APIs Prefer reading over writing Prefer static typing Remain backward compatible
  • 22. Short-term design Goals Regularize Existing Language Improve diagnostics vs generics Fix type inference String switch Limited operator overloading Improved catch clauses Modularity
  • 23. Improve Diagnostics vs Generics interface Box<T> { T get(); void put(T t); } class Tmp { static void test(Box<? extends Number> box) { box.put(box.get()); } } Error: put(capture#417 of ? extends java.lang.Number) in Box<capture#417 of ? extends java.lang.Number> cannot be applied to (java.lang.Number) box.put(box.get()); ^
  • 24. Improve Diagnostics vs Generics interface Box<T> { T get(); void put(T t); } class Tmp { static void test(Box<? extends Number> box) { box.put(box.get()); } } Error: cannot call put(T) as a member of in Box<? ex- tends java.lang.Number> box.put(box.get()); ^
  • 25. Fix Type Inference: constructors Today: Map<String, List<String>> anagrams = new HashMap<String, List<String>>();
  • 26. Fix Type Inference: constructors Proposed: Map<String, List<String>> anagrams = new HashMap<>();
  • 27. Fix Type Inference: arguments Today: public <E> Set<E> emptySet() { … } void timeWaitsFor(Set<Man> people) { … } // * Won't compile! timeWaitsFor(Collections.emptySet());
  • 28. Fix Type Inference: arguments Today: public <E> Set<E> emptySet() { … } void timeWaitsFor(Set<Man> people) { … } // OK timeWaitsFor(Collections.<Man>emptySet());
  • 29. Fix Type Inference: arguments Proposed: public <E> Set<E> emptySet() { … } void timeWaitsFor(Set<Man> people) { … } // OK timeWaitsFor(Collections.emptySet());
  • 30. String Switch Today static boolean booleanFromString(String s) { if (s.equals(quot;truequot;)) { return true; } else if (s.equals(quot;falsequot;)) { return false; } else { throw new IllegalArgumentException(s); } }
  • 31. String Switch Proposed static boolean booleanFromString(String s) { switch(s) { case quot;truequot;: return true; case quot;falsequot;: return false; default: throw new IllegalArgumentException(s); } }
  • 32. Limited Operator Overloading Today enum Size { SMALL, MEDIUM, LARGE } if (mySize.compareTo(yourSize) >= 0) System.out.println(“You can wear my pants.”);
  • 33. Limited Operator Overloading Proposed enum Size { SMALL, MEDIUM, LARGE } if (mySize > yourSize) System.out.println(“You can wear my pants.”);
  • 34. Improved Catch Clauses: multi Today: try { return klass.newInstance(); } catch (InstantiationException e) { throw new AssertionError(e); } catch (IllegalAccessException e) { throw new AssertionError(e); }
  • 35. Improved Catch Clauses: multi Proposed: try { return klass.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new AssertionError(e); }
  • 36. Improved Catch Clauses: rethrow Today: try { doable.doit(); // Throws several types } catch (Throwable ex) { logger.log(ex); throw ex; // Error: Throwable not declared }
  • 37. Improved Catch Clauses: rethrow Proposed: try { doable.doit(); // Throws several types } catch (final Throwable ex) { logger.log(ex); throw ex; // OK: Throws the same several types }
  • 39. Long-term goals Regularize Existing Language Reification Further Generics simplification Concurrency support Immutable data Control Abstraction Closures Actors, etc.
  • 40. JDK7 jsrs 277 + 294 (modularity) Maintenance review of jsr14 “Small” language issues Possibly jsr308 (limited by time, resources)
  • 41. JDK8 Reification Control Abstraction Further out: Immutable data, pattern match- ing, further operator overloading?
  • 42. Q&A