Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RC2: InterfaceGenerator mangles @def words that start with a numeral #9401

Closed
ShaunEdiger opened this issue Aug 16, 2016 · 5 comments
Closed
Assignees
Milestone

Comments

@ShaunEdiger
Copy link

When using 2.8.0-rc2, a @def statement such as
@def DEF_1 #FFF; in a .gss will confuse InterfaceGenerator (gwt:css). The resulting method will be nameed def1, but calling the method will result in the following failure:

[ERROR] The following method [def1()] doesn't match a constant nor a style class. You could fix that by adding .def1 {}

Using DEF_N1 will work successfully.

I first encountered the issue on August 1st using SNAPSHOT.

I'm attaching a maven project to demonstrate the problem. Running mvn clean prepare-package ought to be sufficient. The offending @def is located in DefsImpl.gss.

gss-def-interface-generator.zip

@jnehlmeier jnehlmeier added this to the 2.8 milestone Aug 21, 2016
@gkdn
Copy link
Contributor

gkdn commented Sep 2, 2016

@jDramaix could you take a look and see if there is a quick fix before 2.8?

@jDramaix
Copy link
Member

The problem seems to come from Guava.

   // returns def1
   CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, "DEF_1");

   // return DEF1
   CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, "def1");

I'm checking with the guava team if it's the expected behavior. Otherwise, the quick fix could be to change the InterfaceGenerator to use DEF_1 as method name instead of trying to convert the name of the constant to lower camel case when the pattern _[0-9] is detected in the constant name.

@tbroyer
Copy link
Member

tbroyer commented Sep 22, 2016

Instead of "the pattern _[0-9]", how about testing roundtripping instead?

@jDramaix
Copy link
Member

agree.

@jDramaix
Copy link
Member

bauna pushed a commit to bauna/gwt that referenced this issue Sep 29, 2016
If a constant name contains words starting with a numeral (e.g DEF_1), 
the InterfaceGenerator generates a method with the constant name in 
camel lower case to access the constant (def1())
The CssRessourceGenerator is not able to match the method with the 
constant afterwards.

Change-Id: I6469b793cc6372b7e0e2dfa2441c1d8779bbb567
Bug-Link: gwtproject#9401
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants