victoriaharry
asked on
Java - Eclipse lambda expressions are not supported in -source 1.7
Hi, Trying to build a java project in Eclipse Neon and I'm getting the error below. When I look at the Java compiler settings for the project it shows as using 1.8 so I'm not sure where it is getting the 1.7 from. My java version is 1.8.0.51. Is there another eclipse settings somewhere which might still be referring to 1.7
lambda expressions are not supported in -source 1.7
(use -source 8 or higher to enable lambda expressions)
Thanks
lambda expressions are not supported in -source 1.7
(use -source 8 or higher to enable lambda expressions)
Thanks
Is it a project that we can look at online?
ASKER
no sorry, it is on a client site.
ASKER
I'm guessing the lambada expressions in the code below is causing the issue. Alternatively if there is a way to swap these out so I don't have to use them would work as well
List<TestOutcome> testOutcomes = serenityRunner.getTestOutcomes();
testOutcomes.stream().forEach(outcome -> {
System.out.println("Outcome");
System.out.println(outcome);
System.out.println(outcome.getCompleteName());
System.out.println(outcome.getConciseErrorMessage());
System.out.println(outcome.getErrorMessage());
System.out.println(outcome.getTestFailureCause());
System.out.println(outcome.getTestFailureMessage());
System.out.println(outcome.getTestFailureSummary());
});
sampleResult.setSuccessful(true);
Optional<TestOutcome> firstFailure = testOutcomes.stream().filter(outcome -> outcome.isError() || outcome.isFailure()).findFirst();
firstFailure.ifPresent(failed -> {
sampleResult.setSuccessful(false);
sampleResult.setResponseData(failed.getTestFailureMessage(), null);
sampleResult.setDataType(SampleResult.TEXT);
});
I could probably rewrite that for you, but you'd probably be better off waiting for someone who knows Eclipse well. I don't really use it
Can you provide a screenshot of your Java Compiler settings for your project? Also, are you using Maven?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, the pom still referenced 1.7. I changed it to 1.8 and it built successfully
You're welcome, glad that it is all sorted!