1

I'm trying to achieve harmony between FindBugs and GWT 2.4 (being used with Java 6). FindBugs complains about this line ...

childrenStr.append(child.getName().toLowerCase());

with the error

Internationalization - Consider using Locale parameterized version of invoked method

To attempt to heal the pain, I added a Locale ...

childrenStr.append(child.getName().toLowerCase(Locale.ENGLISH));

but then GWT dies with the compile error ...

[ERROR] Line 346: The method toLowerCase() in the type String is not applicable for the arguments (Locale)

How can I achieve a lasting peace between the two whereby I resolve the FindBugs error and keep GWT quiet?

Thanks, - Dave

Dave
  • 15,639
  • 133
  • 442
  • 830

1 Answers1

3

Since GWT doesn't include support for the locale sensitive String#toLowerCase(Locale) method and there is no locale sensitive lowercase conversion in the GWT API, suppress the FindBugs DM_CONVERT_CASE warning:

@edu.umd.cs.findbugs.annotations.SuppressWarnings(
    value="DM_CONVERT_CASE", 
    justification="No GWT emulation of String#toLowerCase(Locale)")
public void lowercaseUser() {
  childrenStr.append(child.getName().toLowerCase());
}
Community
  • 1
  • 1
Jason Terk
  • 6,005
  • 1
  • 27
  • 31