Revision: 8699
Author: rj...@google.com
Date: Thu Sep  2 06:12:48 2010
Log: Revert r8691 due to api break
[Was: Add debugging information to CssResource.]

http://code.google.com/p/google-web-toolkit/source/detail?r=8699

Deleted:
 /trunk/user/src/com/google/gwt/resources/EnableCssResourceDebugging.gwt.xml
/trunk/user/src/com/google/gwt/resources/client/impl/CssResourceObserver.java
 /trunk/user/src/com/google/gwt/resources/css/CssDebugInfo.java
 /trunk/user/src/com/google/gwt/resources/css/CssDebugInfoImpl.java
/trunk/user/test/com/google/gwt/resources/client/CssResourceDebugInfoTest.java
Modified:
 /trunk/user/src/com/google/gwt/resources/Resources.gwt.xml
 /trunk/user/src/com/google/gwt/resources/client/CssResource.java
 /trunk/user/src/com/google/gwt/resources/css/ClassRenamer.java
 /trunk/user/src/com/google/gwt/resources/css/ast/CssStylesheet.java
 /trunk/user/src/com/google/gwt/resources/rg/CssResourceGenerator.java
 /trunk/user/test/com/google/gwt/resources/ResourcesSuite.java
 /trunk/user/test/com/google/gwt/resources/client/CSSResourceTest.java

