Bug 474001

Summary: Consider Java 8 impact on Handly API design
Product: [Technology] Handly Reporter: Vladimir Piskarev <pisv>
Component: CoreAssignee: Vladimir Piskarev <pisv>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 Keywords: api
Version: 0.4   
Target Milestone: 0.4   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 472914, 474023    

Description Vladimir Piskarev CLA 2015-07-31 05:35:10 EDT
Handly is a relatively new project and Java 8 is coming into mainstream. We can't afford to finalize Handly core APIs without giving careful consideration to potential impact of the new Java 8 features such as default interface methods and streams.
Comment 1 Vladimir Piskarev CLA 2015-07-31 07:37:58 EDT
It is important to note that streams don't mix well with checked exceptions. See for example http://stackoverflow.com/questions/19757300/java-8-lambda-streams-filter-by-method-with-exception

Since many Eclipse Platform APIs throw CoreException, this might become quite an issue for stream-oriented processing. This general problem calls for a general solution. I don't (yet) think we can and should address it separately in Handly.
Comment 2 Vladimir Piskarev CLA 2015-07-31 09:22:20 EDT
Default interface methods would help with evolution of interfaces that clients may implement and could provide convenient "mini-implementations" that don't lock clients into a particular class hierarchy (see bug 474023 for an example of where they would be really useful in Handly).
Comment 3 Vladimir Piskarev CLA 2015-07-31 10:35:25 EDT
Just a note that streams also don't mix especially well with iterables:

http://stackoverflow.com/questions/23114015/why-does-iterablet-not-provide-stream-and-parallelstream-methods
Comment 4 Vladimir Piskarev CLA 2015-07-31 10:41:41 EDT
A broad perspective on API design with Java 8:

https://jarthorn.github.io/EclipseCon2014/java8/
Comment 5 Vladimir Piskarev CLA 2015-08-07 06:16:00 EDT
To summarize, I think that default methods in Java 8 could be really useful for Handly. Streams look promising, but unfortunately don't mix well with checked exceptions such as the CoreException omnipresent in Eclipse. We need to adopt Java 8 as soon as it becomes feasible (bug 474391).