4

I have a gears library, depending on

"org.typelevel"              %% "cats-core"        % "2.7.0",
"org.typelevel"              %% "cats-effect"      % "2.5.4"

cats-effect 2.5.4 depends on cats-core 2.6.1, so the latter is evicted. I'm not sure this matters though.

This library is used by a few services. In the gears library there is StreamMetrics trait used by main (runnable) class of all of them. It contains following piece of code:

implicit val traverseMeasured: Traverse[Measured] = new Traverse[Measured] { ... }

In some (but not all) services I get following error when I try to start them (I added newlines):

java.lang.AbstractMethodError: Receiver class my.company.platform.image.MainModule$$anon$9
does not define or inherit an implementation of the resolved method 
'abstract void my$company$gear$metrics$StreamMetrics$_setter_$traverseMeasured_$eq(cats.Traverse)' 
of interface my.company.gear.metrics.StreamMetrics.

From my understanding the my$company$gear$metrics$StreamMetrics$_setter_$traverseMeasured_$eq(cats.Traverse) is setter generated by scala compiler for implicit val traverseMeasured. This setter is defined and obviously used only in StreamMetrics trait - it's val so I can't set it anywhere else. So why the error?

Dmytro Mitin
  • 48,194
  • 3
  • 28
  • 66
amorfis
  • 15,390
  • 15
  • 77
  • 125
  • 1
    The cause of it is version mismatch. How to fix it? Get rid of the version conflict. – Dima May 06 '22 at 23:41
  • But how it works? And why the "gears" library compiles? And what difference between versions can cause such error? It's Scala compiler that creates the setter method isn't it? So why it depends on cats version? – amorfis May 07 '22 at 09:51

0 Answers0