=======================================
--- /trunk/user/src/com/google/gwt/resources/EnableCssResourceDebugging.gwt.xml Wed Sep 1 12:11:35 2010
+++ /dev/null
@@ -1,22 +0,0 @@
-<!-- --> -<!-- Copyright 2008 Google Inc. --> -<!-- Licensed under the Apache License, Version 2.0 (the "License"); you --> -<!-- may not use this file except in compliance with the License. You may --> -<!-- may obtain a copy of the License at --> -<!-- --> -<!-- http://www.apache.org/licenses/LICENSE-2.0 --> -<!-- --> -<!-- Unless required by applicable law or agreed to in writing, software --> -<!-- distributed under the License is distributed on an "AS IS" BASIS, --> -<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or --> -<!-- implied. License for the specific language governing permissions and --> -<!-- limitations under the License. -->
-
-<!-- Enables CssResource.getDebugInfo() and records obfuscated name map -->
-<module>
-  <inherits name="com.google.gwt.resources.Resources" />
- <set-configuration-property name="CssResource.enableDebugInfo" value="true" /> - <replace-with class="com.google.gwt.resources.client.impl.CssResourceObserver.Mapper"> - <when-type-is class="com.google.gwt.resources.client.impl.CssResourceObserver" />
-  </replace-with>
-</module>
=======================================
--- /trunk/user/src/com/google/gwt/resources/client/impl/CssResourceObserver.java Wed Sep 1 12:11:35 2010
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.google.gwt.resources.client.impl;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.resources.client.CssResource;
-import com.google.gwt.resources.client.CssResource.DebugInfo;
-
-import java.util.Map;
-
-/**
- * Enables CssResources to be intercepted before injection. The base
- * implementation is a no-op.
- * <p>
- * <em>This is an internal implementation API that is subject to change.</em>
- */
-public class CssResourceObserver {
- private static final CssResourceObserver IMPL = GWT.create(CssResourceObserver.class);
-
-  /**
-   * An implementation of CssResourceObserver that records CssResource
- * obfuscation data into a JavaScriptObject accessible on the main application
-   * window as <code>$wnd.gwtCssResource['moduleName']</code>.
-   * <p>
-   * The keys on this object will be of the form
- * <code>&lt;ClientBundle type name>.&lt;CssResource method name>.&lt;Raw css class selector></code>
-   * . An example key might be
- * <code>com.example.Resources.superButton.button-outer-div</code>. The value - * associated with the key is the (possibly obfuscated) CSS class selector
-   * used in the injected code.
-   */
-  public static class Mapper extends CssResourceObserver {
-    private final JavaScriptObject myMap;
-
-    public Mapper() {
-      myMap = ensureMap();
-    }
-
-    @Override
-    protected <T extends CssResource> T registerImpl(T resource) {
-      DebugInfo info = resource.getDebugInfo();
-      if (info != null) {
- String prefix = info.getOwnerType() + "." + info.getMethodName() + "."; - for (Map.Entry<String, String> entry : info.getClassMap().entrySet()) {
-          set(myMap, prefix + entry.getKey(), entry.getValue());
-        }
-      }
-      return resource;
-    }
-
-    /**
-     * Creates or returns the module-specific CssResource map.
-     */
-    private native JavaScriptObject ensureMap() /*-{
-      var topMap = $wnd.gwtCssResource;
-      if (!topMap) {
-        topMap = $wnd.gwtCssResource = {};
-      }
-      var moduleName = @com.google.gwt.core.client.GWT::getModuleName()();
-      var myMap = topMap[moduleName];
-      if (!myMap) {
-          myMap = topMap[moduleName] = {};
-      }
-      return myMap;
-    }-*/;
-
-    /**
-     * Trivial JS associative array assignment.
-     */
- private native void set(JavaScriptObject map, String key, String value) /*-{
-      map[key] = value;
-    }-*/;
-  }
-
-  /**
-   * Register a CssResource. This method is called from code generated by
-   * CssResourceGenerator.
-   */
-  public static <T extends CssResource> T register(T resource) {
-    return IMPL.registerImpl(resource);
-  }
-
-  /**
-   * No-op.
-   */
-  protected <T extends CssResource> T registerImpl(T resource) {
-    return resource;
-  }
-}
=======================================
--- /trunk/user/src/com/google/gwt/resources/css/CssDebugInfo.java Wed Sep 1 12:11:35 2010
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.google.gwt.resources.css;
-
-/**
- * This interface allows diagnostic information about a CssResource to be
- * accumulated during processing.
- */
-public interface CssDebugInfo {
-  /**
-   * A no-op implementation.
-   */
-  CssDebugInfo NULL = new CssDebugInfo() {
- public void addToClassMap(String rawClassName, String obfuscatedClassName) {
-    }
-
-    public boolean isEnabled() {
-      return false;
-    }
-
-    public void setMethodName(String methodName) {
-    }
-
-    public void setOwnerType(String ownerType) {
-    }
-
-    public void setSource(String[] source) {
-    }
-  };
-
-  void addToClassMap(String rawClassName, String obfuscatedClassName);
-
-  boolean isEnabled();
-
-  void setMethodName(String methodName);
-
-  void setOwnerType(String ownerType);
-
-  void setSource(String[] source);
-}
=======================================
--- /trunk/user/src/com/google/gwt/resources/css/CssDebugInfoImpl.java Wed Sep 1 12:11:35 2010
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.google.gwt.resources.css;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Used by CssResourceGenerator.
- */
-public class CssDebugInfoImpl implements CssDebugInfo {
- private final Map<String, String> classNameMap = new HashMap<String, String>();
-  private String methodName;
-  private String ownerType;
-  private String[] source;
-
- public void addToClassMap(String rawClassName, String obfuscatedClassName) {
-    classNameMap.put(rawClassName, obfuscatedClassName);
-  }
-
-  public Map<String, String> getClassNameMap() {
-    return classNameMap;
-  }
-
-  public String getMethodName() {
-    return methodName;
-  }
-
-  public String getOwnerType() {
-    return ownerType;
-  }
-
-  public String[] getSource() {
-    return source;
-  }
-
-  public boolean isEnabled() {
-    return true;
-  }
-
-  public void setMethodName(String methodName) {
-    this.methodName = methodName;
-  }
-
-  public void setOwnerType(String ownerType) {
-    this.ownerType = ownerType;
-  }
-
-  public void setSource(String[] source) {
-    this.source = source;
-  }
-}
=======================================
--- /trunk/user/test/com/google/gwt/resources/client/CssResourceDebugInfoTest.java Wed Sep 1 12:11:35 2010
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright 2010 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.google.gwt.resources.client;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.junit.client.GWTTestCase;
-import com.google.gwt.resources.client.CssResource.DebugInfo;
-import com.google.gwt.resources.client.CssResource.NotStrict;
-
-import java.util.Map;
-
-/**
- * Tests for {...@link CssResource.DebugInfo}.
- */
-public class CssResourceDebugInfoTest extends GWTTestCase {
-  interface Concatenated extends CssResource {
-    String partA();
-
-    String partB();
-  }
-
-  interface Resources extends ClientBundle {
-    @Source(value = {"concatenatedA.css", "concatenatedB.css"})
-    Concatenated concatenated();
-
-    CssResource empty();
-
-    @NotStrict
-    @Source("concatenatedA.css")
-    CssResource notStrict();
-
-    @NotStrict
-    @Source("concatenatedB.css")
-    CssResource unused();
-  }
-
-  @Override
-  public String getModuleName() {
-    return "com.google.gwt.resources.EnableCssResourceDebugging";
-  }
-
-  public void testClassMap() {
-    Resources r = GWT.create(Resources.class);
-    Concatenated css = r.concatenated();
-    DebugInfo info = css.getDebugInfo();
-
-    assertEquals(2, info.getSource().length);
-
-    Map<String, String> map = info.getClassMap();
-    assertEquals(css.partA(), map.get("partA"));
-    assertEquals(css.partB(), map.get("partB"));
-    assertNull(map.get("something"));
-
-    CssResource notStrict = r.notStrict();
-    info = notStrict.getDebugInfo();
-    assertEquals("partA", info.getClassMap().get("partA"));
-  }
-
-  /**
- * Test the JavaScriptObject-based obfuscation map. This should be installed
-   * by EnableCssResourceDebugging.gwt.xml.
-   */
-  public void testCssResourceObserver() {
-    JavaScriptObject myMap = getMap();
-    assertNotNull("No map registered", myMap);
-
-    Resources r = GWT.create(Resources.class);
-    Concatenated css = r.concatenated();
-    DebugInfo info = css.getDebugInfo();
-    String prefix = info.getOwnerType() + "." + info.getMethodName() + ".";
-    assertEquals(css.partA(), get(myMap, prefix + "partA"));
-    assertEquals(css.partB(), get(myMap, prefix + "partB"));
-    assertNull(get(myMap, prefix + "partC"));
-
-    // Test the unobfuscated resource
- assertEquals("partA", get(myMap, info.getOwnerType() + ".notStrict.partA"));
-
-    // Test the otherwise-unused resource
- assertEquals("partB", get(myMap, info.getOwnerType() + ".unused.partB"));
-  }
-
-  public void testTrivialDebugInfo() {
-    Resources r = GWT.create(Resources.class);
-    CssResource empty = r.empty();
-    DebugInfo info = empty.getDebugInfo();
-    assertNotNull(info);
-    assertEquals("empty", info.getMethodName());
-    assertEquals(
-        "com.google.gwt.resources.client.CssResourceDebugInfoTest$Resources",
-        info.getOwnerType());
-    assertEquals(1, info.getSource().length);
-    assertTrue(info.getSource()[0].endsWith("empty.css"));
-  }
-
-  private native String get(JavaScriptObject map, String key) /*-{
-    return map[key];
-  }-*/;
-
-  private native JavaScriptObject getMap() /*-{
- return $wnd.gwtcssresour...@com.google.gwt.core.client.gwt::getModuleName()()];
-  }-*/;
-}
=======================================
--- /trunk/user/src/com/google/gwt/resources/Resources.gwt.xml Wed Sep 1 12:11:35 2010 +++ /trunk/user/src/com/google/gwt/resources/Resources.gwt.xml Thu Sep 2 06:12:48 2010
@@ -58,10 +58,6 @@
     </all>
   </generate-with>

