Error while building Strata


#1

I am trying to build Strata in Eclipse and followed the instructions. Most of the projects are good except in Strata-function project, I have a compiler error.
In package com.opengamma.strata.function.marketdata.curve, class CurveInputsMarketDataFunction has getMarketDataValues method (the last method of the class with generic parameters) , I am getting an error “Type mismatch: cannot convert from ImmutableMap<Object,Object> to Map<? extends MarketDataKey<?>,MarketDataBox<?>>”.

Below is the code snippet of the method =

private static Map<? extends MarketDataKey<?>, MarketDataBox<?>> getMarketDataValues(
CalculationEnvironment marketData,
Set<? extends SimpleMarketDataKey<?>> keys,
MarketDataFeed marketDataFeed) {

return keys.stream().collect(toImmutableMap(k -> k, k -> marketData.getValue(k.toMarketDataId(marketDataFeed))));

}


#2

Hi

What compiler are you using and what version? The early versions of the Java 8 compiler contained bugs in the type inference implementation and couldn’t handle some valid code containing lambdas. Strata requires a JDK version of 1.8.0_40 or later to build. See the README file on Github.

Can you build from the command line using Maven?

Regards
Chris


#3

I am using jdk 1.8.0_40
I am using the Eclipse “embedded” version of Maven. I guess I could install a standalone version of Maven and do “mvn install” .Let me try that. Or do you suggest I upgrade my JDK to the most recent version ? Thanks.


#4

I’ve just done a Maven build at the command line with JDK 1.8.0_40 and it worked so I don’t think your JDK is the problem.

What version of Eclipse are you using? We’ve seen cases where the Eclipse compiler won’t compile Java 8 code that compiles fine with the JDK compiler.


#5

Just to note that I use Eclipse Mars 4.5.1 daily and everything is fine there.


#6

I have a similar problem.

This is the only one compiler error in all strata projects.

I have installed JDK version “1.8.0_92”. My eclipse is Version: Mars Release (4.5.0). In all strata projects, I used this JDK. I have made a Maven build at the command line too.


#7

Does your command-line build work with Maven and JDK 1.8.0_92?


#8

Are you using the Oracle JDK or OpenJDK? And which version of Strata are you trying to compile?


#9

Yes, my command-line build work with Maven and JDK 1.8.0_92.


#10

I use eclipse GIT plugin to download the newest mater branch of Strata. I use Oracle JDK to build.


#11

We’ve deleted that method in master as it was only used in tests. Try pulling the latest version.


#12

Good. It’s OK now. Thanks.