Java 为什么我在Eclipse/ADT中看到相同代码行的重复警告?
我很惊讶看到以下代码片段出现重复的Android Lint警告:Java 为什么我在Eclipse/ADT中看到相同代码行的重复警告?,java,android,eclipse,warnings,lint,Java,Android,Eclipse,Warnings,Lint,我很惊讶看到以下代码片段出现重复的Android Lint警告: 122 String contactName = contact.getName(); 123 name += contactName.substring(0, 1).toUpperCase(); -> Implicitly using the default local is common source of bugs: Use toUpperCase(Locale) instead; Contact.java; lin
122 String contactName = contact.getName();
123 name += contactName.substring(0, 1).toUpperCase();
-> Implicitly using the default local is common source of bugs: Use toUpperCase(Locale) instead; Contact.java; line 123
-> Implicitly using the default local is common source of bugs: Use toUpperCase(Locale) instead; Contact.java; line 123
我知道如何解决这个问题,但我仍然惊讶地看到同样的警告两次。
有人有想法/建议吗,或者这是安卓系统的警告问题?
我的开发设置:iMac、ADT/Eclipse构建:v22.2.1-833290找到了解决方案,即,如果使用以下代码段,您只会收到一条警告:
122 String contactName = contact.getName();
123 name = name + contactName.substring(0, 1).toUpperCase();
-> Implicitly using the default local is common source of bugs: Use toUpperCase(Locale) instead; Contact.java; line 123
如果您正在使用以下内容:
123 name = contactName.isEmpty() ? "-" : contactName.substring(0, 1).toUpperCase();
您将得到与前面提到的相同的两个警告
可能与构建/解析表达式树IMHO有关