-  <!-- This enables CssResource.getDebugInfo() -->
- <define-configuration-property name="CssResource.enableDebugInfo" is-multi-valued="false" /> - <set-configuration-property name="CssResource.enableDebugInfo" value="false" />
-
   <!-- This can be used to disable the use of strongly-named files -->
<define-configuration-property name="ClientBundle.enableRenaming" is-multi-valued="false" /> <set-configuration-property name="ClientBundle.enableRenaming" value="true" />
=======================================
--- /trunk/user/src/com/google/gwt/resources/client/CssResource.java Wed Sep 1 12:11:35 2010 +++ /trunk/user/src/com/google/gwt/resources/client/CssResource.java Thu Sep 2 06:12:48 2010
@@ -24,7 +24,6 @@
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
-import java.util.Map;

 /**
* Aggregates and minifies CSS stylesheets. A CssResource represents a regular
@@ -170,42 +169,6 @@
   public @interface ClassName {
     String value();
   }
-
-  /**
-   * This interface allows CssResources to be used with external testing
-   * infrastructure.
-   */
-  public interface DebugInfo {
-    /**
- * Returns an immutable map of the raw CSS class names used in the source
-     * CSS to their obfuscated identifiers.
-     * <p>
- * The object returned from this method is essentially a JSON map literal:
-     *
-     * <pre>
-     * { 'someClass' : 'xyzzy', 'anotherClass' : 'xyzzz' }
-     * </pre>
-     * </p>
-     */
-    Map<String, String> getClassMap();
-
-    /**
-     * Equivalent to {...@link CssResource#getName()}.
-     */
-    String getMethodName();
-
-    /**
- * Returns the fully-qualified binary name of the ClientBundle in which the
-     * CssResource was declared.
-     */
-    String getOwnerType();
-
-    /**
-     * Returns the resolved locations of the resources specified in the
-     * CssResource's {...@code @Source} annotation.
-     */
-    String[] getSource();
-  }

   /**
* Makes class selectors from other CssResource types available in the raw
@@ -355,27 +318,6 @@
    */
   boolean ensureInjected();

