The basic Array() type doesn't need special rescue because it gets a direct instantiation from Array.initValues(). If Array.initValues() is pruned in the final pass, it means no arrays were ever instantiated.
However, we don't want to prune instance fields due to non-instantiability.
Note: this was partially rolled-back and superceded by r2297.
Review by: spoon (postmortem)
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@2234 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/Pruner.java b/dev/core/src/com/google/gwt/dev/jjs/impl/Pruner.java
index 54be4a0..783a65a 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/Pruner.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/Pruner.java
@@ -238,7 +238,7 @@
* Remove any unreferenced classes and interfaces from JProgram. Remove any
* unreferenced methods and fields from their containing classes.
*/
- private class PruneVisitor extends JVisitor {
+ private class PruneVisitor extends JModVisitor {
private boolean didChange = false;
@@ -414,8 +414,11 @@
return false;
}
- private boolean pruneViaNoninstantiability(boolean isInstantiated,
- CanBeStatic it) {
+ private <T extends CanBeStatic & HasEnclosingType> boolean pruneViaNoninstantiability(
+ boolean isInstantiated, T it) {
+ if (it.getEnclosingType() == program.getIndexedType("Array")) {
+ return false;
+ }
return (!isInstantiated && !it.isStatic());
}
}
@@ -910,8 +913,6 @@
boolean madeChanges = false;
while (true) {
RescueVisitor rescuer = new RescueVisitor();
- // Always rescue and instantiate the "base" array type
- rescuer.rescue(program.getIndexedType("Array"), true, true);
for (JReferenceType type : program.codeGenTypes) {
rescuer.rescue(type, true, saveCodeGenTypes);
}