Eclipse and Java 8. Daniel Megert Platform and JDT Lead Eclipse PMC Member IBM Rational Zurich Research Lab

Similar documents
Srikanth Sankaran IBM India. Stephan Herrmann GK Software. Noopur Gupta. IBM India. EclipseCon NA 2014 JDT Embraces Lambda Expressions

Java 11 and MAKING ECLIPSE JDT FUTURE READY MANOJ PALAT IBM

Lambdas in Java 8. Start programming in a more functional style

Oracle Corporation

Andy Clement, SpringSource/VMware SpringSource, A division of VMware. All rights reserved

Status Report. JSR-305: Annotations for Software Defect Detection. William Pugh Professor

LAMBDA EXPRESSIONS. Summer 2018

Every language has its own scoping rules. For example, what is the scope of variable j in this Java program?

Nested Classes in Java. Slides by: Alon Mishne Edited by: Eran Gilad, Eyal Moscovici April 2013

Timing for Interfaces and Abstract Classes

Introduction to Java

Java SE 8: Lambda Expressions And The Stream API

The Checker Framework: pluggable static analysis for Java

JavaFX.Next. Kevin Rushforth Oracle Johan Vos Gluon October Copyright 2018, Oracle and/or its affiliates. All rights reserved.

Java How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved.

JVA-103. Java Programming

Constructors for classes

Packages Inner Classes

Object Orientation Fourth Story. Bok, Jong Soon

JavaScript: Sort of a Big Deal,


Wrapper Classes double pi = new Double(3.14); 3 double pi = new Double("3.14"); 4... Zheng-Liang Lu Java Programming 290 / 321

LAMBDA EXPRESSIONS AND STREAMS API

JSR 377 Desktop Application Framework September Andres Almiray

(800) Toll Free (804) Fax Introduction to Java and Enterprise Java using Eclipse IDE Duration: 5 days

CSE 504: Compiler Design. Intermediate Representations Symbol Table

CS321 Languages and Compiler Design I. Winter 2012 Lecture 2

Topic 6: Inner Classes

Java Programming. Manuel Oriol, March 22nd, 2007

Vendor: Oracle. Exam Code: 1Z Exam Name: Java Certified Programmer. Version: Demo

CS18000: Programming I

Kotlin for Android Developers

An Introduction to Software Engineering. David Greenstein Monta Vista High School

CS 315 Software Design Homework 3 Preconditions, Postconditions, Invariants Due: Sept. 29, 11:30 PM

JML and Java 1.5+ David R. Cok Eastman Kodak Company, Research Laboratories 9 October 2008 SAVCBS08 workshop

AJDT: Getting started with Aspect-Oriented Programming in Eclipse

Sri Vidya College of Engineering & Technology

About Tom. CEO BestSolution Systemhaus GmbH. Eclipse Committer. Platform UI EMF. Projectlead: UFaceKit, Nebula. Member of the Architectual Council

CMSC 132: Object-Oriented Programming II

Eclipse project update by the Eclipse project PMC March 11 th 2008

Introduction to Typed Racket. The plan: Racket Crash Course Typed Racket and PL Racket Differences with the text Some PL Racket Examples

Using Type Annotations to Improve Your Code

Chapter 3. Interactive Software Development Assistants Logic-based Software Representation. Logic-based Software Analysis

Programming Languages. Streams Wrapup, Memoization, Type Systems, and Some Monty Python

Object-Oriented Programming Fall Robert Grimm, New York University

DSL vs. Library API Shootout

Topics Covered Thus Far CMSC 330: Organization of Programming Languages

JDT Plug in Developer Guide. Programmer's Guide

Java Language Modularity With Superpackages

Introduction to Programming Using Java (98-388)

CMSC 132: Object-Oriented Programming II

CSE341: Programming Languages Lecture 19 Introduction to Ruby and OOP. Dan Grossman Winter 2013

Project Lambda in Java SE 8

The Heads and Tails of Project Coin

Metadata Features in Java SE 8

Array. Prepared By - Rifat Shahriyar

Class object initialization block destructor Class object

Ruby logistics. CSE341: Programming Languages Lecture 19 Introduction to Ruby and OOP. Ruby: Not our focus. Ruby: Our focus. A note on the homework

You will need to download the Java software development kit from

6.170 Laboratory in Software Engineering Eclipse Reference for 6.170

Java Workshop Lambda Expressions

Anonymous Functions CMSC 330: Organization of Programming Languages

EGF Creation Review. Benoît Langlois - Thales/TCS/EPM. April 22, 2009

Another IS-A Relationship

Jigsaw and OSGi: What the Heck Happens Now?

Using Scala for building DSL s

C++11: 10 Features You Should be Using. Gordon R&D Runtime Engineer Codeplay Software Ltd.

Homework 3 Semantic Analysis. Remi Meier Compiler Design

How to Install (then Test) the NetBeans Bundle

Chapter 1 Getting Started

OHJ-306x: Software Testing Introduction to the Course Project Part 1: General Information and Project phases 1 & 2: Unit testing

Lecture 10 Declarations and Scope

CS 11 java track: lecture 3

C30b: Inner Class, Anonymous Class, and Lambda Expression

FindBugs review of Glassfish v2 b09

JSR 335: Project Lambda. François Sarradin -- Xebia

CS Lecture #14

Program Correctness and Efficiency. Chapter 2

Because you can t fix what you don t know is broken

JSR-305: Annotations for Software Defect Detection

Announcements. Java Review. More Announcements. Today. Assembly Language. Machine Language

1 Shyam sir JAVA Notes

Refactoring with Eclipse

Interface evolution via public defender methods

A Short Summary of Javali

Declarations and Access Control SCJP tips

Introduction to Eclipse and Eclipse RCP

