summaryrefslogtreecommitdiffstats
path: root/libjava/java/lang/Class.java
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2002-09-03 21:33:46 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2002-09-03 21:33:46 +0000
commite23786d215a538516b4e4f33d11abbdf32296e15 (patch)
treeb89c68832aa1f41f6cad7d80d73b8ae5813779c8 /libjava/java/lang/Class.java
parent80e426a6f11c5bd4e755eaf97c23021b30c176c0 (diff)
downloadppe42-gcc-e23786d215a538516b4e4f33d11abbdf32296e15.tar.gz
ppe42-gcc-e23786d215a538516b4e4f33d11abbdf32296e15.zip
* java/lang/Class.h (_getDeclaredMethod): Declare.
(_getMethod): Now private. * java/lang/natClass.cc (_getDeclaredMethod): Renamed from getDeclaredMethod. Now returns NULL on failure. * java/lang/Class.java (_getDeclaredMethod): Declare. (getDeclaredMethod): No longer native; implements access checks. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@56772 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/lang/Class.java')
-rw-r--r--libjava/java/lang/Class.java28
1 files changed, 25 insertions, 3 deletions
diff --git a/libjava/java/lang/Class.java b/libjava/java/lang/Class.java
index 12306da8061..cc1cc40f2a4 100644
--- a/libjava/java/lang/Class.java
+++ b/libjava/java/lang/Class.java
@@ -65,9 +65,31 @@ public final class Class implements Serializable
public native Field getDeclaredField (String fieldName)
throws NoSuchFieldException, SecurityException;
public native Field[] getDeclaredFields () throws SecurityException;
- public native Method getDeclaredMethod (String methodName,
- Class[] parameterTypes)
- throws NoSuchMethodException, SecurityException;
+
+ private native Method _getDeclaredMethod (String methodName,
+ Class[] parameterTypes);
+
+ public Method getDeclaredMethod (String methodName, Class[] parameterTypes)
+ throws NoSuchMethodException, SecurityException
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ {
+ sm.checkMemberAccess(this, Member.DECLARED);
+ Package p = getPackage();
+ if (p != null)
+ sm.checkPackageAccess(p.getName());
+ }
+
+ if ("<init>".equals(methodName) || "<clinit>".equals(methodName))
+ throw new NoSuchMethodException(methodName);
+
+ Method m = _getDeclaredMethod(methodName, parameterTypes);
+ if (m == null)
+ throw new NoSuchMethodException (methodName);
+ return m;
+ }
+
public native Method[] getDeclaredMethods () throws SecurityException;
// This is marked as unimplemented in the JCL book.
OpenPOWER on IntegriCloud