Fixes issue #1536: nullifies the return type of methods declared to return a type that has been determined to be globally uninstantiable.

Review by: mmastrac, mmendez


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@1531 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 8a46fcc..db93546 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
@@ -86,7 +86,8 @@
 public class Pruner {
 
   /**
-   * Remove assignments to pruned fields, locals and params.
+   * Remove assignments to pruned fields, locals and params. Also nullify the
+   * return type of methods declared to return a globally uninstantiable type.
    */
   private class CleanupRefsVisitor extends JModVisitor {
 
@@ -159,6 +160,16 @@
         ctx.replaceMe(newCall);
       }
     }
+
+    @Override
+    public void endVisit(JMethod x, Context ctx) {
+      JType type = x.getType();
+      if (type instanceof JReferenceType) {
+        if (!program.typeOracle.isInstantiatedType((JReferenceType) type)) {
+          x.setType(program.getTypeNull());
+        }
+      }
+    }
   }
 
   /**