JAVA METHODS OBJECT ORIENTED PROGRAMMING AND DATA STRUCTURES

Asynchronous Functions in C#

Making Void Safety Practical

Java Code Coverage Mechanics

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler Front-End

Object Teams Release Review. Planned Review Date: July 7, 2010 Communcation Channel: Submitted by: Stephan Herrmann

Generic Programming Constructs and Applications in Object-Oriented Languages

COMP322 - Introduction to C++

Retaining Comments when Refactoring Code or

Pointers and Memory 1

CSE 421 Course Overview and Introduction to Java

Weeks 6&7: Procedures and Parameter Passing

Functional Programming in Java. CSE 219 Department of Computer Science, Stony Brook University

Transcription:

Eclipse and Java 8 Daniel Megert Platform and JDT Lead Eclipse PMC Member IBM Rational Zurich Research Lab

Eclipse and Java 8 New Java language features Eclipse features for Java 8 (demo) Behind the scenes 2 2014 IBM Corporation

New Java Language Features 2 JSRs JSR-335: Lambda Expressions JSR-308: Annotations on Java Types 2 JEPs JEP 118: Method Parameter Reflection JEP 120: Repeating Annotations 3 2014 IBM Corporation

JSR-335: Two New Type of Methods Default methods Previous names: Defender methods Virtual extension methods Static interface methods No OOP here! Method must be qualified with exact interface type 4 2014 IBM Corporation

Default Methods Intention Allow evolution of interfaces (esp. in libraries) Methods can be added to interface without API breakage Why part of JSR-335? Allows to add new methods that take a lambda expression: java.util.function.function<t, R> Consequences Multiple inheritance? Yes, but compiler throws error if same method is inherited Need to resolve manually with new construct: I.super.m() 5 2014 IBM Corporation

JSR-335: Lambda Expressions Many names used in the past Lambda Expressions, Closures, Anonymous Methods Function + captured state (can have non-locals) Paradigm of passing a "code block as data" Get rid of verbose anonymous class syntax 6 2014 IBM Corporation

Lambda Expressions Scope Anonymous classes introduce their own scopes Interplay between names in enclosing scope inherited names Capture Can capture explicitly final outer locals And now since 1.8: effectively final locals Expressions at the grammar level Lambda needs a context that provides target type 7 2014 IBM Corporation

Lambda Expressions: Functional Interface Lambda needs a context that provides target type Lambda only allowed for functional interfaces Interface with a single abstract method Default methods don't count, but can be there Static methods are not allowed, but can be there Methods from Object don't count either Optionally annotated with @FunctionalInterface Lambda object implements a functional interface 8 2014 IBM Corporation

JSR-335: Method References Very similar to lambda expressions Also require a target type Target type must be a functional interface Serve as instances of the functional interface Don't provide a method body, but instead: refer to an existing method void dosort(integer[] ints) { Arrays.sort(ints, Integer::compare); } 9 2014 IBM Corporation

JSR-308: Annotations on Java Types But, couldn't we already do this before Java 8? void foo(@foo String s) {} No! The annotation was on the declaration (s) Same here: @Foo String java17() {} So far, only annotations on declarations ElementType: packages, classes, fields, methods, Java 8: annotations on types ElementType.TYPE_PARAMETER ElementType.TYPE_USE 10 2014 IBM Corporation

JSR-308: Annotations on Java Types Allows to add constraints to types anywhere in the code Leveraged in Eclipse to improve null analysis 11 2014 IBM Corporation

JEP 118: Parameter Reflection New compiler option that allows to write method parameter information into the class file As of Java 8, this is just the parameter name Future releases might write additional information New class: java.lang.reflect.parameter New API to access parameter information Parameter information that was already in the class file Harvest the new feature (parameter name) New command line option: ecj / javac -parameters 12 2014 IBM Corporation

JEP 120: Repeating Annotations So far, only one annotationof a given annotation type allowed per declaration Java 8 now allows to repeat annotations of the same type, if declared as @Repeatable Example: @Foo(1) @Foo(2) @Bar class A {} 13 2014 IBM Corporation

Behind the Scenes The Team How did we implement the Java 8 specs? Java 8 effort by numbers 14 2014 IBM Corporation

The Team 15 2014 IBM Corporation

Implementing the Specs Initially: javac defined/drove specs Eclipse must only use spec, but Incomplete (April Sept 2013) Inaccurate or undefined in some parts We participated in the JSR expert groups Users report differences between ECJ and javac ECJ? javac bug? JLS bug? Who is the master, JLS or javac? We helped to make the spec more concise! 16 2014 IBM Corporation

Why Oh Why No Java 8 Support in Builds? JDT does not just ship tools for Java 8 but also a full compiler that must implement the specs If specs are not implemented, we can't call it Java The specs come with a license Some terms limit the scope on how/where you can ship implementations of the unfinished spec We will try to get a better license for Java 9 and beyond 17 2014 IBM Corporation

JDT Does Not Accept Contributions! Really? 2012 starts with a JDT team that has 4 core and 4 UI committers/experts Half of the team gone by summer 2012! Hard to find new people with compiler know-how Backfilled by the end of the year BUT: New people had zero knowledge of JDT Hard life for existing committers: train new people and make progress on Java 8 18 2014 IBM Corporation

JDT Does Not Accept Contributions! Really? Not much room/energy to review contributions unrelated to Java 8? JDT spent lots of time to review contributions! JDT Core: 50 contributions from 20 people JDT UI: 47 contributions from 15 people 19 2014 IBM Corporation

Java 8 Effort by Numbers First commit in May 25, 2012 3 big projects tested compiler to build it JDK 8, OpenJFX and Eclipse SDK 31 people contributed code 800 bugs/enhancements fixed for Java 8 1500+ commits 20 2014 IBM Corporation