summaryrefslogtreecommitdiff
path: root/src/library/scala/runtime/ScalaRunTime.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-04-02 11:05:54 -0700
committerPaul Phillips <paulp@improving.org>2013-04-03 01:29:21 -0700
commit7168743a909c6be9c607f856fdc3e789b53271a6 (patch)
tree472b8bcdadf9cd1d9dd45a97f2a55e264ee0062a /src/library/scala/runtime/ScalaRunTime.scala
parentb575c1ed131a578a18239e3922c1ea8b7dd188a2 (diff)
downloadscala-7168743a909c6be9c607f856fdc3e789b53271a6.tar.gz
scala-7168743a909c6be9c607f856fdc3e789b53271a6.tar.bz2
scala-7168743a909c6be9c607f856fdc3e789b53271a6.zip
Added ensureAccessible to reflection library.
This method comes up with some frequency and there are a lot of ways to write it either unsafely (failing to catch a likely exception) or with inadequate generality (as was done in the pre-existing version of this method in ScalaRunTime) so I thought it warranted a place in the standard library.
Diffstat (limited to 'src/library/scala/runtime/ScalaRunTime.scala')
-rw-r--r--src/library/scala/runtime/ScalaRunTime.scala8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/library/scala/runtime/ScalaRunTime.scala b/src/library/scala/runtime/ScalaRunTime.scala
index 753dd0205e..ea1f392e2b 100644
--- a/src/library/scala/runtime/ScalaRunTime.scala
+++ b/src/library/scala/runtime/ScalaRunTime.scala
@@ -158,13 +158,7 @@ object ScalaRunTime {
// Java bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4071957
// More background at ticket #2318.
- def ensureAccessible(m: JMethod): JMethod = {
- if (!m.isAccessible) {
- try m setAccessible true
- catch { case _: SecurityException => () }
- }
- m
- }
+ def ensureAccessible(m: JMethod): JMethod = scala.reflect.ensureAccessible(m)
def checkInitialized[T <: AnyRef](x: T): T =
if (x == null) throw new UninitializedError else x