Skip to content

Commit

Permalink
JIRA MRP-2, fix for Class.getMethod fails to match specification.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Rogers committed Mar 31, 2009
1 parent cda33b4 commit 511d014
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libraryInterface/Common/src/java/lang/Class.java
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ public T newInstance() throws IllegalAccessException, InstantiationException,
@Pure
private RVMMethod getMethodInternal1(Atom aName, Class<?>... parameterTypes) {
RVMMethod answer = null;
for (RVMClass current = type.asClass(); current != null; current = current.getSuperClass()) {
for (RVMClass current = type.asClass(); current != null && answer == null; current = current.getSuperClass()) {
RVMMethod[] methods = current.getDeclaredMethods();
for (RVMMethod meth : methods) {
if (meth.getName() == aName && meth.isPublic() &&
Expand All @@ -886,6 +886,8 @@ private RVMMethod getMethodInternal1(Atom aName, Class<?>... parameterTypes) {
answer = meth;
} else {
RVMMethod m2 = meth;
// make answer have the weakest return type of the methods declared
// in this class
if (answer.getReturnType().resolve().isAssignableFrom(m2.getReturnType().resolve())) {
answer = m2;
}
Expand Down

0 comments on commit 511d014

Please sign in to comment.