Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/378.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/183.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 为什么我在Eclipse/ADT中看到相同代码行的重复警告?_Java_Android_Eclipse_Warnings_Lint - Fatal编程技术网

Java 为什么我在Eclipse/ADT中看到相同代码行的重复警告?

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

我很惊讶看到以下代码片段出现重复的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; 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有关