src/Pure/General/untyped.scala
author wenzelm
Thu May 08 00:12:22 2014 +0200 (2014-05-08)
changeset 56905 fb38a767a78b
child 58682 542fa5093ebf
permissions -rw-r--r--
untyped, unscoped, unchecked access to JVM objects;
     1 /*  Title:      Pure/General/untyped.scala
     2     Module:     PIDE
     3     Author:     Makarius
     4 
     5 Untyped, unscoped, unchecked access to JVM objects.
     6 */
     7 
     8 package isabelle
     9 
    10 
    11 object Untyped
    12 {
    13   def get(obj: AnyRef, x: String): AnyRef =
    14   {
    15     obj.getClass.getDeclaredFields.find(_.getName == x) match {
    16       case Some(field) =>
    17         field.setAccessible(true)
    18         field.get(obj)
    19       case None => error("No field " + quote(x) + " for " + obj)
    20     }
    21   }
    22 }
    23