re PR libgcj/7060 (getMethod() doesn't search super interface)

2002-07-04  Tom Tromey  <tromey@redhat.com>
            Jeff Sturm  <jsturm@one-point.com>

	Fix for PR libgcj/7060:
	* java/lang/Class.h (_getMethod): Renamed from getMethod.
	* java/lang/natClass.cc (_getMethod): Renamed from getMethod.
	Recurse into superinterfaces.  Don't throw NoSuchMethodException.
	* java/lang/Class.java (getMethod): New Java implementation;
	complies with spec.
	(_getMethod): New native method.

Co-Authored-By: Jeff Sturm <jsturm@one-point.com>

From-SVN: r55266
This commit is contained in:
Tom Tromey 2002-07-05 20:40:11 +00:00 committed by Tom Tromey
parent 9833f6792a
commit 0d49ec1158
4 changed files with 51 additions and 5 deletions

View file

@ -121,8 +121,29 @@ public final class Class implements Serializable
private static final native String getSignature (Class[] parameterTypes,
boolean is_construtor);
public native Method getMethod (String methodName, Class[] parameterTypes)
throws NoSuchMethodException, SecurityException;
public native Method _getMethod (String methodName, Class[] parameterTypes);
public Method getMethod (String methodName, Class[] parameterTypes)
throws NoSuchMethodException, SecurityException
{
SecurityManager sm = System.getSecurityManager();
if (sm != null)
{
sm.checkMemberAccess(this, Member.PUBLIC);
Package p = getPackage();
if (p != null)
sm.checkPackageAccess(p.getName());
}
if ("<init>".equals(methodName) || "<clinit>".equals(methodName))
throw new NoSuchMethodException(methodName);
Method m = _getMethod(methodName, parameterTypes);
if (m == null)
throw new NoSuchMethodException (methodName);
return m;
}
private native int _getMethods (Method[] result, int offset);
public native Method[] getMethods () throws SecurityException;