JDT Embraces Java 8 Stephan Herrmann - Eclipse · JDT Embraces Java 8 Stephan Herrmann Committer:...
Transcript of JDT Embraces Java 8 Stephan Herrmann - Eclipse · JDT Embraces Java 8 Stephan Herrmann Committer:...
JDT Embraces Java 8
Stephan HerrmannCommitter:– Object Teams– JDT
8
Java 8 ready
© 2014 by Stephan Herrmann; made available under the EPL v1.0
Eclipse DemoCamp 2014, Munich, Germany
JDT Embraces Java 8 - © 2014 by Stephan Herrmann; EPL v1.0 #2
THE RETAIL APPLICATION Company– POS– Store Integration– Mobile Devices– ...
© 2014 by Stephan Herrmann; made available under the EPL v1.0
Eclipse DemoCamp 2014, Munich, Germany
...
Domain Specific Languages
Java (Server & Client)
Hardware Integration
Schöneck, VogtlandSt. Ingbert, Saarland
BerlinKöln
JDT Embraces Java 8 - © 2014 by Stephan Herrmann; EPL v1.0 #3
● Jay Arthanareeswaran● Anirban Chakarborty● Manoj Palat● Shankha Banerjee● Manju Mathew● Noopur Gupta● Deepak Azad● Srikanth Sankaran
● Andy Clement● Steve Francisco● Michael Rennie● Olivier Thomann● Curtis Windatt
● Walter Harley● David Williams ● Dani Megert
● Markus Keller
Java 8 Support: Luna ~ “SR1”
Released March 18th!
● Jesper S. Møller
● Stephan Herrmann
JDT Embraces Java 8 - © 2014 by Stephan Herrmann; EPL v1.0 #4
Eclipse and Java™ 8
● Java 8 features supported: – JSR 308 - Type Annotations.
– JEP 120 - Repeating Annotations.
– JEP 118 - Method Parameter Reflection.
– JSR 269 - Pluggable Annotation Processor API & javax.lang.model API enhancements for Java 8.
– JSR 335 – Lambda Expressions● Lambda expressions & method/constructor references● Support for “code carrying” interface methods● Enhanced target typing
new overload resolution & type inference
JDT Embraces Java 8 - © 2014 by Stephan Herrmann; EPL v1.0 #5
Evolution or Disruption
● Assumptions made in the implementation– Grammar can be made to conform to LALR(1)
– Type bindings can be compared with “==” (interned)
– Compilation happens in sequential phases● overload resolution is based on types being resolved● flow analysis starts after resolution is completed
– Indexing is word-based (parsing suffices)
– Code completion can stop parsing at cursor
None of these assumptions are valid for Java 8None of these assumptions are valid for Java 8
JDT Embraces Java 8 - © 2014 by Stephan Herrmann; EPL v1.0 #6
Revolution
● Fundamental changes in many places● Full rewrite of
– Type Inference
JDT Embraces Java 8 - © 2014 by Stephan Herrmann; EPL v1.0 #8
Demo: λ
JDT Embraces Java 8 - © 2014 by Stephan Herrmann; EPL v1.0 #9
● DEMO JDT Support for Lambda– Quick assist
● to / from lambda● expression block↔
– Hover ● to see the functional type● to see inference results
● Not shown– Search / Type hierarchy / Refactoring
● are lambda aware
JDT Embraces Java 8 - © 2014 by Stephan Herrmann; EPL v1.0 #10
The Compiler
● Reasons for having our own compiler– incremental compilation (as you type)
● good error recovery
– run even code with errors
– use compiler information in the UI● visualization● navigation● quick assist & refactoring
– QUALITY ASSURANCE
JDT Embraces Java 8 - © 2014 by Stephan Herrmann; EPL v1.0 #11
spec
abstractly capturethe concepts
ecj
implement the spec,the full spec,and nothing but the spec
deviation
bug?
bug?
bug?
compare behavior
javac
Java Quality Assurance
JDT Embraces Java 8 - © 2014 by Stephan Herrmann; EPL v1.0 #12
Demo: @
JDT Embraces Java 8 - © 2014 by Stephan Herrmann; EPL v1.0 #13
Areas Covered
● Connecting objects to a system– nothing new–
● Algorithms– lambda expressions
– library updates for lambdas
● Types– type annotations
– type inference
NPE
λ
JDT Embraces Java 8 - © 2014 by Stephan Herrmann; EPL v1.0 #14
Object Composition
● Properties– Dynamism:
roles can come and go(same base object)
– Multiplicities:one base can play several roles(different/same role types)
playedBy Relationship
Personname
Employeesalary
«playedBy»
joe: Personname=”joe”
:Studentmatr=0815
«base»
:Employeesalary=100
«base»
:Employeesalary=2000
«bas
e»
Employeesalary
Role Base
Personname
JDT Embraces Java 8 - © 2014 by Stephan Herrmann; EPL v1.0 #15
Areas Covered
● Connecting objects to a system– Object Teams–
● Algorithms– lambda expressions
– library updates for lambdas
● Types– type annotations
– type inference
NPE
λ Java 8 ready