Does anyone know a fix for this? ```class ClassA&l...
# android
c
Does anyone know a fix for this?
Copy code
class ClassA<B: ClassB<*>> {

}

class ClassB<A: ClassA<*>> {

}
I’m getting an error:
This type parameter violates the Finite Bound Restriction
. What am I doing wrong here?
Basically something like following works in java but not in Koltin (where we need to add
<*>
):
Copy code
class ClassA<B: ClassB> {}

class ClassB<A: ClassA> {}
v
That works in Java because you use non-generic raw types. The
ClassA
you use as type argument for
ClassB
has no type argument and the
ClassB
you use as type argument for
ClassA
has no type argument, so there are no problems. With Kotlin raw types (which should not be used anyway) are right away not present.
In Kotlin
ClassA
would need a type argument of
ClassB
which would need a type argument of
ClassA
which would need a type argument of
ClassB
, ... I guess this cannot work out properly
c
Thats legitimate. Thanks for answering @Vampire 🙂