diff options
author | Paul Phillips <paulp@improving.org> | 2010-11-30 06:04:33 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-11-30 06:04:33 +0000 |
commit | 402d96dd3fab6ae677966a9a258c00b3f34a37ed (patch) | |
tree | cf7ea182c1d6e3eea2a2b3eb61b123203103e340 /src/library | |
parent | 66a92814a61c62149a49335f65f4189763b43296 (diff) | |
download | scala-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 'src/library')
-rw-r--r-- | src/library/scala/runtime/ScalaRunTime.scala | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/library/scala/runtime/ScalaRunTime.scala b/src/library/scala/runtime/ScalaRunTime.scala index 2d4d1d3306..925e9b4b64 100644 --- a/src/library/scala/runtime/ScalaRunTime.scala +++ b/src/library/scala/runtime/ScalaRunTime.scala @@ -17,6 +17,7 @@ import scala.collection.immutable.{ NumericRange, List, Stream, Nil, :: } import scala.collection.generic.{ Sorted } import scala.xml.{ Node, MetaData } import scala.util.control.ControlThrowable +import java.lang.reflect.{ Modifier, Method => JMethod } /* The object <code>ScalaRunTime</code> provides ... */ @@ -111,6 +112,16 @@ object ScalaRunTime { arr } + // 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 checkInitialized[T <: AnyRef](x: T): T = if (x == null) throw new UninitializedError else x |