Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optionFormat and eitherFormat should be typed JsonFormat[T] #151

Closed
fommil opened this issue Apr 24, 2015 · 5 comments
Closed

optionFormat and eitherFormat should be typed JsonFormat[T] #151

fommil opened this issue Apr 24, 2015 · 5 comments

Comments

@fommil
Copy link
Contributor

fommil commented Apr 24, 2015

unfortunately these two implicit methods return very specific types, making them very troublesome to deal with when overriding or doing anything funky with shapless to automatically derive product/trait types.

@fommil
Copy link
Contributor Author

fommil commented Apr 24, 2015

actually, (performance aside) eitherFormat might be ok. It's just optionFormat that's killing me.

@fommil
Copy link
Contributor Author

fommil commented Apr 24, 2015

I can workaround this with a non-implicit method of the same name, and introducing an implicit one with the correct return type.

sirthias added a commit that referenced this issue May 6, 2015
standard optionFormat type close #151
@jkinkead
Copy link

This fix broke compatibility with version 1.3.1 - optionFormat has a different return type from 1.3.1, and anything compiled against it will now throw a runtime exception like:

Exception in thread "main" java.lang.NoSuchMethodError: spray.json.DefaultJsonProtocol$.optionFormat(Lspray/json/JsonFormat;)Lspray/json/StandardFormats$OptionFormat;

I'll open a separate issue.

@fommil
Copy link
Contributor Author

fommil commented Jun 12, 2015

ouch

@fommil
Copy link
Contributor Author

fommil commented Jun 12, 2015

the workaround is to create an implicit override def that will return the specialised type instead of JsonFormat[Option[T]]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants