changeset 7346:571e5f452640

8015470: Remove redundant calls of toString() on String objects Reviewed-by: dholmes, alanb Contributed-by: Otavio Goncalves <otariojava@java.net>
author dholmes
date Thu, 06 Jun 2013 05:32:26 -0400
parents e857b2a3ecee
children c4480e0d9f53
files src/share/classes/com/sun/jndi/toolkit/dir/SearchFilter.java src/share/classes/java/lang/annotation/IncompleteAnnotationException.java src/share/classes/sun/rmi/rmic/Main.java src/share/classes/sun/tools/java/MemberDefinition.java src/share/classes/sun/tools/jconsole/inspector/Utils.java
diffstat 5 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/jndi/toolkit/dir/SearchFilter.java	Wed Jun 05 08:41:02 2013 -0700
+++ b/src/share/classes/com/sun/jndi/toolkit/dir/SearchFilter.java	Thu Jun 06 05:32:26 2013 -0400
@@ -396,7 +396,7 @@
 
             // do we need to begin with the first token?
             if(proto.charAt(0) != WILDCARD_TOKEN &&
-                    !value.toString().toLowerCase(Locale.ENGLISH).startsWith(
+                    !value.toLowerCase(Locale.ENGLISH).startsWith(
                         subStrs.nextToken().toLowerCase(Locale.ENGLISH))) {
                 if(debug) {
                     System.out.println("faild initial test");
--- a/src/share/classes/java/lang/annotation/IncompleteAnnotationException.java	Wed Jun 05 08:41:02 2013 -0700
+++ b/src/share/classes/java/lang/annotation/IncompleteAnnotationException.java	Thu Jun 06 05:32:26 2013 -0400
@@ -55,8 +55,7 @@
     public IncompleteAnnotationException(
             Class<? extends Annotation> annotationType,
             String elementName) {
-        super(annotationType.getName().toString() +
-              " missing element " +
+        super(annotationType.getName() + " missing element " +
               elementName.toString());
 
         this.annotationType = annotationType;
--- a/src/share/classes/sun/rmi/rmic/Main.java	Wed Jun 05 08:41:02 2013 -0700
+++ b/src/share/classes/sun/rmi/rmic/Main.java	Thu Jun 06 05:32:26 2013 -0400
@@ -879,9 +879,9 @@
         }
 
         String[] args = new String[3];
-        args[0] = (arg0 != null ? arg0.toString() : "null");
-        args[1] = (arg1 != null ? arg1.toString() : "null");
-        args[2] = (arg2 != null ? arg2.toString() : "null");
+        args[0] = (arg0 != null ? arg0 : "null");
+        args[1] = (arg1 != null ? arg1 : "null");
+        args[2] = (arg2 != null ? arg2 : "null");
 
         return java.text.MessageFormat.format(format, (Object[]) args);
     }
--- a/src/share/classes/sun/tools/java/MemberDefinition.java	Wed Jun 05 08:41:02 2013 -0700
+++ b/src/share/classes/sun/tools/java/MemberDefinition.java	Thu Jun 06 05:32:26 2013 -0400
@@ -256,8 +256,8 @@
         }
         String name = this.name.toString();
         return name.startsWith(prefixVal)
-            || name.toString().startsWith(prefixLoc)
-            || name.toString().startsWith(prefixThis);
+            || name.startsWith(prefixLoc)
+            || name.startsWith(prefixThis);
     }
 
     public boolean isAccessMethod() {
--- a/src/share/classes/sun/tools/jconsole/inspector/Utils.java	Wed Jun 05 08:41:02 2013 -0700
+++ b/src/share/classes/sun/tools/jconsole/inspector/Utils.java	Thu Jun 06 05:32:26 2013 -0400
@@ -352,7 +352,7 @@
             result = new Character(value.charAt(0));
         } else if (Number.class.isAssignableFrom(Utils.getClass(type))) {
             result = createNumberFromStringValue(value);
-        } else if (value == null || value.toString().equals("null")) {
+        } else if (value == null || value.equals("null")) {
             // hack for null value
             result = null;
         } else {