7110111: Minor Java SE javadoc & Constructor clean up

Reviewed-by: alanb, darcy
This commit is contained in:
Martin Desruisseaux 2011-11-10 11:41:27 -05:00 committed by Lance Andersen
parent b53840e998
commit f6f5a14a32
8 changed files with 17 additions and 19 deletions

View File

@ -57,7 +57,7 @@ public abstract class Writer implements Appendable, Closeable, Flushable {
/**
* Size of writeBuffer, must be >= 1
*/
private final int writeBufferSize = 1024;
private static final int WRITE_BUFFER_SIZE = 1024;
/**
* The object used to synchronize operations on this stream. For
@ -107,7 +107,7 @@ public abstract class Writer implements Appendable, Closeable, Flushable {
public void write(int c) throws IOException {
synchronized (lock) {
if (writeBuffer == null){
writeBuffer = new char[writeBufferSize];
writeBuffer = new char[WRITE_BUFFER_SIZE];
}
writeBuffer[0] = (char) c;
write(writeBuffer, 0, 1);
@ -180,9 +180,9 @@ public abstract class Writer implements Appendable, Closeable, Flushable {
public void write(String str, int off, int len) throws IOException {
synchronized (lock) {
char cbuf[];
if (len <= writeBufferSize) {
if (len <= WRITE_BUFFER_SIZE) {
if (writeBuffer == null) {
writeBuffer = new char[writeBufferSize];
writeBuffer = new char[WRITE_BUFFER_SIZE];
}
cbuf = writeBuffer;
} else { // Don't permanently allocate very large buffers.

View File

@ -71,7 +71,7 @@ public class AssertionError extends Error {
* @see Throwable#getCause()
*/
public AssertionError(Object detailMessage) {
this("" + detailMessage);
this(String.valueOf(detailMessage));
if (detailMessage instanceof Throwable)
initCause((Throwable) detailMessage);
}
@ -85,7 +85,7 @@ public class AssertionError extends Error {
* @param detailMessage value to be used in constructing detail message
*/
public AssertionError(boolean detailMessage) {
this("" + detailMessage);
this(String.valueOf(detailMessage));
}
/**
@ -97,7 +97,7 @@ public class AssertionError extends Error {
* @param detailMessage value to be used in constructing detail message
*/
public AssertionError(char detailMessage) {
this("" + detailMessage);
this(String.valueOf(detailMessage));
}
/**
@ -109,7 +109,7 @@ public class AssertionError extends Error {
* @param detailMessage value to be used in constructing detail message
*/
public AssertionError(int detailMessage) {
this("" + detailMessage);
this(String.valueOf(detailMessage));
}
/**
@ -121,7 +121,7 @@ public class AssertionError extends Error {
* @param detailMessage value to be used in constructing detail message
*/
public AssertionError(long detailMessage) {
this("" + detailMessage);
this(String.valueOf(detailMessage));
}
/**
@ -133,7 +133,7 @@ public class AssertionError extends Error {
* @param detailMessage value to be used in constructing detail message
*/
public AssertionError(float detailMessage) {
this("" + detailMessage);
this(String.valueOf(detailMessage));
}
/**
@ -145,7 +145,7 @@ public class AssertionError extends Error {
* @param detailMessage value to be used in constructing detail message
*/
public AssertionError(double detailMessage) {
this("" + detailMessage);
this(String.valueOf(detailMessage));
}
/**

View File

@ -3008,7 +3008,7 @@ public final
/**
* Casts this {@code Class} object to represent a subclass of the class
* represented by the specified class object. Checks that that the cast
* represented by the specified class object. Checks that the cast
* is valid, and throws a {@code ClassCastException} if it is not. If
* this method succeeds, it always returns a reference to this class object.
*

View File

@ -607,8 +607,7 @@ public final class Double extends Number implements Comparable<Double> {
* @see java.lang.Double#valueOf(java.lang.String)
*/
public Double(String s) throws NumberFormatException {
// REMIND: this is inefficient
this(valueOf(s).doubleValue());
value = parseDouble(s);
}
/**

View File

@ -529,8 +529,7 @@ public final class Float extends Number implements Comparable<Float> {
* @see java.lang.Float#valueOf(java.lang.String)
*/
public Float(String s) throws NumberFormatException {
// REMIND: this is inefficient
this(valueOf(s).floatValue());
value = parseFloat(s);
}
/**

View File

@ -767,7 +767,7 @@ public interface PreparedStatement extends Statement {
/**
* Sets the designated paramter to the given <code>String</code> object.
* Sets the designated parameter to the given <code>String</code> object.
* The driver converts this to a SQL <code>NCHAR</code> or
* <code>NVARCHAR</code> or <code>LONGNVARCHAR</code> value
* (depending on the argument's

View File

@ -991,7 +991,7 @@ public interface Statement extends Wrapper, AutoCloseable {
/**
* Requests that a <code>Statement</code> be pooled or not pooled. The value
* specified is a hint to the statement pool implementation indicating
* whether the applicaiton wants the statement to be pooled. It is up to
* whether the application wants the statement to be pooled. It is up to
* the statement pool manager as to whether the hint is used.
* <p>
* The poolable value of a statement is applicable to both internal

View File

@ -629,7 +629,7 @@ public class Attributes implements Map<Object,Object>, Cloneable {
public static final Name IMPLEMENTATION_VENDOR_ID = new Name("Implementation-Vendor-Id");
/**
* <code>Name</code> object for <code>Implementation-Vendor-URL</code>
* <code>Name</code> object for <code>Implementation-URL</code>
* manifest attribute used for package versioning.
* @see <a href="../../../../technotes/guides/versioning/spec/versioning2.html#wp90779">
* Java Product Versioning Specification</a>