Implement Class#getDeclaredClasses

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2013-10-31 17:01:33 -05:00
parent efb3ef9b51
commit dba8d39e63
5 changed files with 63 additions and 6 deletions

View File

@ -38,7 +38,18 @@ public class Reflection {
if (! v) throw new RuntimeException();
}
private static class Hello { }
private static void innerClasses() throws Exception {
Class c = Reflection.class;
Class[] inner = c.getDeclaredClasses();
expect(1 == inner.length);
expect(Hello.class == inner[0]);
}
public static void main(String[] args) throws Exception {
innerClasses();
Class system = Class.forName("java.lang.System");
Field out = system.getDeclaredField("out");
Class output = Class.forName("java.io.PrintStream");