gwtproject / gwt

GWT Open Source Project
http://www.gwtproject.org
1.52k stars 377 forks source link

CssResource import with common ancestor generates incorrect top-level style name #8241

Open dankurka opened 9 years ago

dankurka commented 9 years ago

Originally reported on Google Code with ID 8251

Found in GWT Release (e.g. 2.4.0, 2.5.1, trunk):

2.5.1

Detailed description (please be as specific as possible):

Given the following:

1) interface WidgetStyle extends CssResource
2) interface InnerStyle extends WidgetStyle
3) interface OuterStyle1 extends WidgetStyle

importing InnerStyle.class via @CssResource.Import in a ClientBundle causes the generated
top-level style names for OuterStyle1 to be replaced by those for InnerStyle.

Shortest code snippet which demonstrates issue (please indicate where
actual result differs from expected result):

Build the attached example and inspect the output in a browser. Two labels are displayed;
the first shows the bug, while the second shows the expected result.

Looking at the generated Java source, InnerResources generates this:

      public String getText() {
        return (".GMUSOAADA{background-color:" + ("#fff")  + ";}");
      }
      public java.lang.String widget(){
        return "GMUSOAADA";
      }

OuterResources1 generates this (see comment prefixed with "FIXME"):

      public String getText() {
        return (".GMUSOAADB{background-color:" + ("#ddf")  + ";}.GMUSOAADB .GMUSOAADA{background-color:"
+ ("#ddd")  + ";}");
      }
      public java.lang.String widget(){
        // FIXME: This should be GMUSOAADB
        return "GMUSOAADA";
      }

And OuterResources2 generates this:

      public String getText() {
        return (".GMUSOAADC{background-color:" + ("#ddf")  + ";}.GMUSOAADC .GMUSOAADA{background-color:"
+ ("#ddd")  + ";}");
      }
      public java.lang.String widget(){
        return "GMUSOAADC";
      }

Workaround if you have one:

None

Reported by atomknight033197 on 2013-07-09 21:21:33


dankurka commented 9 years ago
See also issue #8618.

Reported by post2edbras on 2014-03-23 16:50:45

dankurka commented 9 years ago
Issue 8618 has been merged into this issue.

Reported by t.broyer on 2014-03-23 22:39:47

dankurka commented 9 years ago
Debug research: https://groups.google.com/d/topic/google-web-toolkit/IyB80gtGQiI

Workaround (IIUC): override the inherited method, so the key in the map is different
and doesn't conflict.

Reported by t.broyer on 2014-03-23 22:43:32

dankurka commented 9 years ago
Please solve this issue for 2.8. It's still an issue (see also: #8642)

Reported by post2edbras on 2015-02-17 11:44:52