Type arguments do not conform to trait type parameter bounds

The thing is, if you look at the definition of State trait, you will see trait State[S <: State[S]] which means the type inside the State type argument (named S), MUST be a subtype of State of that type, for instance: trait MyState extends State[MyState]. but using underscore in analyzer: Analyzer[_(this one), Metric[_]] does not assure the compiler that this type extends State of that type. to make the compile error go away, you can do:

case class AnomalyCheckConfigBuilder(anomalyDetectionStrategy: AnomalyDetectionStrategy,
                                     analyzer: Analyzer[_ <: State[_], Metric[_]],
                                     anomalyCheckConfig: Option[AnomalyCheckConfig] = None)

which is shorter form of

case class AnomalyCheckConfigBuilder[StateType <: State[_]](anomalyDetectionStrategy: AnomalyDetectionStrategy,
                                     analyzer: Analyzer[StateType, Metric[_]],
                                     anomalyCheckConfig: Option[AnomalyCheckConfig] = None)