Bug 476245 - Issue Resolving Type with Java 8 Lambda Functions
Summary: Issue Resolving Type with Java 8 Lambda Functions
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.8.6   Edit
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Target Milestone: 1.8.7   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-31 11:58 EDT by Matt Wittmann CLA
Modified: 2015-09-04 16:34 EDT (History)
1 user (show)

See Also:


Attachments
Source code demonstrating bug (339 bytes, application/octet-stream)
2015-08-31 11:58 EDT, Matt Wittmann CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Wittmann CLA 2015-08-31 11:58:18 EDT
Created attachment 256265 [details]
Source code demonstrating bug

I get a compiler error from ajc 1.8.6 when I try to compile a Java class making use of lambda functions:

ajc: Type mismatch: cannot convert from Object to boolean

The code that triggers this error is below. Note that this compiles with the Oracle JDK 1.8.0_60 compiler.

import java.util.Optional;

public class Testing {
    public static void main(String[] args) {
        Optional<Integer> value1 = Optional.of(15);
        Optional<Integer> value2 = Optional.of(30);
        boolean passed = value1.flatMap(v1 -> value2.map(v2 -> (v2 / v1) == 2)).orElse(false);
        System.out.println(passed);
    }
}
Comment 1 Andrew Clement CLA 2015-09-04 16:30:25 EDT
Have you tried with an AspectJ 1.8.7 dev build? (the snapshot build on https://www.eclipse.org/aspectj/downloads.php) compiles that code fine (whilst 1.8.6 does not) - so I think it is already fixed.
Comment 2 Andrew Clement CLA 2015-09-04 16:34:25 EDT
I added the sample code here as a testcase, it is definitely passing in 1.8.7.