Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
a1205134
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a1205134
编写于
2月 07, 2014
作者:
A
asaha
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
6f119e23
f98b4d16
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
51 addition
and
5 deletion
+51
-5
.hgtags
.hgtags
+1
-0
src/macosx/classes/apple/laf/JRSUIUtils.java
src/macosx/classes/apple/laf/JRSUIUtils.java
+5
-2
src/share/classes/java/util/Comparator.java
src/share/classes/java/util/Comparator.java
+2
-2
test/java/util/Comparator/TypeTest.java
test/java/util/Comparator/TypeTest.java
+43
-1
未找到文件。
.hgtags
浏览文件 @
a1205134
...
...
@@ -250,6 +250,7 @@ ae303640bc1cca06f1c6ac887e6b523ceeb425a6 jdk8-b125
a9088d517f2fa9919886d3d95023c518b59172b8 jdk8-b126
fbf251b8ef8a4a2aa1fd58efc8d0d5c8e2fd582b jdk8-b127
f644211c59fd7c1d0c81239c55b31e1d377d7650 jdk8-b128
80568a19aab7300bc92baf2dc225be929f5b03ed jdk8-b129
fa2d5a06308f3f36fb09662fa58070a02352f023 jdk8u5-b01
343f4f8ba0982b3516e33c859b01634d919243c4 jdk8u5-b02
c35571198602a5856280d5c7c10bda4e7b769104 jdk8u5-b03
...
...
src/macosx/classes/apple/laf/JRSUIUtils.java
浏览文件 @
a1205134
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 201
4
, 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
...
...
@@ -28,6 +28,9 @@ package apple.laf;
import
com.apple.laf.AquaImageFactory.NineSliceMetrics
;
import
apple.laf.JRSUIConstants.*
;
import
sun.security.action.GetPropertyAction
;
import
java.security.AccessController
;
public
class
JRSUIUtils
{
static
boolean
isLeopard
=
isMacOSXLeopard
();
...
...
@@ -47,7 +50,7 @@ public class JRSUIUtils {
static
boolean
currentMacOSXVersionMatchesGivenVersionRange
(
final
int
version
,
final
boolean
inclusive
,
final
boolean
matchBelow
,
final
boolean
matchAbove
)
{
// split the "10.x.y" version number
String
osVersion
=
System
.
getProperty
(
"os.version"
);
String
osVersion
=
AccessController
.
doPrivileged
(
new
GetPropertyAction
(
"os.version"
)
);
String
[]
fragments
=
osVersion
.
split
(
"\\."
);
// sanity check the "10." part of the version
...
...
src/share/classes/java/util/Comparator.java
浏览文件 @
a1205134
/*
* Copyright (c) 1997, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
4
, 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
...
...
@@ -235,7 +235,7 @@ public interface Comparator<T> {
* @see #thenComparing(Comparator)
* @since 1.8
*/
default
<
U
extends
Comparable
<?
super
U
>
>
Comparator
<
T
>
thenComparing
(
default
<
U
>
Comparator
<
T
>
thenComparing
(
Function
<?
super
T
,
?
extends
U
>
keyExtractor
,
Comparator
<?
super
U
>
keyComparator
)
{
...
...
test/java/util/Comparator/TypeTest.java
浏览文件 @
a1205134
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013,
2014,
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
...
...
@@ -24,6 +24,7 @@
/**
* @test
* @summary Comparator API narrowing type test
* @bug 8033590
* @run testng TypeTest
*/
...
...
@@ -33,6 +34,8 @@ import java.util.TreeMap;
import
java.util.Comparator
;
import
org.testng.annotations.Test
;
import
static
org
.
testng
.
Assert
.
assertTrue
;
@Test
(
groups
=
"unit"
)
public
class
TypeTest
{
static
class
Person
{
...
...
@@ -66,6 +69,24 @@ public class TypeTest {
}
}
static
class
Department
{
Manager
mgr
;
String
hr_code
;
Department
(
Manager
mgr
,
String
hr
)
{
this
.
mgr
=
mgr
;
this
.
hr_code
=
hr
;
}
Manager
getManager
()
{
return
mgr
;
}
String
getHR
()
{
return
hr_code
;
}
}
static
<
T
>
void
assertOrder
(
T
o1
,
T
o2
,
Comparator
<?
super
T
>
cmp
)
{
if
(
cmp
.
compare
(
o1
,
o2
)
>
0
)
{
System
.
out
.
println
(
"Fail!!"
);
...
...
@@ -75,6 +96,8 @@ public class TypeTest {
}
}
// Type tests just to make sure the code can compile and build
// Not necessarily need a meaningful result
public
void
testOrder
()
{
Manager
m1
=
new
Manager
(
"Manager"
,
2
,
2000
);
Manager
m2
=
new
Manager
(
"Manager"
,
4
,
1300
);
...
...
@@ -93,4 +116,23 @@ public class TypeTest {
Map
<
String
,
Integer
>
map
=
new
TreeMap
<>();
map
.
entrySet
().
stream
().
sorted
(
Map
.
Entry
.
comparingByKey
(
String
.
CASE_INSENSITIVE_ORDER
));
}
public
void
testJDK8033590
()
{
Manager
a
=
new
Manager
(
"John Doe"
,
1234
,
16
);
Manager
b
=
new
Manager
(
"Jane Roe"
,
2468
,
16
);
Department
da
=
new
Department
(
a
,
"X"
);
Department
db
=
new
Department
(
b
,
"X"
);
Comparator
<
Department
>
cmp
=
Comparator
.
comparing
(
Department:
:
getHR
)
.
thenComparing
(
Department:
:
getManager
,
Employee
.
C
);
assertTrue
(
cmp
.
compare
(
da
,
db
)
<
0
);
cmp
=
Comparator
.
comparing
(
Department:
:
getHR
)
.
thenComparing
(
Department:
:
getManager
,
Manager
.
C
);
assertTrue
(
cmp
.
compare
(
da
,
db
)
==
0
);
cmp
=
Comparator
.
comparing
(
Department:
:
getHR
)
.
thenComparing
(
Department:
:
getManager
,
Person
.
C
);
assertTrue
(
cmp
.
compare
(
da
,
db
)
>
0
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录