From cfead78069f3dc32998dc118ee08cab3867acea2 Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Mon, 27 Feb 2012 10:21:35 -0800 Subject: Upgrade from Progaurd 4.4 to 4.7. Change-Id: Ie185d0be411a80cc6a330cafa8547252a7dc1d9c You can find the changelog here http://proguard.sourceforge.net/#downloads.html --- src/proguard/classfile/ClassPool.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/proguard/classfile/ClassPool.java') diff --git a/src/proguard/classfile/ClassPool.java b/src/proguard/classfile/ClassPool.java index 57728a5..c5defe8 100644 --- a/src/proguard/classfile/ClassPool.java +++ b/src/proguard/classfile/ClassPool.java @@ -2,7 +2,7 @@ * ProGuard -- shrinking, optimization, obfuscation, and preverification * of Java bytecode. * - * Copyright (c) 2002-2009 Eric Lafortune (eric@graphics.cornell.edu) + * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu) * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free @@ -26,14 +26,16 @@ import proguard.classfile.visitor.*; import java.util.*; /** - * This is a set of representations of classes. They can be enumerated or + * This is a set of representations of classes. They can be enumerated or * retrieved by name. They can also be accessed by means of class visitors. * * @author Eric Lafortune */ public class ClassPool { - private final Map classes = new HashMap(); + // We're using a sorted tree map instead of a hash map to store the classes, + // in order to make the processing more deterministic. + private final Map classes = new TreeMap(); /** @@ -66,11 +68,11 @@ public class ClassPool /** * Returns a Clazz from the class pool based on its name. Returns * null if the class with the given name is not in the class - * pool. Returns the base class if the class name is an array type. + * pool. */ public Clazz getClass(String className) { - return (Clazz)classes.get(ClassUtil.internalClassNameFromClassType(className)); + return (Clazz)classes.get(className); } @@ -122,8 +124,11 @@ public class ClassPool */ public void classesAcceptAlphabetically(ClassVisitor classVisitor) { - TreeMap sortedClasses = new TreeMap(classes); - Iterator iterator = sortedClasses.values().iterator(); + // We're already using a tree map. + //TreeMap sortedClasses = new TreeMap(classes); + //Iterator iterator = sortedClasses.values().iterator(); + + Iterator iterator = classes.values().iterator(); while (iterator.hasNext()) { Clazz clazz = (Clazz)iterator.next(); -- cgit v1.2.3