src/Pure/General/untyped.scala
author blanchet
Wed, 24 Sep 2014 15:45:55 +0200
changeset 58425 246985c6b20b
parent 56905 fb38a767a78b
child 58682 542fa5093ebf
permissions -rw-r--r--
simpler proof

/*  Title:      Pure/General/untyped.scala
    Module:     PIDE
    Author:     Makarius

Untyped, unscoped, unchecked access to JVM objects.
*/

package isabelle


object Untyped
{
  def get(obj: AnyRef, x: String): AnyRef =
  {
    obj.getClass.getDeclaredFields.find(_.getName == x) match {
      case Some(field) =>
        field.setAccessible(true)
        field.get(obj)
      case None => error("No field " + quote(x) + " for " + obj)
    }
  }
}