diff options
author | Ian Rogers <irogers@google.com> | 2013-07-25 20:29:18 -0700 |
---|---|---|
committer | Ian Rogers <irogers@google.com> | 2013-08-08 12:05:49 -0700 |
commit | ed80d3a1a25d5bd37c25c1cd8ea4c192729c2618 (patch) | |
tree | 7ba00f38e9e42c50be189eaa8ff22388279ca750 | |
parent | 87f155f5761977276cd2aff66afe9312aefec02d (diff) | |
download | libcore-ed80d3a1a25d5bd37c25c1cd8ea4c192729c2618.zip libcore-ed80d3a1a25d5bd37c25c1cd8ea4c192729c2618.tar.gz libcore-ed80d3a1a25d5bd37c25c1cd8ea4c192729c2618.tar.bz2 |
Fix sign-extension of type indices.
We pass type indices as ints but Dex represents them as shorts. Avoid sign
extending the shorts which would cause problem for dex cache indices, etc.
(cherry-picked from commit 1d02e61adf72a3cd59b796fc8d7ee1161ba66e7a)
Change-Id: Id9b540863fee56ad3165f4cac2a23389ba78ca2e
-rw-r--r-- | libart/src/main/java/java/lang/reflect/AbstractMethod.java | 4 | ||||
-rw-r--r-- | libart/src/main/java/java/lang/reflect/Method.java | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/libart/src/main/java/java/lang/reflect/AbstractMethod.java b/libart/src/main/java/java/lang/reflect/AbstractMethod.java index c1412e1..6a4b8e9 100644 --- a/libart/src/main/java/java/lang/reflect/AbstractMethod.java +++ b/libart/src/main/java/java/lang/reflect/AbstractMethod.java @@ -195,7 +195,7 @@ public abstract class AbstractMethod extends AccessibleObject { Class<?>[] parametersArray = new Class[types.length]; for (int i = 0; i < types.length; i++) { // Note, in the case of a Proxy the dex cache types are equal. - parametersArray[i] = getDexCacheType(dex, types[i]); + parametersArray[i] = getDexCacheType(dex, types[i] & 0xFFFF); } return parametersArray; } @@ -212,7 +212,7 @@ public abstract class AbstractMethod extends AccessibleObject { return false; } for (int i = 0; i < types.length; i++) { - if (getDexCacheType(dex, types[i]) != params[i]) { + if (getDexCacheType(dex, types[i] & 0xFFFF) != params[i]) { return false; } } diff --git a/libart/src/main/java/java/lang/reflect/Method.java b/libart/src/main/java/java/lang/reflect/Method.java index 5096745..ce3d99e 100644 --- a/libart/src/main/java/java/lang/reflect/Method.java +++ b/libart/src/main/java/java/lang/reflect/Method.java @@ -255,7 +255,7 @@ public final class Method extends AbstractMethod implements GenericDeclaration, short[] types = dex.parameterTypeIndicesFromMethodIndex(methodDexIndex); int length = Math.min(types.length, params.length); for (int i = 0; i < types.length; i++) { - Class<?> aType = getDexCacheType(dex, types[i]); + Class<?> aType = getDexCacheType(dex, types[i] & 0xFFFF); Class<?> bType = params[i]; if (aType != bType) { int comparison = aType.getName().compareTo(bType.getName()); |