Skip to content

Commit

Permalink
Fix scala 2.11 compilation issues introduced in b051d8c
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitrii Kostianoi committed Jan 18, 2018
1 parent 6432521 commit b386dbe
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.rabbitmq.client.Envelope
import com.rabbitmq.client.AMQP.BasicProperties
import org.slf4j.LoggerFactory
import com.typesafe.config.ConfigFactory
import scala.collection.convert.ImplicitConversions._
import scala.collection.JavaConversions._

/**
== BATTERIES NOT INCLUDED ==
Expand Down
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ val assertNoApplicationConf = taskKey[Unit]("Makes sure application.conf isn't p
val commonSettings = Seq(
organization := "com.spingo",
version := appProperties.getProperty("version"),
scalaVersion := "2.12.4",
crossScalaVersions := Seq("2.11.8", "2.12.4"),
scalaVersion := "2.11.12",
crossScalaVersions := Seq("2.11.12", "2.12.4"),
libraryDependencies ++= Seq(
"com.chuusai" %% "shapeless" % "2.3.3",
"com.typesafe" % "config" % "1.3.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ case class ConnectionParams(
factory.setPassword(password)
factory.setVirtualHost(virtualHost)
// Replace the table of client properties that will be sent to the server during subsequent connection startups.
factory.setClientProperties(mapAsJavaMap(clientProperties))
factory.setClientProperties(clientProperties.asJava)
factory.setConnectionTimeout(connectionTimeout)
factory.setExceptionHandler(exceptionHandler)
factory.setRequestedChannelMax(requestedChannelMax)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import java.nio.charset.Charset
import java.util.Date
import com.rabbitmq.client.LongString
import scala.collection.JavaConverters._
import scala.collection.convert.ImplicitConversionsToScala._

/**
Trait which represents all values allowed in property generc headers
Expand Down Expand Up @@ -122,7 +121,7 @@ object HeaderValue {
implicit val convertFromByteArray : ToHeaderValue[Array[Byte] , ByteArrayHeaderValue] = ByteArrayHeaderValue(_)
implicit def convertFromMap[T](implicit converter: ToHeaderValue[T, HeaderValue]): ToHeaderValue[Map[String, T], MapHeaderValue] = { m => MapHeaderValue(m.mapValues(converter)) }
implicit def convertFromSeq[T](implicit converter: ToHeaderValue[T, HeaderValue]): ToHeaderValue[Seq[T], SeqHeaderValue] = { s => SeqHeaderValue(s.map(converter)) }
implicit def convertFromJavaList[T](implicit converter: ToHeaderValue[T, HeaderValue]): ToHeaderValue[java.util.List[T], SeqHeaderValue] = { list => SeqHeaderValue(list.map(converter)) }
implicit def convertFromJavaList[T](implicit converter: ToHeaderValue[T, HeaderValue]): ToHeaderValue[java.util.List[T], SeqHeaderValue] = { list => SeqHeaderValue(list.asScala.map(converter)) }

def apply[T](value: T)(implicit converter: ToHeaderValue[T, HeaderValue]): HeaderValue =
if (value == null) NullHeaderValue else converter(value)
Expand All @@ -134,7 +133,7 @@ object HeaderValue {
case v: java.math.BigDecimal => apply(v)
case v: java.util.Date => apply(v)
case v: java.util.Map[_, _] =>
MapHeaderValue(v.map {
MapHeaderValue(v.asScala.map {
case (k, v: Object) => (k.toString, from(v))
case (k, otherwise) =>
throw new RuntimeException(
Expand All @@ -149,7 +148,7 @@ object HeaderValue {
case v: Array[Byte] => apply(v)
case null => NullHeaderValue
case v: java.util.List[_] =>
SeqHeaderValue(v.map { case v: Object => from(v) })
SeqHeaderValue(v.asScala.map { case v: Object => from(v) })
case v: Array[Object] =>
SeqHeaderValue(v.map(from))
case otherwise =>
Expand Down

0 comments on commit b386dbe

Please sign in to comment.