From ecce49be5da0aa0fa1566b4c16bbd78230f73075 Mon Sep 17 00:00:00 2001 From: Ilya Mizus Date: Sat, 11 Oct 2014 23:50:53 +0400 Subject: [PATCH] Added some tests for class types --- test/Reflection.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/test/Reflection.java b/test/Reflection.java index 7f0398ef81..39dc5c85a8 100644 --- a/test/Reflection.java +++ b/test/Reflection.java @@ -98,15 +98,31 @@ public class Reflection { expect(1 == args.length); expect(args[0] == String.class); } - + public static void throwOOME() { throw new OutOfMemoryError(); } + public static void classType() throws Exception { + // Class types + expect(!Reflection.class.isAnonymousClass()); + expect(!Reflection.class.isLocalClass()); + expect(!Reflection.class.isMemberClass()); + + expect(Reflection.Hello.class.isMemberClass()); + + Cloneable anonymousLocal = new Cloneable() {}; + expect(anonymousLocal.getClass().isAnonymousClass()); + + class NamedLocal {} + expect(NamedLocal.class.isLocalClass()); + } + public static void main(String[] args) throws Exception { innerClasses(); annotations(); genericType(); + classType(); Class system = Class.forName("java.lang.System"); Field out = system.getDeclaredField("out");