summaryrefslogtreecommitdiff
path: root/src/main/scala
diff options
context:
space:
mode:
authorJohannes Rudolph <johannes.rudolph@gmail.com>2018-07-26 15:14:09 +0200
committerGitHub <noreply@github.com>2018-07-26 15:14:09 +0200
commit245a3fbeb96c6e6df711daf9989350d2d7f9ab81 (patch)
tree196cf8a84460ad66c06f244b4ae4d798633a76ab /src/main/scala
parent326a001a44bd818750f2baa3f65e68184f5a2d5a (diff)
parenta26f45ba61e39c7eb3c890a07ebb96edb7dbf987 (diff)
downloadspray-json-245a3fbeb96c6e6df711daf9989350d2d7f9ab81.tar.gz
spray-json-245a3fbeb96c6e6df711daf9989350d2d7f9ab81.tar.bz2
spray-json-245a3fbeb96c6e6df711daf9989350d2d7f9ab81.zip
Merge pull request #219 from magnolia-k/fix_warnings_about_manifest
Replace ClassManifest with ClassTag
Diffstat (limited to 'src/main/scala')
-rw-r--r--src/main/scala/spray/json/CollectionFormats.scala6
-rw-r--r--src/main/scala/spray/json/ProductFormats.scala5
2 files changed, 7 insertions, 4 deletions
diff --git a/src/main/scala/spray/json/CollectionFormats.scala b/src/main/scala/spray/json/CollectionFormats.scala
index 24ab1dd..9a3e8fd 100644
--- a/src/main/scala/spray/json/CollectionFormats.scala
+++ b/src/main/scala/spray/json/CollectionFormats.scala
@@ -17,6 +17,8 @@
package spray.json
+import scala.reflect.ClassTag
+
trait CollectionFormats {
/**
@@ -33,7 +35,7 @@ trait CollectionFormats {
/**
* Supplies the JsonFormat for Arrays.
*/
- implicit def arrayFormat[T :JsonFormat :ClassManifest] = new RootJsonFormat[Array[T]] {
+ implicit def arrayFormat[T :JsonFormat :ClassTag] = new RootJsonFormat[Array[T]] {
def write(array: Array[T]) = JsArray(array.map(_.toJson).toVector)
def read(value: JsValue) = value match {
case JsArray(elements) => elements.map(_.convertTo[T]).toArray[T]
@@ -90,4 +92,4 @@ trait CollectionFormats {
case x => deserializationError("Expected Collection as JsArray, but got " + x)
}
}
-} \ No newline at end of file
+}
diff --git a/src/main/scala/spray/json/ProductFormats.scala b/src/main/scala/spray/json/ProductFormats.scala
index 7d6c63e..81a48af 100644
--- a/src/main/scala/spray/json/ProductFormats.scala
+++ b/src/main/scala/spray/json/ProductFormats.scala
@@ -19,6 +19,7 @@ package spray.json
import java.lang.reflect.Modifier
import scala.annotation.tailrec
import scala.util.control.NonFatal
+import scala.reflect.ClassTag
/**
* Provides the helpers for constructing custom JsonFormat implementations for types implementing the Product trait
@@ -64,8 +65,8 @@ trait ProductFormats extends ProductFormatsInstances {
case _ => deserializationError("Object expected in field '" + fieldName + "'", fieldNames = fieldName :: Nil)
}
- protected def extractFieldNames(classManifest: ClassManifest[_]): Array[String] = {
- val clazz = classManifest.erasure
+ protected def extractFieldNames(tag: ClassTag[_]): Array[String] = {
+ val clazz = tag.runtimeClass
try {
// copy methods have the form copy$default$N(), we need to sort them in order, but must account for the fact
// that lexical sorting of ...8(), ...9(), ...10() is not correct, so we extract N and sort by N.toInt