Code refinement for JDK-picked classes (#1014)
This commit is contained in:
parent
820ff9233a
commit
1253471078
|
|
@ -46,6 +46,7 @@ public class LongAdder extends Striped64 implements Serializable {
|
||||||
/**
|
/**
|
||||||
* Version of plus for use in retryUpdate
|
* Version of plus for use in retryUpdate
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
final long fn(long v, long x) { return v + x; }
|
final long fn(long v, long x) { return v + x; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -153,6 +154,7 @@ public class LongAdder extends Striped64 implements Serializable {
|
||||||
*
|
*
|
||||||
* @return the String representation of the {@link #sum}
|
* @return the String representation of the {@link #sum}
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return Long.toString(sum());
|
return Long.toString(sum());
|
||||||
}
|
}
|
||||||
|
|
@ -162,6 +164,7 @@ public class LongAdder extends Striped64 implements Serializable {
|
||||||
*
|
*
|
||||||
* @return the sum
|
* @return the sum
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public long longValue() {
|
public long longValue() {
|
||||||
return sum();
|
return sum();
|
||||||
}
|
}
|
||||||
|
|
@ -170,6 +173,7 @@ public class LongAdder extends Striped64 implements Serializable {
|
||||||
* Returns the {@link #sum} as an {@code int} after a narrowing
|
* Returns the {@link #sum} as an {@code int} after a narrowing
|
||||||
* primitive conversion.
|
* primitive conversion.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int intValue() {
|
public int intValue() {
|
||||||
return (int)sum();
|
return (int)sum();
|
||||||
}
|
}
|
||||||
|
|
@ -178,6 +182,7 @@ public class LongAdder extends Striped64 implements Serializable {
|
||||||
* Returns the {@link #sum} as a {@code float}
|
* Returns the {@link #sum} as a {@code float}
|
||||||
* after a widening primitive conversion.
|
* after a widening primitive conversion.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public float floatValue() {
|
public float floatValue() {
|
||||||
return (float)sum();
|
return (float)sum();
|
||||||
}
|
}
|
||||||
|
|
@ -186,6 +191,7 @@ public class LongAdder extends Striped64 implements Serializable {
|
||||||
* Returns the {@link #sum} as a {@code double} after a widening
|
* Returns the {@link #sum} as a {@code double} after a widening
|
||||||
* primitive conversion.
|
* primitive conversion.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public double doubleValue() {
|
public double doubleValue() {
|
||||||
return (double)sum();
|
return (double)sum();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,7 @@ abstract class Striped64 extends Number {
|
||||||
* The corresponding ThreadLocal class
|
* The corresponding ThreadLocal class
|
||||||
*/
|
*/
|
||||||
static final class ThreadHashCode extends ThreadLocal<HashCode> {
|
static final class ThreadHashCode extends ThreadLocal<HashCode> {
|
||||||
|
@Override
|
||||||
public HashCode initialValue() { return new HashCode(); }
|
public HashCode initialValue() { return new HashCode(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -330,6 +331,7 @@ abstract class Striped64 extends Number {
|
||||||
return java.security.AccessController.doPrivileged
|
return java.security.AccessController.doPrivileged
|
||||||
(new java.security
|
(new java.security
|
||||||
.PrivilegedExceptionAction<sun.misc.Unsafe>() {
|
.PrivilegedExceptionAction<sun.misc.Unsafe>() {
|
||||||
|
@Override
|
||||||
public sun.misc.Unsafe run() throws Exception {
|
public sun.misc.Unsafe run() throws Exception {
|
||||||
java.lang.reflect.Field f = sun.misc
|
java.lang.reflect.Field f = sun.misc
|
||||||
.Unsafe.class.getDeclaredField("theUnsafe");
|
.Unsafe.class.getDeclaredField("theUnsafe");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue