aboutsummaryrefslogtreecommitdiffstats
path: root/src/proguard/optimize/peephole/RetargetedInnerClassAttributeRemover.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/proguard/optimize/peephole/RetargetedInnerClassAttributeRemover.java')
-rw-r--r--src/proguard/optimize/peephole/RetargetedInnerClassAttributeRemover.java44
1 files changed, 7 insertions, 37 deletions
diff --git a/src/proguard/optimize/peephole/RetargetedInnerClassAttributeRemover.java b/src/proguard/optimize/peephole/RetargetedInnerClassAttributeRemover.java
index 254f748..6707a12 100644
--- a/src/proguard/optimize/peephole/RetargetedInnerClassAttributeRemover.java
+++ b/src/proguard/optimize/peephole/RetargetedInnerClassAttributeRemover.java
@@ -2,7 +2,7 @@
* ProGuard -- shrinking, optimization, obfuscation, and preverification
* of Java bytecode.
*
- * Copyright (c) 2002-2011 Eric Lafortune (eric@graphics.cornell.edu)
+ * Copyright (c) 2002-2009 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
@@ -28,8 +28,6 @@ import proguard.classfile.constant.visitor.ConstantVisitor;
import proguard.classfile.util.SimplifiedVisitor;
import proguard.classfile.visitor.ClassVisitor;
-import java.util.Arrays;
-
/**
* This ClassVisitor removes InnerClasses and EnclosingMethod attributes in
* classes that are retargeted or that refer to classes that are retargeted.
@@ -72,7 +70,10 @@ implements ClassVisitor,
}
// Clean up any remaining array elements.
- Arrays.fill(attributes, newAtributesCount, attributesCount, null);
+ for (int index = newAtributesCount; index < attributesCount; index++)
+ {
+ attributes[index] = null;
+ }
// Update the number of attribuets.
programClass.u2attributesCount = newAtributesCount;
@@ -89,39 +90,8 @@ implements ClassVisitor,
// Check whether the class itself is retargeted.
checkTarget(clazz);
- if (!retargeted)
- {
- // Check whether the referenced classes are retargeted.
- innerClassesAttribute.innerClassEntriesAccept(clazz, this);
- int classesCount = innerClassesAttribute.u2classesCount;
- InnerClassesInfo[] classes = innerClassesAttribute.classes;
-
- int newClassesCount = 0;
-
- // Copy over all non-retargeted attributes.
- for (int index = 0; index < classesCount; index++)
- {
- InnerClassesInfo classInfo = classes[index];
-
- // Check if the outer class or inner class is a retargeted class.
- retargeted = false;
- classInfo.outerClassConstantAccept(clazz, this);
- classInfo.innerClassConstantAccept(clazz, this);
- if (!retargeted)
- {
- classes[newClassesCount++] = classInfo;
- }
- }
-
- // Clean up any remaining array elements.
- Arrays.fill(classes, newClassesCount, classesCount, null);
-
- // Update the number of classes.
- innerClassesAttribute.u2classesCount = newClassesCount;
-
- // Remove the attribute altogether if it's empty.
- retargeted = newClassesCount == 0;
- }
+ // Check whether the referenced classes are retargeted.
+ innerClassesAttribute.innerClassEntriesAccept(clazz, this);
}