summaryrefslogtreecommitdiff
path: root/src/proguard/classfile/ClassPool.java
diff options
context:
space:
mode:
authorYing Wang <wangying@google.com>2013-09-20 16:17:43 -0700
committerYing Wang <wangying@google.com>2013-09-20 16:32:42 -0700
commitb9cc48a43ed984587c939d02fba5316bf5c0df6e (patch)
tree7d42e31a97264803b1147ef6001e8a5e6968a122 /src/proguard/classfile/ClassPool.java
parent54f59ac04f3e21d5aecdd46bb1e7f4577924ab92 (diff)
downloadproguard-b9cc48a43ed984587c939d02fba5316bf5c0df6e.tar.gz
Upgrade Proguard to 4.10.
Downloaded from: http://sourceforge.net/projects/proguard/files/proguard/4.10/ Bug: 8992787 Change-Id: Ia07cc5b3feed443982b7e8f2a1f361479e735b18
Diffstat (limited to 'src/proguard/classfile/ClassPool.java')
-rw-r--r--src/proguard/classfile/ClassPool.java30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/proguard/classfile/ClassPool.java b/src/proguard/classfile/ClassPool.java
index 57728a5..5439c6f 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-2013 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();
/**
@@ -59,18 +61,27 @@ public class ClassPool
*/
public void removeClass(Clazz clazz)
{
- classes.remove(clazz.getName());
+ removeClass(clazz.getName());
+ }
+
+
+ /**
+ * Removes the specified Clazz from the class pool.
+ */
+ public void removeClass(String className)
+ {
+ classes.remove(className);
}
/**
* Returns a Clazz from the class pool based on its name. Returns
* <code>null</code> 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 +133,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();