diff options
-rw-r--r-- | ojluni/src/main/java/java/lang/Class.java | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/ojluni/src/main/java/java/lang/Class.java b/ojluni/src/main/java/java/lang/Class.java index 3e7fb6099e..8591bfe1a2 100644 --- a/ojluni/src/main/java/java/lang/Class.java +++ b/ojluni/src/main/java/java/lang/Class.java @@ -2670,9 +2670,31 @@ public final class Class<T> implements java.io.Serializable, public Class<?> getDexCacheType(Dex dex, int dexTypeIndex) { Class<?> resolvedType = dexCache.getResolvedType(dexTypeIndex); if (resolvedType == null) { - int descriptorIndex = dex.typeIds().get(dexTypeIndex); - String descriptor = getDexCacheString(dex, descriptorIndex); - resolvedType = InternalNames.getClass(getClassLoader(), descriptor); + + // Temporary debugging code for issue b/35970927. In the absence of reproducibility, + // we want more information on : + // + // (a) This class: a proxy for the dex file whose cache is being queried. + // (b) The dex type index & descriptor index. + // (c) The resolved descriptor. + // (d) The wrapper message : this is the name of the class used by InternalNames + // for its loadClass call. + // + // (c) & (d) should help us rule out string compression issues. + // (a) & (b) should help us rule out some classes of heap corruption issues. + int descriptorIndex = 0; + String descriptor = ""; + try { + descriptorIndex = dex.typeIds().get(dexTypeIndex); + descriptor = getDexCacheString(dex, descriptorIndex); + resolvedType = InternalNames.getClass(getClassLoader(), descriptor); + } catch (NoClassDefFoundError error) { + throw new NoClassDefFoundError("class: " + getName() + + ", dexTypeIndex=" + dexTypeIndex + + ", descriptorIndex=" + descriptorIndex + ", desc=" + descriptor + + ", wrapped Msg= " + error.getMessage()); + } + dexCache.setResolvedType(dexTypeIndex, resolvedType); } return resolvedType; |