-  /**
-   * Returns diagnostic information associated with the CssResource if the
- * <code>CssResource.enableDebugInfo</code> configuration property is set to
-   * <code>true</code>. Otherwise, this method returns <code>null</code>.
-   * <p>
-   * To enable this method, inherit the
- * <code>com.google.gwt.resources.EnableCssResourceDebugging</code> module.
-   * Inheriting this module will also cause all class selectors used in a
-   * CssResource to be exported to a global object accessible on the main
-   * application window as <code>$wnd.gwtCssResource['moduleName']</code>.
-   * <p>
-   * The keys on the map object will be of the form
- * <code>&lt;ClientBundle type name>.&lt;CssResource method name>.&lt;Raw css class selector></code>
-   * . An example key might be
- * <code>com.example.Resources.superButton.button-outer-div</code>. The value - * associated with the key is the (possibly obfuscated) CSS class selector
-   * used in the injected code.
-   * </p>
-   */
-  DebugInfo getDebugInfo();
-
   /**
    * Provides the contents of the CssResource.
    */
=======================================
--- /trunk/user/src/com/google/gwt/resources/css/ClassRenamer.java Wed Sep 1 12:11:35 2010 +++ /trunk/user/src/com/google/gwt/resources/css/ClassRenamer.java Thu Sep 2 06:12:48 2010
@@ -40,6 +40,13 @@
  */
 public class ClassRenamer extends CssVisitor {

+  /**
+ * A tag to indicate that an externally-defined CSS class has no JMethod that
+   * is used to access it.
+   */
+  private static final Replacement UNREFERENCED_EXTERNAL = new Replacement(
+      null, null);
+
   /*
    * TODO: Replace with Pair<A, B>.
    */
@@ -73,13 +80,6 @@
       }
     }
   }
