diff options
author | Sergio Giro <sgiro@google.com> | 2015-03-11 12:32:30 +0000 |
---|---|---|
committer | Sergio Giro <sgiro@google.com> | 2015-03-11 15:06:43 +0000 |
commit | e78f8ca1c55628312772c9c110d12fca09126a7e (patch) | |
tree | b712e975f0a100c7f1efeb370db5e8c57bf55a65 /libart | |
parent | f6681759e51d8e22f871a0f826baab53e02717f1 (diff) | |
download | libcore-e78f8ca1c55628312772c9c110d12fca09126a7e.zip libcore-e78f8ca1c55628312772c9c110d12fca09126a7e.tar.gz libcore-e78f8ca1c55628312772c9c110d12fca09126a7e.tar.bz2 |
java.lang.reflect: Use only relevant modifiers when converting to string
Some modifiers not relevant might be used to encode internal information
(eg bridge methods) that shouldn't be displayed when converting to string
bug: 18488857
Change-Id: Ie82ed513b58083a795549a708197f1db52ffb796
Diffstat (limited to 'libart')
-rw-r--r-- | libart/src/main/java/java/lang/reflect/Field.java | 11 | ||||
-rw-r--r-- | libart/src/main/java/java/lang/reflect/Method.java | 3 |
2 files changed, 9 insertions, 5 deletions
diff --git a/libart/src/main/java/java/lang/reflect/Field.java b/libart/src/main/java/java/lang/reflect/Field.java index 11e8a6e..cad876b 100644 --- a/libart/src/main/java/java/lang/reflect/Field.java +++ b/libart/src/main/java/java/lang/reflect/Field.java @@ -182,10 +182,12 @@ public final class Field extends AccessibleObject implements Member { */ public String toGenericString() { StringBuilder sb = new StringBuilder(80); + // Limit modifier bits to the ones that toStringGeneric should return for fields. + + String modifiers = Modifier.getDeclarationFieldModifiers(getModifiers()); // append modifiers if any - int modifier = getModifiers(); - if (modifier != 0) { - sb.append(Modifier.toString(modifier)).append(' '); + if (!modifiers.isEmpty()) { + sb.append(modifiers).append(' '); } // append generic type Types.appendGenericType(sb, getGenericType()); @@ -861,7 +863,8 @@ public final class Field extends AccessibleObject implements Member { */ @Override public String toString() { - StringBuilder result = new StringBuilder(Modifier.toString(getModifiers())); + StringBuilder result = new StringBuilder( + Modifier.getDeclarationFieldModifiers(getModifiers())); if (result.length() != 0) { result.append(' '); } diff --git a/libart/src/main/java/java/lang/reflect/Method.java b/libart/src/main/java/java/lang/reflect/Method.java index 058fb96..f0e4f5c 100644 --- a/libart/src/main/java/java/lang/reflect/Method.java +++ b/libart/src/main/java/java/lang/reflect/Method.java @@ -398,7 +398,8 @@ public final class Method extends AbstractMethod implements GenericDeclaration, */ @Override public String toString() { - StringBuilder result = new StringBuilder(Modifier.toString(getModifiers())); + StringBuilder result = new StringBuilder( + Modifier.getDeclarationMethodModifiers(getModifiers())); if (result.length() != 0) { result.append(' '); |