Skip to content

Commit

Permalink
Fix yaml module on Scala 2.11
Browse files Browse the repository at this point in the history
  • Loading branch information
ruippeixotog committed Jan 19, 2019
1 parent cce3f5f commit a6027d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/src/main/scala/pureconfig/FluentConfigCursor.scala
Expand Up @@ -107,7 +107,7 @@ case class FluentConfigCursor(cursor: ConfigReader.Result[ConfigCursor]) {
* @return a `Right` with the list obtained by mapping all elements of the list pointed to by this cursor if all
* casts and mappings can be done, `Left` with a list of failures otherwise.
*/
def mapList[A](f: ConfigCursor => ConfigReader.Result[A]) =
def mapList[A](f: ConfigCursor => ConfigReader.Result[A]): ConfigReader.Result[List[A]] =
asListCursor.right.flatMap { listCur => ConfigReader.Result.sequence(listCur.list.map(f)) }

/**
Expand Down
Expand Up @@ -5,7 +5,6 @@ import java.nio.file.{ Files, Path }
import java.util.Base64

import scala.collection.JavaConverters._
import scala.collection.mutable
import scala.reflect.ClassTag
import scala.util.Try
import scala.util.control.NonFatal
Expand All @@ -26,11 +25,11 @@ package object yaml {

def aux(obj: AnyRef): ConfigReader.Result[AnyRef] = obj match {
case m: java.util.Map[AnyRef @unchecked, AnyRef @unchecked] =>
val entries = m.asScala.map {
val entries: Iterable[ConfigReader.Result[(String, AnyRef)]] = m.asScala.map {
case (k: String, v) => aux(v).right.map { v: AnyRef => k -> v }
case (k, _) => Left(ConfigReaderFailures(NonStringKeyFound(k.toString, k.getClass.getSimpleName)))
}
ConfigReader.Result.sequence[(String, AnyRef), mutable.Iterable](entries).right.map(_.toMap.asJava)
ConfigReader.Result.sequence(entries).right.map(_.toMap.asJava)

case xs: java.util.List[AnyRef @unchecked] =>
ConfigReader.Result.sequence(xs.asScala.map(aux)).right.map(_.toList.asJava)
Expand Down

0 comments on commit a6027d4

Please sign in to comment.