Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
8f7132bc
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看板
提交
8f7132bc
编写于
7月 25, 2013
作者:
D
darcy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8021429: Fix lint warnings in java.lang.ref
Reviewed-by: lancea, mduigou, alanb
上级
dac7033a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
23 addition
and
20 deletion
+23
-20
src/share/classes/java/lang/ref/FinalReference.java
src/share/classes/java/lang/ref/FinalReference.java
+4
-5
src/share/classes/java/lang/ref/Finalizer.java
src/share/classes/java/lang/ref/Finalizer.java
+5
-5
src/share/classes/java/lang/ref/Reference.java
src/share/classes/java/lang/ref/Reference.java
+4
-3
src/share/classes/java/lang/ref/ReferenceQueue.java
src/share/classes/java/lang/ref/ReferenceQueue.java
+10
-7
未找到文件。
src/share/classes/java/lang/ref/FinalReference.java
浏览文件 @
8f7132bc
/*
* Copyright (c) 1997, 20
0
3, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 20
1
3, 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
...
...
@@ -25,13 +25,12 @@
package
java.lang.ref
;
/* Final references, used to implement finalization */
/**
* Final references, used to implement finalization
*/
class
FinalReference
<
T
>
extends
Reference
<
T
>
{
public
FinalReference
(
T
referent
,
ReferenceQueue
<?
super
T
>
q
)
{
super
(
referent
,
q
);
}
}
src/share/classes/java/lang/ref/Finalizer.java
浏览文件 @
8f7132bc
/*
* Copyright (c) 1997, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 20
13
, 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
...
...
@@ -29,16 +29,16 @@ import java.security.PrivilegedAction;
import
java.security.AccessController
;
final
class
Finalizer
extends
FinalReference
{
/* Package-private; must be in
same package as the Reference
class */
final
class
Finalizer
extends
FinalReference
<
Object
>
{
/* Package-private; must be in
same package as the Reference
class */
/* A native method that invokes an arbitrary object's finalize method is
required since the finalize method is protected
*/
static
native
void
invokeFinalizeMethod
(
Object
o
)
throws
Throwable
;
private
static
ReferenceQueue
queue
=
new
ReferenceQueue
();
private
static
ReferenceQueue
<
Object
>
queue
=
new
ReferenceQueue
<>
();
private
static
Finalizer
unfinalized
=
null
;
private
static
final
Object
lock
=
new
Object
();
...
...
src/share/classes/java/lang/ref/Reference.java
浏览文件 @
8f7132bc
...
...
@@ -96,6 +96,7 @@ public abstract class Reference<T> {
* Enqueued: next reference in queue (or this if last)
* Inactive: this
*/
@SuppressWarnings
(
"rawtypes"
)
Reference
next
;
/* When active: next element in a discovered reference list maintained by GC (or this if last)
...
...
@@ -119,7 +120,7 @@ public abstract class Reference<T> {
* them. This list is protected by the above lock object. The
* list uses the discovered field to link its elements.
*/
private
static
Reference
pending
=
null
;
private
static
Reference
<
Object
>
pending
=
null
;
/* High-priority thread to enqueue pending References
*/
...
...
@@ -131,7 +132,7 @@ public abstract class Reference<T> {
public
void
run
()
{
for
(;;)
{
Reference
r
;
Reference
<
Object
>
r
;
synchronized
(
lock
)
{
if
(
pending
!=
null
)
{
r
=
pending
;
...
...
@@ -166,7 +167,7 @@ public abstract class Reference<T> {
continue
;
}
ReferenceQueue
q
=
r
.
queue
;
ReferenceQueue
<
Object
>
q
=
r
.
queue
;
if
(
q
!=
ReferenceQueue
.
NULL
)
q
.
enqueue
(
r
);
}
}
...
...
src/share/classes/java/lang/ref/ReferenceQueue.java
浏览文件 @
8f7132bc
/*
* Copyright (c) 1997, 20
05
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 20
13
, 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
...
...
@@ -40,14 +40,14 @@ public class ReferenceQueue<T> {
*/
public
ReferenceQueue
()
{
}
private
static
class
Null
extends
ReferenceQueue
{
boolean
enqueue
(
Reference
r
)
{
private
static
class
Null
<
S
>
extends
ReferenceQueue
<
S
>
{
boolean
enqueue
(
Reference
<?
extends
S
>
r
)
{
return
false
;
}
}
static
ReferenceQueue
NULL
=
new
Null
();
static
ReferenceQueue
ENQUEUED
=
new
Null
();
static
ReferenceQueue
<
Object
>
NULL
=
new
Null
<>
();
static
ReferenceQueue
<
Object
>
ENQUEUED
=
new
Null
<>
();
static
private
class
Lock
{
};
private
Lock
lock
=
new
Lock
();
...
...
@@ -58,7 +58,7 @@ public class ReferenceQueue<T> {
synchronized
(
lock
)
{
// Check that since getting the lock this reference hasn't already been
// enqueued (and even then removed)
ReferenceQueue
queue
=
r
.
queue
;
ReferenceQueue
<?>
queue
=
r
.
queue
;
if
((
queue
==
NULL
)
||
(
queue
==
ENQUEUED
))
{
return
false
;
}
...
...
@@ -75,10 +75,13 @@ public class ReferenceQueue<T> {
}
}
@SuppressWarnings
(
"unchecked"
)
private
Reference
<?
extends
T
>
reallyPoll
()
{
/* Must hold lock */
Reference
<?
extends
T
>
r
=
head
;
if
(
r
!=
null
)
{
head
=
(
r
.
next
==
r
)
?
null
:
r
.
next
;
head
=
(
r
.
next
==
r
)
?
null
:
r
.
next
;
// Unchecked due to the next field having a raw type in Reference
r
.
queue
=
NULL
;
r
.
next
=
r
;
queueLength
--;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录