From 6b9829917263ba6ccc8d725d730316bb36c0fc78 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 4 Feb 2014 16:14:30 -0800 Subject: Switch libcore over to a long in DexFile. Change-Id: I7f259bd14134fc6663047b8a1237b8364f10a51d --- dalvik/src/main/java/dalvik/system/DexFile.java | 27 +++++++++---------------- 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'dalvik/src') diff --git a/dalvik/src/main/java/dalvik/system/DexFile.java b/dalvik/src/main/java/dalvik/system/DexFile.java index d2fd5da..5d38f2c 100644 --- a/dalvik/src/main/java/dalvik/system/DexFile.java +++ b/dalvik/src/main/java/dalvik/system/DexFile.java @@ -34,7 +34,7 @@ import libcore.io.StructStat; * read-only by the VM. */ public final class DexFile { - private int mCookie; + private long mCookie; private final String mFileName; private final CloseGuard guard = CloseGuard.get(); @@ -215,7 +215,7 @@ public final class DexFile { return defineClass(name, loader, mCookie, suppressed); } - private static Class defineClass(String name, ClassLoader loader, int cookie, + private static Class defineClass(String name, ClassLoader loader, long cookie, List suppressed) { Class result = null; try { @@ -232,9 +232,6 @@ public final class DexFile { return result; } - private static native Class defineClassNative(String name, ClassLoader loader, int cookie) - throws ClassNotFoundException, NoClassDefFoundError; - /** * Enumerate the names of the classes in this DEX file. * @@ -266,9 +263,6 @@ public final class DexFile { } } - /* return a String array with class names */ - native private static String[] getClassNameList(int cookie); - /** * Called when the class is finalized. Makes sure the DEX file is closed. * @@ -291,20 +285,17 @@ public final class DexFile { * Open a DEX file. The value returned is a magic VM cookie. On * failure, an IOException is thrown. */ - private static int openDexFile(String sourceName, String outputName, - int flags) throws IOException { + private static long openDexFile(String sourceName, String outputName, int flags) throws IOException { return openDexFileNative(new File(sourceName).getCanonicalPath(), (outputName == null) ? null : new File(outputName).getCanonicalPath(), flags); } - native private static int openDexFileNative(String sourceName, String outputName, - int flags) throws IOException; - - /* - * Close DEX file. - */ - native private static void closeDexFile(int cookie); + private static native void closeDexFile(long cookie); + private static native Class defineClassNative(String name, ClassLoader loader, long cookie) + throws ClassNotFoundException, NoClassDefFoundError; + private static native String[] getClassNameList(long cookie); + private static native long openDexFileNative(String sourceName, String outputName, int flags); /** * Returns true if the VM believes that the apk/jar file is out of date @@ -320,6 +311,6 @@ public final class DexFile { * @throws dalvik.system.StaleDexCacheError if the optimized dex file * is stale but exists on a read-only partition. */ - native public static boolean isDexOptNeeded(String fileName) + public static native boolean isDexOptNeeded(String fileName) throws FileNotFoundException, IOException; } -- cgit v1.1