Link to home
Start Free TrialLog in
Avatar of victoriaharry
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
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Is it a project that we can look at online?
Avatar of victoriaharry
victoriaharry

ASKER

no sorry, it is on a client site.
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);
            });

Open in new window

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?
User generated image
I'm using maven to build
ASKER CERTIFIED SOLUTION
Avatar of mccarl
mccarl
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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!