mirror of
https://github.com/corda/corda.git
synced 2025-06-17 22:58:19 +00:00
make Class.getMethod (and getConstructor) more strict about parameter types
This matches the JDK behavior.
This commit is contained in:
@ -260,6 +260,15 @@ public class Reflection {
|
||||
.getEnclosingMethod().equals
|
||||
(Reflection.class.getMethod
|
||||
("main", new Class[] { String[].class })));
|
||||
|
||||
Slithy.class.getMethod("tove", Gybe.class);
|
||||
|
||||
try {
|
||||
Slithy.class.getMethod("tove", Bandersnatch.class);
|
||||
expect(false);
|
||||
} catch (NoSuchMethodException e) {
|
||||
// cool
|
||||
}
|
||||
}
|
||||
|
||||
protected static class Baz {
|
||||
@ -267,6 +276,16 @@ public class Reflection {
|
||||
}
|
||||
}
|
||||
|
||||
class Bandersnatch { }
|
||||
|
||||
class Gybe extends Bandersnatch { }
|
||||
|
||||
class Slithy {
|
||||
public static void tove(Gybe gybe) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
class Foo {
|
||||
static {
|
||||
if (true) throw new MyException();
|
||||
|
Reference in New Issue
Block a user