提交 08e66185 编写于 作者: L lancea

7110111: Minor Java SE javadoc & Constructor clean up

Reviewed-by: alanb, darcy
Contributed-by: NMartin Desruisseaux <martin.desruisseaux@geomatys.fr>
上级 d0d335b8
...@@ -57,7 +57,7 @@ public abstract class Writer implements Appendable, Closeable, Flushable { ...@@ -57,7 +57,7 @@ public abstract class Writer implements Appendable, Closeable, Flushable {
/** /**
* Size of writeBuffer, must be >= 1 * 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 * The object used to synchronize operations on this stream. For
...@@ -107,7 +107,7 @@ public abstract class Writer implements Appendable, Closeable, Flushable { ...@@ -107,7 +107,7 @@ public abstract class Writer implements Appendable, Closeable, Flushable {
public void write(int c) throws IOException { public void write(int c) throws IOException {
synchronized (lock) { synchronized (lock) {
if (writeBuffer == null){ if (writeBuffer == null){
writeBuffer = new char[writeBufferSize]; writeBuffer = new char[WRITE_BUFFER_SIZE];
} }
writeBuffer[0] = (char) c; writeBuffer[0] = (char) c;
write(writeBuffer, 0, 1); write(writeBuffer, 0, 1);
...@@ -180,9 +180,9 @@ public abstract class Writer implements Appendable, Closeable, Flushable { ...@@ -180,9 +180,9 @@ public abstract class Writer implements Appendable, Closeable, Flushable {
public void write(String str, int off, int len) throws IOException { public void write(String str, int off, int len) throws IOException {
synchronized (lock) { synchronized (lock) {
char cbuf[]; char cbuf[];
if (len <= writeBufferSize) { if (len <= WRITE_BUFFER_SIZE) {
if (writeBuffer == null) { if (writeBuffer == null) {
writeBuffer = new char[writeBufferSize]; writeBuffer = new char[WRITE_BUFFER_SIZE];
} }
cbuf = writeBuffer; cbuf = writeBuffer;
} else { // Don't permanently allocate very large buffers. } else { // Don't permanently allocate very large buffers.
......
...@@ -71,7 +71,7 @@ public class AssertionError extends Error { ...@@ -71,7 +71,7 @@ public class AssertionError extends Error {
* @see Throwable#getCause() * @see Throwable#getCause()
*/ */
public AssertionError(Object detailMessage) { public AssertionError(Object detailMessage) {
this("" + detailMessage); this(String.valueOf(detailMessage));
if (detailMessage instanceof Throwable) if (detailMessage instanceof Throwable)
initCause((Throwable) detailMessage); initCause((Throwable) detailMessage);
} }
...@@ -85,7 +85,7 @@ public class AssertionError extends Error { ...@@ -85,7 +85,7 @@ public class AssertionError extends Error {
* @param detailMessage value to be used in constructing detail message * @param detailMessage value to be used in constructing detail message
*/ */
public AssertionError(boolean detailMessage) { public AssertionError(boolean detailMessage) {
this("" + detailMessage); this(String.valueOf(detailMessage));
} }
/** /**
...@@ -97,7 +97,7 @@ public class AssertionError extends Error { ...@@ -97,7 +97,7 @@ public class AssertionError extends Error {
* @param detailMessage value to be used in constructing detail message * @param detailMessage value to be used in constructing detail message
*/ */
public AssertionError(char detailMessage) { public AssertionError(char detailMessage) {
this("" + detailMessage); this(String.valueOf(detailMessage));
} }
/** /**
...@@ -109,7 +109,7 @@ public class AssertionError extends Error { ...@@ -109,7 +109,7 @@ public class AssertionError extends Error {
* @param detailMessage value to be used in constructing detail message * @param detailMessage value to be used in constructing detail message
*/ */
public AssertionError(int detailMessage) { public AssertionError(int detailMessage) {
this("" + detailMessage); this(String.valueOf(detailMessage));
} }
/** /**
...@@ -121,7 +121,7 @@ public class AssertionError extends Error { ...@@ -121,7 +121,7 @@ public class AssertionError extends Error {
* @param detailMessage value to be used in constructing detail message * @param detailMessage value to be used in constructing detail message
*/ */
public AssertionError(long detailMessage) { public AssertionError(long detailMessage) {
this("" + detailMessage); this(String.valueOf(detailMessage));
} }
/** /**
...@@ -133,7 +133,7 @@ public class AssertionError extends Error { ...@@ -133,7 +133,7 @@ public class AssertionError extends Error {
* @param detailMessage value to be used in constructing detail message * @param detailMessage value to be used in constructing detail message
*/ */
public AssertionError(float detailMessage) { public AssertionError(float detailMessage) {
this("" + detailMessage); this(String.valueOf(detailMessage));
} }
/** /**
...@@ -145,7 +145,7 @@ public class AssertionError extends Error { ...@@ -145,7 +145,7 @@ public class AssertionError extends Error {
* @param detailMessage value to be used in constructing detail message * @param detailMessage value to be used in constructing detail message
*/ */
public AssertionError(double detailMessage) { public AssertionError(double detailMessage) {
this("" + detailMessage); this(String.valueOf(detailMessage));
} }
/** /**
......
...@@ -3008,7 +3008,7 @@ public final ...@@ -3008,7 +3008,7 @@ public final
/** /**
* Casts this {@code Class} object to represent a subclass of the class * 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 * is valid, and throws a {@code ClassCastException} if it is not. If
* this method succeeds, it always returns a reference to this class object. * this method succeeds, it always returns a reference to this class object.
* *
......
...@@ -607,8 +607,7 @@ public final class Double extends Number implements Comparable<Double> { ...@@ -607,8 +607,7 @@ public final class Double extends Number implements Comparable<Double> {
* @see java.lang.Double#valueOf(java.lang.String) * @see java.lang.Double#valueOf(java.lang.String)
*/ */
public Double(String s) throws NumberFormatException { public Double(String s) throws NumberFormatException {
// REMIND: this is inefficient value = parseDouble(s);
this(valueOf(s).doubleValue());
} }
/** /**
......
...@@ -529,8 +529,7 @@ public final class Float extends Number implements Comparable<Float> { ...@@ -529,8 +529,7 @@ public final class Float extends Number implements Comparable<Float> {
* @see java.lang.Float#valueOf(java.lang.String) * @see java.lang.Float#valueOf(java.lang.String)
*/ */
public Float(String s) throws NumberFormatException { public Float(String s) throws NumberFormatException {
// REMIND: this is inefficient value = parseFloat(s);
this(valueOf(s).floatValue());
} }
/** /**
......
...@@ -767,7 +767,7 @@ public interface PreparedStatement extends Statement { ...@@ -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 * The driver converts this to a SQL <code>NCHAR</code> or
* <code>NVARCHAR</code> or <code>LONGNVARCHAR</code> value * <code>NVARCHAR</code> or <code>LONGNVARCHAR</code> value
* (depending on the argument's * (depending on the argument's
......
...@@ -991,7 +991,7 @@ public interface Statement extends Wrapper, AutoCloseable { ...@@ -991,7 +991,7 @@ public interface Statement extends Wrapper, AutoCloseable {
/** /**
* Requests that a <code>Statement</code> be pooled or not pooled. The value * Requests that a <code>Statement</code> be pooled or not pooled. The value
* specified is a hint to the statement pool implementation indicating * 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. * the statement pool manager as to whether the hint is used.
* <p> * <p>
* The poolable value of a statement is applicable to both internal * The poolable value of a statement is applicable to both internal
......
...@@ -629,7 +629,7 @@ public class Attributes implements Map<Object,Object>, Cloneable { ...@@ -629,7 +629,7 @@ public class Attributes implements Map<Object,Object>, Cloneable {
public static final Name IMPLEMENTATION_VENDOR_ID = new Name("Implementation-Vendor-Id"); 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. * manifest attribute used for package versioning.
* @see <a href="../../../../technotes/guides/versioning/spec/versioning2.html#wp90779"> * @see <a href="../../../../technotes/guides/versioning/spec/versioning2.html#wp90779">
* Java Product Versioning Specification</a> * Java Product Versioning Specification</a>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册