8272626: Avoid C-style array declarations in java.*

Reviewed-by: dfuchs, alanb
This commit is contained in:
Claes Redestad 2021-08-18 10:47:03 +00:00
parent e8f1219d6f
commit 30b0f820ce
54 changed files with 140 additions and 140 deletions

View file

@ -272,7 +272,7 @@ public final class String
* @param value
* The initial value of the string
*/
public String(char value[]) {
public String(char[] value) {
this(value, 0, value.length, null);
}
@ -297,7 +297,7 @@ public final class String
* If {@code offset} is negative, {@code count} is negative, or
* {@code offset} is greater than {@code value.length - count}
*/
public String(char value[], int offset, int count) {
public String(char[] value, int offset, int count) {
this(value, offset, count, rangeCheck(value, offset, count));
}
@ -394,7 +394,7 @@ public final class String
* @see #String(byte[])
*/
@Deprecated(since="1.1")
public String(byte ascii[], int hibyte, int offset, int count) {
public String(byte[] ascii, int hibyte, int offset, int count) {
checkBoundsOffCount(offset, count, ascii.length);
if (count == 0) {
this.value = "".value;
@ -446,7 +446,7 @@ public final class String
* @see #String(byte[])
*/
@Deprecated(since="1.1")
public String(byte ascii[], int hibyte) {
public String(byte[] ascii, int hibyte) {
this(ascii, hibyte, 0, ascii.length);
}
@ -1354,7 +1354,7 @@ public final class String
*
* @since 1.1
*/
public String(byte bytes[], String charsetName)
public String(byte[] bytes, String charsetName)
throws UnsupportedEncodingException {
this(bytes, 0, bytes.length, charsetName);
}
@ -1379,7 +1379,7 @@ public final class String
*
* @since 1.6
*/
public String(byte bytes[], Charset charset) {
public String(byte[] bytes, Charset charset) {
this(bytes, 0, bytes.length, charset);
}
@ -1665,7 +1665,7 @@ public final class String
* <li>{@code dstBegin+(srcEnd-srcBegin)} is larger than
* {@code dst.length}</ul>
*/
public void getChars(int srcBegin, int srcEnd, char dst[], int dstBegin) {
public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) {
checkBoundsBeginEnd(srcBegin, srcEnd, length());
checkBoundsOffCount(dstBegin, srcEnd - srcBegin, dst.length);
if (isLatin1()) {
@ -1719,7 +1719,7 @@ public final class String
* </ul>
*/
@Deprecated(since="1.1")
public void getBytes(int srcBegin, int srcEnd, byte dst[], int dstBegin) {
public void getBytes(int srcBegin, int srcEnd, byte[] dst, int dstBegin) {
checkBoundsBeginEnd(srcBegin, srcEnd, length());
Objects.requireNonNull(dst);
checkBoundsOffCount(dstBegin, srcEnd - srcBegin, dst.length);
@ -4221,7 +4221,7 @@ public final class String
* @return a {@code String} that contains the characters of the
* character array.
*/
public static String valueOf(char data[]) {
public static String valueOf(char[] data) {
return new String(data);
}
@ -4245,7 +4245,7 @@ public final class String
* {@code offset+count} is larger than
* {@code data.length}.
*/
public static String valueOf(char data[], int offset, int count) {
public static String valueOf(char[] data, int offset, int count) {
return new String(data, offset, count);
}
@ -4262,7 +4262,7 @@ public final class String
* {@code offset+count} is larger than
* {@code data.length}.
*/
public static String copyValueOf(char data[], int offset, int count) {
public static String copyValueOf(char[] data, int offset, int count) {
return new String(data, offset, count);
}
@ -4273,7 +4273,7 @@ public final class String
* @return a {@code String} that contains the characters of the
* character array.
*/
public static String copyValueOf(char data[]) {
public static String copyValueOf(char[] data) {
return new String(data);
}