Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
77c2e08f
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
77c2e08f
编写于
12月 05, 2011
作者:
D
dl
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7117360: Warnings in java.util.concurrent.atomic package
Reviewed-by: chegar, dholmes
上级
16be1854
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
35 addition
and
40 deletion
+35
-40
src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java
...re/classes/java/util/concurrent/atomic/AtomicBoolean.java
+4
-4
src/share/classes/java/util/concurrent/atomic/AtomicInteger.java
...re/classes/java/util/concurrent/atomic/AtomicInteger.java
+5
-6
src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java
...asses/java/util/concurrent/atomic/AtomicIntegerArray.java
+0
-1
src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java
...ava/util/concurrent/atomic/AtomicIntegerFieldUpdater.java
+3
-4
src/share/classes/java/util/concurrent/atomic/AtomicLong.java
...share/classes/java/util/concurrent/atomic/AtomicLong.java
+7
-8
src/share/classes/java/util/concurrent/atomic/AtomicLongArray.java
.../classes/java/util/concurrent/atomic/AtomicLongArray.java
+0
-2
src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java
...s/java/util/concurrent/atomic/AtomicLongFieldUpdater.java
+6
-6
src/share/classes/java/util/concurrent/atomic/AtomicReference.java
.../classes/java/util/concurrent/atomic/AtomicReference.java
+4
-4
src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java
...ses/java/util/concurrent/atomic/AtomicReferenceArray.java
+2
-1
src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java
...a/util/concurrent/atomic/AtomicReferenceFieldUpdater.java
+4
-3
src/share/classes/java/util/concurrent/atomic/AtomicStampedReference.java
...s/java/util/concurrent/atomic/AtomicStampedReference.java
+0
-1
未找到文件。
src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java
浏览文件 @
77c2e08f
...
@@ -54,10 +54,10 @@ public class AtomicBoolean implements java.io.Serializable {
...
@@ -54,10 +54,10 @@ public class AtomicBoolean implements java.io.Serializable {
private
static
final
long
valueOffset
;
private
static
final
long
valueOffset
;
static
{
static
{
try
{
try
{
valueOffset
=
unsafe
.
objectFieldOffset
valueOffset
=
unsafe
.
objectFieldOffset
(
AtomicBoolean
.
class
.
getDeclaredField
(
"value"
));
(
AtomicBoolean
.
class
.
getDeclaredField
(
"value"
));
}
catch
(
Exception
ex
)
{
throw
new
Error
(
ex
);
}
}
catch
(
Exception
ex
)
{
throw
new
Error
(
ex
);
}
}
}
private
volatile
int
value
;
private
volatile
int
value
;
...
...
src/share/classes/java/util/concurrent/atomic/AtomicInteger.java
浏览文件 @
77c2e08f
...
@@ -57,10 +57,10 @@ public class AtomicInteger extends Number implements java.io.Serializable {
...
@@ -57,10 +57,10 @@ public class AtomicInteger extends Number implements java.io.Serializable {
private
static
final
long
valueOffset
;
private
static
final
long
valueOffset
;
static
{
static
{
try
{
try
{
valueOffset
=
unsafe
.
objectFieldOffset
valueOffset
=
unsafe
.
objectFieldOffset
(
AtomicInteger
.
class
.
getDeclaredField
(
"value"
));
(
AtomicInteger
.
class
.
getDeclaredField
(
"value"
));
}
catch
(
Exception
ex
)
{
throw
new
Error
(
ex
);
}
}
catch
(
Exception
ex
)
{
throw
new
Error
(
ex
);
}
}
}
private
volatile
int
value
;
private
volatile
int
value
;
...
@@ -247,8 +247,7 @@ public class AtomicInteger extends Number implements java.io.Serializable {
...
@@ -247,8 +247,7 @@ public class AtomicInteger extends Number implements java.io.Serializable {
/**
/**
* Returns the value of this {@code AtomicInteger} as an
* Returns the value of this {@code AtomicInteger} as an {@code int}.
* {@code int}.
*/
*/
public
int
intValue
()
{
public
int
intValue
()
{
return
get
();
return
get
();
...
...
src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java
浏览文件 @
77c2e08f
...
@@ -35,7 +35,6 @@
...
@@ -35,7 +35,6 @@
package
java.util.concurrent.atomic
;
package
java.util.concurrent.atomic
;
import
sun.misc.Unsafe
;
import
sun.misc.Unsafe
;
import
java.util.*
;
/**
/**
* An {@code int} array in which elements may be updated atomically.
* An {@code int} array in which elements may be updated atomically.
...
...
src/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java
浏览文件 @
77c2e08f
...
@@ -135,7 +135,6 @@ public abstract class AtomicIntegerFieldUpdater<T> {
...
@@ -135,7 +135,6 @@ public abstract class AtomicIntegerFieldUpdater<T> {
*/
*/
public
abstract
void
lazySet
(
T
obj
,
int
newValue
);
public
abstract
void
lazySet
(
T
obj
,
int
newValue
);
/**
/**
* Gets the current value held in the field of the given object managed
* Gets the current value held in the field of the given object managed
* by this updater.
* by this updater.
...
@@ -266,11 +265,11 @@ public abstract class AtomicIntegerFieldUpdater<T> {
...
@@ -266,11 +265,11 @@ public abstract class AtomicIntegerFieldUpdater<T> {
private
static
final
Unsafe
unsafe
=
Unsafe
.
getUnsafe
();
private
static
final
Unsafe
unsafe
=
Unsafe
.
getUnsafe
();
private
final
long
offset
;
private
final
long
offset
;
private
final
Class
<
T
>
tclass
;
private
final
Class
<
T
>
tclass
;
private
final
Class
cclass
;
private
final
Class
<?>
cclass
;
AtomicIntegerFieldUpdaterImpl
(
Class
<
T
>
tclass
,
String
fieldName
)
{
AtomicIntegerFieldUpdaterImpl
(
Class
<
T
>
tclass
,
String
fieldName
)
{
Field
field
=
null
;
Field
field
=
null
;
Class
caller
=
null
;
Class
<?>
caller
=
null
;
int
modifiers
=
0
;
int
modifiers
=
0
;
try
{
try
{
field
=
tclass
.
getDeclaredField
(
fieldName
);
field
=
tclass
.
getDeclaredField
(
fieldName
);
...
@@ -283,7 +282,7 @@ public abstract class AtomicIntegerFieldUpdater<T> {
...
@@ -283,7 +282,7 @@ public abstract class AtomicIntegerFieldUpdater<T> {
throw
new
RuntimeException
(
ex
);
throw
new
RuntimeException
(
ex
);
}
}
Class
fieldt
=
field
.
getType
();
Class
<?>
fieldt
=
field
.
getType
();
if
(
fieldt
!=
int
.
class
)
if
(
fieldt
!=
int
.
class
)
throw
new
IllegalArgumentException
(
"Must be integer type"
);
throw
new
IllegalArgumentException
(
"Must be integer type"
);
...
...
src/share/classes/java/util/concurrent/atomic/AtomicLong.java
浏览文件 @
77c2e08f
...
@@ -71,10 +71,10 @@ public class AtomicLong extends Number implements java.io.Serializable {
...
@@ -71,10 +71,10 @@ public class AtomicLong extends Number implements java.io.Serializable {
private
static
native
boolean
VMSupportsCS8
();
private
static
native
boolean
VMSupportsCS8
();
static
{
static
{
try
{
try
{
valueOffset
=
unsafe
.
objectFieldOffset
valueOffset
=
unsafe
.
objectFieldOffset
(
AtomicLong
.
class
.
getDeclaredField
(
"value"
));
(
AtomicLong
.
class
.
getDeclaredField
(
"value"
));
}
catch
(
Exception
ex
)
{
throw
new
Error
(
ex
);
}
}
catch
(
Exception
ex
)
{
throw
new
Error
(
ex
);
}
}
}
private
volatile
long
value
;
private
volatile
long
value
;
...
@@ -270,8 +270,7 @@ public class AtomicLong extends Number implements java.io.Serializable {
...
@@ -270,8 +270,7 @@ public class AtomicLong extends Number implements java.io.Serializable {
}
}
/**
/**
* Returns the value of this {@code AtomicLong} as a {@code long}
* Returns the value of this {@code AtomicLong} as a {@code long}.
* value.
*/
*/
public
long
longValue
()
{
public
long
longValue
()
{
return
get
();
return
get
();
...
@@ -287,8 +286,8 @@ public class AtomicLong extends Number implements java.io.Serializable {
...
@@ -287,8 +286,8 @@ public class AtomicLong extends Number implements java.io.Serializable {
}
}
/**
/**
* Returns the value of this {@code AtomicLong} as a {@code
* Returns the value of this {@code AtomicLong} as a {@code
double}
*
double}
after a widening primitive conversion.
* after a widening primitive conversion.
* @jls 5.1.2 Widening Primitive Conversions
* @jls 5.1.2 Widening Primitive Conversions
*/
*/
public
double
doubleValue
()
{
public
double
doubleValue
()
{
...
...
src/share/classes/java/util/concurrent/atomic/AtomicLongArray.java
浏览文件 @
77c2e08f
...
@@ -35,7 +35,6 @@
...
@@ -35,7 +35,6 @@
package
java.util.concurrent.atomic
;
package
java.util.concurrent.atomic
;
import
sun.misc.Unsafe
;
import
sun.misc.Unsafe
;
import
java.util.*
;
/**
/**
* A {@code long} array in which elements may be updated atomically.
* A {@code long} array in which elements may be updated atomically.
...
@@ -136,7 +135,6 @@ public class AtomicLongArray implements java.io.Serializable {
...
@@ -136,7 +135,6 @@ public class AtomicLongArray implements java.io.Serializable {
unsafe
.
putOrderedLong
(
array
,
checkedByteOffset
(
i
),
newValue
);
unsafe
.
putOrderedLong
(
array
,
checkedByteOffset
(
i
),
newValue
);
}
}
/**
/**
* Atomically sets the element at position {@code i} to the given value
* Atomically sets the element at position {@code i} to the given value
* and returns the old value.
* and returns the old value.
...
...
src/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java
浏览文件 @
77c2e08f
...
@@ -265,11 +265,11 @@ public abstract class AtomicLongFieldUpdater<T> {
...
@@ -265,11 +265,11 @@ public abstract class AtomicLongFieldUpdater<T> {
private
static
final
Unsafe
unsafe
=
Unsafe
.
getUnsafe
();
private
static
final
Unsafe
unsafe
=
Unsafe
.
getUnsafe
();
private
final
long
offset
;
private
final
long
offset
;
private
final
Class
<
T
>
tclass
;
private
final
Class
<
T
>
tclass
;
private
final
Class
cclass
;
private
final
Class
<?>
cclass
;
CASUpdater
(
Class
<
T
>
tclass
,
String
fieldName
)
{
CASUpdater
(
Class
<
T
>
tclass
,
String
fieldName
)
{
Field
field
=
null
;
Field
field
=
null
;
Class
caller
=
null
;
Class
<?>
caller
=
null
;
int
modifiers
=
0
;
int
modifiers
=
0
;
try
{
try
{
field
=
tclass
.
getDeclaredField
(
fieldName
);
field
=
tclass
.
getDeclaredField
(
fieldName
);
...
@@ -282,7 +282,7 @@ public abstract class AtomicLongFieldUpdater<T> {
...
@@ -282,7 +282,7 @@ public abstract class AtomicLongFieldUpdater<T> {
throw
new
RuntimeException
(
ex
);
throw
new
RuntimeException
(
ex
);
}
}
Class
fieldt
=
field
.
getType
();
Class
<?>
fieldt
=
field
.
getType
();
if
(
fieldt
!=
long
.
class
)
if
(
fieldt
!=
long
.
class
)
throw
new
IllegalArgumentException
(
"Must be long type"
);
throw
new
IllegalArgumentException
(
"Must be long type"
);
...
@@ -348,11 +348,11 @@ public abstract class AtomicLongFieldUpdater<T> {
...
@@ -348,11 +348,11 @@ public abstract class AtomicLongFieldUpdater<T> {
private
static
final
Unsafe
unsafe
=
Unsafe
.
getUnsafe
();
private
static
final
Unsafe
unsafe
=
Unsafe
.
getUnsafe
();
private
final
long
offset
;
private
final
long
offset
;
private
final
Class
<
T
>
tclass
;
private
final
Class
<
T
>
tclass
;
private
final
Class
cclass
;
private
final
Class
<?>
cclass
;
LockedUpdater
(
Class
<
T
>
tclass
,
String
fieldName
)
{
LockedUpdater
(
Class
<
T
>
tclass
,
String
fieldName
)
{
Field
field
=
null
;
Field
field
=
null
;
Class
caller
=
null
;
Class
<?>
caller
=
null
;
int
modifiers
=
0
;
int
modifiers
=
0
;
try
{
try
{
field
=
tclass
.
getDeclaredField
(
fieldName
);
field
=
tclass
.
getDeclaredField
(
fieldName
);
...
@@ -365,7 +365,7 @@ public abstract class AtomicLongFieldUpdater<T> {
...
@@ -365,7 +365,7 @@ public abstract class AtomicLongFieldUpdater<T> {
throw
new
RuntimeException
(
ex
);
throw
new
RuntimeException
(
ex
);
}
}
Class
fieldt
=
field
.
getType
();
Class
<?>
fieldt
=
field
.
getType
();
if
(
fieldt
!=
long
.
class
)
if
(
fieldt
!=
long
.
class
)
throw
new
IllegalArgumentException
(
"Must be long type"
);
throw
new
IllegalArgumentException
(
"Must be long type"
);
...
...
src/share/classes/java/util/concurrent/atomic/AtomicReference.java
浏览文件 @
77c2e08f
...
@@ -51,10 +51,10 @@ public class AtomicReference<V> implements java.io.Serializable {
...
@@ -51,10 +51,10 @@ public class AtomicReference<V> implements java.io.Serializable {
private
static
final
long
valueOffset
;
private
static
final
long
valueOffset
;
static
{
static
{
try
{
try
{
valueOffset
=
unsafe
.
objectFieldOffset
valueOffset
=
unsafe
.
objectFieldOffset
(
AtomicReference
.
class
.
getDeclaredField
(
"value"
));
(
AtomicReference
.
class
.
getDeclaredField
(
"value"
));
}
catch
(
Exception
ex
)
{
throw
new
Error
(
ex
);
}
}
catch
(
Exception
ex
)
{
throw
new
Error
(
ex
);
}
}
}
private
volatile
V
value
;
private
volatile
V
value
;
...
...
src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java
浏览文件 @
77c2e08f
...
@@ -113,6 +113,7 @@ public class AtomicReferenceArray<E> implements java.io.Serializable {
...
@@ -113,6 +113,7 @@ public class AtomicReferenceArray<E> implements java.io.Serializable {
return
getRaw
(
checkedByteOffset
(
i
));
return
getRaw
(
checkedByteOffset
(
i
));
}
}
@SuppressWarnings
(
"unchecked"
)
private
E
getRaw
(
long
offset
)
{
private
E
getRaw
(
long
offset
)
{
return
(
E
)
unsafe
.
getObjectVolatile
(
array
,
offset
);
return
(
E
)
unsafe
.
getObjectVolatile
(
array
,
offset
);
}
}
...
@@ -150,7 +151,7 @@ public class AtomicReferenceArray<E> implements java.io.Serializable {
...
@@ -150,7 +151,7 @@ public class AtomicReferenceArray<E> implements java.io.Serializable {
public
final
E
getAndSet
(
int
i
,
E
newValue
)
{
public
final
E
getAndSet
(
int
i
,
E
newValue
)
{
long
offset
=
checkedByteOffset
(
i
);
long
offset
=
checkedByteOffset
(
i
);
while
(
true
)
{
while
(
true
)
{
E
current
=
(
E
)
getRaw
(
offset
);
E
current
=
getRaw
(
offset
);
if
(
compareAndSetRaw
(
offset
,
current
,
newValue
))
if
(
compareAndSetRaw
(
offset
,
current
,
newValue
))
return
current
;
return
current
;
}
}
...
...
src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java
浏览文件 @
77c2e08f
...
@@ -183,7 +183,7 @@ public abstract class AtomicReferenceFieldUpdater<T, V> {
...
@@ -183,7 +183,7 @@ public abstract class AtomicReferenceFieldUpdater<T, V> {
private
final
long
offset
;
private
final
long
offset
;
private
final
Class
<
T
>
tclass
;
private
final
Class
<
T
>
tclass
;
private
final
Class
<
V
>
vclass
;
private
final
Class
<
V
>
vclass
;
private
final
Class
cclass
;
private
final
Class
<?>
cclass
;
/*
/*
* Internal type checks within all update methods contain
* Internal type checks within all update methods contain
...
@@ -201,8 +201,8 @@ public abstract class AtomicReferenceFieldUpdater<T, V> {
...
@@ -201,8 +201,8 @@ public abstract class AtomicReferenceFieldUpdater<T, V> {
Class
<
V
>
vclass
,
Class
<
V
>
vclass
,
String
fieldName
)
{
String
fieldName
)
{
Field
field
=
null
;
Field
field
=
null
;
Class
fieldClass
=
null
;
Class
<?>
fieldClass
=
null
;
Class
caller
=
null
;
Class
<?>
caller
=
null
;
int
modifiers
=
0
;
int
modifiers
=
0
;
try
{
try
{
field
=
tclass
.
getDeclaredField
(
fieldName
);
field
=
tclass
.
getDeclaredField
(
fieldName
);
...
@@ -280,6 +280,7 @@ public abstract class AtomicReferenceFieldUpdater<T, V> {
...
@@ -280,6 +280,7 @@ public abstract class AtomicReferenceFieldUpdater<T, V> {
unsafe
.
putOrderedObject
(
obj
,
offset
,
newValue
);
unsafe
.
putOrderedObject
(
obj
,
offset
,
newValue
);
}
}
@SuppressWarnings
(
"unchecked"
)
public
V
get
(
T
obj
)
{
public
V
get
(
T
obj
)
{
if
(
obj
==
null
||
obj
.
getClass
()
!=
tclass
||
cclass
!=
null
)
if
(
obj
==
null
||
obj
.
getClass
()
!=
tclass
||
cclass
!=
null
)
targetCheck
(
obj
);
targetCheck
(
obj
);
...
...
src/share/classes/java/util/concurrent/atomic/AtomicStampedReference.java
浏览文件 @
77c2e08f
...
@@ -155,7 +155,6 @@ public class AtomicStampedReference<V> {
...
@@ -155,7 +155,6 @@ public class AtomicStampedReference<V> {
casPair
(
current
,
Pair
.
of
(
newReference
,
newStamp
)));
casPair
(
current
,
Pair
.
of
(
newReference
,
newStamp
)));
}
}
/**
/**
* Unconditionally sets the value of both the reference and stamp.
* Unconditionally sets the value of both the reference and stamp.
*
*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录