Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 477753

Summary: Erroneous compilation error when using multi-line lambda, ternary, and Collectors.joining()
Product: [Eclipse Project] JDT Reporter: Jeremiah Orr <orr94>
Component: CoreAssignee: Stephan Herrmann <stephan.herrmann>
Status: VERIFIED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: jarthana, orr94
Version: 4.5   
Target Milestone: 4.6 M1   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard:
Attachments:
Description Flags
Example source none

Description Jeremiah Orr CLA 2015-09-17 15:31:57 EDT
Created attachment 256654 [details]
Example source

If I use Stream.map() with a multi-line block that returns with a ternary, then use collect(Collectors.joining()), I get the following compilation error:

The method collect(Collector<? super Object,A,R>) in the type Stream<Object> is not applicable for the arguments (Collector<CharSequence,capture#1-of ?,String>)

If I eliminate the ternary or use the single-line lambda shortcut syntax, there is no problem.

I get no compilation errors when compiling with javac.
Comment 1 Sasikanth Bharadwaj CLA 2015-09-18 03:18:21 EDT
Works fine on master, possible duplicate of bug 463728. Please try with a more recent 4.6 version and reopen if the issue still occurs.

*** This bug has been marked as a duplicate of bug 463728 ***
Comment 2 Jay Arthanareeswaran CLA 2015-12-08 07:19:35 EST
Verified for 4.6 M4 with build I20151207-2000.