-
-  /**
- * A tag to indicate that an externally-defined CSS class has no JMethod that
-   * is used to access it.
-   */
-  private static final Replacement UNREFERENCED_EXTERNAL = new Replacement(
-      null, null);

   /**
    * Records replacements that have actually been performed.
@@ -93,7 +93,6 @@
   private final Map<String, Replacement> potentialReplacements;
   private final TreeLogger logger;
   private final Set<JMethod> missingClasses;
-  private CssStylesheet sheet;
   private final boolean strict;
   private final Set<String> unknownClasses = new HashSet<String>();

@@ -133,14 +132,11 @@
       Replacement entry = potentialReplacements.get(sourceClassName);

       if (entry == null) {
-        // This map is checked when in strict mode
         unknownClasses.add(sourceClassName);
- sheet.getDebugInfo().addToClassMap(sourceClassName, sourceClassName);
         continue;

       } else if (entry == UNREFERENCED_EXTERNAL) {
         // An @external without an accessor method. This is OK.
- sheet.getDebugInfo().addToClassMap(sourceClassName, sourceClassName);
         continue;
       }

@@ -154,7 +150,6 @@

       actualReplacements.put(method, obfuscatedClassName);
       missingClasses.remove(method);
- sheet.getDebugInfo().addToClassMap(sourceClassName, obfuscatedClassName);
     }

     if (start != 0) {
@@ -219,12 +214,6 @@
   public Map<JMethod, String> getReplacements() {
     return actualReplacements;
   }
-
-  @Override
-  public boolean visit(CssStylesheet x, Context ctx) {
-    this.sheet = x;
-    return true;
-  }

   /**
    * Flatten class name lookups to speed selector rewriting.
=======================================
--- /trunk/user/src/com/google/gwt/resources/css/ast/CssStylesheet.java Wed Sep 1 12:11:35 2010 +++ /trunk/user/src/com/google/gwt/resources/css/ast/CssStylesheet.java Thu Sep 2 06:12:48 2010
@@ -15,8 +15,6 @@
  */
 package com.google.gwt.resources.css.ast;

-import com.google.gwt.resources.css.CssDebugInfo;
-
 import java.util.ArrayList;
 import java.util.List;

