Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
322c6102
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看板
提交
322c6102
编写于
12月 08, 2011
作者:
O
omajid
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7117612: Miscellaneous warnings in java.lang
Reviewed-by: smarks, dholmes, alanb, darcy
上级
808a9fe5
变更
18
显示空白变更内容
内联
并排
Showing
18 changed file
with
66 addition
and
36 deletion
+66
-36
src/share/classes/java/lang/Boolean.java
src/share/classes/java/lang/Boolean.java
+2
-1
src/share/classes/java/lang/Byte.java
src/share/classes/java/lang/Byte.java
+1
-0
src/share/classes/java/lang/Character.java
src/share/classes/java/lang/Character.java
+1
-1
src/share/classes/java/lang/CharacterName.java
src/share/classes/java/lang/CharacterName.java
+3
-1
src/share/classes/java/lang/Class.java
src/share/classes/java/lang/Class.java
+13
-5
src/share/classes/java/lang/ClassLoader.java
src/share/classes/java/lang/ClassLoader.java
+2
-1
src/share/classes/java/lang/ConditionalSpecialCasing.java
src/share/classes/java/lang/ConditionalSpecialCasing.java
+6
-6
src/share/classes/java/lang/Double.java
src/share/classes/java/lang/Double.java
+2
-1
src/share/classes/java/lang/EnumConstantNotPresentException.java
...re/classes/java/lang/EnumConstantNotPresentException.java
+1
-0
src/share/classes/java/lang/Float.java
src/share/classes/java/lang/Float.java
+2
-1
src/share/classes/java/lang/Integer.java
src/share/classes/java/lang/Integer.java
+1
-0
src/share/classes/java/lang/Long.java
src/share/classes/java/lang/Long.java
+2
-1
src/share/classes/java/lang/Short.java
src/share/classes/java/lang/Short.java
+1
-0
src/share/classes/java/lang/System.java
src/share/classes/java/lang/System.java
+1
-1
src/share/classes/java/lang/ThreadLocal.java
src/share/classes/java/lang/ThreadLocal.java
+20
-16
src/share/classes/java/lang/Void.java
src/share/classes/java/lang/Void.java
+2
-1
src/solaris/classes/java/lang/ProcessEnvironment.java
src/solaris/classes/java/lang/ProcessEnvironment.java
+1
-0
src/windows/classes/java/lang/ProcessEnvironment.java
src/windows/classes/java/lang/ProcessEnvironment.java
+5
-0
未找到文件。
src/share/classes/java/lang/Boolean.java
浏览文件 @
322c6102
...
...
@@ -60,7 +60,8 @@ public final class Boolean implements java.io.Serializable,
*
* @since JDK1.1
*/
public
static
final
Class
<
Boolean
>
TYPE
=
Class
.
getPrimitiveClass
(
"boolean"
);
@SuppressWarnings
(
"unchecked"
)
public
static
final
Class
<
Boolean
>
TYPE
=
(
Class
<
Boolean
>)
Class
.
getPrimitiveClass
(
"boolean"
);
/**
* The value of the Boolean.
...
...
src/share/classes/java/lang/Byte.java
浏览文件 @
322c6102
...
...
@@ -59,6 +59,7 @@ public final class Byte extends Number implements Comparable<Byte> {
* The {@code Class} instance representing the primitive type
* {@code byte}.
*/
@SuppressWarnings
(
"unchecked"
)
public
static
final
Class
<
Byte
>
TYPE
=
(
Class
<
Byte
>)
Class
.
getPrimitiveClass
(
"byte"
);
/**
...
...
src/share/classes/java/lang/Character.java
浏览文件 @
322c6102
...
...
@@ -172,7 +172,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
* @since 1.1
*/
@SuppressWarnings
(
"unchecked"
)
public
static
final
Class
<
Character
>
TYPE
=
Class
.
getPrimitiveClass
(
"char"
);
public
static
final
Class
<
Character
>
TYPE
=
(
Class
<
Character
>)
Class
.
getPrimitiveClass
(
"char"
);
/*
* Normative general types
...
...
src/share/classes/java/lang/CharacterName.java
浏览文件 @
322c6102
...
...
@@ -101,6 +101,8 @@ class CharacterName {
if
(
lookup
[
cp
>>
8
]
==
null
||
(
off
=
lookup
[
cp
>>
8
][
cp
&
0xff
])
==
0
)
return
null
;
return
new
String
(
strPool
,
0
,
off
>>>
8
,
off
&
0xff
);
// ASCII
@SuppressWarnings
(
"deprecation"
)
String
result
=
new
String
(
strPool
,
0
,
off
>>>
8
,
off
&
0xff
);
// ASCII
return
result
;
}
}
src/share/classes/java/lang/Class.java
浏览文件 @
322c6102
...
...
@@ -631,6 +631,7 @@ public final
* <cite>The Java™ Virtual Machine Specification</cite>
* @since 1.5
*/
@SuppressWarnings
(
"unchecked"
)
public
TypeVariable
<
Class
<
T
>>[]
getTypeParameters
()
{
if
(
getGenericSignature
()
!=
null
)
return
(
TypeVariable
<
Class
<
T
>>[])
getGenericInfo
().
getTypeParameters
();
...
...
@@ -1303,7 +1304,7 @@ public final
return
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
Class
<?>[]>()
{
public
Class
[]
run
()
{
public
Class
<?>
[]
run
()
{
List
<
Class
<?>>
list
=
new
ArrayList
<>();
Class
<?>
currentClass
=
Class
.
this
;
while
(
currentClass
!=
null
)
{
...
...
@@ -1315,7 +1316,7 @@ public final
}
currentClass
=
currentClass
.
getSuperclass
();
}
return
list
.
toArray
(
new
Class
[
0
]);
return
list
.
toArray
(
new
Class
<?>
[
0
]);
}
});
}
...
...
@@ -2150,7 +2151,7 @@ public final
* Return the Virtual Machine's Class object for the named
* primitive type.
*/
static
native
Class
getPrimitiveClass
(
String
name
);
static
native
Class
<?>
getPrimitiveClass
(
String
name
);
/*
...
...
@@ -2395,7 +2396,9 @@ public final
}
// No cached value available; request value from VM
if
(
isInterface
())
{
res
=
new
Constructor
[
0
];
@SuppressWarnings
(
"unchecked"
)
Constructor
<
T
>[]
temporaryRes
=
(
Constructor
<
T
>[])
new
Constructor
<?>[
0
];
res
=
temporaryRes
;
}
else
{
res
=
getDeclaredConstructors0
(
publicOnly
);
}
...
...
@@ -2951,7 +2954,9 @@ public final
return
null
;
}
});
enumConstants
=
(
T
[])
values
.
invoke
(
null
);
@SuppressWarnings
(
"unchecked"
)
T
[]
temporaryConstants
=
(
T
[])
values
.
invoke
(
null
);
enumConstants
=
temporaryConstants
;
}
// These can happen when users concoct enum-like classes
// that don't comply with the enum spec.
...
...
@@ -2996,6 +3001,7 @@ public final
*
* @since 1.5
*/
@SuppressWarnings
(
"unchecked"
)
public
T
cast
(
Object
obj
)
{
if
(
obj
!=
null
&&
!
isInstance
(
obj
))
throw
new
ClassCastException
(
cannotCastMsg
(
obj
));
...
...
@@ -3026,6 +3032,7 @@ public final
* the class itself).
* @since 1.5
*/
@SuppressWarnings
(
"unchecked"
)
public
<
U
>
Class
<?
extends
U
>
asSubclass
(
Class
<
U
>
clazz
)
{
if
(
clazz
.
isAssignableFrom
(
this
))
return
(
Class
<?
extends
U
>)
this
;
...
...
@@ -3037,6 +3044,7 @@ public final
* @throws NullPointerException {@inheritDoc}
* @since 1.5
*/
@SuppressWarnings
(
"unchecked"
)
public
<
A
extends
Annotation
>
A
getAnnotation
(
Class
<
A
>
annotationClass
)
{
if
(
annotationClass
==
null
)
throw
new
NullPointerException
();
...
...
src/share/classes/java/lang/ClassLoader.java
浏览文件 @
322c6102
...
...
@@ -1167,7 +1167,8 @@ public abstract class ClassLoader {
* @since 1.2
*/
public
Enumeration
<
URL
>
getResources
(
String
name
)
throws
IOException
{
Enumeration
[]
tmp
=
new
Enumeration
[
2
];
@SuppressWarnings
(
"unchecked"
)
Enumeration
<
URL
>[]
tmp
=
(
Enumeration
<
URL
>[])
new
Enumeration
<?>[
2
];
if
(
parent
!=
null
)
{
tmp
[
0
]
=
parent
.
getResources
(
name
);
}
else
{
...
...
src/share/classes/java/lang/ConditionalSpecialCasing.java
浏览文件 @
322c6102
...
...
@@ -92,15 +92,15 @@ final class ConditionalSpecialCasing {
};
// A hash table that contains the above entries
static
Hashtable
entryTable
=
new
Hashtable
();
static
Hashtable
<
Integer
,
HashSet
<
Entry
>>
entryTable
=
new
Hashtable
<>
();
static
{
// create hashtable from the entry
for
(
int
i
=
0
;
i
<
entry
.
length
;
i
++)
{
Entry
cur
=
entry
[
i
];
Integer
cp
=
new
Integer
(
cur
.
getCodePoint
());
HashSet
set
=
(
HashSet
)
entryTable
.
get
(
cp
);
HashSet
<
Entry
>
set
=
entryTable
.
get
(
cp
);
if
(
set
==
null
)
{
set
=
new
HashSet
();
set
=
new
HashSet
<
Entry
>
();
}
set
.
add
(
cur
);
entryTable
.
put
(
cp
,
set
);
...
...
@@ -151,13 +151,13 @@ final class ConditionalSpecialCasing {
}
private
static
char
[]
lookUpTable
(
String
src
,
int
index
,
Locale
locale
,
boolean
bLowerCasing
)
{
HashSet
set
=
(
HashSet
)
entryTable
.
get
(
new
Integer
(
src
.
codePointAt
(
index
)));
HashSet
<
Entry
>
set
=
entryTable
.
get
(
new
Integer
(
src
.
codePointAt
(
index
)));
if
(
set
!=
null
)
{
Iterator
iter
=
set
.
iterator
();
Iterator
<
Entry
>
iter
=
set
.
iterator
();
String
currentLang
=
locale
.
getLanguage
();
while
(
iter
.
hasNext
())
{
Entry
entry
=
(
Entry
)
iter
.
next
();
Entry
entry
=
iter
.
next
();
String
conditionLang
=
entry
.
getLanguage
();
if
(((
conditionLang
==
null
)
||
(
conditionLang
.
equals
(
currentLang
)))
&&
isConditionMet
(
src
,
index
,
locale
,
entry
.
getCondition
()))
{
...
...
src/share/classes/java/lang/Double.java
浏览文件 @
322c6102
...
...
@@ -128,6 +128,7 @@ public final class Double extends Number implements Comparable<Double> {
*
* @since JDK1.1
*/
@SuppressWarnings
(
"unchecked"
)
public
static
final
Class
<
Double
>
TYPE
=
(
Class
<
Double
>)
Class
.
getPrimitiveClass
(
"double"
);
/**
...
...
@@ -715,7 +716,7 @@ public final class Double extends Number implements Comparable<Double> {
* @return the {@code double} value represented by this object
*/
public
double
doubleValue
()
{
return
(
double
)
value
;
return
value
;
}
/**
...
...
src/share/classes/java/lang/EnumConstantNotPresentException.java
浏览文件 @
322c6102
...
...
@@ -36,6 +36,7 @@ package java.lang;
* @see java.lang.reflect.AnnotatedElement
* @since 1.5
*/
@SuppressWarnings
(
"rawtypes"
)
/* rawtypes are part of the public api */
public
class
EnumConstantNotPresentException
extends
RuntimeException
{
private
static
final
long
serialVersionUID
=
-
6046998521960521108L
;
...
...
src/share/classes/java/lang/Float.java
浏览文件 @
322c6102
...
...
@@ -126,7 +126,8 @@ public final class Float extends Number implements Comparable<Float> {
*
* @since JDK1.1
*/
public
static
final
Class
<
Float
>
TYPE
=
Class
.
getPrimitiveClass
(
"float"
);
@SuppressWarnings
(
"unchecked"
)
public
static
final
Class
<
Float
>
TYPE
=
(
Class
<
Float
>)
Class
.
getPrimitiveClass
(
"float"
);
/**
* Returns a string representation of the {@code float}
...
...
src/share/classes/java/lang/Integer.java
浏览文件 @
322c6102
...
...
@@ -68,6 +68,7 @@ public final class Integer extends Number implements Comparable<Integer> {
*
* @since JDK1.1
*/
@SuppressWarnings
(
"unchecked"
)
public
static
final
Class
<
Integer
>
TYPE
=
(
Class
<
Integer
>)
Class
.
getPrimitiveClass
(
"int"
);
/**
...
...
src/share/classes/java/lang/Long.java
浏览文件 @
322c6102
...
...
@@ -66,6 +66,7 @@ public final class Long extends Number implements Comparable<Long> {
*
* @since JDK1.1
*/
@SuppressWarnings
(
"unchecked"
)
public
static
final
Class
<
Long
>
TYPE
=
(
Class
<
Long
>)
Class
.
getPrimitiveClass
(
"long"
);
/**
...
...
@@ -734,7 +735,7 @@ public final class Long extends Number implements Comparable<Long> {
* {@code long} value.
*/
public
long
longValue
()
{
return
(
long
)
value
;
return
value
;
}
/**
...
...
src/share/classes/java/lang/Short.java
浏览文件 @
322c6102
...
...
@@ -58,6 +58,7 @@ public final class Short extends Number implements Comparable<Short> {
* The {@code Class} instance representing the primitive type
* {@code short}.
*/
@SuppressWarnings
(
"unchecked"
)
public
static
final
Class
<
Short
>
TYPE
=
(
Class
<
Short
>)
Class
.
getPrimitiveClass
(
"short"
);
/**
...
...
src/share/classes/java/lang/System.java
浏览文件 @
322c6102
...
...
@@ -1032,7 +1032,7 @@ public final class System {
*/
@Deprecated
public
static
void
runFinalizersOnExit
(
boolean
value
)
{
Runtime
.
getRuntime
().
runFinalizersOnExit
(
value
);
Runtime
.
runFinalizersOnExit
(
value
);
}
/**
...
...
src/share/classes/java/lang/ThreadLocal.java
浏览文件 @
322c6102
...
...
@@ -144,8 +144,11 @@ public class ThreadLocal<T> {
ThreadLocalMap
map
=
getMap
(
t
);
if
(
map
!=
null
)
{
ThreadLocalMap
.
Entry
e
=
map
.
getEntry
(
this
);
if
(
e
!=
null
)
return
(
T
)
e
.
value
;
if
(
e
!=
null
)
{
@SuppressWarnings
(
"unchecked"
)
T
result
=
(
T
)
e
.
value
;
return
result
;
}
}
return
setInitialValue
();
}
...
...
@@ -268,11 +271,11 @@ public class ThreadLocal<T> {
* entry can be expunged from table. Such entries are referred to
* as "stale entries" in the code that follows.
*/
static
class
Entry
extends
WeakReference
<
ThreadLocal
>
{
static
class
Entry
extends
WeakReference
<
ThreadLocal
<?>
>
{
/** The value associated with this ThreadLocal. */
Object
value
;
Entry
(
ThreadLocal
k
,
Object
v
)
{
Entry
(
ThreadLocal
<?>
k
,
Object
v
)
{
super
(
k
);
value
=
v
;
}
...
...
@@ -325,7 +328,7 @@ public class ThreadLocal<T> {
* ThreadLocalMaps are constructed lazily, so we only create
* one when we have at least one entry to put in it.
*/
ThreadLocalMap
(
ThreadLocal
firstKey
,
Object
firstValue
)
{
ThreadLocalMap
(
ThreadLocal
<?>
firstKey
,
Object
firstValue
)
{
table
=
new
Entry
[
INITIAL_CAPACITY
];
int
i
=
firstKey
.
threadLocalHashCode
&
(
INITIAL_CAPACITY
-
1
);
table
[
i
]
=
new
Entry
(
firstKey
,
firstValue
);
...
...
@@ -348,7 +351,8 @@ public class ThreadLocal<T> {
for
(
int
j
=
0
;
j
<
len
;
j
++)
{
Entry
e
=
parentTable
[
j
];
if
(
e
!=
null
)
{
ThreadLocal
key
=
e
.
get
();
@SuppressWarnings
(
"unchecked"
)
ThreadLocal
<
Object
>
key
=
(
ThreadLocal
<
Object
>)
e
.
get
();
if
(
key
!=
null
)
{
Object
value
=
key
.
childValue
(
e
.
value
);
Entry
c
=
new
Entry
(
key
,
value
);
...
...
@@ -372,7 +376,7 @@ public class ThreadLocal<T> {
* @param key the thread local object
* @return the entry associated with key, or null if no such
*/
private
Entry
getEntry
(
ThreadLocal
key
)
{
private
Entry
getEntry
(
ThreadLocal
<?>
key
)
{
int
i
=
key
.
threadLocalHashCode
&
(
table
.
length
-
1
);
Entry
e
=
table
[
i
];
if
(
e
!=
null
&&
e
.
get
()
==
key
)
...
...
@@ -390,12 +394,12 @@ public class ThreadLocal<T> {
* @param e the entry at table[i]
* @return the entry associated with key, or null if no such
*/
private
Entry
getEntryAfterMiss
(
ThreadLocal
key
,
int
i
,
Entry
e
)
{
private
Entry
getEntryAfterMiss
(
ThreadLocal
<?>
key
,
int
i
,
Entry
e
)
{
Entry
[]
tab
=
table
;
int
len
=
tab
.
length
;
while
(
e
!=
null
)
{
ThreadLocal
k
=
e
.
get
();
ThreadLocal
<?>
k
=
e
.
get
();
if
(
k
==
key
)
return
e
;
if
(
k
==
null
)
...
...
@@ -413,7 +417,7 @@ public class ThreadLocal<T> {
* @param key the thread local object
* @param value the value to be set
*/
private
void
set
(
ThreadLocal
key
,
Object
value
)
{
private
void
set
(
ThreadLocal
<?>
key
,
Object
value
)
{
// We don't use a fast path as with get() because it is at
// least as common to use set() to create new entries as
...
...
@@ -427,7 +431,7 @@ public class ThreadLocal<T> {
for
(
Entry
e
=
tab
[
i
];
e
!=
null
;
e
=
tab
[
i
=
nextIndex
(
i
,
len
)])
{
ThreadLocal
k
=
e
.
get
();
ThreadLocal
<?>
k
=
e
.
get
();
if
(
k
==
key
)
{
e
.
value
=
value
;
...
...
@@ -449,7 +453,7 @@ public class ThreadLocal<T> {
/**
* Remove the entry for key.
*/
private
void
remove
(
ThreadLocal
key
)
{
private
void
remove
(
ThreadLocal
<?>
key
)
{
Entry
[]
tab
=
table
;
int
len
=
tab
.
length
;
int
i
=
key
.
threadLocalHashCode
&
(
len
-
1
);
...
...
@@ -479,7 +483,7 @@ public class ThreadLocal<T> {
* @param staleSlot index of the first stale entry encountered while
* searching for key.
*/
private
void
replaceStaleEntry
(
ThreadLocal
key
,
Object
value
,
private
void
replaceStaleEntry
(
ThreadLocal
<?>
key
,
Object
value
,
int
staleSlot
)
{
Entry
[]
tab
=
table
;
int
len
=
tab
.
length
;
...
...
@@ -501,7 +505,7 @@ public class ThreadLocal<T> {
for
(
int
i
=
nextIndex
(
staleSlot
,
len
);
(
e
=
tab
[
i
])
!=
null
;
i
=
nextIndex
(
i
,
len
))
{
ThreadLocal
k
=
e
.
get
();
ThreadLocal
<?>
k
=
e
.
get
();
// If we find key, then we need to swap it
// with the stale entry to maintain hash table order.
...
...
@@ -563,7 +567,7 @@ public class ThreadLocal<T> {
for
(
i
=
nextIndex
(
staleSlot
,
len
);
(
e
=
tab
[
i
])
!=
null
;
i
=
nextIndex
(
i
,
len
))
{
ThreadLocal
k
=
e
.
get
();
ThreadLocal
<?>
k
=
e
.
get
();
if
(
k
==
null
)
{
e
.
value
=
null
;
tab
[
i
]
=
null
;
...
...
@@ -650,7 +654,7 @@ public class ThreadLocal<T> {
for
(
int
j
=
0
;
j
<
oldLen
;
++
j
)
{
Entry
e
=
oldTab
[
j
];
if
(
e
!=
null
)
{
ThreadLocal
k
=
e
.
get
();
ThreadLocal
<?>
k
=
e
.
get
();
if
(
k
==
null
)
{
e
.
value
=
null
;
// Help the GC
}
else
{
...
...
src/share/classes/java/lang/Void.java
浏览文件 @
322c6102
...
...
@@ -40,7 +40,8 @@ class Void {
* The {@code Class} object representing the pseudo-type corresponding to
* the keyword {@code void}.
*/
public
static
final
Class
<
Void
>
TYPE
=
Class
.
getPrimitiveClass
(
"void"
);
@SuppressWarnings
(
"unchecked"
)
public
static
final
Class
<
Void
>
TYPE
=
(
Class
<
Void
>)
Class
.
getPrimitiveClass
(
"void"
);
/*
* The Void class cannot be instantiated.
...
...
src/solaris/classes/java/lang/ProcessEnvironment.java
浏览文件 @
322c6102
...
...
@@ -91,6 +91,7 @@ final class ProcessEnvironment
}
/* Only for use by ProcessBuilder.environment() */
@SuppressWarnings
(
"unchecked"
)
static
Map
<
String
,
String
>
environment
()
{
return
new
StringEnvironment
((
Map
<
Variable
,
Value
>)(
theEnvironment
.
clone
()));
...
...
src/windows/classes/java/lang/ProcessEnvironment.java
浏览文件 @
322c6102
...
...
@@ -68,6 +68,9 @@ import java.util.*;
final
class
ProcessEnvironment
extends
HashMap
<
String
,
String
>
{
private
static
final
long
serialVersionUID
=
-
8017839552603542824L
;
private
static
String
validateName
(
String
name
)
{
// An initial `=' indicates a magic Windows variable name -- OK
if
(
name
.
indexOf
(
'='
,
1
)
!=
-
1
||
...
...
@@ -144,6 +147,7 @@ final class ProcessEnvironment extends HashMap<String,String>
};
}
private
static
Map
.
Entry
<
String
,
String
>
checkedEntry
(
Object
o
)
{
@SuppressWarnings
(
"unchecked"
)
Map
.
Entry
<
String
,
String
>
e
=
(
Map
.
Entry
<
String
,
String
>)
o
;
nonNullString
(
e
.
getKey
());
nonNullString
(
e
.
getValue
());
...
...
@@ -281,6 +285,7 @@ final class ProcessEnvironment extends HashMap<String,String>
}
// Only for use by ProcessBuilder.environment()
@SuppressWarnings
(
"unchecked"
)
static
Map
<
String
,
String
>
environment
()
{
return
(
Map
<
String
,
String
>)
theEnvironment
.
clone
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录