src/Pure/General/untyped.scala
changeset 59079 12a689755c3d
parent 58682 542fa5093ebf
child 59080 611914621edb
--- a/src/Pure/General/untyped.scala	Tue Dec 02 16:10:11 2014 +0100
+++ b/src/Pure/General/untyped.scala	Tue Dec 02 16:40:11 2014 +0100
@@ -20,8 +20,8 @@
     }
   }
 
-  def get(obj: AnyRef, x: String): AnyRef =
-    if (obj == null) null
+  def get[A](obj: AnyRef, x: String): A =
+    if (obj == null) null.asInstanceOf[A]
     else {
       val iterator =
         for {
@@ -32,7 +32,7 @@
           field.setAccessible(true)
           field.get(obj)
         }
-      if (iterator.hasNext) iterator.next
+      if (iterator.hasNext) iterator.next.asInstanceOf[A]
       else error("No field " + quote(x) + " for " + obj)
     }
 }