Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
741c9607
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看板
提交
741c9607
编写于
12月 20, 2010
作者:
S
smarks
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6880112: Project Coin: Port JDK core library code to use diamond operator
Reviewed-by: darcy, lancea, alanb, briangoetz, mduigou, mchung
上级
ecf74ffd
变更
71
展开全部
隐藏空白更改
内联
并排
Showing
71 changed file
with
264 addition
and
281 deletion
+264
-281
src/share/classes/com/sun/java/util/jar/pack/BandStructure.java
...are/classes/com/sun/java/util/jar/pack/BandStructure.java
+1
-1
src/share/classes/com/sun/java/util/jar/pack/ConstantPool.java
...hare/classes/com/sun/java/util/jar/pack/ConstantPool.java
+1
-1
src/share/classes/com/sun/java/util/jar/pack/Package.java
src/share/classes/com/sun/java/util/jar/pack/Package.java
+1
-1
src/share/classes/java/io/DeleteOnExitHook.java
src/share/classes/java/io/DeleteOnExitHook.java
+2
-2
src/share/classes/java/io/File.java
src/share/classes/java/io/File.java
+3
-3
src/share/classes/java/io/FileInputStream.java
src/share/classes/java/io/FileInputStream.java
+1
-1
src/share/classes/java/io/FileOutputStream.java
src/share/classes/java/io/FileOutputStream.java
+1
-1
src/share/classes/java/io/FilePermission.java
src/share/classes/java/io/FilePermission.java
+3
-3
src/share/classes/java/io/ObjectInputStream.java
src/share/classes/java/io/ObjectInputStream.java
+3
-3
src/share/classes/java/io/ObjectOutputStream.java
src/share/classes/java/io/ObjectOutputStream.java
+3
-3
src/share/classes/java/io/ObjectStreamClass.java
src/share/classes/java/io/ObjectStreamClass.java
+13
-13
src/share/classes/java/lang/ApplicationShutdownHooks.java
src/share/classes/java/lang/ApplicationShutdownHooks.java
+1
-1
src/share/classes/java/lang/Character.java
src/share/classes/java/lang/Character.java
+2
-3
src/share/classes/java/lang/CharacterName.java
src/share/classes/java/lang/CharacterName.java
+1
-1
src/share/classes/java/lang/Class.java
src/share/classes/java/lang/Class.java
+13
-13
src/share/classes/java/lang/ClassLoader.java
src/share/classes/java/lang/ClassLoader.java
+16
-20
src/share/classes/java/lang/Package.java
src/share/classes/java/lang/Package.java
+3
-6
src/share/classes/java/lang/ProcessBuilder.java
src/share/classes/java/lang/ProcessBuilder.java
+2
-2
src/share/classes/java/lang/String.java
src/share/classes/java/lang/String.java
+1
-1
src/share/classes/java/lang/StringCoding.java
src/share/classes/java/lang/StringCoding.java
+3
-3
src/share/classes/java/lang/Thread.java
src/share/classes/java/lang/Thread.java
+3
-4
src/share/classes/java/lang/Throwable.java
src/share/classes/java/lang/Throwable.java
+2
-2
src/share/classes/java/lang/management/ManagementFactory.java
...share/classes/java/lang/management/ManagementFactory.java
+1
-1
src/share/classes/java/lang/management/PlatformComponent.java
...share/classes/java/lang/management/PlatformComponent.java
+3
-3
src/share/classes/java/lang/reflect/Constructor.java
src/share/classes/java/lang/reflect/Constructor.java
+1
-1
src/share/classes/java/lang/reflect/Proxy.java
src/share/classes/java/lang/reflect/Proxy.java
+3
-3
src/share/classes/java/lang/reflect/ReflectAccess.java
src/share/classes/java/lang/reflect/ReflectAccess.java
+1
-1
src/share/classes/java/sql/DriverManager.java
src/share/classes/java/sql/DriverManager.java
+1
-1
src/share/classes/java/util/AbstractList.java
src/share/classes/java/util/AbstractList.java
+4
-4
src/share/classes/java/util/Arrays.java
src/share/classes/java/util/Arrays.java
+1
-1
src/share/classes/java/util/Collections.java
src/share/classes/java/util/Collections.java
+77
-78
src/share/classes/java/util/EnumMap.java
src/share/classes/java/util/EnumMap.java
+1
-1
src/share/classes/java/util/EnumSet.java
src/share/classes/java/util/EnumSet.java
+3
-3
src/share/classes/java/util/Formatter.java
src/share/classes/java/util/Formatter.java
+1
-1
src/share/classes/java/util/HashMap.java
src/share/classes/java/util/HashMap.java
+2
-2
src/share/classes/java/util/HashSet.java
src/share/classes/java/util/HashSet.java
+5
-5
src/share/classes/java/util/Hashtable.java
src/share/classes/java/util/Hashtable.java
+5
-5
src/share/classes/java/util/IdentityHashMap.java
src/share/classes/java/util/IdentityHashMap.java
+2
-2
src/share/classes/java/util/JumboEnumSet.java
src/share/classes/java/util/JumboEnumSet.java
+1
-1
src/share/classes/java/util/LinkedHashMap.java
src/share/classes/java/util/LinkedHashMap.java
+2
-2
src/share/classes/java/util/LinkedList.java
src/share/classes/java/util/LinkedList.java
+4
-4
src/share/classes/java/util/ListResourceBundle.java
src/share/classes/java/util/ListResourceBundle.java
+1
-1
src/share/classes/java/util/PriorityQueue.java
src/share/classes/java/util/PriorityQueue.java
+1
-1
src/share/classes/java/util/Properties.java
src/share/classes/java/util/Properties.java
+1
-1
src/share/classes/java/util/RegularEnumSet.java
src/share/classes/java/util/RegularEnumSet.java
+1
-1
src/share/classes/java/util/ServiceLoader.java
src/share/classes/java/util/ServiceLoader.java
+3
-3
src/share/classes/java/util/TimSort.java
src/share/classes/java/util/TimSort.java
+1
-1
src/share/classes/java/util/TreeMap.java
src/share/classes/java/util/TreeMap.java
+7
-7
src/share/classes/java/util/TreeSet.java
src/share/classes/java/util/TreeSet.java
+8
-8
src/share/classes/java/util/WeakHashMap.java
src/share/classes/java/util/WeakHashMap.java
+4
-5
src/share/classes/java/util/logging/FileHandler.java
src/share/classes/java/util/logging/FileHandler.java
+1
-1
src/share/classes/java/util/logging/Level.java
src/share/classes/java/util/logging/Level.java
+1
-1
src/share/classes/java/util/logging/LogManager.java
src/share/classes/java/util/logging/LogManager.java
+4
-5
src/share/classes/java/util/logging/LogRecord.java
src/share/classes/java/util/logging/LogRecord.java
+1
-2
src/share/classes/java/util/logging/Logger.java
src/share/classes/java/util/logging/Logger.java
+3
-3
src/share/classes/java/util/logging/Logging.java
src/share/classes/java/util/logging/Logging.java
+1
-1
src/share/classes/java/util/prefs/AbstractPreferences.java
src/share/classes/java/util/prefs/AbstractPreferences.java
+3
-5
src/share/classes/java/util/regex/Pattern.java
src/share/classes/java/util/regex/Pattern.java
+3
-3
src/share/classes/java/util/zip/ZipFile.java
src/share/classes/java/util/zip/ZipFile.java
+1
-1
src/share/classes/java/util/zip/ZipOutputStream.java
src/share/classes/java/util/zip/ZipOutputStream.java
+2
-2
src/share/classes/sun/io/Converters.java
src/share/classes/sun/io/Converters.java
+1
-1
src/share/classes/sun/util/logging/PlatformLogger.java
src/share/classes/sun/util/logging/PlatformLogger.java
+3
-3
src/solaris/classes/java/lang/ProcessEnvironment.java
src/solaris/classes/java/lang/ProcessEnvironment.java
+1
-1
src/solaris/classes/java/util/prefs/FileSystemPreferences.java
...olaris/classes/java/util/prefs/FileSystemPreferences.java
+7
-7
src/windows/classes/java/lang/ProcessEnvironment.java
src/windows/classes/java/lang/ProcessEnvironment.java
+2
-4
test/java/io/Serializable/NPEProvoker/NPEProvoker.java
test/java/io/Serializable/NPEProvoker/NPEProvoker.java
+1
-1
test/java/lang/instrument/ilib/Inject.java
test/java/lang/instrument/ilib/Inject.java
+1
-1
test/java/lang/instrument/ilib/InjectBytecodes.java
test/java/lang/instrument/ilib/InjectBytecodes.java
+1
-1
test/java/lang/reflect/Generics/TestPlainArrayNotGeneric.java
.../java/lang/reflect/Generics/TestPlainArrayNotGeneric.java
+1
-1
test/java/util/Random/DistinctSeeds.java
test/java/util/Random/DistinctSeeds.java
+1
-1
test/java/util/logging/ClassLoaderLeakTest.java
test/java/util/logging/ClassLoaderLeakTest.java
+1
-1
未找到文件。
src/share/classes/com/sun/java/util/jar/pack/BandStructure.java
浏览文件 @
741c9607
...
...
@@ -1704,7 +1704,7 @@ class BandStructure {
for
(
int
i
=
0
;
i
<
ATTR_CONTEXT_LIMIT
;
i
++)
{
assert
(
attrIndexLimit
[
i
]
==
0
);
attrIndexLimit
[
i
]
=
32
;
// just for the sake of predefs.
attrDefs
.
set
(
i
,
new
ArrayList
<
Attribute
.
Layout
>(
Collections
.
nCopies
(
attrDefs
.
set
(
i
,
new
ArrayList
<>(
Collections
.
nCopies
(
attrIndexLimit
[
i
],
(
Attribute
.
Layout
)
null
)));
}
...
...
src/share/classes/com/sun/java/util/jar/pack/ConstantPool.java
浏览文件 @
741c9607
...
...
@@ -1137,7 +1137,7 @@ class ConstantPool {
void
completeReferencesIn
(
Set
<
Entry
>
cpRefs
,
boolean
flattenSigs
)
{
cpRefs
.
remove
(
null
);
for
(
ListIterator
<
Entry
>
work
=
new
ArrayList
<
Entry
>(
cpRefs
).
listIterator
(
cpRefs
.
size
());
new
ArrayList
<>(
cpRefs
).
listIterator
(
cpRefs
.
size
());
work
.
hasPrevious
();
)
{
Entry
e
=
work
.
previous
();
work
.
remove
();
// pop stack
...
...
src/share/classes/com/sun/java/util/jar/pack/Package.java
浏览文件 @
741c9607
...
...
@@ -322,7 +322,7 @@ class Package {
}
public
void
setInnerClasses
(
Collection
<
InnerClass
>
ics
)
{
innerClasses
=
(
ics
==
null
)
?
null
:
new
ArrayList
<
InnerClass
>(
ics
);
innerClasses
=
(
ics
==
null
)
?
null
:
new
ArrayList
<>(
ics
);
// Edit the attribute list, if necessary.
Attribute
a
=
getAttribute
(
attrInnerClassesEmpty
);
if
(
innerClasses
!=
null
&&
a
==
null
)
...
...
src/share/classes/java/io/DeleteOnExitHook.java
浏览文件 @
741c9607
...
...
@@ -34,7 +34,7 @@ import java.io.File;
*/
class
DeleteOnExitHook
{
private
static
LinkedHashSet
<
String
>
files
=
new
LinkedHashSet
<
String
>();
private
static
LinkedHashSet
<
String
>
files
=
new
LinkedHashSet
<>();
static
{
// DeleteOnExitHook must be the last shutdown hook to be invoked.
// Application shutdown hooks may add the first file to the
...
...
@@ -71,7 +71,7 @@ class DeleteOnExitHook {
files
=
null
;
}
ArrayList
<
String
>
toBeDeleted
=
new
ArrayList
<
String
>(
theFiles
);
ArrayList
<
String
>
toBeDeleted
=
new
ArrayList
<>(
theFiles
);
// reverse the list to maintain previous jdk deletion order.
// Last in first deleted.
...
...
src/share/classes/java/io/File.java
浏览文件 @
741c9607
...
...
@@ -1067,7 +1067,7 @@ public class File
if
((
names
==
null
)
||
(
filter
==
null
))
{
return
names
;
}
List
<
String
>
v
=
new
ArrayList
<
String
>();
List
<
String
>
v
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
names
.
length
;
i
++)
{
if
(
filter
.
accept
(
this
,
names
[
i
]))
{
v
.
add
(
names
[
i
]);
...
...
@@ -1158,7 +1158,7 @@ public class File
public
File
[]
listFiles
(
FilenameFilter
filter
)
{
String
ss
[]
=
list
();
if
(
ss
==
null
)
return
null
;
ArrayList
<
File
>
files
=
new
ArrayList
<
File
>();
ArrayList
<
File
>
files
=
new
ArrayList
<>();
for
(
String
s
:
ss
)
if
((
filter
==
null
)
||
filter
.
accept
(
this
,
s
))
files
.
add
(
new
File
(
s
,
this
));
...
...
@@ -1195,7 +1195,7 @@ public class File
public
File
[]
listFiles
(
FileFilter
filter
)
{
String
ss
[]
=
list
();
if
(
ss
==
null
)
return
null
;
ArrayList
<
File
>
files
=
new
ArrayList
<
File
>();
ArrayList
<
File
>
files
=
new
ArrayList
<>();
for
(
String
s
:
ss
)
{
File
f
=
new
File
(
s
,
this
);
if
((
filter
==
null
)
||
filter
.
accept
(
f
))
...
...
src/share/classes/java/io/FileInputStream.java
浏览文件 @
741c9607
...
...
@@ -56,7 +56,7 @@ class FileInputStream extends InputStream
private
volatile
boolean
closed
=
false
;
private
static
final
ThreadLocal
<
Boolean
>
runningFinalize
=
new
ThreadLocal
<
Boolean
>();
new
ThreadLocal
<>();
private
static
boolean
isRunningFinalize
()
{
Boolean
val
;
...
...
src/share/classes/java/io/FileOutputStream.java
浏览文件 @
741c9607
...
...
@@ -69,7 +69,7 @@ class FileOutputStream extends OutputStream
private
final
Object
closeLock
=
new
Object
();
private
volatile
boolean
closed
=
false
;
private
static
final
ThreadLocal
<
Boolean
>
runningFinalize
=
new
ThreadLocal
<
Boolean
>();
new
ThreadLocal
<>();
private
static
boolean
isRunningFinalize
()
{
Boolean
val
;
...
...
src/share/classes/java/io/FilePermission.java
浏览文件 @
741c9607
...
...
@@ -725,7 +725,7 @@ implements Serializable {
*/
public
FilePermissionCollection
()
{
perms
=
new
ArrayList
<
Permission
>();
perms
=
new
ArrayList
<>();
}
/**
...
...
@@ -830,7 +830,7 @@ implements Serializable {
// Don't call out.defaultWriteObject()
// Write out Vector
Vector
<
Permission
>
permissions
=
new
Vector
<
Permission
>(
perms
.
size
());
Vector
<
Permission
>
permissions
=
new
Vector
<>(
perms
.
size
());
synchronized
(
this
)
{
permissions
.
addAll
(
perms
);
}
...
...
@@ -853,7 +853,7 @@ implements Serializable {
// Get the one we want
Vector
<
Permission
>
permissions
=
(
Vector
<
Permission
>)
gfields
.
get
(
"permissions"
,
null
);
perms
=
new
ArrayList
<
Permission
>(
permissions
.
size
());
perms
=
new
ArrayList
<>(
permissions
.
size
());
perms
.
addAll
(
permissions
);
}
}
src/share/classes/java/io/ObjectInputStream.java
浏览文件 @
741c9607
...
...
@@ -213,7 +213,7 @@ public class ObjectInputStream
/** table mapping primitive type names to corresponding class objects */
private
static
final
HashMap
<
String
,
Class
<?>>
primClasses
=
new
HashMap
<
String
,
Class
<?>
>(
8
,
1.0
F
);
=
new
HashMap
<>(
8
,
1.0
F
);
static
{
primClasses
.
put
(
"boolean"
,
boolean
.
class
);
primClasses
.
put
(
"byte"
,
byte
.
class
);
...
...
@@ -229,11 +229,11 @@ public class ObjectInputStream
private
static
class
Caches
{
/** cache of subclass security audit results */
static
final
ConcurrentMap
<
WeakClassKey
,
Boolean
>
subclassAudits
=
new
ConcurrentHashMap
<
WeakClassKey
,
Boolean
>();
new
ConcurrentHashMap
<>();
/** queue for WeakReferences to audited subclasses */
static
final
ReferenceQueue
<
Class
<?>>
subclassAuditsQueue
=
new
ReferenceQueue
<
Class
<?>
>();
new
ReferenceQueue
<>();
}
/** filter stream for handling block data conversion */
...
...
src/share/classes/java/io/ObjectOutputStream.java
浏览文件 @
741c9607
...
...
@@ -165,11 +165,11 @@ public class ObjectOutputStream
private
static
class
Caches
{
/** cache of subclass security audit results */
static
final
ConcurrentMap
<
WeakClassKey
,
Boolean
>
subclassAudits
=
new
ConcurrentHashMap
<
WeakClassKey
,
Boolean
>();
new
ConcurrentHashMap
<>();
/** queue for WeakReferences to audited subclasses */
static
final
ReferenceQueue
<
Class
<?>>
subclassAuditsQueue
=
new
ReferenceQueue
<
Class
<?>
>();
new
ReferenceQueue
<>();
}
/** filter stream for handling block data conversion */
...
...
@@ -2413,7 +2413,7 @@ public class ObjectOutputStream
private
final
List
<
String
>
stack
;
DebugTraceInfoStack
()
{
stack
=
new
ArrayList
<
String
>();
stack
=
new
ArrayList
<>();
}
/**
...
...
src/share/classes/java/io/ObjectStreamClass.java
浏览文件 @
741c9607
...
...
@@ -84,18 +84,18 @@ public class ObjectStreamClass implements Serializable {
private
static
class
Caches
{
/** cache mapping local classes -> descriptors */
static
final
ConcurrentMap
<
WeakClassKey
,
Reference
<?>>
localDescs
=
new
ConcurrentHashMap
<
WeakClassKey
,
Reference
<?>
>();
new
ConcurrentHashMap
<>();
/** cache mapping field group/local desc pairs -> field reflectors */
static
final
ConcurrentMap
<
FieldReflectorKey
,
Reference
<?>>
reflectors
=
new
ConcurrentHashMap
<
FieldReflectorKey
,
Reference
<?>
>();
new
ConcurrentHashMap
<>();
/** queue for WeakReferences to local classes */
private
static
final
ReferenceQueue
<
Class
<?>>
localDescsQueue
=
new
ReferenceQueue
<
Class
<?>
>();
new
ReferenceQueue
<>();
/** queue for WeakReferences to field reflectors keys */
private
static
final
ReferenceQueue
<
Class
<?>>
reflectorsQueue
=
new
ReferenceQueue
<
Class
<?>
>();
new
ReferenceQueue
<>();
}
/** class associated with this descriptor (if any) */
...
...
@@ -290,7 +290,7 @@ public class ObjectStreamClass implements Serializable {
EntryFuture
future
=
null
;
if
(
entry
==
null
)
{
EntryFuture
newEntry
=
new
EntryFuture
();
Reference
<?>
newRef
=
new
SoftReference
<
EntryFuture
>(
newEntry
);
Reference
<?>
newRef
=
new
SoftReference
<>(
newEntry
);
do
{
if
(
ref
!=
null
)
{
Caches
.
localDescs
.
remove
(
key
,
ref
);
...
...
@@ -329,7 +329,7 @@ public class ObjectStreamClass implements Serializable {
entry
=
th
;
}
if
(
future
.
set
(
entry
))
{
Caches
.
localDescs
.
put
(
key
,
new
SoftReference
<
Object
>(
entry
));
Caches
.
localDescs
.
put
(
key
,
new
SoftReference
<>(
entry
));
}
else
{
// nested lookup call already set future
entry
=
future
.
get
();
...
...
@@ -1130,7 +1130,7 @@ public class ObjectStreamClass implements Serializable {
private
ClassDataSlot
[]
getClassDataLayout0
()
throws
InvalidClassException
{
ArrayList
<
ClassDataSlot
>
slots
=
new
ArrayList
<
ClassDataSlot
>();
ArrayList
<
ClassDataSlot
>
slots
=
new
ArrayList
<>();
Class
<?>
start
=
cl
,
end
=
cl
;
// locate closest non-serializable superclass
...
...
@@ -1566,7 +1566,7 @@ public class ObjectStreamClass implements Serializable {
ObjectStreamField
[]
boundFields
=
new
ObjectStreamField
[
serialPersistentFields
.
length
];
Set
<
String
>
fieldNames
=
new
HashSet
<
String
>(
serialPersistentFields
.
length
);
Set
<
String
>
fieldNames
=
new
HashSet
<>(
serialPersistentFields
.
length
);
for
(
int
i
=
0
;
i
<
serialPersistentFields
.
length
;
i
++)
{
ObjectStreamField
spf
=
serialPersistentFields
[
i
];
...
...
@@ -1604,7 +1604,7 @@ public class ObjectStreamClass implements Serializable {
*/
private
static
ObjectStreamField
[]
getDefaultSerialFields
(
Class
<?>
cl
)
{
Field
[]
clFields
=
cl
.
getDeclaredFields
();
ArrayList
<
ObjectStreamField
>
list
=
new
ArrayList
<
ObjectStreamField
>();
ArrayList
<
ObjectStreamField
>
list
=
new
ArrayList
<>();
int
mask
=
Modifier
.
STATIC
|
Modifier
.
TRANSIENT
;
for
(
int
i
=
0
;
i
<
clFields
.
length
;
i
++)
{
...
...
@@ -1855,8 +1855,8 @@ public class ObjectStreamClass implements Serializable {
writeKeys
=
new
long
[
nfields
];
offsets
=
new
int
[
nfields
];
typeCodes
=
new
char
[
nfields
];
ArrayList
<
Class
<?>>
typeList
=
new
ArrayList
<
Class
<?>
>();
Set
<
Long
>
usedKeys
=
new
HashSet
<
Long
>();
ArrayList
<
Class
<?>>
typeList
=
new
ArrayList
<>();
Set
<
Long
>
usedKeys
=
new
HashSet
<>();
for
(
int
i
=
0
;
i
<
nfields
;
i
++)
{
...
...
@@ -2092,7 +2092,7 @@ public class ObjectStreamClass implements Serializable {
EntryFuture
future
=
null
;
if
(
entry
==
null
)
{
EntryFuture
newEntry
=
new
EntryFuture
();
Reference
<?>
newRef
=
new
SoftReference
<
EntryFuture
>(
newEntry
);
Reference
<?>
newRef
=
new
SoftReference
<>(
newEntry
);
do
{
if
(
ref
!=
null
)
{
Caches
.
reflectors
.
remove
(
key
,
ref
);
...
...
@@ -2118,7 +2118,7 @@ public class ObjectStreamClass implements Serializable {
entry
=
th
;
}
future
.
set
(
entry
);
Caches
.
reflectors
.
put
(
key
,
new
SoftReference
<
Object
>(
entry
));
Caches
.
reflectors
.
put
(
key
,
new
SoftReference
<>(
entry
));
}
if
(
entry
instanceof
FieldReflector
)
{
...
...
src/share/classes/java/lang/ApplicationShutdownHooks.java
浏览文件 @
741c9607
...
...
@@ -47,7 +47,7 @@ class ApplicationShutdownHooks {
}
}
);
hooks
=
new
IdentityHashMap
<
Thread
,
Thread
>();
hooks
=
new
IdentityHashMap
<>();
}
catch
(
IllegalStateException
e
)
{
// application shutdown hooks cannot be added if
// shutdown is in progress.
...
...
src/share/classes/java/lang/Character.java
浏览文件 @
741c9607
...
...
@@ -648,8 +648,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
*/
public
static
final
class
UnicodeBlock
extends
Subset
{
private
static
Map
<
String
,
UnicodeBlock
>
map
=
new
HashMap
<
String
,
UnicodeBlock
>(
256
);
private
static
Map
<
String
,
UnicodeBlock
>
map
=
new
HashMap
<>(
256
);
/**
* Creates a UnicodeBlock with the given identifier name.
...
...
@@ -4178,7 +4177,7 @@ class Character implements java.io.Serializable, Comparable<Character> {
private
static
HashMap
<
String
,
Character
.
UnicodeScript
>
aliases
;
static
{
aliases
=
new
HashMap
<
String
,
UnicodeScript
>(
128
);
aliases
=
new
HashMap
<>(
128
);
aliases
.
put
(
"ARAB"
,
ARABIC
);
aliases
.
put
(
"ARMI"
,
IMPERIAL_ARAMAIC
);
aliases
.
put
(
"ARMN"
,
ARMENIAN
);
...
...
src/share/classes/java/lang/CharacterName.java
浏览文件 @
741c9607
...
...
@@ -81,7 +81,7 @@ class CharacterName {
}
while
(
cpOff
<
cpEnd
);
strPool
=
new
byte
[
total
-
cpEnd
];
dis
.
readFully
(
strPool
);
refStrPool
=
new
SoftReference
<
byte
[]
>(
strPool
);
refStrPool
=
new
SoftReference
<>(
strPool
);
}
catch
(
Exception
x
)
{
throw
new
InternalError
(
x
.
getMessage
());
}
finally
{
...
...
src/share/classes/java/lang/Class.java
浏览文件 @
741c9607
...
...
@@ -1306,7 +1306,7 @@ public final
return
java
.
security
.
AccessController
.
doPrivileged
(
new
java
.
security
.
PrivilegedAction
<
Class
<?>[]>()
{
public
Class
[]
run
()
{
List
<
Class
<?>>
list
=
new
ArrayList
<
Class
<?>
>();
List
<
Class
<?>>
list
=
new
ArrayList
<>();
Class
<?>
currentClass
=
Class
.
this
;
while
(
currentClass
!=
null
)
{
Class
<?>[]
members
=
currentClass
.
getDeclaredClasses
();
...
...
@@ -2306,9 +2306,9 @@ public final
res
=
Reflection
.
filterFields
(
this
,
getDeclaredFields0
(
publicOnly
));
if
(
useCaches
)
{
if
(
publicOnly
)
{
declaredPublicFields
=
new
SoftReference
<
Field
[]
>(
res
);
declaredPublicFields
=
new
SoftReference
<>(
res
);
}
else
{
declaredFields
=
new
SoftReference
<
Field
[]
>(
res
);
declaredFields
=
new
SoftReference
<>(
res
);
}
}
return
res
;
...
...
@@ -2330,9 +2330,9 @@ public final
// No cached value available; compute value recursively.
// Traverse in correct order for getField().
List
<
Field
>
fields
=
new
ArrayList
<
Field
>();
List
<
Field
>
fields
=
new
ArrayList
<>();
if
(
traversedInterfaces
==
null
)
{
traversedInterfaces
=
new
HashSet
<
Class
<?>
>();
traversedInterfaces
=
new
HashSet
<>();
}
// Local fields
...
...
@@ -2358,7 +2358,7 @@ public final
res
=
new
Field
[
fields
.
size
()];
fields
.
toArray
(
res
);
if
(
useCaches
)
{
publicFields
=
new
SoftReference
<
Field
[]
>(
res
);
publicFields
=
new
SoftReference
<>(
res
);
}
return
res
;
}
...
...
@@ -2403,9 +2403,9 @@ public final
}
if
(
useCaches
)
{
if
(
publicOnly
)
{
publicConstructors
=
new
SoftReference
<
Constructor
<
T
>[]
>(
res
);
publicConstructors
=
new
SoftReference
<>(
res
);
}
else
{
declaredConstructors
=
new
SoftReference
<
Constructor
<
T
>[]
>(
res
);
declaredConstructors
=
new
SoftReference
<>(
res
);
}
}
return
res
;
...
...
@@ -2440,9 +2440,9 @@ public final
res
=
Reflection
.
filterMethods
(
this
,
getDeclaredMethods0
(
publicOnly
));
if
(
useCaches
)
{
if
(
publicOnly
)
{
declaredPublicMethods
=
new
SoftReference
<
Method
[]
>(
res
);
declaredPublicMethods
=
new
SoftReference
<>(
res
);
}
else
{
declaredMethods
=
new
SoftReference
<
Method
[]
>(
res
);
declaredMethods
=
new
SoftReference
<>(
res
);
}
}
return
res
;
...
...
@@ -2598,7 +2598,7 @@ public final
methods
.
compactAndTrim
();
res
=
methods
.
getArray
();
if
(
useCaches
)
{
publicMethods
=
new
SoftReference
<
Method
[]
>(
res
);
publicMethods
=
new
SoftReference
<>(
res
);
}
return
res
;
}
...
...
@@ -2977,7 +2977,7 @@ public final
if
(
universe
==
null
)
throw
new
IllegalArgumentException
(
getName
()
+
" is not an enum type"
);
Map
<
String
,
T
>
m
=
new
HashMap
<
String
,
T
>(
2
*
universe
.
length
);
Map
<
String
,
T
>
m
=
new
HashMap
<>(
2
*
universe
.
length
);
for
(
T
constant
:
universe
)
m
.
put
(((
Enum
<?>)
constant
).
name
(),
constant
);
enumConstantDirectory
=
m
;
...
...
@@ -3090,7 +3090,7 @@ public final
if
(
superClass
==
null
)
{
annotations
=
declaredAnnotations
;
}
else
{
annotations
=
new
HashMap
<
Class
<?
extends
Annotation
>,
Annotation
>();
annotations
=
new
HashMap
<>();
superClass
.
initAnnotationsIfNecessary
();
for
(
Map
.
Entry
<
Class
<?
extends
Annotation
>,
Annotation
>
e
:
superClass
.
annotations
.
entrySet
())
{
Class
<?
extends
Annotation
>
annotationClass
=
e
.
getKey
();
...
...
src/share/classes/java/lang/ClassLoader.java
浏览文件 @
741c9607
...
...
@@ -247,7 +247,7 @@ public abstract class ClassLoader {
// The classes loaded by this class loader. The only purpose of this table
// is to keep the classes from being GC'ed until the loader is GC'ed.
private
final
Vector
<
Class
<?>>
classes
=
new
Vector
<
Class
<?>
>();
private
final
Vector
<
Class
<?>>
classes
=
new
Vector
<>();
// The "default" domain. Set as the default ProtectionDomain on newly
// created classes.
...
...
@@ -266,8 +266,7 @@ public abstract class ClassLoader {
// The packages defined in this class loader. Each package name is mapped
// to its corresponding Package object.
// @GuardedBy("itself")
private
final
HashMap
<
String
,
Package
>
packages
=
new
HashMap
<
String
,
Package
>();
private
final
HashMap
<
String
,
Package
>
packages
=
new
HashMap
<>();
private
static
Void
checkCreateClassLoader
()
{
SecurityManager
security
=
System
.
getSecurityManager
();
...
...
@@ -280,16 +279,16 @@ public abstract class ClassLoader {
private
ClassLoader
(
Void
unused
,
ClassLoader
parent
)
{
this
.
parent
=
parent
;
if
(
ParallelLoaders
.
isRegistered
(
this
.
getClass
()))
{
parallelLockMap
=
new
ConcurrentHashMap
<
String
,
Object
>();
package2certs
=
new
ConcurrentHashMap
<
String
,
Certificate
[]
>();
parallelLockMap
=
new
ConcurrentHashMap
<>();
package2certs
=
new
ConcurrentHashMap
<>();
domains
=
Collections
.
synchronizedSet
(
new
HashSet
<
ProtectionDomain
>());
assertionLock
=
new
Object
();
}
else
{
// no finer-grained lock; lock on the classloader instance
parallelLockMap
=
null
;
package2certs
=
new
Hashtable
<
String
,
Certificate
[]
>();
domains
=
new
HashSet
<
ProtectionDomain
>();
package2certs
=
new
Hashtable
<>();
domains
=
new
HashSet
<>();
assertionLock
=
this
;
}
}
...
...
@@ -1182,7 +1181,7 @@ public abstract class ClassLoader {
}
tmp
[
1
]
=
findResources
(
name
);
return
new
CompoundEnumeration
<
URL
>(
tmp
);
return
new
CompoundEnumeration
<>(
tmp
);
}
/**
...
...
@@ -1657,7 +1656,7 @@ public abstract class ClassLoader {
protected
Package
[]
getPackages
()
{
Map
<
String
,
Package
>
map
;
synchronized
(
packages
)
{
map
=
new
HashMap
<
String
,
Package
>(
packages
);
map
=
new
HashMap
<>(
packages
);
}
Package
[]
pkgs
;
if
(
parent
!=
null
)
{
...
...
@@ -1764,20 +1763,17 @@ public abstract class ClassLoader {
}
// All native library names we've loaded.
private
static
Vector
<
String
>
loadedLibraryNames
=
new
Vector
<
String
>();
private
static
Vector
<
String
>
loadedLibraryNames
=
new
Vector
<>();
// Native libraries belonging to system classes.
private
static
Vector
<
NativeLibrary
>
systemNativeLibraries
=
new
Vector
<
NativeLibrary
>();
=
new
Vector
<>();
// Native libraries associated with the class loader.
private
Vector
<
NativeLibrary
>
nativeLibraries
=
new
Vector
<
NativeLibrary
>();
private
Vector
<
NativeLibrary
>
nativeLibraries
=
new
Vector
<>();
// native libraries being loaded/unloaded.
private
static
Stack
<
NativeLibrary
>
nativeLibraryContext
=
new
Stack
<
NativeLibrary
>();
private
static
Stack
<
NativeLibrary
>
nativeLibraryContext
=
new
Stack
<>();
// The paths searched for libraries
private
static
String
usr_paths
[];
...
...
@@ -2101,8 +2097,8 @@ public abstract class ClassLoader {
* them to empty maps, effectively ignoring any present settings.
*/
synchronized
(
assertionLock
)
{
classAssertionStatus
=
new
HashMap
<
String
,
Boolean
>();
packageAssertionStatus
=
new
HashMap
<
String
,
Boolean
>();
classAssertionStatus
=
new
HashMap
<>();
packageAssertionStatus
=
new
HashMap
<>();
defaultAssertionStatus
=
false
;
}
}
...
...
@@ -2164,8 +2160,8 @@ public abstract class ClassLoader {
private
void
initializeJavaAssertionMaps
()
{
// assert Thread.holdsLock(assertionLock);
classAssertionStatus
=
new
HashMap
<
String
,
Boolean
>();
packageAssertionStatus
=
new
HashMap
<
String
,
Boolean
>();
classAssertionStatus
=
new
HashMap
<>();
packageAssertionStatus
=
new
HashMap
<>();
AssertionStatusDirectives
directives
=
retrieveDirectives
();
for
(
int
i
=
0
;
i
<
directives
.
classes
.
length
;
i
++)
...
...
src/share/classes/java/lang/Package.java
浏览文件 @
741c9607
...
...
@@ -588,16 +588,13 @@ public class Package implements java.lang.reflect.AnnotatedElement {
}
// The map of loaded system packages
private
static
Map
<
String
,
Package
>
pkgs
=
new
HashMap
<
String
,
Package
>(
31
);
private
static
Map
<
String
,
Package
>
pkgs
=
new
HashMap
<>(
31
);
// Maps each directory or zip file name to its corresponding url
private
static
Map
<
String
,
URL
>
urls
=
new
HashMap
<
String
,
URL
>(
10
);
private
static
Map
<
String
,
URL
>
urls
=
new
HashMap
<>(
10
);
// Maps each code source url for a jar file to its manifest
private
static
Map
<
String
,
Manifest
>
mans
=
new
HashMap
<
String
,
Manifest
>(
10
);
private
static
Map
<
String
,
Manifest
>
mans
=
new
HashMap
<>(
10
);
private
static
native
String
getSystemPackage0
(
String
name
);
private
static
native
String
[]
getSystemPackages0
();
...
...
src/share/classes/java/lang/ProcessBuilder.java
浏览文件 @
741c9607
...
...
@@ -214,7 +214,7 @@ public final class ProcessBuilder
* @param command a string array containing the program and its arguments
*/
public
ProcessBuilder
(
String
...
command
)
{
this
.
command
=
new
ArrayList
<
String
>(
command
.
length
);
this
.
command
=
new
ArrayList
<>(
command
.
length
);
for
(
String
arg
:
command
)
this
.
command
.
add
(
arg
);
}
...
...
@@ -251,7 +251,7 @@ public final class ProcessBuilder
* @return this process builder
*/
public
ProcessBuilder
command
(
String
...
command
)
{
this
.
command
=
new
ArrayList
<
String
>(
command
.
length
);
this
.
command
=
new
ArrayList
<>(
command
.
length
);
for
(
String
arg
:
command
)
this
.
command
.
add
(
arg
);
return
this
;
...
...
src/share/classes/java/lang/String.java
浏览文件 @
741c9607
...
...
@@ -2330,7 +2330,7 @@ public final class String
int
off
=
0
;
int
next
=
0
;
boolean
limited
=
limit
>
0
;
ArrayList
<
String
>
list
=
new
ArrayList
<
String
>();
ArrayList
<
String
>
list
=
new
ArrayList
<>();
while
((
next
=
indexOf
(
ch
,
off
))
!=
-
1
)
{
if
(!
limited
||
list
.
size
()
<
limit
-
1
)
{
list
.
add
(
substring
(
off
,
next
));
...
...
src/share/classes/java/lang/StringCoding.java
浏览文件 @
741c9607
...
...
@@ -53,9 +53,9 @@ class StringCoding {
/** The cached coders for each thread */
private
final
static
ThreadLocal
<
SoftReference
<
StringDecoder
>>
decoder
=
new
ThreadLocal
<
SoftReference
<
StringDecoder
>
>();
new
ThreadLocal
<>();
private
final
static
ThreadLocal
<
SoftReference
<
StringEncoder
>>
encoder
=
new
ThreadLocal
<
SoftReference
<
StringEncoder
>
>();
new
ThreadLocal
<>();
private
static
boolean
warnUnsupportedCharset
=
true
;
...
...
@@ -67,7 +67,7 @@ class StringCoding {
}
private
static
<
T
>
void
set
(
ThreadLocal
<
SoftReference
<
T
>>
tl
,
T
ob
)
{
tl
.
set
(
new
SoftReference
<
T
>(
ob
));
tl
.
set
(
new
SoftReference
<>(
ob
));
}
// Trim the given byte array to the given length
...
...
src/share/classes/java/lang/Thread.java
浏览文件 @
741c9607
...
...
@@ -1642,8 +1642,7 @@ class Thread implements Runnable {
// Get a snapshot of the list of all threads
Thread
[]
threads
=
getThreads
();
StackTraceElement
[][]
traces
=
dumpThreads
(
threads
);
Map
<
Thread
,
StackTraceElement
[]>
m
=
new
HashMap
<
Thread
,
StackTraceElement
[]>(
threads
.
length
);
Map
<
Thread
,
StackTraceElement
[]>
m
=
new
HashMap
<>(
threads
.
length
);
for
(
int
i
=
0
;
i
<
threads
.
length
;
i
++)
{
StackTraceElement
[]
stackTrace
=
traces
[
i
];
if
(
stackTrace
!=
null
)
{
...
...
@@ -1664,11 +1663,11 @@ class Thread implements Runnable {
private
static
class
Caches
{
/** cache of subclass security audit results */
static
final
ConcurrentMap
<
WeakClassKey
,
Boolean
>
subclassAudits
=
new
ConcurrentHashMap
<
WeakClassKey
,
Boolean
>();
new
ConcurrentHashMap
<>();
/** queue for WeakReferences to audited subclasses */
static
final
ReferenceQueue
<
Class
<?>>
subclassAuditsQueue
=
new
ReferenceQueue
<
Class
<?>
>();
new
ReferenceQueue
<>();
}
/**
...
...
src/share/classes/java/lang/Throwable.java
浏览文件 @
741c9607
...
...
@@ -828,7 +828,7 @@ public class Throwable implements Serializable {
// Use the sentinel for a zero-length list
suppressed
=
SUPPRESSED_SENTINEL
;
}
else
{
// Copy Throwables to new list
suppressed
=
new
ArrayList
<
Throwable
>(
1
);
suppressed
=
new
ArrayList
<>(
1
);
for
(
Throwable
t
:
suppressedExceptions
)
{
// Enforce constraints on suppressed exceptions in
// case of corrupt or malicious stream.
...
...
@@ -911,7 +911,7 @@ public class Throwable implements Serializable {
return
;
if
(
suppressedExceptions
==
SUPPRESSED_SENTINEL
)
suppressedExceptions
=
new
ArrayList
<
Throwable
>(
1
);
suppressedExceptions
=
new
ArrayList
<>(
1
);
assert
suppressedExceptions
!=
SUPPRESSED_SENTINEL
;
...
...
src/share/classes/java/lang/management/ManagementFactory.java
浏览文件 @
741c9607
...
...
@@ -794,7 +794,7 @@ public class ManagementFactory {
*/
public
static
List
<
Class
<?
extends
PlatformManagedObject
>>
getAllPlatformMXBeanInterfaces
()
{
List
<
Class
<?
extends
PlatformManagedObject
>>
result
=
new
ArrayList
<
Class
<?
extends
PlatformManagedObject
>
>();
new
ArrayList
<>();
for
(
PlatformComponent
component:
PlatformComponent
.
values
())
{
result
.
add
(
component
.
getMXBeanInterface
());
}
...
...
src/share/classes/java/lang/management/PlatformComponent.java
浏览文件 @
741c9607
...
...
@@ -267,7 +267,7 @@ enum PlatformComponent {
List
<
T
>
getGcMXBeanList
(
Class
<
T
>
gcMXBeanIntf
)
{
List
<
GarbageCollectorMXBean
>
list
=
ManagementFactoryHelper
.
getGarbageCollectorMXBeans
();
List
<
T
>
result
=
new
ArrayList
<
T
>(
list
.
size
());
List
<
T
>
result
=
new
ArrayList
<>(
list
.
size
());
for
(
GarbageCollectorMXBean
m
:
list
)
{
if
(
gcMXBeanIntf
.
isInstance
(
m
))
{
result
.
add
(
gcMXBeanIntf
.
cast
(
m
));
...
...
@@ -330,7 +330,7 @@ enum PlatformComponent {
}
private
static
Set
<
String
>
keyProperties
(
String
...
keyNames
)
{
Set
<
String
>
set
=
new
HashSet
<
String
>();
Set
<
String
>
set
=
new
HashSet
<>();
set
.
add
(
"type"
);
for
(
String
s
:
keyNames
)
{
set
.
add
(
s
);
...
...
@@ -364,7 +364,7 @@ enum PlatformComponent {
List
<
T
>
getMXBeans
(
MBeanServerConnection
mbs
,
Class
<
T
>
mxbeanInterface
)
throws
java
.
io
.
IOException
{
List
<
T
>
result
=
new
ArrayList
<
T
>();
List
<
T
>
result
=
new
ArrayList
<>();
for
(
ObjectName
on
:
getObjectNames
(
mbs
))
{
result
.
add
(
ManagementFactory
.
newPlatformMXBeanProxy
(
mbs
,
...
...
src/share/classes/java/lang/reflect/Constructor.java
浏览文件 @
741c9607
...
...
@@ -144,7 +144,7 @@ public final
// which implicitly requires that new java.lang.reflect
// objects be fabricated for each reflective call on Class
// objects.)
Constructor
<
T
>
res
=
new
Constructor
<
T
>(
clazz
,
Constructor
<
T
>
res
=
new
Constructor
<>(
clazz
,
parameterTypes
,
exceptionTypes
,
modifiers
,
slot
,
signature
,
...
...
src/share/classes/java/lang/reflect/Proxy.java
浏览文件 @
741c9607
...
...
@@ -232,7 +232,7 @@ public class Proxy implements java.io.Serializable {
/** maps a class loader to the proxy class cache for that loader */
private
static
Map
<
ClassLoader
,
Map
<
List
<
String
>,
Object
>>
loaderToCache
=
new
WeakHashMap
<
ClassLoader
,
Map
<
List
<
String
>,
Object
>
>();
=
new
WeakHashMap
<>();
/** marks that a particular proxy class is currently being generated */
private
static
Object
pendingGenerationMarker
=
new
Object
();
...
...
@@ -356,7 +356,7 @@ public class Proxy implements java.io.Serializable {
String
[]
interfaceNames
=
new
String
[
interfaces
.
length
];
// for detecting duplicates
Set
<
Class
<?>>
interfaceSet
=
new
HashSet
<
Class
<?>
>();
Set
<
Class
<?>>
interfaceSet
=
new
HashSet
<>();
for
(
int
i
=
0
;
i
<
interfaces
.
length
;
i
++)
{
/*
...
...
@@ -413,7 +413,7 @@ public class Proxy implements java.io.Serializable {
synchronized
(
loaderToCache
)
{
cache
=
loaderToCache
.
get
(
loader
);
if
(
cache
==
null
)
{
cache
=
new
HashMap
<
List
<
String
>,
Object
>();
cache
=
new
HashMap
<>();
loaderToCache
.
put
(
loader
,
cache
);
}
/*
...
...
src/share/classes/java/lang/reflect/ReflectAccess.java
浏览文件 @
741c9607
...
...
@@ -84,7 +84,7 @@ class ReflectAccess implements sun.reflect.LangReflectAccess {
byte
[]
annotations
,
byte
[]
parameterAnnotations
)
{
return
new
Constructor
<
T
>(
declaringClass
,
return
new
Constructor
<>(
declaringClass
,
parameterTypes
,
checkedExceptions
,
modifiers
,
...
...
src/share/classes/java/sql/DriverManager.java
浏览文件 @
741c9607
...
...
@@ -364,7 +364,7 @@ public class DriverManager {
* @return the list of JDBC Drivers loaded by the caller's class loader
*/
public
static
java
.
util
.
Enumeration
<
Driver
>
getDrivers
()
{
java
.
util
.
Vector
<
Driver
>
result
=
new
java
.
util
.
Vector
<
Driver
>();
java
.
util
.
Vector
<
Driver
>
result
=
new
java
.
util
.
Vector
<>();
java
.
util
.
Vector
drivers
=
null
;
if
(!
initialized
)
{
...
...
src/share/classes/java/util/AbstractList.java
浏览文件 @
741c9607
...
...
@@ -482,8 +482,8 @@ public abstract class AbstractList<E> extends AbstractCollection<E> implements L
*/
public
List
<
E
>
subList
(
int
fromIndex
,
int
toIndex
)
{
return
(
this
instanceof
RandomAccess
?
new
RandomAccessSubList
<
E
>(
this
,
fromIndex
,
toIndex
)
:
new
SubList
<
E
>(
this
,
fromIndex
,
toIndex
));
new
RandomAccessSubList
<>(
this
,
fromIndex
,
toIndex
)
:
new
SubList
<>(
this
,
fromIndex
,
toIndex
));
}
// Comparison and hashing
...
...
@@ -747,7 +747,7 @@ class SubList<E> extends AbstractList<E> {
}
public
List
<
E
>
subList
(
int
fromIndex
,
int
toIndex
)
{
return
new
SubList
<
E
>(
this
,
fromIndex
,
toIndex
);
return
new
SubList
<>(
this
,
fromIndex
,
toIndex
);
}
private
void
rangeCheck
(
int
index
)
{
...
...
@@ -776,6 +776,6 @@ class RandomAccessSubList<E> extends SubList<E> implements RandomAccess {
}
public
List
<
E
>
subList
(
int
fromIndex
,
int
toIndex
)
{
return
new
RandomAccessSubList
<
E
>(
this
,
fromIndex
,
toIndex
);
return
new
RandomAccessSubList
<>(
this
,
fromIndex
,
toIndex
);
}
}
src/share/classes/java/util/Arrays.java
浏览文件 @
741c9607
...
...
@@ -2824,7 +2824,7 @@ public class Arrays {
* @return a list view of the specified array
*/
public
static
<
T
>
List
<
T
>
asList
(
T
...
a
)
{
return
new
ArrayList
<
T
>(
a
);
return
new
ArrayList
<>(
a
);
}
/**
...
...
src/share/classes/java/util/Collections.java
浏览文件 @
741c9607
此差异已折叠。
点击以展开。
src/share/classes/java/util/EnumMap.java
浏览文件 @
741c9607
...
...
@@ -499,7 +499,7 @@ public class EnumMap<K extends Enum<K>, V> extends AbstractMap<K, V>
int
j
=
0
;
for
(
int
i
=
0
;
i
<
vals
.
length
;
i
++)
if
(
vals
[
i
]
!=
null
)
a
[
j
++]
=
new
AbstractMap
.
SimpleEntry
<
K
,
V
>(
a
[
j
++]
=
new
AbstractMap
.
SimpleEntry
<>(
keyUniverse
[
i
],
unmaskNull
(
vals
[
i
]));
return
a
;
}
...
...
src/share/classes/java/util/EnumSet.java
浏览文件 @
741c9607
...
...
@@ -110,9 +110,9 @@ public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E>
throw
new
ClassCastException
(
elementType
+
" not an enum"
);
if
(
universe
.
length
<=
64
)
return
new
RegularEnumSet
<
E
>(
elementType
,
universe
);
return
new
RegularEnumSet
<>(
elementType
,
universe
);
else
return
new
JumboEnumSet
<
E
>(
elementType
,
universe
);
return
new
JumboEnumSet
<>(
elementType
,
universe
);
}
/**
...
...
@@ -430,7 +430,7 @@ public abstract class EnumSet<E extends Enum<E>> extends AbstractSet<E>
}
Object
writeReplace
()
{
return
new
SerializationProxy
<
E
>(
this
);
return
new
SerializationProxy
<>(
this
);
}
// readObject method for the serialization proxy pattern
...
...
src/share/classes/java/util/Formatter.java
浏览文件 @
741c9607
...
...
@@ -2490,7 +2490,7 @@ public final class Formatter implements Closeable, Flushable {
* Finds format specifiers in the format string.
*/
private
FormatString
[]
parse
(
String
s
)
{
ArrayList
<
FormatString
>
al
=
new
ArrayList
<
FormatString
>();
ArrayList
<
FormatString
>
al
=
new
ArrayList
<>();
Matcher
m
=
fsPattern
.
matcher
(
s
);
for
(
int
i
=
0
,
len
=
s
.
length
();
i
<
len
;
)
{
if
(
m
.
find
(
i
))
{
...
...
src/share/classes/java/util/HashMap.java
浏览文件 @
741c9607
...
...
@@ -763,7 +763,7 @@ public class HashMap<K,V>
*/
void
addEntry
(
int
hash
,
K
key
,
V
value
,
int
bucketIndex
)
{
Entry
<
K
,
V
>
e
=
table
[
bucketIndex
];
table
[
bucketIndex
]
=
new
Entry
<
K
,
V
>(
hash
,
key
,
value
,
e
);
table
[
bucketIndex
]
=
new
Entry
<>(
hash
,
key
,
value
,
e
);
if
(
size
++
>=
threshold
)
resize
(
2
*
table
.
length
);
}
...
...
@@ -778,7 +778,7 @@ public class HashMap<K,V>
*/
void
createEntry
(
int
hash
,
K
key
,
V
value
,
int
bucketIndex
)
{
Entry
<
K
,
V
>
e
=
table
[
bucketIndex
];
table
[
bucketIndex
]
=
new
Entry
<
K
,
V
>(
hash
,
key
,
value
,
e
);
table
[
bucketIndex
]
=
new
Entry
<>(
hash
,
key
,
value
,
e
);
size
++;
}
...
...
src/share/classes/java/util/HashSet.java
浏览文件 @
741c9607
...
...
@@ -100,7 +100,7 @@ public class HashSet<E>
* default initial capacity (16) and load factor (0.75).
*/
public
HashSet
()
{
map
=
new
HashMap
<
E
,
Object
>();
map
=
new
HashMap
<>();
}
/**
...
...
@@ -113,7 +113,7 @@ public class HashSet<E>
* @throws NullPointerException if the specified collection is null
*/
public
HashSet
(
Collection
<?
extends
E
>
c
)
{
map
=
new
HashMap
<
E
,
Object
>(
Math
.
max
((
int
)
(
c
.
size
()/.
75
f
)
+
1
,
16
));
map
=
new
HashMap
<>(
Math
.
max
((
int
)
(
c
.
size
()/.
75
f
)
+
1
,
16
));
addAll
(
c
);
}
...
...
@@ -127,7 +127,7 @@ public class HashSet<E>
* than zero, or if the load factor is nonpositive
*/
public
HashSet
(
int
initialCapacity
,
float
loadFactor
)
{
map
=
new
HashMap
<
E
,
Object
>(
initialCapacity
,
loadFactor
);
map
=
new
HashMap
<>(
initialCapacity
,
loadFactor
);
}
/**
...
...
@@ -139,7 +139,7 @@ public class HashSet<E>
* than zero
*/
public
HashSet
(
int
initialCapacity
)
{
map
=
new
HashMap
<
E
,
Object
>(
initialCapacity
);
map
=
new
HashMap
<>(
initialCapacity
);
}
/**
...
...
@@ -156,7 +156,7 @@ public class HashSet<E>
* than zero, or if the load factor is nonpositive
*/
HashSet
(
int
initialCapacity
,
float
loadFactor
,
boolean
dummy
)
{
map
=
new
LinkedHashMap
<
E
,
Object
>(
initialCapacity
,
loadFactor
);
map
=
new
LinkedHashMap
<>(
initialCapacity
,
loadFactor
);
}
/**
...
...
src/share/classes/java/util/Hashtable.java
浏览文件 @
741c9607
...
...
@@ -455,7 +455,7 @@ public class Hashtable<K,V>
// Creates the new entry.
Entry
<
K
,
V
>
e
=
tab
[
index
];
tab
[
index
]
=
new
Entry
<
K
,
V
>(
hash
,
key
,
value
,
e
);
tab
[
index
]
=
new
Entry
<>(
hash
,
key
,
value
,
e
);
count
++;
return
null
;
}
...
...
@@ -579,7 +579,7 @@ public class Hashtable<K,V>
if
(
count
==
0
)
{
return
Collections
.
emptyEnumeration
();
}
else
{
return
new
Enumerator
<
T
>(
type
,
false
);
return
new
Enumerator
<>(
type
,
false
);
}
}
...
...
@@ -587,7 +587,7 @@ public class Hashtable<K,V>
if
(
count
==
0
)
{
return
Collections
.
emptyIterator
();
}
else
{
return
new
Enumerator
<
T
>(
type
,
true
);
return
new
Enumerator
<>(
type
,
true
);
}
}
...
...
@@ -929,7 +929,7 @@ public class Hashtable<K,V>
}
// Creates the new entry.
Entry
<
K
,
V
>
e
=
tab
[
index
];
tab
[
index
]
=
new
Entry
<
K
,
V
>(
hash
,
key
,
value
,
e
);
tab
[
index
]
=
new
Entry
<>(
hash
,
key
,
value
,
e
);
count
++;
}
...
...
@@ -950,7 +950,7 @@ public class Hashtable<K,V>
}
protected
Object
clone
()
{
return
new
Entry
<
K
,
V
>(
hash
,
key
,
value
,
return
new
Entry
<>(
hash
,
key
,
value
,
(
next
==
null
?
null
:
(
Entry
<
K
,
V
>)
next
.
clone
()));
}
...
...
src/share/classes/java/util/IdentityHashMap.java
浏览文件 @
741c9607
...
...
@@ -1134,7 +1134,7 @@ public class IdentityHashMap<K,V>
Object
[]
result
=
new
Object
[
size
];
Iterator
<
Map
.
Entry
<
K
,
V
>>
it
=
iterator
();
for
(
int
i
=
0
;
i
<
size
;
i
++)
result
[
i
]
=
new
AbstractMap
.
SimpleEntry
<
K
,
V
>(
it
.
next
());
result
[
i
]
=
new
AbstractMap
.
SimpleEntry
<>(
it
.
next
());
return
result
;
}
...
...
@@ -1146,7 +1146,7 @@ public class IdentityHashMap<K,V>
.
newInstance
(
a
.
getClass
().
getComponentType
(),
size
);
Iterator
<
Map
.
Entry
<
K
,
V
>>
it
=
iterator
();
for
(
int
i
=
0
;
i
<
size
;
i
++)
a
[
i
]
=
(
T
)
new
AbstractMap
.
SimpleEntry
<
K
,
V
>(
it
.
next
());
a
[
i
]
=
(
T
)
new
AbstractMap
.
SimpleEntry
<>(
it
.
next
());
if
(
a
.
length
>
size
)
a
[
size
]
=
null
;
return
a
;
...
...
src/share/classes/java/util/JumboEnumSet.java
浏览文件 @
741c9607
...
...
@@ -89,7 +89,7 @@ class JumboEnumSet<E extends Enum<E>> extends EnumSet<E> {
* @return an iterator over the elements contained in this set
*/
public
Iterator
<
E
>
iterator
()
{
return
new
EnumSetIterator
<
E
>();
return
new
EnumSetIterator
<>();
}
private
class
EnumSetIterator
<
E
extends
Enum
<
E
>>
implements
Iterator
<
E
>
{
...
...
src/share/classes/java/util/LinkedHashMap.java
浏览文件 @
741c9607
...
...
@@ -237,7 +237,7 @@ public class LinkedHashMap<K,V>
* the chain.
*/
void
init
()
{
header
=
new
Entry
<
K
,
V
>(-
1
,
null
,
null
,
null
);
header
=
new
Entry
<>(-
1
,
null
,
null
,
null
);
header
.
before
=
header
.
after
=
header
;
}
...
...
@@ -438,7 +438,7 @@ public class LinkedHashMap<K,V>
*/
void
createEntry
(
int
hash
,
K
key
,
V
value
,
int
bucketIndex
)
{
HashMap
.
Entry
<
K
,
V
>
old
=
table
[
bucketIndex
];
Entry
<
K
,
V
>
e
=
new
Entry
<
K
,
V
>(
hash
,
key
,
value
,
old
);
Entry
<
K
,
V
>
e
=
new
Entry
<>(
hash
,
key
,
value
,
old
);
table
[
bucketIndex
]
=
e
;
e
.
addBefore
(
header
);
size
++;
...
...
src/share/classes/java/util/LinkedList.java
浏览文件 @
741c9607
...
...
@@ -122,7 +122,7 @@ public class LinkedList<E>
*/
private
void
linkFirst
(
E
e
)
{
final
Node
<
E
>
f
=
first
;
final
Node
<
E
>
newNode
=
new
Node
<
E
>(
null
,
e
,
f
);
final
Node
<
E
>
newNode
=
new
Node
<>(
null
,
e
,
f
);
first
=
newNode
;
if
(
f
==
null
)
last
=
newNode
;
...
...
@@ -137,7 +137,7 @@ public class LinkedList<E>
*/
void
linkLast
(
E
e
)
{
final
Node
<
E
>
l
=
last
;
final
Node
<
E
>
newNode
=
new
Node
<
E
>(
l
,
e
,
null
);
final
Node
<
E
>
newNode
=
new
Node
<>(
l
,
e
,
null
);
last
=
newNode
;
if
(
l
==
null
)
first
=
newNode
;
...
...
@@ -153,7 +153,7 @@ public class LinkedList<E>
void
linkBefore
(
E
e
,
Node
<
E
>
succ
)
{
// assert succ != null;
final
Node
<
E
>
pred
=
succ
.
prev
;
final
Node
<
E
>
newNode
=
new
Node
<
E
>(
pred
,
e
,
succ
);
final
Node
<
E
>
newNode
=
new
Node
<>(
pred
,
e
,
succ
);
succ
.
prev
=
newNode
;
if
(
pred
==
null
)
first
=
newNode
;
...
...
@@ -419,7 +419,7 @@ public class LinkedList<E>
for
(
Object
o
:
a
)
{
@SuppressWarnings
(
"unchecked"
)
E
e
=
(
E
)
o
;
Node
<
E
>
newNode
=
new
Node
<
E
>(
pred
,
e
,
null
);
Node
<
E
>
newNode
=
new
Node
<>(
pred
,
e
,
null
);
if
(
pred
==
null
)
first
=
newNode
;
else
...
...
src/share/classes/java/util/ListResourceBundle.java
浏览文件 @
741c9607
...
...
@@ -187,7 +187,7 @@ public abstract class ListResourceBundle extends ResourceBundle {
return
;
Object
[][]
contents
=
getContents
();
HashMap
<
String
,
Object
>
temp
=
new
HashMap
<
String
,
Object
>(
contents
.
length
);
HashMap
<
String
,
Object
>
temp
=
new
HashMap
<>(
contents
.
length
);
for
(
int
i
=
0
;
i
<
contents
.
length
;
++
i
)
{
// key must be non-null String, value must be non-null
String
key
=
(
String
)
contents
[
i
][
0
];
...
...
src/share/classes/java/util/PriorityQueue.java
浏览文件 @
741c9607
...
...
@@ -538,7 +538,7 @@ public class PriorityQueue<E> extends AbstractQueue<E>
cursor
--;
else
{
if
(
forgetMeNot
==
null
)
forgetMeNot
=
new
ArrayDeque
<
E
>();
forgetMeNot
=
new
ArrayDeque
<>();
forgetMeNot
.
add
(
moved
);
}
}
else
if
(
lastRetElt
!=
null
)
{
...
...
src/share/classes/java/util/Properties.java
浏览文件 @
741c9607
...
...
@@ -1011,7 +1011,7 @@ class Properties extends Hashtable<Object,Object> {
* @since 1.6
*/
public
Set
<
String
>
stringPropertyNames
()
{
Hashtable
<
String
,
String
>
h
=
new
Hashtable
<
String
,
String
>();
Hashtable
<
String
,
String
>
h
=
new
Hashtable
<>();
enumerateStringProperties
(
h
);
return
h
.
keySet
();
}
...
...
src/share/classes/java/util/RegularEnumSet.java
浏览文件 @
741c9607
...
...
@@ -71,7 +71,7 @@ class RegularEnumSet<E extends Enum<E>> extends EnumSet<E> {
* @return an iterator over the elements contained in this set
*/
public
Iterator
<
E
>
iterator
()
{
return
new
EnumSetIterator
<
E
>();
return
new
EnumSetIterator
<>();
}
private
class
EnumSetIterator
<
E
extends
Enum
<
E
>>
implements
Iterator
<
E
>
{
...
...
src/share/classes/java/util/ServiceLoader.java
浏览文件 @
741c9607
...
...
@@ -191,7 +191,7 @@ public final class ServiceLoader<S>
private
ClassLoader
loader
;
// Cached providers, in instantiation order
private
LinkedHashMap
<
String
,
S
>
providers
=
new
LinkedHashMap
<
String
,
S
>();
private
LinkedHashMap
<
String
,
S
>
providers
=
new
LinkedHashMap
<>();
// The current lazy-lookup iterator
private
LazyIterator
lookupIterator
;
...
...
@@ -291,7 +291,7 @@ public final class ServiceLoader<S>
{
InputStream
in
=
null
;
BufferedReader
r
=
null
;
ArrayList
<
String
>
names
=
new
ArrayList
<
String
>();
ArrayList
<
String
>
names
=
new
ArrayList
<>();
try
{
in
=
u
.
openStream
();
r
=
new
BufferedReader
(
new
InputStreamReader
(
in
,
"utf-8"
));
...
...
@@ -463,7 +463,7 @@ public final class ServiceLoader<S>
public
static
<
S
>
ServiceLoader
<
S
>
load
(
Class
<
S
>
service
,
ClassLoader
loader
)
{
return
new
ServiceLoader
<
S
>(
service
,
loader
);
return
new
ServiceLoader
<>(
service
,
loader
);
}
/**
...
...
src/share/classes/java/util/TimSort.java
浏览文件 @
741c9607
...
...
@@ -196,7 +196,7 @@ class TimSort<T> {
* extending short natural runs to minRun elements, and merging runs
* to maintain stack invariant.
*/
TimSort
<
T
>
ts
=
new
TimSort
<
T
>(
a
,
c
);
TimSort
<
T
>
ts
=
new
TimSort
<>(
a
,
c
);
int
minRun
=
minRunLength
(
nRemaining
);
do
{
// Identify next run
...
...
src/share/classes/java/util/TreeMap.java
浏览文件 @
741c9607
...
...
@@ -533,7 +533,7 @@ public class TreeMap<K,V>
// throw NullPointerException
//
// compare(key, key); // type check
root
=
new
Entry
<
K
,
V
>(
key
,
value
,
null
);
root
=
new
Entry
<>(
key
,
value
,
null
);
size
=
1
;
modCount
++;
return
null
;
...
...
@@ -569,7 +569,7 @@ public class TreeMap<K,V>
return
t
.
setValue
(
value
);
}
while
(
t
!=
null
);
}
Entry
<
K
,
V
>
e
=
new
Entry
<
K
,
V
>(
key
,
value
,
parent
);
Entry
<
K
,
V
>
e
=
new
Entry
<>(
key
,
value
,
parent
);
if
(
cmp
<
0
)
parent
.
left
=
e
;
else
...
...
@@ -1069,14 +1069,14 @@ public class TreeMap<K,V>
}
public
NavigableSet
<
E
>
subSet
(
E
fromElement
,
boolean
fromInclusive
,
E
toElement
,
boolean
toInclusive
)
{
return
new
KeySet
<
E
>(
m
.
subMap
(
fromElement
,
fromInclusive
,
return
new
KeySet
<>(
m
.
subMap
(
fromElement
,
fromInclusive
,
toElement
,
toInclusive
));
}
public
NavigableSet
<
E
>
headSet
(
E
toElement
,
boolean
inclusive
)
{
return
new
KeySet
<
E
>(
m
.
headMap
(
toElement
,
inclusive
));
return
new
KeySet
<>(
m
.
headMap
(
toElement
,
inclusive
));
}
public
NavigableSet
<
E
>
tailSet
(
E
fromElement
,
boolean
inclusive
)
{
return
new
KeySet
<
E
>(
m
.
tailMap
(
fromElement
,
inclusive
));
return
new
KeySet
<>(
m
.
tailMap
(
fromElement
,
inclusive
));
}
public
SortedSet
<
E
>
subSet
(
E
fromElement
,
E
toElement
)
{
return
subSet
(
fromElement
,
true
,
toElement
,
false
);
...
...
@@ -1205,7 +1205,7 @@ public class TreeMap<K,V>
*/
static
<
K
,
V
>
Map
.
Entry
<
K
,
V
>
exportEntry
(
TreeMap
.
Entry
<
K
,
V
>
e
)
{
return
(
e
==
null
)
?
null
:
new
AbstractMap
.
SimpleImmutableEntry
<
K
,
V
>(
e
);
new
AbstractMap
.
SimpleImmutableEntry
<>(
e
);
}
/**
...
...
@@ -2406,7 +2406,7 @@ public class TreeMap<K,V>
value
=
(
defaultVal
!=
null
?
defaultVal
:
(
V
)
str
.
readObject
());
}
Entry
<
K
,
V
>
middle
=
new
Entry
<
K
,
V
>(
key
,
value
,
null
);
Entry
<
K
,
V
>
middle
=
new
Entry
<>(
key
,
value
,
null
);
// color nodes in non-full bottommost level red
if
(
level
==
redLevel
)
...
...
src/share/classes/java/util/TreeSet.java
浏览文件 @
741c9607
...
...
@@ -138,7 +138,7 @@ public class TreeSet<E> extends AbstractSet<E>
* ordering} of the elements will be used.
*/
public
TreeSet
(
Comparator
<?
super
E
>
comparator
)
{
this
(
new
TreeMap
<
E
,
Object
>(
comparator
));
this
(
new
TreeMap
<>(
comparator
));
}
/**
...
...
@@ -195,7 +195,7 @@ public class TreeSet<E> extends AbstractSet<E>
* @since 1.6
*/
public
NavigableSet
<
E
>
descendingSet
()
{
return
new
TreeSet
<
E
>(
m
.
descendingMap
());
return
new
TreeSet
<>(
m
.
descendingMap
());
}
/**
...
...
@@ -322,7 +322,7 @@ public class TreeSet<E> extends AbstractSet<E>
*/
public
NavigableSet
<
E
>
subSet
(
E
fromElement
,
boolean
fromInclusive
,
E
toElement
,
boolean
toInclusive
)
{
return
new
TreeSet
<
E
>(
m
.
subMap
(
fromElement
,
fromInclusive
,
return
new
TreeSet
<>(
m
.
subMap
(
fromElement
,
fromInclusive
,
toElement
,
toInclusive
));
}
...
...
@@ -335,7 +335,7 @@ public class TreeSet<E> extends AbstractSet<E>
* @since 1.6
*/
public
NavigableSet
<
E
>
headSet
(
E
toElement
,
boolean
inclusive
)
{
return
new
TreeSet
<
E
>(
m
.
headMap
(
toElement
,
inclusive
));
return
new
TreeSet
<>(
m
.
headMap
(
toElement
,
inclusive
));
}
/**
...
...
@@ -347,7 +347,7 @@ public class TreeSet<E> extends AbstractSet<E>
* @since 1.6
*/
public
NavigableSet
<
E
>
tailSet
(
E
fromElement
,
boolean
inclusive
)
{
return
new
TreeSet
<
E
>(
m
.
tailMap
(
fromElement
,
inclusive
));
return
new
TreeSet
<>(
m
.
tailMap
(
fromElement
,
inclusive
));
}
/**
...
...
@@ -477,7 +477,7 @@ public class TreeSet<E> extends AbstractSet<E>
throw
new
InternalError
();
}
clone
.
m
=
new
TreeMap
<
E
,
Object
>(
m
);
clone
.
m
=
new
TreeMap
<>(
m
);
return
clone
;
}
...
...
@@ -524,9 +524,9 @@ public class TreeSet<E> extends AbstractSet<E>
// Create backing TreeMap
TreeMap
<
E
,
Object
>
tm
;
if
(
c
==
null
)
tm
=
new
TreeMap
<
E
,
Object
>();
tm
=
new
TreeMap
<>();
else
tm
=
new
TreeMap
<
E
,
Object
>(
c
);
tm
=
new
TreeMap
<>(
c
);
m
=
tm
;
// Read in size
...
...
src/share/classes/java/util/WeakHashMap.java
浏览文件 @
741c9607
...
...
@@ -171,7 +171,7 @@ public class WeakHashMap<K,V>
/**
* Reference queue for cleared WeakEntries
*/
private
final
ReferenceQueue
<
Object
>
queue
=
new
ReferenceQueue
<
Object
>();
private
final
ReferenceQueue
<
Object
>
queue
=
new
ReferenceQueue
<>();
/**
* The number of times this WeakHashMap has been structurally modified.
...
...
@@ -439,7 +439,7 @@ public class WeakHashMap<K,V>
modCount
++;
Entry
<
K
,
V
>
e
=
tab
[
i
];
tab
[
i
]
=
new
Entry
<
K
,
V
>(
k
,
value
,
queue
,
h
,
e
);
tab
[
i
]
=
new
Entry
<>(
k
,
value
,
queue
,
h
,
e
);
if
(++
size
>=
threshold
)
resize
(
tab
.
length
*
2
);
return
null
;
...
...
@@ -955,10 +955,9 @@ public class WeakHashMap<K,V>
}
private
List
<
Map
.
Entry
<
K
,
V
>>
deepCopy
()
{
List
<
Map
.
Entry
<
K
,
V
>>
list
=
new
ArrayList
<
Map
.
Entry
<
K
,
V
>>(
size
());
List
<
Map
.
Entry
<
K
,
V
>>
list
=
new
ArrayList
<>(
size
());
for
(
Map
.
Entry
<
K
,
V
>
e
:
this
)
list
.
add
(
new
AbstractMap
.
SimpleEntry
<
K
,
V
>(
e
));
list
.
add
(
new
AbstractMap
.
SimpleEntry
<>(
e
));
return
list
;
}
...
...
src/share/classes/java/util/logging/FileHandler.java
浏览文件 @
741c9607
...
...
@@ -127,7 +127,7 @@ public class FileHandler extends StreamHandler {
private
FileOutputStream
lockStream
;
private
File
files
[];
private
static
final
int
MAX_LOCKS
=
100
;
private
static
java
.
util
.
HashMap
<
String
,
String
>
locks
=
new
java
.
util
.
HashMap
<
String
,
String
>();
private
static
java
.
util
.
HashMap
<
String
,
String
>
locks
=
new
java
.
util
.
HashMap
<>();
// A metered stream is a subclass of OutputStream that
// (a) forwards all its output to a target stream
...
...
src/share/classes/java/util/logging/Level.java
浏览文件 @
741c9607
...
...
@@ -59,7 +59,7 @@ import java.util.ResourceBundle;
*/
public
class
Level
implements
java
.
io
.
Serializable
{
private
static
java
.
util
.
ArrayList
<
Level
>
known
=
new
java
.
util
.
ArrayList
<
Level
>();
private
static
java
.
util
.
ArrayList
<
Level
>
known
=
new
java
.
util
.
ArrayList
<>();
private
static
String
defaultBundle
=
"sun.util.logging.resources.logging"
;
/**
...
...
src/share/classes/java/util/logging/LogManager.java
浏览文件 @
741c9607
...
...
@@ -156,8 +156,7 @@ public class LogManager {
private
final
static
Level
defaultLevel
=
Level
.
INFO
;
// Table of named Loggers that maps names to Loggers.
private
Hashtable
<
String
,
LoggerWeakRef
>
namedLoggers
=
new
Hashtable
<
String
,
LoggerWeakRef
>();
private
Hashtable
<
String
,
LoggerWeakRef
>
namedLoggers
=
new
Hashtable
<>();
// Tree of named Loggers
private
LogNode
root
=
new
LogNode
(
null
);
private
Logger
rootLogger
;
...
...
@@ -422,7 +421,7 @@ public class LogManager {
// loggerRefQueue holds LoggerWeakRef objects for Logger objects
// that have been GC'ed.
private
final
ReferenceQueue
<
Logger
>
loggerRefQueue
=
new
ReferenceQueue
<
Logger
>();
=
new
ReferenceQueue
<>();
// Package-level inner class.
// Helper class for managing WeakReferences to Logger objects.
...
...
@@ -672,7 +671,7 @@ public class LogManager {
name
=
""
;
}
if
(
node
.
children
==
null
)
{
node
.
children
=
new
HashMap
<
String
,
LogNode
>();
node
.
children
=
new
HashMap
<>();
}
LogNode
child
=
node
.
children
.
get
(
head
);
if
(
child
==
null
)
{
...
...
@@ -856,7 +855,7 @@ public class LogManager {
}
hands
=
hands
.
trim
();
int
ix
=
0
;
Vector
<
String
>
result
=
new
Vector
<
String
>();
Vector
<
String
>
result
=
new
Vector
<>();
while
(
ix
<
hands
.
length
())
{
int
end
=
ix
;
while
(
end
<
hands
.
length
())
{
...
...
src/share/classes/java/util/logging/LogRecord.java
浏览文件 @
741c9607
...
...
@@ -85,8 +85,7 @@ public class LogRecord implements java.io.Serializable {
private
static
final
AtomicInteger
nextThreadId
=
new
AtomicInteger
(
MIN_SEQUENTIAL_THREAD_ID
);
private
static
final
ThreadLocal
<
Integer
>
threadIds
=
new
ThreadLocal
<
Integer
>();
private
static
final
ThreadLocal
<
Integer
>
threadIds
=
new
ThreadLocal
<>();
/**
* @serial Logging message level
...
...
src/share/classes/java/util/logging/Logger.java
浏览文件 @
741c9607
...
...
@@ -170,7 +170,7 @@ public class Logger {
private
LogManager
manager
;
private
String
name
;
private
final
CopyOnWriteArrayList
<
Handler
>
handlers
=
new
CopyOnWriteArrayList
<
Handler
>();
new
CopyOnWriteArrayList
<>();
private
String
resourceBundleName
;
private
volatile
boolean
useParentHandlers
=
true
;
private
volatile
Filter
filter
;
...
...
@@ -1420,13 +1420,13 @@ public class Logger {
// Set our new parent.
parent
=
newParent
;
if
(
parent
.
kids
==
null
)
{
parent
.
kids
=
new
ArrayList
<
LogManager
.
LoggerWeakRef
>(
2
);
parent
.
kids
=
new
ArrayList
<>(
2
);
}
if
(
ref
==
null
)
{
// we didn't have a previous parent
ref
=
manager
.
new
LoggerWeakRef
(
this
);
}
ref
.
setParentRef
(
new
WeakReference
<
Logger
>(
parent
));
ref
.
setParentRef
(
new
WeakReference
<>(
parent
));
parent
.
kids
.
add
(
ref
);
// As a result of the reparenting, the effective level
...
...
src/share/classes/java/util/logging/Logging.java
浏览文件 @
741c9607
...
...
@@ -56,7 +56,7 @@ class Logging implements LoggingMXBean {
public
List
<
String
>
getLoggerNames
()
{
Enumeration
loggers
=
logManager
.
getLoggerNames
();
ArrayList
<
String
>
array
=
new
ArrayList
<
String
>();
ArrayList
<
String
>
array
=
new
ArrayList
<>();
for
(;
loggers
.
hasMoreElements
();)
{
array
.
add
((
String
)
loggers
.
nextElement
());
...
...
src/share/classes/java/util/prefs/AbstractPreferences.java
浏览文件 @
741c9607
...
...
@@ -155,8 +155,7 @@ public abstract class AbstractPreferences extends Preferences {
* All known unremoved children of this node. (This "cache" is consulted
* prior to calling childSpi() or getChild().
*/
private
Map
<
String
,
AbstractPreferences
>
kidCache
=
new
HashMap
<
String
,
AbstractPreferences
>();
private
Map
<
String
,
AbstractPreferences
>
kidCache
=
new
HashMap
<>();
/**
* This field is used to keep track of whether or not this node has
...
...
@@ -713,7 +712,7 @@ public abstract class AbstractPreferences extends Preferences {
if
(
removed
)
throw
new
IllegalStateException
(
"Node has been removed."
);
Set
<
String
>
s
=
new
TreeSet
<
String
>(
kidCache
.
keySet
());
Set
<
String
>
s
=
new
TreeSet
<>(
kidCache
.
keySet
());
for
(
String
kid
:
childrenNamesSpi
())
s
.
add
(
kid
);
return
s
.
toArray
(
EMPTY_STRING_ARRAY
);
...
...
@@ -1442,8 +1441,7 @@ public abstract class AbstractPreferences extends Preferences {
* event delivery from preference activity, greatly simplifying
* locking and reducing opportunity for deadlock.
*/
private
static
final
List
<
EventObject
>
eventQueue
=
new
LinkedList
<
EventObject
>();
private
static
final
List
<
EventObject
>
eventQueue
=
new
LinkedList
<>();
/**
* These two classes are used to distinguish NodeChangeEvents on
...
...
src/share/classes/java/util/regex/Pattern.java
浏览文件 @
741c9607
...
...
@@ -1068,7 +1068,7 @@ public final class Pattern
public
String
[]
split
(
CharSequence
input
,
int
limit
)
{
int
index
=
0
;
boolean
matchLimited
=
limit
>
0
;
ArrayList
<
String
>
matchList
=
new
ArrayList
<
String
>();
ArrayList
<
String
>
matchList
=
new
ArrayList
<>();
Matcher
m
=
matcher
(
input
);
// Add segments before each match found
...
...
@@ -1566,7 +1566,7 @@ loop: for(int x=0, offset=0; x<nCodePoints; x++, offset+=len) {
Map
<
String
,
Integer
>
namedGroups
()
{
if
(
namedGroups
==
null
)
namedGroups
=
new
HashMap
<
String
,
Integer
>(
2
);
namedGroups
=
new
HashMap
<>(
2
);
return
namedGroups
;
}
...
...
@@ -5309,7 +5309,7 @@ NEXT: while (i <= last) {
}
private
static
final
HashMap
<
String
,
CharPropertyFactory
>
map
=
new
HashMap
<
String
,
CharPropertyFactory
>();
=
new
HashMap
<>();
static
{
// Unicode character property aliases, defined in
...
...
src/share/classes/java/util/zip/ZipFile.java
浏览文件 @
741c9607
...
...
@@ -543,7 +543,7 @@ class ZipFile implements ZipConstants, Closeable {
if
(
streams
.
size
()
!=
0
)
{
Set
<
InputStream
>
copy
=
streams
;
streams
=
new
HashSet
<
InputStream
>();
streams
=
new
HashSet
<>();
for
(
InputStream
is:
copy
)
is
.
close
();
}
...
...
src/share/classes/java/util/zip/ZipOutputStream.java
浏览文件 @
741c9607
...
...
@@ -52,8 +52,8 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
}
private
XEntry
current
;
private
Vector
<
XEntry
>
xentries
=
new
Vector
<
XEntry
>();
private
HashSet
<
String
>
names
=
new
HashSet
<
String
>();
private
Vector
<
XEntry
>
xentries
=
new
Vector
<>();
private
HashSet
<
String
>
names
=
new
HashSet
<>();
private
CRC32
crc
=
new
CRC32
();
private
long
written
=
0
;
private
long
locoff
=
0
;
...
...
src/share/classes/sun/io/Converters.java
浏览文件 @
741c9607
...
...
@@ -120,7 +120,7 @@ public class Converters {
private
static
Class
<?>
cache
(
int
type
,
Object
encoding
,
Class
<?>
c
)
{
SoftReference
<
Object
[]>[]
srs
=
classCache
[
type
];
srs
[
CACHE_SIZE
-
1
]
=
new
SoftReference
<
Object
[]
>(
new
Object
[]
{
c
,
encoding
});
srs
[
CACHE_SIZE
-
1
]
=
new
SoftReference
<>(
new
Object
[]
{
c
,
encoding
});
moveToFront
(
srs
,
CACHE_SIZE
-
1
);
return
c
;
}
...
...
src/share/classes/sun/util/logging/PlatformLogger.java
浏览文件 @
741c9607
...
...
@@ -113,7 +113,7 @@ public class PlatformLogger {
// Table of known loggers. Maps names to PlatformLoggers.
private
static
Map
<
String
,
WeakReference
<
PlatformLogger
>>
loggers
=
new
HashMap
<
String
,
WeakReference
<
PlatformLogger
>
>();
new
HashMap
<>();
/**
* Returns a PlatformLogger of a given name.
...
...
@@ -126,7 +126,7 @@ public class PlatformLogger {
}
if
(
log
==
null
)
{
log
=
new
PlatformLogger
(
name
);
loggers
.
put
(
name
,
new
WeakReference
<
PlatformLogger
>(
log
));
loggers
.
put
(
name
,
new
WeakReference
<>(
log
));
}
return
log
;
}
...
...
@@ -488,7 +488,7 @@ public class PlatformLogger {
*/
static
class
JavaLogger
extends
LoggerProxy
{
private
static
final
Map
<
Integer
,
Object
>
levelObjects
=
new
HashMap
<
Integer
,
Object
>();
new
HashMap
<>();
static
{
if
(
LoggingSupport
.
isAvailable
())
{
...
...
src/solaris/classes/java/lang/ProcessEnvironment.java
浏览文件 @
741c9607
...
...
@@ -68,7 +68,7 @@ final class ProcessEnvironment
// We cache the C environment. This means that subsequent calls
// to putenv/setenv from C will not be visible from Java code.
byte
[][]
environ
=
environ
();
theEnvironment
=
new
HashMap
<
Variable
,
Value
>(
environ
.
length
/
2
+
3
);
theEnvironment
=
new
HashMap
<>(
environ
.
length
/
2
+
3
);
// Read environment variables back to front,
// so that earlier variables override later ones.
for
(
int
i
=
environ
.
length
-
1
;
i
>
0
;
i
-=
2
)
...
...
src/solaris/classes/java/util/prefs/FileSystemPreferences.java
浏览文件 @
741c9607
...
...
@@ -354,7 +354,7 @@ class FileSystemPreferences extends AbstractPreferences {
* log against that map. The resulting map is then written back
* to the disk.
*/
final
List
<
Change
>
changeLog
=
new
ArrayList
<
Change
>();
final
List
<
Change
>
changeLog
=
new
ArrayList
<>();
/**
* Represents a change to a preference.
...
...
@@ -507,7 +507,7 @@ class FileSystemPreferences extends AbstractPreferences {
});
if
(
newNode
)
{
// These 2 things guarantee node will get wrtten at next flush/sync
prefsCache
=
new
TreeMap
<
String
,
String
>();
prefsCache
=
new
TreeMap
<>();
nodeCreate
=
new
NodeCreate
();
changeLog
.
add
(
nodeCreate
);
}
...
...
@@ -550,7 +550,7 @@ class FileSystemPreferences extends AbstractPreferences {
loadCache
();
}
catch
(
Exception
e
)
{
// assert lastSyncTime == 0;
prefsCache
=
new
TreeMap
<
String
,
String
>();
prefsCache
=
new
TreeMap
<>();
}
}
...
...
@@ -567,7 +567,7 @@ class FileSystemPreferences extends AbstractPreferences {
AccessController
.
doPrivileged
(
new
PrivilegedExceptionAction
<
Void
>()
{
public
Void
run
()
throws
BackingStoreException
{
Map
<
String
,
String
>
m
=
new
TreeMap
<
String
,
String
>();
Map
<
String
,
String
>
m
=
new
TreeMap
<>();
long
newLastSyncTime
=
0
;
try
{
newLastSyncTime
=
prefsFile
.
lastModified
();
...
...
@@ -581,7 +581,7 @@ class FileSystemPreferences extends AbstractPreferences {
prefsFile
.
renameTo
(
new
File
(
prefsFile
.
getParentFile
(),
"IncorrectFormatPrefs.xml"
));
m
=
new
TreeMap
<
String
,
String
>();
m
=
new
TreeMap
<>();
}
else
if
(
e
instanceof
FileNotFoundException
)
{
getLogger
().
warning
(
"Prefs file removed in background "
+
prefsFile
.
getPath
());
...
...
@@ -646,7 +646,7 @@ class FileSystemPreferences extends AbstractPreferences {
return
AccessController
.
doPrivileged
(
new
PrivilegedAction
<
String
[]>()
{
public
String
[]
run
()
{
List
<
String
>
result
=
new
ArrayList
<
String
>();
List
<
String
>
result
=
new
ArrayList
<>();
File
[]
dirContents
=
dir
.
listFiles
();
if
(
dirContents
!=
null
)
{
for
(
int
i
=
0
;
i
<
dirContents
.
length
;
i
++)
...
...
@@ -794,7 +794,7 @@ class FileSystemPreferences extends AbstractPreferences {
}
else
if
(
lastSyncTime
!=
0
&&
!
dir
.
exists
())
{
// This node was removed in the background. Playback any changes
// against a virgin (empty) Map.
prefsCache
=
new
TreeMap
<
String
,
String
>();
prefsCache
=
new
TreeMap
<>();
replayChanges
();
}
if
(!
changeLog
.
isEmpty
())
{
...
...
src/windows/classes/java/lang/ProcessEnvironment.java
浏览文件 @
741c9607
...
...
@@ -250,8 +250,7 @@ final class ProcessEnvironment extends HashMap<String,String>
envblock
.
substring
(
eql
+
1
,
end
));
}
theCaseInsensitiveEnvironment
=
new
TreeMap
<
String
,
String
>(
nameComparator
);
theCaseInsensitiveEnvironment
=
new
TreeMap
<>(
nameComparator
);
theCaseInsensitiveEnvironment
.
putAll
(
theEnvironment
);
}
...
...
@@ -296,8 +295,7 @@ final class ProcessEnvironment extends HashMap<String,String>
// Only for use by ProcessImpl.start()
String
toEnvironmentBlock
()
{
// Sort Unicode-case-insensitively by name
List
<
Map
.
Entry
<
String
,
String
>>
list
=
new
ArrayList
<
Map
.
Entry
<
String
,
String
>>(
entrySet
());
List
<
Map
.
Entry
<
String
,
String
>>
list
=
new
ArrayList
<>(
entrySet
());
Collections
.
sort
(
list
,
entryComparator
);
StringBuilder
sb
=
new
StringBuilder
(
size
()*
30
);
...
...
test/java/io/Serializable/NPEProvoker/NPEProvoker.java
浏览文件 @
741c9607
...
...
@@ -56,7 +56,7 @@ public class NPEProvoker implements java.io.Externalizable {
public
static
void
main
(
String
[]
args
)
{
System
.
err
.
println
(
"\n Regression test for bug 6541870\n"
);
try
{
ArrayList
<
NPEProvoker
>
list
=
new
ArrayList
<
NPEProvoker
>();
ArrayList
<
NPEProvoker
>
list
=
new
ArrayList
<>();
list
.
add
(
new
NPEProvoker
());
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
();
ObjectOutputStream
oos
=
new
ObjectOutputStream
(
baos
);
...
...
test/java/lang/instrument/ilib/Inject.java
浏览文件 @
741c9607
...
...
@@ -107,7 +107,7 @@ public class Inject implements RuntimeConstants {
class
IndexedInjector
implements
TrackerInjector
{
int
counter
=
0
;
int
tracker
;
List
<
Info
>
infoList
=
new
ArrayList
<
Info
>();
List
<
Info
>
infoList
=
new
ArrayList
<>();
public
int
stackSize
(
int
currentSize
)
{
return
currentSize
+
1
;
...
...
test/java/lang/instrument/ilib/InjectBytecodes.java
浏览文件 @
741c9607
...
...
@@ -50,7 +50,7 @@ class InjectBytecodes implements RuntimeConstants {
private
final
Injector
[]
after
=
new
Injector
[
256
];
private
final
String
className
;
private
final
String
methodName
;
private
final
Map
<
Integer
,
byte
[]>
snippets
=
new
HashMap
<
Integer
,
byte
[]
>();
private
final
Map
<
Integer
,
byte
[]>
snippets
=
new
HashMap
<>();
private
int
pos
;
private
int
newPos
;
...
...
test/java/lang/reflect/Generics/TestPlainArrayNotGeneric.java
浏览文件 @
741c9607
...
...
@@ -103,7 +103,7 @@ public class TestPlainArrayNotGeneric {
}
}
private
static
final
Set
<
Type
>
checking
=
new
HashSet
<
Type
>();
private
static
final
Set
<
Type
>
checking
=
new
HashSet
<>();
private
static
void
check
(
Type
t
,
String
what
)
{
if
(
t
==
null
||
!
checking
.
add
(
t
))
...
...
test/java/util/Random/DistinctSeeds.java
浏览文件 @
741c9607
...
...
@@ -59,7 +59,7 @@ public class DistinctSeeds {
}
}
final
int
threadCount
=
2
;
List
<
RandomCollector
>
collectors
=
new
ArrayList
<
RandomCollector
>();
List
<
RandomCollector
>
collectors
=
new
ArrayList
<>();
List
<
Thread
>
threads
=
new
ArrayList
<
Thread
>();
for
(
int
i
=
0
;
i
<
threadCount
;
i
++)
{
RandomCollector
r
=
new
RandomCollector
();
...
...
test/java/util/logging/ClassLoaderLeakTest.java
浏览文件 @
741c9607
...
...
@@ -89,7 +89,7 @@ public class ClassLoaderLeakTest {
MyClassLoader
appClassLoader
=
new
MyClassLoader
(
urls
,
"test0"
);
WeakReference
<
MyClassLoader
>
ref
=
new
WeakReference
<
MyClassLoader
>(
appClassLoader
);
new
WeakReference
<>(
appClassLoader
);
Thread
appThread
=
new
Thread
(
appsThreadGroup
,
launcher
,
"AppThread-0"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录