byte-buddy icon indicating copy to clipboard operation
byte-buddy copied to clipboard

Cannot resolve `In` from class `zio.cache.Cache$$anon$1`

Open jxnu-liguobin opened this issue 2 years ago • 3 comments

This is Scala, since the minimum reproduction code is uncertain at this point, a guess would be something like this:

abstract class Cache[-Key, +Value]:

  def get(key: Key): Value

object Cache:

  def make[In, Key, Value](keyBy: In => Key) = new Cache[In, Value]:
    override def get(in: In): Value = ???

The full code is here https://github.com/zio/zio-cache/blob/series/2.x/zio-cache/shared/src/main/scala/zio/cache/Cache.scala

jxnu-liguobin avatar Dec 31 '23 10:12 jxnu-liguobin

I would assume that there is an issue in the Scala compiler here. Did you try to resolve the type variables using Java reflection? It would normally result in the same error.

raphw avatar Feb 24 '24 21:02 raphw

I would assume that there is an issue in the Scala compiler here. Did you try to resolve the type variables using Java reflection? It would normally result in the same error.

Are you referring to the get method for reflecting Cache instances? But what I got was the Object

jxnu-liguobin avatar Feb 26 '24 01:02 jxnu-liguobin

If you get hold of zio.cache.Cache$$anon$1 Class representstion, and call methods for getting generic types on it, I'd assume it yields similar exceptions.

raphw avatar Feb 26 '24 06:02 raphw