提交 fa681a76 编写于 作者: D dholmes

8015470: Remove redundant calls of toString() on String objects

Reviewed-by: dholmes, alanb
Contributed-by: NOtavio Goncalves <otariojava@java.net>
上级 802f99a8
...@@ -396,7 +396,7 @@ public class SearchFilter implements AttrFilter { ...@@ -396,7 +396,7 @@ public class SearchFilter implements AttrFilter {
// do we need to begin with the first token? // do we need to begin with the first token?
if(proto.charAt(0) != WILDCARD_TOKEN && if(proto.charAt(0) != WILDCARD_TOKEN &&
!value.toString().toLowerCase(Locale.ENGLISH).startsWith( !value.toLowerCase(Locale.ENGLISH).startsWith(
subStrs.nextToken().toLowerCase(Locale.ENGLISH))) { subStrs.nextToken().toLowerCase(Locale.ENGLISH))) {
if(debug) { if(debug) {
System.out.println("faild initial test"); System.out.println("faild initial test");
......
...@@ -55,8 +55,7 @@ public class IncompleteAnnotationException extends RuntimeException { ...@@ -55,8 +55,7 @@ public class IncompleteAnnotationException extends RuntimeException {
public IncompleteAnnotationException( public IncompleteAnnotationException(
Class<? extends Annotation> annotationType, Class<? extends Annotation> annotationType,
String elementName) { String elementName) {
super(annotationType.getName().toString() + super(annotationType.getName() + " missing element " +
" missing element " +
elementName.toString()); elementName.toString());
this.annotationType = annotationType; this.annotationType = annotationType;
......
...@@ -879,9 +879,9 @@ public class Main implements sun.rmi.rmic.Constants { ...@@ -879,9 +879,9 @@ public class Main implements sun.rmi.rmic.Constants {
} }
String[] args = new String[3]; String[] args = new String[3];
args[0] = (arg0 != null ? arg0.toString() : "null"); args[0] = (arg0 != null ? arg0 : "null");
args[1] = (arg1 != null ? arg1.toString() : "null"); args[1] = (arg1 != null ? arg1 : "null");
args[2] = (arg2 != null ? arg2.toString() : "null"); args[2] = (arg2 != null ? arg2 : "null");
return java.text.MessageFormat.format(format, (Object[]) args); return java.text.MessageFormat.format(format, (Object[]) args);
} }
......
...@@ -256,8 +256,8 @@ class MemberDefinition implements Constants { ...@@ -256,8 +256,8 @@ class MemberDefinition implements Constants {
} }
String name = this.name.toString(); String name = this.name.toString();
return name.startsWith(prefixVal) return name.startsWith(prefixVal)
|| name.toString().startsWith(prefixLoc) || name.startsWith(prefixLoc)
|| name.toString().startsWith(prefixThis); || name.startsWith(prefixThis);
} }
public boolean isAccessMethod() { public boolean isAccessMethod() {
......
...@@ -352,7 +352,7 @@ public class Utils { ...@@ -352,7 +352,7 @@ public class Utils {
result = new Character(value.charAt(0)); result = new Character(value.charAt(0));
} else if (Number.class.isAssignableFrom(Utils.getClass(type))) { } else if (Number.class.isAssignableFrom(Utils.getClass(type))) {
result = createNumberFromStringValue(value); result = createNumberFromStringValue(value);
} else if (value == null || value.toString().equals("null")) { } else if (value == null || value.equals("null")) {
// hack for null value // hack for null value
result = null; result = null;
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册