summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-11-30 06:04:33 +0000
committerPaul Phillips <paulp@improving.org>2010-11-30 06:04:33 +0000
commit402d96dd3fab6ae677966a9a258c00b3f34a37ed (patch)
treecf7ea182c1d6e3eea2a2b3eb61b123203103e340 /test/files/run
parent66a92814a61c62149a49335f65f4189763b43296 (diff)
downloadscala-402d96dd3fab6ae677966a9a258c00b3f34a37ed.tar.gz
scala-402d96dd3fab6ae677966a9a258c00b3f34a37ed.tar.bz2
scala-402d96dd3fab6ae677966a9a258c00b3f34a37ed.zip
It looks like the fix for #2318 was causing pro...
It looks like the fix for #2318 was causing problems, so I gave it some more graceful failure. Leaving #2318 open because the implementation could still work harder to find the right method. No review.
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/bug2318.check2
-rw-r--r--test/files/run/bug2318.scala37
2 files changed, 39 insertions, 0 deletions
diff --git a/test/files/run/bug2318.check b/test/files/run/bug2318.check
new file mode 100644
index 0000000000..a486f1ac47
--- /dev/null
+++ b/test/files/run/bug2318.check
@@ -0,0 +1,2 @@
+bar
+bar
diff --git a/test/files/run/bug2318.scala b/test/files/run/bug2318.scala
new file mode 100644
index 0000000000..8347ed8e7b
--- /dev/null
+++ b/test/files/run/bug2318.scala
@@ -0,0 +1,37 @@
+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 _ => super.checkPermission(perm)
+ }
+ }
+
+ def bug1() = {
+ val p = Runtime.getRuntime().exec("ls");
+ type Destroyable = { def destroy() : Unit }
+ def doDestroy( obj : Destroyable ) : Unit = obj.destroy();
+ doDestroy( p );
+ }
+ def bug2() = {
+ 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 bug1()
+ catch { case _: java.io.IOException => () }
+
+ bug2()
+ }
+}