playframework - Trait Subtractable issue after upgrading from Scala 2.11.11 to Scala 2.12.3 -
i migrated scala play! application scala 2.11.11 scala 2.12.3
since then, obtain following error when compiling app:
type arguments [?,equals] not conform trait subtractable's type parameter bounds [a,+repr <: scala.collection.generic.subtractable[a,repr]] [error] (req <- request.req.getrequestlist) { [error] ^ [error] 1 error found
for reason, scala 2.12 seems have problem iterating on java array.
the getrequestlist returns following object: array[req].
did encountered issue?
here part of code encountering issue:
// sorting requests certificate authority (req <- request.req.getrequestlist) { // extracting key hash request val keyhash = getkeyhash(req) // extracting name hash request val namehash = getnamehash(req) // retrieving ca key hash or name hash val ca = keyhash.flatmap(getcertificateauthorityfromkeyhash).map { ca => logger.debug(s"[${self.path.name}] - ca found based on issuer key hash ('${keyhash.getorelse("na").touppercase}') -> '${ca.name}'") ca } orelse namehash.flatmap(getcertificateauthorityfromnamehash).map { ca => logger.debug(s"[${self.path.name}] - ca found based on issuer name hash ('${namehash.getorelse("na").touppercase}') -> '${ca.name}'") ca } getorelse { logger.debug(s"[${self.path.name}] - unable find ca based on issuer key hash ('${keyhash.getorelse("na").touppercase}') , name hash ('${namehash.getorelse("na").touppercase}'. discarding request unauthorized status)") throw new unknowncertificateauthorityexception("certificateid not reference registered certificate authority") } if (reqsbyca.contains(ca.id.get)) { reqsbyca(ca.id.get) += req } else { reqsbyca += (ca.id.get -> arraybuffer(req)) } }
the request.re.getrequestlist returns array of org.bouncycastle.cert.ocsp.req (array[org.bouncycastle.cert.ocsp.req]).
after further investigation, problem coming line:
reqsbyca(ca.id.get) += req
i replaced by:
reqsbyca(ca.id.get).append(req)
which me strictly equivalent...
and compiles , run.
if explain why, appreciate.
anyway, problem solved.
Comments
Post a Comment