< prev index next >

src/java.desktop/share/classes/javax/sound/sampled/EnumControl.java

Print this page
rev 57600 : 8236980: toString() cleanup in JavaSound
Reviewed-by: XXX

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -128,17 +128,18 @@
 
         return false;
     }
 
     /**
-     * Provides a string representation of the control.
+     * Returns a string representation of the enumerated control.
      *
-     * @return a string description
+     * @return a string representation of the enumerated control
      */
     @Override
     public String toString() {
-        return new String(getType() + " with current value: " + getValue());
+        return String.format("%s with current value: %s", super.toString(),
+                             getValue());
     }
 
     /**
      * An instance of the {@code EnumControl.Type} inner class identifies one
      * kind of enumerated control. Static instances are provided for the common
< prev index next >