mirror of
https://github.com/corda/corda.git
synced 2025-01-22 12:28:11 +00:00
Merge pull request #358 from bigfatbrowncat/avian-pack
Tiny fix in Class.getClassType()
This commit is contained in:
commit
d063ea0ef3
@ -539,7 +539,7 @@ public final class Class <T>
|
|||||||
|
|
||||||
if (skipDigits == chars.length) {
|
if (skipDigits == chars.length) {
|
||||||
return ClassType.ANONYMOUS;
|
return ClassType.ANONYMOUS;
|
||||||
} else if (skipDigits > dollar + 1) {
|
} else if (skipDigits == dollar + 1) {
|
||||||
return ClassType.MEMBER;
|
return ClassType.MEMBER;
|
||||||
} else {
|
} else {
|
||||||
return ClassType.LOCAL;
|
return ClassType.LOCAL;
|
||||||
|
@ -98,15 +98,31 @@ public class Reflection {
|
|||||||
expect(1 == args.length);
|
expect(1 == args.length);
|
||||||
expect(args[0] == String.class);
|
expect(args[0] == String.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void throwOOME() {
|
public static void throwOOME() {
|
||||||
throw new OutOfMemoryError();
|
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 {
|
public static void main(String[] args) throws Exception {
|
||||||
innerClasses();
|
innerClasses();
|
||||||
annotations();
|
annotations();
|
||||||
genericType();
|
genericType();
|
||||||
|
classType();
|
||||||
|
|
||||||
Class system = Class.forName("java.lang.System");
|
Class system = Class.forName("java.lang.System");
|
||||||
Field out = system.getDeclaredField("out");
|
Field out = system.getDeclaredField("out");
|
||||||
|
Loading…
Reference in New Issue
Block a user