diff options
author | Ian Rogers <irogers@google.com> | 2013-09-06 18:32:05 -0700 |
---|---|---|
committer | Brian Carlstrom <bdc@google.com> | 2013-11-07 10:42:12 -0800 |
commit | b182186c1dbe98a37a64a7c929a87d74ead59acd (patch) | |
tree | 7afad02cde9618e71df62512d8f470728aa13d29 /libdvm/src | |
parent | 174ee29b8c5f3923ec872a33112cb076214952f3 (diff) | |
download | libcore-b182186c1dbe98a37a64a7c929a87d74ead59acd.zip libcore-b182186c1dbe98a37a64a7c929a87d74ead59acd.tar.gz libcore-b182186c1dbe98a37a64a7c929a87d74ead59acd.tar.bz2 |
Lazier annotation signature parsing.
Bug: 10244719.
Also, make wider use of empty arrays.
Also, use named inner classes to aid profiling.
Remove caching as the empty result will be fast.
Porting the ART changes to DVM, to avoid the caching, results in bringing
in a bunch of other ART clean-up.
TODO, avoid modified-UTF8 to String conversions by Dex.
(cherry-picked from commit 4e7a4fad7f1bb3307af40243253b30bcb4de444e)
Change-Id: I878d1e363eab0421dd56fc11a19cf4bce9613d5a
Diffstat (limited to 'libdvm/src')
-rw-r--r-- | libdvm/src/main/java/java/lang/Class.java | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/libdvm/src/main/java/java/lang/Class.java b/libdvm/src/main/java/java/lang/Class.java index 8c847c2..4b36f3c 100644 --- a/libdvm/src/main/java/java/lang/Class.java +++ b/libdvm/src/main/java/java/lang/Class.java @@ -529,11 +529,14 @@ public final class Class<T> implements Serializable, AnnotatedElement, GenericDe native private boolean isDeclaredAnnotationPresent(Class<? extends Annotation> annotationClass); /** - * Returns an array containing {@code Class} objects for all classes, - * interfaces, enums and annotations that are members of this class. + * Returns an array containing {@code Class} objects for all classes and + * interfaces that are declared as members of the class which this {@code + * Class} represents. If there are no classes or interfaces declared or if + * this class represents an array class, a primitive type or void, then an + * empty array is returned. */ public Class<?>[] getDeclaredClasses() { - return AnnotationAccess.getMemberClasses(this); + return getDeclaredClasses(this, false); } /* @@ -1224,25 +1227,14 @@ public final class Class<T> implements Serializable, AnnotatedElement, GenericDe // TODO This might be a hack, but the VM doesn't have the necessary info. ClassLoader loader = getClassLoader(); if (loader != null) { - String packageName = getPackageName$(); - return packageName != null ? loader.getPackage(packageName) : null; + String name = getName(); + int dot = name.lastIndexOf('.'); + return (dot != -1 ? loader.getPackage(name.substring(0, dot)) : null); } return null; } /** - * Returns the package name of this class. This returns null for classes in - * the default package. - * - * @hide - */ - public String getPackageName$() { - String name = getName(); - int last = name.lastIndexOf('.'); - return last == -1 ? null : name.substring(0, last); - } - - /** * Returns the assertion status for the class represented by this {@code * Class}. Assertion is enabled / disabled based on the class loader, * package or class default at runtime. |