From b9785280a7138a2bb52060faf94807aa0d07dec1 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Wed, 24 Aug 2011 17:11:55 +0000 Subject: Renamed tests named bugXXX to tXXX, no review. --- test/pending/run/t2318.scala | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 test/pending/run/t2318.scala (limited to 'test/pending/run/t2318.scala') diff --git a/test/pending/run/t2318.scala b/test/pending/run/t2318.scala new file mode 100644 index 0000000000..7bb666706f --- /dev/null +++ b/test/pending/run/t2318.scala @@ -0,0 +1,38 @@ +import java.security._ + +object Test { + trait Bar { def bar: Unit } + + object Mgr extends SecurityManager { + override def checkPermission(perm: Permission) = perm match { + case _: java.lang.RuntimePermission => () + case _: java.io.FilePermission => () + case x: java.security.AccessControlException if x.getName contains ".networkaddress." => () // generality ftw + case _ => super.checkPermission(perm) + } + } + + def t1() = { + val p = Runtime.getRuntime().exec("ls"); + type Destroyable = { def destroy() : Unit } + def doDestroy( obj : Destroyable ) : Unit = obj.destroy(); + doDestroy( p ); + } + def t2() = { + System.setSecurityManager(Mgr) + + val b = new Bar { def bar = println("bar") } + b.bar + + val structural = b.asInstanceOf[{ def bar: Unit }] + structural.bar + } + + def main(args: Array[String]) { + // figuring this will otherwise break on windows + try t1() + catch { case _: java.io.IOException => () } + + t2() + } +} -- cgit v1.2.3