From 3eae42f4cc89fde2fffe2861c024341cf1ce700b Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 2 Feb 2007 18:35:47 +0000 Subject: added comment & test case --- test/files/neg/sensitive.scala | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/files/neg/sensitive.scala (limited to 'test/files/neg/sensitive.scala') diff --git a/test/files/neg/sensitive.scala b/test/files/neg/sensitive.scala new file mode 100644 index 0000000000..f435a385e1 --- /dev/null +++ b/test/files/neg/sensitive.scala @@ -0,0 +1,19 @@ +class Certificate{} + +object Admin extends Certificate; + +class SecurityViolationException extends Exception + +object Sensitive { + def makeSensitive(credentials: Certificate): Sensitive = + if (credentials == Admin) new Sensitive() + else throw new SecurityViolationException +} +class Sensitive private () { +} + +object Attacker { + val x = Sensitive.makeSensitive(null) + val y = new Sensitive() +} + -- cgit v1.2.3