8300863: Remove C-style array declarations in java.io

Reviewed-by: alanb, rriggs, darcy, iris
This commit is contained in:
Per Minborg 2023-01-24 07:43:29 +00:00
parent 2292ce137c
commit 57f2d48e1e
8 changed files with 19 additions and 19 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 2023, 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
@ -48,7 +48,7 @@ public class BufferedOutputStream extends FilterOutputStream {
/**
* The internal buffer where data is stored.
*/
protected byte buf[];
protected byte[] buf;
/**
* The number of valid bytes in the buffer. This value is always

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2023, 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
@ -73,8 +73,9 @@ public class BufferedWriter extends Writer {
private Writer out;
private char cb[];
private int nChars, nextChar;
private char[] cb;
private int nChars;
private int nextChar;
private final int maxChars; // maximum number of buffers chars
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 2023, 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
@ -53,7 +53,7 @@ public class ByteArrayInputStream extends InputStream {
* stream; element {@code buf[pos]} is
* the next byte to be read.
*/
protected byte buf[];
protected byte[] buf;
/**
* The index of the next character to read from the input stream buffer.

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1994, 2023, 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
@ -51,7 +51,7 @@ public class ByteArrayOutputStream extends OutputStream {
/**
* The buffer where data is stored.
*/
protected byte buf[];
protected byte[] buf;
/**
* The number of valid bytes in the buffer.

View file

@ -44,7 +44,7 @@ public class CharArrayWriter extends Writer {
/**
* The buffer where data is stored.
*/
protected char buf[];
protected char[] buf;
/**
* The number of chars in the buffer.

View file

@ -1216,7 +1216,7 @@ public class File
* @see java.nio.file.Files#newDirectoryStream(Path,String)
*/
public String[] list(FilenameFilter filter) {
String names[] = normalizedList();
String[] names = normalizedList();
if ((names == null) || (filter == null)) {
return names;
}
@ -1309,7 +1309,7 @@ public class File
* @see java.nio.file.Files#newDirectoryStream(Path,String)
*/
public File[] listFiles(FilenameFilter filter) {
String ss[] = normalizedList();
String[] ss = normalizedList();
if (ss == null) return null;
ArrayList<File> files = new ArrayList<>();
for (String s : ss)
@ -1347,7 +1347,7 @@ public class File
* @see java.nio.file.Files#newDirectoryStream(Path,java.nio.file.DirectoryStream.Filter)
*/
public File[] listFiles(FileFilter filter) {
String ss[] = normalizedList();
String[] ss = normalizedList();
if (ss == null) return null;
ArrayList<File> files = new ArrayList<>();
for (String s : ss) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2023, 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
@ -54,7 +54,7 @@ public class PipedReader extends Reader {
/**
* The circular buffer into which incoming data is placed.
*/
char buffer[];
char[] buffer;
/**
* The index of the position in the circular buffer at which the
@ -100,7 +100,6 @@ public class PipedReader extends Reader {
connect(src);
}
/**
* Creates a {@code PipedReader} so
* that it is not yet {@linkplain #connect(java.io.PipedWriter)

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2023, 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
@ -68,7 +68,7 @@ public class StreamTokenizer {
private Reader reader = null;
private InputStream input = null;
private char buf[] = new char[20];
private char[] buf = new char[20];
/**
* The next character to be considered by the nextToken method. May also
@ -91,7 +91,7 @@ public class StreamTokenizer {
private boolean slashSlashCommentsP = false;
private boolean slashStarCommentsP = false;
private byte ctype[] = new byte[256];
private final byte[] ctype = new byte[256];
private static final byte CT_WHITESPACE = 1;
private static final byte CT_DIGIT = 2;
private static final byte CT_ALPHA = 4;