@@ -24,7 +22,6 @@
  * An abstract representation of a CSS stylesheet.
  */
 public class CssStylesheet extends CssNode implements HasNodes {
-  private CssDebugInfo debugInfo = CssDebugInfo.NULL;
   private List<CssNode> rules = new ArrayList<CssNode>();

   public CssStylesheet() {
@@ -45,22 +42,10 @@
   public void append(CssStylesheet other) {
     rules.addAll(CssNodeCloner.clone(CssNode.class, other.rules));
   }
-
-  /**
- * Returns {...@link CssDebugInfo#NULL} unless {...@link #setDebugInfo} has been
-   * called.
-   */
-  public CssDebugInfo getDebugInfo() {
-    return debugInfo;
-  }

   public List<CssNode> getNodes() {
     return rules;
   }
-
-  public void setDebugInfo(CssDebugInfo debugInfo) {
-    this.debugInfo = debugInfo;
-  }

   public void traverse(CssVisitor visitor, Context context) {
     if (visitor.visit(this, context)) {
=======================================
--- /trunk/user/src/com/google/gwt/resources/rg/CssResourceGenerator.java Wed Sep 1 12:11:35 2010 +++ /trunk/user/src/com/google/gwt/resources/rg/CssResourceGenerator.java Thu Sep 2 06:12:48 2010
@@ -37,10 +37,7 @@
 import com.google.gwt.resources.client.CssResource.ImportedWithPrefix;
 import com.google.gwt.resources.client.CssResource.NotStrict;
 import com.google.gwt.resources.client.CssResource.Shared;
-import com.google.gwt.resources.client.impl.CssResourceObserver;
 import com.google.gwt.resources.css.ClassRenamer;
-import com.google.gwt.resources.css.CssDebugInfo;
-import com.google.gwt.resources.css.CssDebugInfoImpl;
 import com.google.gwt.resources.css.CssGenerationVisitor;
 import com.google.gwt.resources.css.DefsCollector;
 import com.google.gwt.resources.css.ExternalClassesCollector;
@@ -77,7 +74,6 @@
 import java.io.Serializable;
 import java.net.URL;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
 import java.util.IdentityHashMap;
@@ -101,8 +97,6 @@
return o1.getQualifiedSourceName().compareTo(o2.getQualifiedSourceName());
     }
   }
-
- private static final String ENABLE_DEBUG_INFO_PROPERTY = "CssResource.enableDebugInfo";

   /**
* A lookup table of base-32 chars we use to encode CSS idents. Because CSS
@@ -435,11 +429,12 @@
   @Override
public String createAssignment(TreeLogger logger, ResourceContext context,
       JMethod method) throws UnableToCompleteException {
+
     TypeOracle typeOracle = context.getGeneratorContext().getTypeOracle();
     SourceWriter sw = new StringSourceWriter();
     // Write the expression to create the subtype.
-    sw.println(CssResourceObserver.class.getName() + ".register(new "
-        + method.getReturnType().getQualifiedSourceName() + "() {");
+    sw.println("new " + method.getReturnType().getQualifiedSourceName()
+        + "() {");
     sw.indent();

     JClassType cssResourceSubtype = method.getReturnType().isInterface();
@@ -493,9 +488,8 @@
     writeUserMethods(logger, sw, stylesheetMap.get(method),
         cssResourceSubtype.getOverridableMethods(), actualReplacements);

-    writeDebugInfo(sw, stylesheetMap.get(method).getDebugInfo());
     sw.outdent();
-    sw.println("})");
+    sw.println("}");

     return sw.toString();
   }
@@ -558,22 +552,6 @@

     // Create the AST and do a quick scan for requirements
     CssStylesheet sheet = GenerateCssAst.exec(logger, resources);
-
-    // Start recording diagnostic info
-    CssDebugInfo debugInfo = makeDebugInfo(logger, context);
-    if (debugInfo.isEnabled()) {
-      debugInfo.setMethodName(method.getName());
- debugInfo.setOwnerType(context.getClientBundleType().getQualifiedBinaryName());
-
-      String[] sources = new String[resources.length];
-      for (int i = 0, j = resources.length; i < j; i++) {
-        sources[i] = resources[i].toExternalForm();
-      }
-      debugInfo.setSource(sources);
-
-      sheet.setDebugInfo(debugInfo);
-    }
-
     stylesheetMap.put(method, sheet);
     (new RequirementsCollector(logger, requirements)).accept(sheet);
   }
@@ -869,25 +847,6 @@

     return strict;
   }
-
-  /**
-   * Returns {...@link CssDebugInfo#NULL} or a new instance of
-   * {...@link CssDebugInfoImpl} based on the value of the
-   * {...@value #ENABLE_DEBUG_INFO_PROPERTY} deferred binding property.
-   */
- private CssDebugInfo makeDebugInfo(TreeLogger logger, ResourceContext context) {
-    CssDebugInfo debugInfo = CssDebugInfo.NULL;
-    try {
- PropertyOracle oracle = context.getGeneratorContext().getPropertyOracle(); - ConfigurationProperty debugInfoProperty = oracle.getConfigurationProperty(ENABLE_DEBUG_INFO_PROPERTY);
-      if (Boolean.valueOf(debugInfoProperty.getValues().get(0))) {
-        debugInfo = new CssDebugInfoImpl();
-      }
-    } catch (BadPropertyValueException e) {
-      // Unexpected, but non-fatal
-    }
-    return debugInfo;
-  }

   /**
* Create a Java expression that evaluates to the string representation of the
@@ -974,67 +933,6 @@
     sw.outdent();
     sw.println("}");
   }
-
-  private void writeDebugInfo(SourceWriter sw, CssDebugInfo debugInfo) {
-    if (debugInfo instanceof CssDebugInfoImpl) {
-      writeDebugInfoEnabled(sw, (CssDebugInfoImpl) debugInfo);
-    } else {
-      writeDebugInfoDisabled(sw);
-    }
-  }
-
-  /**
-   * Write the null implementation of <code>getDebugInfo</code>.
-   */
-  private void writeDebugInfoDisabled(SourceWriter sw) {
-    sw.println("public DebugInfo getDebugInfo() {");
-    sw.indentln("return null;");
-    sw.println("}");
-  }
-
-  /**
-   * Writes the real implementation of <code>getDebugInfo</code>.
-   */
- private void writeDebugInfoEnabled(SourceWriter sw, CssDebugInfoImpl debugInfo) {
-    sw.println("public DebugInfo getDebugInfo() {");
-    sw.indent();
-    sw.println("final " + Map.class.getName() + "<String, String> map;");
-    // Instance initializer to populate the map
-    sw.println("{");
-    sw.indent();
-    sw.println(Map.class.getName() + "<String, String> temp = new "
-        + HashMap.class.getName() + "<String, String>();");
- for (Map.Entry<String, String> entry : debugInfo.getClassNameMap().entrySet()) {
-      // temp.put("key", "value");
- sw.println("temp.put(\"" + Generator.escape(entry.getKey()) + "\", \""
-          + Generator.escape(entry.getValue()) + "\");");
-    }
-    sw.println("map = " + Collections.class.getName()
-        + ".unmodifiableMap(temp);");
-    sw.outdent();
-    sw.println("}");
-    sw.println("return new DebugInfo() {");
-    sw.indent();
-
-    sw.println("public " + Map.class.getName()
-        + "<String, String> getClassMap() {return map;}");
-    sw.println("public String getMethodName() {return \""
-        + Generator.escape(debugInfo.getMethodName()) + "\";}");
-    sw.println("public String getOwnerType() {return \""
-        + Generator.escape(debugInfo.getOwnerType()) + "\";}");
-
-    // return new String[] {"foo", "bar",};
-    sw.println("public String[] getSource() {return new String[] {");
-    for (String s : debugInfo.getSource()) {
-      sw.indentln("\"" + Generator.escape(s) + "\",");
-    }
-    sw.println("};}");
-
-    sw.outdent();
-    sw.println("};");
-    sw.outdent();
-    sw.println("}");
-  }

   private void writeDefAssignment(TreeLogger logger, SourceWriter sw,
       JMethod toImplement, CssStylesheet cssStylesheet)
@@ -1110,7 +1008,6 @@
   }

   private void writeGetName(JMethod method, SourceWriter sw) {
- stylesheetMap.get(method).getDebugInfo().setMethodName(method.getName());
     sw.println("public String getName() {");
     sw.indent();
     sw.println("return \"" + method.getName() + "\";");
@@ -1134,7 +1031,7 @@
     for (JMethod toImplement : methods) {
       String name = toImplement.getName();
       if ("getName".equals(name) || "getText".equals(name)
- || "ensureInjected".equals(name) || "getDebugInfo".equals(name)) {
+          || "ensureInjected".equals(name)) {
         continue;
       }

=======================================
--- /trunk/user/test/com/google/gwt/resources/ResourcesSuite.java Wed Sep 1 12:11:35 2010 +++ /trunk/user/test/com/google/gwt/resources/ResourcesSuite.java Thu Sep 2 06:12:48 2010
@@ -17,12 +17,11 @@

 import com.google.gwt.junit.tools.GWTTestSuite;
 import com.google.gwt.resources.client.CSSResourceTest;
-import com.google.gwt.resources.client.CssResourceDebugInfoTest;
-import com.google.gwt.resources.client.DataResourceDoNotEmbedTest;
-import com.google.gwt.resources.client.DataResourceMimeTypeTest;
 import com.google.gwt.resources.client.ImageResourceNoInliningTest;
 import com.google.gwt.resources.client.ImageResourceTest;
 import com.google.gwt.resources.client.NestedBundleTest;
+import com.google.gwt.resources.client.DataResourceDoNotEmbedTest;
+import com.google.gwt.resources.client.DataResourceMimeTypeTest;
 import com.google.gwt.resources.client.TextResourceTest;
 import com.google.gwt.resources.css.CssExternalTest;
 import com.google.gwt.resources.css.CssNodeClonerTest;
@@ -44,7 +43,6 @@
GWTTestSuite suite = new GWTTestSuite("Test for com.google.gwt.resources");
     suite.addTestSuite(CssClassNamesTestCase.class);
     suite.addTestSuite(CssExternalTest.class);
-    suite.addTestSuite(CssResourceDebugInfoTest.class);
     suite.addTestSuite(CSSResourceTest.class);
     suite.addTestSuite(CssReorderTest.class);
     suite.addTestSuite(CssRtlTest.class);
=======================================
--- /trunk/user/test/com/google/gwt/resources/client/CSSResourceTest.java Wed Sep 1 12:11:35 2010 +++ /trunk/user/test/com/google/gwt/resources/client/CSSResourceTest.java Thu Sep 2 06:12:48 2010
@@ -337,9 +337,6 @@
     assertTrue(text.contains(".externalA ." + css.replacement()));
     assertTrue(text.contains(".externalB"));
     assertTrue(text.contains(".externalC"));
-
-    // See CssResourceDebugInfoTest
-    assertNull(css.getDebugInfo());
   }

   public void testDefines() {

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to