diff options
author | Martin Odersky <odersky@gmail.com> | 2007-02-02 18:35:47 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2007-02-02 18:35:47 +0000 |
commit | 3eae42f4cc89fde2fffe2861c024341cf1ce700b (patch) | |
tree | 566e9ba4aed87a175df10ad43ca8eb6d5fcdaaed /test | |
parent | 828377d9c0c86471a1c18ba11ff13460400729cf (diff) | |
download | scala-3eae42f4cc89fde2fffe2861c024341cf1ce700b.tar.gz scala-3eae42f4cc89fde2fffe2861c024341cf1ce700b.tar.bz2 scala-3eae42f4cc89fde2fffe2861c024341cf1ce700b.zip |
added comment & test case
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/sensitive.check | 4 | ||||
-rw-r--r-- | test/files/neg/sensitive.scala | 19 |
2 files changed, 23 insertions, 0 deletions
diff --git a/test/files/neg/sensitive.check b/test/files/neg/sensitive.check new file mode 100644 index 0000000000..aa7c65a3b1 --- /dev/null +++ b/test/files/neg/sensitive.check @@ -0,0 +1,4 @@ +sensitive.scala:17: error: constructor Sensitive cannot be accessed in object Attacker + val y = new Sensitive() + ^ +one error found 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() +} + |