Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
840d2f58
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看板
提交
840d2f58
编写于
3月 18, 2015
作者:
L
lana
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
a87a4e77
5b55914a
变更
28
隐藏空白更改
内联
并排
Showing
28 changed file
with
790 addition
and
98 deletion
+790
-98
src/aix/classes/sun/tools/attach/AixVirtualMachine.java
src/aix/classes/sun/tools/attach/AixVirtualMachine.java
+11
-5
src/aix/native/sun/tools/attach/AixVirtualMachine.c
src/aix/native/sun/tools/attach/AixVirtualMachine.c
+4
-4
src/macosx/classes/com/apple/laf/AquaMenuUI.java
src/macosx/classes/com/apple/laf/AquaMenuUI.java
+9
-5
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
+3
-0
src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java
src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java
+1
-1
src/macosx/native/sun/awt/AWTView.m
src/macosx/native/sun/awt/AWTView.m
+4
-1
src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m
src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m
+1
-5
src/share/classes/com/sun/jmx/remote/internal/ClientNotifForwarder.java
...ses/com/sun/jmx/remote/internal/ClientNotifForwarder.java
+9
-2
src/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java
src/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java
+8
-4
src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java
...classes/java/lang/invoke/InnerClassLambdaMetafactory.java
+2
-0
src/share/classes/java/util/zip/ZipEntry.java
src/share/classes/java/util/zip/ZipEntry.java
+42
-9
src/share/classes/java/util/zip/ZipFile.java
src/share/classes/java/util/zip/ZipFile.java
+2
-3
src/share/classes/java/util/zip/ZipInputStream.java
src/share/classes/java/util/zip/ZipInputStream.java
+2
-2
src/share/classes/java/util/zip/ZipOutputStream.java
src/share/classes/java/util/zip/ZipOutputStream.java
+5
-14
src/share/classes/java/util/zip/ZipUtils.java
src/share/classes/java/util/zip/ZipUtils.java
+33
-7
src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java
...lasses/javax/management/remote/rmi/RMIConnectionImpl.java
+5
-4
src/share/classes/sun/text/resources/fi/FormatData_fi.java
src/share/classes/sun/text/resources/fi/FormatData_fi.java
+3
-3
src/share/native/sun/tracing/dtrace/JVM.c
src/share/native/sun/tracing/dtrace/JVM.c
+27
-17
test/Makefile
test/Makefile
+2
-2
test/com/sun/jdi/InterfaceMethodsTest.java
test/com/sun/jdi/InterfaceMethodsTest.java
+29
-5
test/java/awt/Frame/MaximizedNormalBoundsUndecoratedTest/MaximizedNormalBoundsUndecoratedTest.java
...UndecoratedTest/MaximizedNormalBoundsUndecoratedTest.java
+76
-0
test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java
...reen/MultiResolutionSplash/MultiResolutionSplashTest.java
+1
-1
test/java/lang/invoke/lambda/LambdaStackTrace.java
test/java/lang/invoke/lambda/LambdaStackTrace.java
+204
-0
test/java/util/zip/TestExtraTime.java
test/java/util/zip/TestExtraTime.java
+32
-2
test/javax/swing/JMenu/8072900/WrongSelectionOnMouseOver.java
.../javax/swing/JMenu/8072900/WrongSelectionOnMouseOver.java
+198
-0
test/sun/text/resources/Format/Bug8074791.java
test/sun/text/resources/Format/Bug8074791.java
+69
-0
test/sun/text/resources/LocaleData
test/sun/text/resources/LocaleData
+6
-0
test/sun/text/resources/LocaleDataTest.java
test/sun/text/resources/LocaleDataTest.java
+2
-2
未找到文件。
src/aix/classes/sun/tools/attach/AixVirtualMachine.java
浏览文件 @
840d2f58
/*
* Copyright (c) 2008, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright 201
3
SAP AG. All rights reserved.
* Copyright (c) 2008, 201
5
, Oracle and/or its affiliates. All rights reserved.
* Copyright 201
5
SAP AG. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -25,14 +25,14 @@
*/
package
sun.tools.attach
;
import
com.sun.tools.attach.
VirtualMachine
;
import
com.sun.tools.attach.
AttachOperationFailedException
;
import
com.sun.tools.attach.AgentLoadException
;
import
com.sun.tools.attach.AttachNotSupportedException
;
import
com.sun.tools.attach.spi.AttachProvider
;
import
java.io.InputStream
;
import
java.io.IOException
;
import
java.io.File
;
import
java.util.Properties
;
// Based on 'LinuxVirtualMachine.java'. All occurrences of the string
// "Linux" have been textually replaced by "Aix" to avoid confusion.
...
...
@@ -192,6 +192,8 @@ public class AixVirtualMachine extends HotSpotVirtualMachine {
}
if
(
completionStatus
!=
0
)
{
// read from the stream and use that as the error message
String
message
=
readErrorMessage
(
sis
);
sis
.
close
();
// In the event of a protocol mismatch then the target VM
...
...
@@ -206,7 +208,11 @@ public class AixVirtualMachine extends HotSpotVirtualMachine {
if
(
cmd
.
equals
(
"load"
))
{
throw
new
AgentLoadException
(
"Failed to load agent library"
);
}
else
{
throw
new
IOException
(
"Command failed in target VM"
);
if
(
message
==
null
)
{
throw
new
AttachOperationFailedException
(
"Command failed in target VM"
);
}
else
{
throw
new
AttachOperationFailedException
(
message
);
}
}
}
...
...
src/aix/native/sun/tools/attach/AixVirtualMachine.c
浏览文件 @
840d2f58
/*
* Copyright (c) 2008, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright 201
3
SAP AG. All rights reserved.
* Copyright (c) 2008, 201
5
, Oracle and/or its affiliates. All rights reserved.
* Copyright 201
5
SAP AG. 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
...
...
@@ -238,14 +238,14 @@ JNIEXPORT jint JNICALL Java_sun_tools_attach_AixVirtualMachine_read
len
=
remaining
;
}
RESTARTABLE
(
read
(
fd
,
buf
+
off
,
len
),
n
);
RESTARTABLE
(
read
(
fd
,
buf
,
len
),
n
);
if
(
n
==
-
1
)
{
JNU_ThrowIOExceptionWithLastError
(
env
,
"read"
);
}
else
{
if
(
n
==
0
)
{
n
=
-
1
;
// EOF
}
else
{
(
*
env
)
->
SetByteArrayRegion
(
env
,
ba
,
off
,
(
jint
)
n
,
(
jbyte
*
)(
buf
+
off
));
(
*
env
)
->
SetByteArrayRegion
(
env
,
ba
,
off
,
(
jint
)
n
,
(
jbyte
*
)(
buf
));
}
}
return
n
;
...
...
src/macosx/classes/com/apple/laf/AquaMenuUI.java
浏览文件 @
840d2f58
...
...
@@ -148,11 +148,15 @@ public class AquaMenuUI extends BasicMenuUI implements AquaMenuPainter.Client {
// In Aqua, we always have a menu delay, regardless of where the menu is.
if
(!(
selectedPath
.
length
>
0
&&
selectedPath
[
selectedPath
.
length
-
1
]
==
menu
.
getPopupMenu
()))
{
if
(
menu
.
getDelay
()
==
0
)
{
appendPath
(
getPath
(),
menu
.
getPopupMenu
());
}
else
{
manager
.
setSelectedPath
(
getPath
());
setupPostTimer
(
menu
);
// the condition below prevents from activating menu in other frame
if
(!
menu
.
isTopLevelMenu
()
||
(
selectedPath
.
length
>
0
&&
selectedPath
[
0
]
==
menu
.
getParent
()))
{
if
(
menu
.
getDelay
()
==
0
)
{
appendPath
(
getPath
(),
menu
.
getPopupMenu
());
}
else
{
manager
.
setSelectedPath
(
getPath
());
setupPostTimer
(
menu
);
}
}
}
}
...
...
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
浏览文件 @
840d2f58
...
...
@@ -488,6 +488,9 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
}
else
{
deliverZoom
(
true
);
// We need an up to date size of the peer, so we flush the native events
// to be sure that there are no setBounds requests in the queue.
LWCToolkit
.
flushNativeSelectors
();
this
.
normalBounds
=
peer
.
getBounds
();
GraphicsConfiguration
config
=
getPeer
().
getGraphicsConfiguration
();
...
...
src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java
浏览文件 @
840d2f58
...
...
@@ -833,7 +833,7 @@ public final class LWCToolkit extends LWToolkit {
/**
* Just spin a single empty block synchronously.
*/
private
static
native
void
flushNativeSelectors
();
static
native
void
flushNativeSelectors
();
@Override
public
Clipboard
createPlatformClipboard
()
{
...
...
src/macosx/native/sun/awt/AWTView.m
浏览文件 @
840d2f58
...
...
@@ -310,7 +310,10 @@ AWT_ASSERT_APPKIT_THREAD;
}
-
(
BOOL
)
performKeyEquivalent
:
(
NSEvent
*
)
event
{
[
self
deliverJavaKeyEventHelper
:
event
];
// if IM is active key events should be ignored
if
(
!
[
self
hasMarkedText
]
&&
!
fInPressAndHold
)
{
[
self
deliverJavaKeyEventHelper
:
event
];
}
// Workaround for 8020209: special case for "Cmd =" and "Cmd ."
// because Cocoa calls performKeyEquivalent twice for these keystrokes
...
...
src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m
浏览文件 @
840d2f58
...
...
@@ -131,11 +131,7 @@ char* SplashGetScaledImageName(const char* jar, const char* file,
NSAutoreleasePool
*
pool
=
[
NSAutoreleasePool
new
];
*
scaleFactor
=
1
;
char
*
scaledFile
=
nil
;
__block
float
screenScaleFactor
=
1
;
[
ThreadUtilities
performOnMainThreadWaiting
:
YES
block
:
^
(){
screenScaleFactor
=
[
SplashNSScreen
()
backingScaleFactor
];
}];
float
screenScaleFactor
=
1
;
if
(
screenScaleFactor
>
1
)
{
NSString
*
fileName
=
[
NSString
stringWithUTF8String
:
file
];
...
...
src/share/classes/com/sun/jmx/remote/internal/ClientNotifForwarder.java
浏览文件 @
840d2f58
/*
* Copyright (c) 2002, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 201
5
, 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
...
...
@@ -538,6 +538,13 @@ public abstract class ClientNotifForwarder {
currentFetchThread
=
null
;
}
if
(
nr
==
null
)
{
if
(
logger
.
traceOn
())
{
logger
.
trace
(
"NotifFetcher-run"
,
"Recieved null object as notifs, stops fetching because the "
+
"notification server is terminated."
);
}
}
if
(
nr
==
null
||
shouldStop
())
{
// tell that the thread is REALLY stopped
setState
(
STOPPED
);
...
...
@@ -657,7 +664,7 @@ public abstract class ClientNotifForwarder {
return
null
;
}
if
(
shouldStop
())
if
(
shouldStop
()
||
nr
==
null
)
return
null
;
startSequenceNumber
=
nr
.
getNextSequenceNumber
();
...
...
src/share/classes/com/sun/tools/jdi/ObjectReferenceImpl.java
浏览文件 @
840d2f58
/*
* Copyright (c) 1998, 201
1
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 201
5
, 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
...
...
@@ -311,7 +311,7 @@ public class ObjectReferenceImpl extends ValueImpl
/*
* For nonvirtual invokes, method must have a body
*/
if
(
(
options
&
INVOKE_NONVIRTUAL
)
!=
0
)
{
if
(
isNonVirtual
(
options
)
)
{
if
(
method
.
isAbstract
())
{
throw
new
IllegalArgumentException
(
"Abstract method"
);
}
...
...
@@ -323,7 +323,7 @@ public class ObjectReferenceImpl extends ValueImpl
* method argument types.
*/
ClassTypeImpl
invokedClass
;
if
(
(
options
&
INVOKE_NONVIRTUAL
)
!=
0
)
{
if
(
isNonVirtual
(
options
)
)
{
// No overrides in non-virtual invokes
invokedClass
=
clazz
;
}
else
{
...
...
@@ -348,7 +348,7 @@ public class ObjectReferenceImpl extends ValueImpl
/*
* Only default methods allowed for nonvirtual invokes
*/
if
(!
method
.
isDefault
())
{
if
(
isNonVirtual
(
options
)
&&
!
method
.
isDefault
())
{
throw
new
IllegalArgumentException
(
"Not a default method"
);
}
}
...
...
@@ -624,4 +624,8 @@ public class ObjectReferenceImpl extends ValueImpl
byte
typeValueKey
()
{
return
JDWP
.
Tag
.
OBJECT
;
}
private
static
boolean
isNonVirtual
(
int
options
)
{
return
(
options
&
INVOKE_NONVIRTUAL
)
!=
0
;
}
}
src/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java
浏览文件 @
840d2f58
...
...
@@ -285,6 +285,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
// Forward the SAM method
MethodVisitor
mv
=
cw
.
visitMethod
(
ACC_PUBLIC
,
samMethodName
,
samMethodType
.
toMethodDescriptorString
(),
null
,
null
);
mv
.
visitAnnotation
(
"Ljava/lang/invoke/LambdaForm$Hidden;"
,
true
);
new
ForwardingMethodGenerator
(
mv
).
generate
(
samMethodType
);
// Forward the bridges
...
...
@@ -292,6 +293,7 @@ import static jdk.internal.org.objectweb.asm.Opcodes.*;
for
(
MethodType
mt
:
additionalBridges
)
{
mv
=
cw
.
visitMethod
(
ACC_PUBLIC
|
ACC_BRIDGE
,
samMethodName
,
mt
.
toMethodDescriptorString
(),
null
,
null
);
mv
.
visitAnnotation
(
"Ljava/lang/invoke/LambdaForm$Hidden;"
,
true
);
new
ForwardingMethodGenerator
(
mv
).
generate
(
mt
);
}
}
...
...
src/share/classes/java/util/zip/ZipEntry.java
浏览文件 @
840d2f58
/*
* Copyright (c) 1995, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 201
5
, 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
...
...
@@ -41,7 +41,9 @@ public
class
ZipEntry
implements
ZipConstants
,
Cloneable
{
String
name
;
// entry name
long
time
=
-
1
;
// last modification time
long
xdostime
=
-
1
;
// last modification time (in extended DOS time,
// where milliseconds lost in conversion might
// be encoded into the upper half)
FileTime
mtime
;
// last modification time, from extra field data
FileTime
atime
;
// last access time, from extra field data
FileTime
ctime
;
// creation time, from extra field data
...
...
@@ -63,6 +65,28 @@ class ZipEntry implements ZipConstants, Cloneable {
*/
public
static
final
int
DEFLATED
=
8
;
/**
* DOS time constant for representing timestamps before 1980.
*/
static
final
long
DOSTIME_BEFORE_1980
=
(
1
<<
21
)
|
(
1
<<
16
);
/**
* Approximately 128 years, in milliseconds (ignoring leap years etc).
*
* This establish an approximate high-bound value for DOS times in
* milliseconds since epoch, used to enable an efficient but
* sufficient bounds check to avoid generating extended last modified
* time entries.
*
* Calculating the exact number is locale dependent, would require loading
* TimeZone data eagerly, and would make little practical sense. Since DOS
* times theoretically go to 2107 - with compatibility not guaranteed
* after 2099 - setting this to a time that is before but near 2099
* should be sufficient.
*/
private
static
final
long
UPPER_DOSTIME_BOUND
=
128L
*
365
*
24
*
60
*
60
*
1000
;
/**
* Creates a new zip entry with the specified name.
*
...
...
@@ -93,7 +117,7 @@ class ZipEntry implements ZipConstants, Cloneable {
public
ZipEntry
(
ZipEntry
e
)
{
Objects
.
requireNonNull
(
e
,
"entry"
);
name
=
e
.
name
;
time
=
e
.
time
;
xdostime
=
e
.
xdos
time
;
mtime
=
e
.
mtime
;
atime
=
e
.
atime
;
ctime
=
e
.
ctime
;
...
...
@@ -137,8 +161,14 @@ class ZipEntry implements ZipConstants, Cloneable {
* @see #getLastModifiedTime()
*/
public
void
setTime
(
long
time
)
{
this
.
time
=
time
;
this
.
mtime
=
null
;
this
.
xdostime
=
javaToExtendedDosTime
(
time
);
// Avoid setting the mtime field if time is in the valid
// range for a DOS time
if
(
xdostime
!=
DOSTIME_BEFORE_1980
&&
time
<=
UPPER_DOSTIME_BOUND
)
{
this
.
mtime
=
null
;
}
else
{
this
.
mtime
=
FileTime
.
from
(
time
,
TimeUnit
.
MILLISECONDS
);
}
}
/**
...
...
@@ -158,7 +188,10 @@ class ZipEntry implements ZipConstants, Cloneable {
* @see #setLastModifiedTime(FileTime)
*/
public
long
getTime
()
{
return
time
;
if
(
mtime
!=
null
)
{
return
mtime
.
toMillis
();
}
return
(
xdostime
!=
-
1
)
?
extendedDosToJavaTime
(
xdostime
)
:
-
1
;
}
/**
...
...
@@ -181,7 +214,7 @@ class ZipEntry implements ZipConstants, Cloneable {
*/
public
ZipEntry
setLastModifiedTime
(
FileTime
time
)
{
this
.
mtime
=
Objects
.
requireNonNull
(
time
,
"lastModifiedTime"
);
this
.
time
=
time
.
to
(
TimeUnit
.
MILLISECONDS
);
this
.
xdostime
=
javaToExtendedDosTime
(
time
.
to
(
TimeUnit
.
MILLISECONDS
)
);
return
this
;
}
...
...
@@ -204,9 +237,9 @@ class ZipEntry implements ZipConstants, Cloneable {
public
FileTime
getLastModifiedTime
()
{
if
(
mtime
!=
null
)
return
mtime
;
if
(
time
==
-
1
)
if
(
xdos
time
==
-
1
)
return
null
;
return
FileTime
.
from
(
time
,
TimeUnit
.
MILLISECONDS
);
return
FileTime
.
from
(
getTime
()
,
TimeUnit
.
MILLISECONDS
);
}
/**
...
...
src/share/classes/java/util/zip/ZipFile.java
浏览文件 @
840d2f58
/*
* Copyright (c) 1995, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 201
5
, 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
...
...
@@ -46,7 +46,6 @@ import java.util.stream.Stream;
import
java.util.stream.StreamSupport
;
import
static
java
.
util
.
zip
.
ZipConstants64
.*;
import
static
java
.
util
.
zip
.
ZipUtils
.*;
/**
* This class is used to read entries from a zip file.
...
...
@@ -567,7 +566,7 @@ class ZipFile implements ZipConstants, Closeable {
e
.
name
=
zc
.
toString
(
bname
,
bname
.
length
);
}
}
e
.
time
=
dosToJavaTime
(
getEntryTime
(
jzentry
)
);
e
.
xdostime
=
getEntryTime
(
jzentry
);
e
.
crc
=
getEntryCrc
(
jzentry
);
e
.
size
=
getEntrySize
(
jzentry
);
e
.
csize
=
getEntryCSize
(
jzentry
);
...
...
src/share/classes/java/util/zip/ZipInputStream.java
浏览文件 @
840d2f58
/*
* Copyright (c) 1996, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
5
, 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
...
...
@@ -303,7 +303,7 @@ class ZipInputStream extends InflaterInputStream implements ZipConstants {
throw
new
ZipException
(
"encrypted ZIP entry not supported"
);
}
e
.
method
=
get16
(
tmpbuf
,
LOCHOW
);
e
.
time
=
dosToJavaTime
(
get32
(
tmpbuf
,
LOCTIM
)
);
e
.
xdostime
=
get32
(
tmpbuf
,
LOCTIM
);
if
((
flag
&
8
)
==
8
)
{
/* "Data Descriptor" present */
if
(
e
.
method
!=
DEFLATED
)
{
...
...
src/share/classes/java/util/zip/ZipOutputStream.java
浏览文件 @
840d2f58
/*
* Copyright (c) 1996, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
5
, 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
...
...
@@ -61,7 +61,6 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
private
static
class
XEntry
{
final
ZipEntry
entry
;
final
long
offset
;
long
dostime
;
// last modification time in msdos format
public
XEntry
(
ZipEntry
entry
,
long
offset
)
{
this
.
entry
=
entry
;
this
.
offset
=
offset
;
...
...
@@ -192,7 +191,7 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
if
(
current
!=
null
)
{
closeEntry
();
// close previous entry
}
if
(
e
.
time
==
-
1
)
{
if
(
e
.
xdos
time
==
-
1
)
{
// by default, do NOT use extended timestamps in extra
// data, for now.
e
.
setTime
(
System
.
currentTimeMillis
());
...
...
@@ -389,18 +388,12 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
boolean
hasZip64
=
false
;
int
elen
=
getExtraLen
(
e
.
extra
);
// keep a copy of dostime for writeCEN(), otherwise the tz
// sensitive local time entries in loc and cen might be
// different if the default tz get changed during writeLOC()
// and writeCEN()
xentry
.
dostime
=
javaToDosTime
(
e
.
time
);
writeInt
(
LOCSIG
);
// LOC header signature
if
((
flag
&
8
)
==
8
)
{
writeShort
(
version
(
e
));
// version needed to extract
writeShort
(
flag
);
// general purpose bit flag
writeShort
(
e
.
method
);
// compression method
writeInt
(
xentry
.
dostime
);
// last modification time
writeInt
(
e
.
xdostime
);
// last modification time
// store size, uncompressed size, and crc-32 in data descriptor
// immediately following compressed entry data
writeInt
(
0
);
...
...
@@ -415,7 +408,7 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
}
writeShort
(
flag
);
// general purpose bit flag
writeShort
(
e
.
method
);
// compression method
writeInt
(
xentry
.
dostime
);
// last modification time
writeInt
(
e
.
xdostime
);
// last modification time
writeInt
(
e
.
crc
);
// crc-32
if
(
hasZip64
)
{
writeInt
(
ZIP64_MAGICVAL
);
...
...
@@ -522,9 +515,7 @@ class ZipOutputStream extends DeflaterOutputStream implements ZipConstants {
}
writeShort
(
flag
);
// general purpose bit flag
writeShort
(
e
.
method
);
// compression method
// use the copy in xentry, which has been converted
// from e.time in writeLOC()
writeInt
(
xentry
.
dostime
);
// last modification time
writeInt
(
e
.
xdostime
);
// last modification time
writeInt
(
e
.
crc
);
// crc-32
writeInt
(
csize
);
// compressed size
writeInt
(
size
);
// uncompressed size
...
...
src/share/classes/java/util/zip/ZipUtils.java
浏览文件 @
840d2f58
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013,
2015,
Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -29,9 +29,6 @@ import java.nio.file.attribute.FileTime;
import
java.util.Date
;
import
java.util.concurrent.TimeUnit
;
import
static
java
.
util
.
zip
.
ZipConstants
.*;
import
static
java
.
util
.
zip
.
ZipConstants64
.*;
class
ZipUtils
{
// used to adjust values between Windows and java epoch
...
...
@@ -69,7 +66,7 @@ class ZipUtils {
/**
* Converts DOS time to Java time (number of milliseconds since epoch).
*/
p
ublic
static
long
dosToJavaTime
(
long
dtime
)
{
p
rivate
static
long
dosToJavaTime
(
long
dtime
)
{
@SuppressWarnings
(
"deprecation"
)
// Use of date constructor.
Date
d
=
new
Date
((
int
)(((
dtime
>>
25
)
&
0x7f
)
+
80
),
(
int
)(((
dtime
>>
21
)
&
0x0f
)
-
1
),
...
...
@@ -80,21 +77,50 @@ class ZipUtils {
return
d
.
getTime
();
}
/**
* Converts extended DOS time to Java time, where up to 1999 milliseconds
* might be encoded into the upper half of the returned long.
*
* @param xdostime the extended DOS time value
* @return milliseconds since epoch
*/
public
static
long
extendedDosToJavaTime
(
long
xdostime
)
{
long
time
=
dosToJavaTime
(
xdostime
);
return
time
+
(
xdostime
>>
32
);
}
/**
* Converts Java time to DOS time.
*/
@SuppressWarnings
(
"deprecation"
)
// Use of date methods
p
ublic
static
long
javaToDosTime
(
long
time
)
{
p
rivate
static
long
javaToDosTime
(
long
time
)
{
Date
d
=
new
Date
(
time
);
int
year
=
d
.
getYear
()
+
1900
;
if
(
year
<
1980
)
{
return
(
1
<<
21
)
|
(
1
<<
16
)
;
return
ZipEntry
.
DOSTIME_BEFORE_1980
;
}
return
(
year
-
1980
)
<<
25
|
(
d
.
getMonth
()
+
1
)
<<
21
|
d
.
getDate
()
<<
16
|
d
.
getHours
()
<<
11
|
d
.
getMinutes
()
<<
5
|
d
.
getSeconds
()
>>
1
;
}
/**
* Converts Java time to DOS time, encoding any milliseconds lost
* in the conversion into the upper half of the returned long.
*
* @param time milliseconds since epoch
* @return DOS time with 2s remainder encoded into upper half
*/
public
static
long
javaToExtendedDosTime
(
long
time
)
{
if
(
time
<
0
)
{
return
ZipEntry
.
DOSTIME_BEFORE_1980
;
}
long
dostime
=
javaToDosTime
(
time
);
return
(
dostime
!=
ZipEntry
.
DOSTIME_BEFORE_1980
)
?
dostime
+
((
time
%
2000
)
<<
32
)
:
ZipEntry
.
DOSTIME_BEFORE_1980
;
}
/**
* Fetches unsigned 16-bit value from byte array at specified offset.
* The bytes are assumed to be in Intel (little-endian) byte order.
...
...
src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java
浏览文件 @
840d2f58
...
...
@@ -1254,10 +1254,11 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
if
(
serverTerminated
)
{
// we must not call fetchNotifs() if the server is
// terminated (timeout elapsed).
//
return
new
NotificationResult
(
0L
,
0L
,
new
TargetedNotification
[
0
]);
// returns null to force the client to stop fetching
if
(
logger
.
debugOn
())
logger
.
debug
(
"fetchNotifications"
,
"The notification server has been closed, "
+
"returns null to force the client to stop fetching"
);
return
null
;
}
final
long
csn
=
clientSequenceNumber
;
final
int
mn
=
maxNotifications
;
...
...
src/share/classes/sun/text/resources/fi/FormatData_fi.java
浏览文件 @
840d2f58
/*
* Copyright (c) 1996, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 201
5
, 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
...
...
@@ -295,8 +295,8 @@ public class FormatData_fi extends ParallelListResourceBundle {
},
{
"DatePatterns"
,
new
String
[]
{
"d. MMMM
'ta '
yyyy"
,
// full date pattern
"d. MMMM
'ta '
yyyy"
,
// long date pattern
"d. MMMM
yyyy"
,
// full date pattern
"d. MMMM
yyyy"
,
// long date pattern
"d.M.yyyy"
,
// medium date pattern
"d.M.yyyy"
,
// short date pattern
}
...
...
src/share/native/sun/tracing/dtrace/JVM.c
浏览文件 @
840d2f58
...
...
@@ -144,32 +144,34 @@ static void readInterfaceAttributes(
env
,
provider
,
&
(
jvm_provider
->
argsAttributes
));
}
static
void
readProviderData
(
static
int
readProviderData
(
JNIEnv
*
env
,
jobject
provider
,
JVM_DTraceProvider
*
jvm_provider
)
{
jmethodID
mid
;
jobjectArray
probes
;
jsize
i
;
jclass
clazz
=
(
*
env
)
->
GetObjectClass
(
env
,
provider
);
CHECK
jclass
clazz
=
(
*
env
)
->
GetObjectClass
(
env
,
provider
);
CHECK
_
(
0
)
mid
=
(
*
env
)
->
GetMethodID
(
env
,
clazz
,
"getProbes"
,
"()[Lsun/tracing/dtrace/DTraceProbe;"
);
CHECK
env
,
clazz
,
"getProbes"
,
"()[Lsun/tracing/dtrace/DTraceProbe;"
);
CHECK
_
(
0
)
probes
=
(
jobjectArray
)(
*
env
)
->
CallObjectMethod
(
env
,
provider
,
mid
);
CHECK
env
,
provider
,
mid
);
CHECK
_
(
0
)
// Fill JVM structure, describing provider
jvm_provider
->
probe_count
=
(
*
env
)
->
GetArrayLength
(
env
,
probes
);
CHECK
jvm_provider
->
probe_count
=
(
*
env
)
->
GetArrayLength
(
env
,
probes
);
CHECK
_
(
0
)
jvm_provider
->
probes
=
(
JVM_DTraceProbe
*
)
calloc
(
jvm_provider
->
probe_count
,
sizeof
(
*
jvm_provider
->
probes
));
mid
=
(
*
env
)
->
GetMethodID
(
env
,
clazz
,
"getProviderName"
,
"()Ljava/lang/String;"
);
CHECK
env
,
clazz
,
"getProviderName"
,
"()Ljava/lang/String;"
);
CHECK
_
(
0
)
jvm_provider
->
name
=
(
jstring
)(
*
env
)
->
CallObjectMethod
(
env
,
provider
,
mid
);
CHECK
env
,
provider
,
mid
);
CHECK
_
(
0
)
readInterfaceAttributes
(
env
,
provider
,
jvm_provider
);
CHECK
readInterfaceAttributes
(
env
,
provider
,
jvm_provider
);
CHECK
_
(
0
)
for
(
i
=
0
;
i
<
jvm_provider
->
probe_count
;
++
i
)
{
jobject
probe
=
(
*
env
)
->
GetObjectArrayElement
(
env
,
probes
,
i
);
CHECK
readProbeData
(
env
,
probe
,
&
jvm_provider
->
probes
[
i
]);
CHECK
jobject
probe
=
(
*
env
)
->
GetObjectArrayElement
(
env
,
probes
,
i
);
CHECK
_
(
0
)
readProbeData
(
env
,
probe
,
&
jvm_provider
->
probes
[
i
]);
CHECK
_
(
0
)
}
return
1
;
}
/*
...
...
@@ -182,6 +184,7 @@ JNIEXPORT jlong JNICALL Java_sun_tracing_dtrace_JVM_activate0(
jlong
handle
=
0
;
jsize
num_providers
;
jsize
i
;
jsize
count
=
0
;
JVM_DTraceProvider
*
jvm_providers
;
initialize
();
...
...
@@ -195,16 +198,23 @@ JNIEXPORT jlong JNICALL Java_sun_tracing_dtrace_JVM_activate0(
jvm_providers
=
(
JVM_DTraceProvider
*
)
calloc
(
num_providers
,
sizeof
(
*
jvm_providers
));
for
(
i
=
0
;
i
<
num_providers
;
++
i
)
{
JVM_DTraceProvider
*
p
=
&
(
jvm_providers
[
i
]);
for
(
;
count
<
num_providers
;
++
count
)
{
JVM_DTraceProvider
*
p
=
&
(
jvm_providers
[
count
]);
jobject
provider
=
(
*
env
)
->
GetObjectArrayElement
(
env
,
providers
,
i
);
readProviderData
(
env
,
provider
,
p
);
env
,
providers
,
count
);
if
((
*
env
)
->
ExceptionOccurred
(
env
)
||
!
readProviderData
(
env
,
provider
,
p
))
{
// got an error, bail out!
break
;
}
}
handle
=
jvm_symbols
->
Activate
(
env
,
JVM_TRACING_DTRACE_VERSION
,
moduleName
,
num_providers
,
jvm_providers
);
if
(
count
==
num_providers
)
{
// all providers successfully loaded - get the handle
handle
=
jvm_symbols
->
Activate
(
env
,
JVM_TRACING_DTRACE_VERSION
,
moduleName
,
num_providers
,
jvm_providers
);
}
for
(
i
=
0
;
i
<
num_providers
;
++
i
)
{
JVM_DTraceProvider
*
p
=
&
(
jvm_providers
[
i
]);
...
...
test/Makefile
浏览文件 @
840d2f58
...
...
@@ -262,8 +262,8 @@ ifdef CONCURRENCY
EXTRA_JTREG_OPTIONS
+=
-concurrency
:
$(CONCURRENCY)
endif
# Default JTREG to run
(win32 script works for everybody)
JTREG
=
$(JT_HOME)
/
win32/
bin/jtreg
# Default JTREG to run
JTREG
=
$(JT_HOME)
/bin/jtreg
# run in agentvm mode
JTREG_BASIC_OPTIONS
+=
-agentvm
# Only run automatic tests
...
...
test/com/sun/jdi/InterfaceMethodsTest.java
浏览文件 @
840d2f58
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014,
2015,
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
* @bug 8031195
* @bug 8071657
* @summary JDI: Add support for static and default methods in interfaces
*
* @run build TestScaffold VMConnection TargetListener TargetAdapter
...
...
@@ -38,6 +39,7 @@ public class InterfaceMethodsTest extends TestScaffold {
private
static
final
int
RESULT_A
=
1
;
private
static
final
int
RESULT_B
=
1
;
private
static
final
int
RESULT_TARGET
=
1
;
static
interface
InterfaceA
{
static
int
staticMethodA
()
{
System
.
out
.
println
(
"-InterfaceA: static interface method A-"
);
...
...
@@ -202,6 +204,9 @@ public class InterfaceMethodsTest extends TestScaffold {
// try to invoke static method B on the instance
testInvokePos
(
ifaceClass
,
ref
,
"staticMethodB"
,
"()I"
,
vm
().
mirrorOf
(
RESULT_A
));
// try to invoke a virtual method
testInvokePos
(
ifaceClass
,
ref
,
"implementedMethod"
,
"()I"
,
vm
().
mirrorOf
(
RESULT_A
),
true
);
}
private
void
testInterfaceB
(
ObjectReference
ref
)
{
...
...
@@ -302,9 +307,14 @@ public class InterfaceMethodsTest extends TestScaffold {
private
void
testInvokePos
(
ReferenceType
targetClass
,
ObjectReference
ref
,
String
methodName
,
String
methodSig
,
Value
value
)
{
testInvokePos
(
targetClass
,
ref
,
methodName
,
methodSig
,
value
,
false
);
}
private
void
testInvokePos
(
ReferenceType
targetClass
,
ObjectReference
ref
,
String
methodName
,
String
methodSig
,
Value
value
,
boolean
virtual
)
{
logInvocation
(
ref
,
methodName
,
methodSig
,
targetClass
);
try
{
invoke
(
targetClass
,
ref
,
methodName
,
methodSig
,
value
);
invoke
(
targetClass
,
ref
,
methodName
,
methodSig
,
value
,
virtual
);
System
.
err
.
println
(
"--- PASSED"
);
}
catch
(
Exception
e
)
{
System
.
err
.
println
(
"--- FAILED"
);
...
...
@@ -314,9 +324,14 @@ public class InterfaceMethodsTest extends TestScaffold {
private
void
testInvokeNeg
(
ReferenceType
targetClass
,
ObjectReference
ref
,
String
methodName
,
String
methodSig
,
Value
value
,
String
msg
)
{
testInvokeNeg
(
targetClass
,
ref
,
methodName
,
methodSig
,
value
,
msg
,
false
);
}
private
void
testInvokeNeg
(
ReferenceType
targetClass
,
ObjectReference
ref
,
String
methodName
,
String
methodSig
,
Value
value
,
String
msg
,
boolean
virtual
)
{
logInvocation
(
ref
,
methodName
,
methodSig
,
targetClass
);
try
{
invoke
(
targetClass
,
ref
,
methodName
,
methodSig
,
value
);
invoke
(
targetClass
,
ref
,
methodName
,
methodSig
,
value
,
virtual
);
System
.
err
.
println
(
"--- FAILED"
);
failure
(
"FAILED: "
+
msg
);
}
catch
(
Exception
e
)
{
...
...
@@ -326,7 +341,7 @@ public class InterfaceMethodsTest extends TestScaffold {
}
private
void
invoke
(
ReferenceType
targetClass
,
ObjectReference
ref
,
String
methodName
,
String
methodSig
,
Value
value
)
String
methodSig
,
Value
value
,
boolean
virtual
)
throws
Exception
{
Method
method
=
getMethod
(
targetClass
,
methodName
,
methodSig
);
if
(
method
==
null
)
{
...
...
@@ -334,10 +349,15 @@ public class InterfaceMethodsTest extends TestScaffold {
}
println
(
"Invoking "
+
(
method
.
isAbstract
()
?
"abstract "
:
" "
)
+
"method: "
+
method
);
println
(
method
.
declaringType
().
toString
());
Value
returnValue
=
null
;
if
(
ref
!=
null
)
{
returnValue
=
invokeInstance
(
ref
,
method
);
if
(
virtual
)
{
returnValue
=
invokeVirtual
(
ref
,
method
);
}
else
{
returnValue
=
invokeInstance
(
ref
,
method
);
}
}
else
{
returnValue
=
invokeStatic
(
targetClass
,
method
);
}
...
...
@@ -362,6 +382,10 @@ public class InterfaceMethodsTest extends TestScaffold {
return
ref
.
invokeMethod
(
mainThread
,
method
,
Collections
.
emptyList
(),
ObjectReference
.
INVOKE_NONVIRTUAL
);
}
private
Value
invokeVirtual
(
ObjectReference
ref
,
Method
method
)
throws
Exception
{
return
ref
.
invokeMethod
(
mainThread
,
method
,
Collections
.
emptyList
(),
0
);
}
private
Value
invokeStatic
(
ReferenceType
refType
,
Method
method
)
throws
Exception
{
if
(
refType
instanceof
ClassType
)
{
return
((
ClassType
)
refType
).
invokeMethod
(
mainThread
,
method
,
Collections
.
emptyList
(),
ObjectReference
.
INVOKE_NONVIRTUAL
);
...
...
test/java/awt/Frame/MaximizedNormalBoundsUndecoratedTest/MaximizedNormalBoundsUndecoratedTest.java
0 → 100644
浏览文件 @
840d2f58
/*
* Copyright (c) 2007, 2015, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
import
java.awt.Frame
;
import
java.awt.Toolkit
;
import
java.awt.Dimension
;
/*
* @test
* @bug 8066436
* @summary Set the size of frame. Set extendedState Frame.MAXIMIZED_BOTH and Frame.NORMAL
* sequentially for undecorated Frame and .
* Check if resulted size is equal to original frame size.
* @run main MaximizedNormalBoundsUndecoratedTest
*/
public
class
MaximizedNormalBoundsUndecoratedTest
{
private
Frame
frame
;
public
static
void
main
(
String
args
[])
{
if
(!
Toolkit
.
getDefaultToolkit
().
isFrameStateSupported
(
Frame
.
MAXIMIZED_BOTH
)
&&
!
Toolkit
.
getDefaultToolkit
().
isFrameStateSupported
(
Frame
.
NORMAL
))
{
return
;
}
MaximizedNormalBoundsUndecoratedTest
test
=
new
MaximizedNormalBoundsUndecoratedTest
();
boolean
doPass
=
true
;
if
(
!
test
.
doTest
()
)
{
System
.
out
.
println
(
"Maximizing frame not saving correct normal bounds"
);
doPass
=
false
;
}
if
(!
doPass
)
{
throw
new
RuntimeException
(
"Maximizing frame not saving correct normal bounds"
);
}
}
boolean
doTest
()
{
Dimension
beforeMaximizeCalled
=
new
Dimension
(
300
,
300
);
frame
=
new
Frame
(
"Test Frame"
);
frame
.
setUndecorated
(
true
);
frame
.
setFocusable
(
true
);
frame
.
setSize
(
beforeMaximizeCalled
);
frame
.
setVisible
(
true
);
frame
.
setExtendedState
(
Frame
.
MAXIMIZED_BOTH
);
frame
.
setExtendedState
(
Frame
.
NORMAL
);
Dimension
afterMaximizedCalled
=
frame
.
getBounds
().
getSize
();
frame
.
dispose
();
if
(
beforeMaximizeCalled
.
equals
(
afterMaximizedCalled
))
{
return
true
;
}
return
false
;
}
}
test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java
浏览文件 @
840d2f58
...
...
@@ -36,7 +36,7 @@ import javax.imageio.ImageIO;
import
sun.java2d.SunGraphics2D
;
/**
*
@
test
* test
* @bug 8043869
* @author Alexander Scherbatiy
* @summary [macosx] java -splash does not honor 2x hi dpi notation for retina
...
...
test/java/lang/invoke/lambda/LambdaStackTrace.java
0 → 100644
浏览文件 @
840d2f58
/*
* Copyright (c) 2015, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8025636
* @summary Synthetic frames should be hidden in exceptions
* @compile -XDignore.symbol.file LUtils.java LambdaStackTrace.java
* @run main LambdaStackTrace
*/
import
jdk.internal.org.objectweb.asm.ClassWriter
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
import
java.util.ArrayList
;
import
static
jdk
.
internal
.
org
.
objectweb
.
asm
.
Opcodes
.
ACC_ABSTRACT
;
import
static
jdk
.
internal
.
org
.
objectweb
.
asm
.
Opcodes
.
ACC_INTERFACE
;
import
static
jdk
.
internal
.
org
.
objectweb
.
asm
.
Opcodes
.
ACC_PUBLIC
;
import
static
jdk
.
internal
.
org
.
objectweb
.
asm
.
Opcodes
.
V1_7
;
public
class
LambdaStackTrace
{
static
File
classes
=
new
File
(
System
.
getProperty
(
"test.classes"
));
public
static
void
main
(
String
[]
args
)
throws
Exception
{
testBasic
();
testBridgeMethods
();
}
/**
* Test the simple case
*/
private
static
void
testBasic
()
throws
Exception
{
try
{
Runnable
r
=
()
->
{
throw
new
RuntimeException
();
};
r
.
run
();
}
catch
(
Exception
ex
)
{
// Before 8025636 the stacktrace would look like:
// at LambdaStackTrace.lambda$main$0(LambdaStackTrace.java:37)
// at LambdaStackTrace$$Lambda$1/1937396743.run(<Unknown>:1000000)
// at LambdaStackTrace.testBasic(LambdaStackTrace.java:40)
// at ...
//
// We are verifying that the middle frame above is gone.
verifyFrames
(
ex
.
getStackTrace
(),
"LambdaStackTrace\\..*"
,
"LambdaStackTrace.testBasic"
);
}
}
/**
* Test the more complicated case with bridge methods.
*
* We set up the following interfaces:
*
* interface Maker {
* Object make();
* }
* interface StringMaker extends Maker {
* String make();
* }
*
* And we will use them like so:
*
* StringMaker sm = () -> { throw new RuntimeException(); };
* sm.make();
* ((Maker)m).make();
*
* The first call is a "normal" interface call, the second will use a
* bridge method. In both cases the generated lambda frame should
* be removed from the stack trace.
*/
private
static
void
testBridgeMethods
()
throws
Exception
{
// setup
generateInterfaces
();
compileCaller
();
// test
StackTraceElement
[]
frames
=
call
(
"Caller"
,
"callStringMaker"
);
verifyFrames
(
frames
,
"Caller\\..*"
,
"Caller.callStringMaker"
);
frames
=
call
(
"Caller"
,
"callMaker"
);
verifyFrames
(
frames
,
"Caller\\..*"
,
"Caller.callMaker"
);
}
private
static
void
generateInterfaces
()
throws
IOException
{
// We can't let javac compile these interfaces because in > 1.8 it will insert
// bridge methods into the interfaces - we want code that looks like <= 1.7,
// so we generate it.
try
(
FileOutputStream
fw
=
new
FileOutputStream
(
new
File
(
classes
,
"Maker.class"
)))
{
fw
.
write
(
generateMaker
());
}
try
(
FileOutputStream
fw
=
new
FileOutputStream
(
new
File
(
classes
,
"StringMaker.class"
)))
{
fw
.
write
(
generateStringMaker
());
}
}
private
static
byte
[]
generateMaker
()
{
// interface Maker {
// Object make();
// }
ClassWriter
cw
=
new
ClassWriter
(
0
);
cw
.
visit
(
V1_7
,
ACC_INTERFACE
|
ACC_ABSTRACT
,
"Maker"
,
null
,
"java/lang/Object"
,
null
);
cw
.
visitMethod
(
ACC_PUBLIC
|
ACC_ABSTRACT
,
"make"
,
"()Ljava/lang/Object;"
,
null
,
null
);
cw
.
visitEnd
();
return
cw
.
toByteArray
();
}
private
static
byte
[]
generateStringMaker
()
{
// interface StringMaker extends Maker {
// String make();
// }
ClassWriter
cw
=
new
ClassWriter
(
0
);
cw
.
visit
(
V1_7
,
ACC_INTERFACE
|
ACC_ABSTRACT
,
"StringMaker"
,
null
,
"java/lang/Object"
,
new
String
[]{
"Maker"
});
cw
.
visitMethod
(
ACC_PUBLIC
|
ACC_ABSTRACT
,
"make"
,
"()Ljava/lang/String;"
,
null
,
null
);
cw
.
visitEnd
();
return
cw
.
toByteArray
();
}
static
void
emitCode
(
File
f
)
{
ArrayList
<
String
>
scratch
=
new
ArrayList
<>();
scratch
.
add
(
"public class Caller {"
);
scratch
.
add
(
" public static void callStringMaker() {"
);
scratch
.
add
(
" StringMaker sm = () -> { throw new RuntimeException(); };"
);
scratch
.
add
(
" sm.make();"
);
scratch
.
add
(
" }"
);
scratch
.
add
(
" public static void callMaker() {"
);
scratch
.
add
(
" StringMaker sm = () -> { throw new RuntimeException(); };"
);
scratch
.
add
(
" ((Maker) sm).make();"
);
// <-- This will call the bridge method
scratch
.
add
(
" }"
);
scratch
.
add
(
"}"
);
LUtils
.
createFile
(
f
,
scratch
);
}
static
void
compileCaller
()
{
File
caller
=
new
File
(
classes
,
"Caller.java"
);
emitCode
(
caller
);
LUtils
.
compile
(
"-cp"
,
classes
.
getAbsolutePath
(),
"-d"
,
classes
.
getAbsolutePath
(),
caller
.
getAbsolutePath
());
}
private
static
void
verifyFrames
(
StackTraceElement
[]
stack
,
String
...
patterns
)
throws
Exception
{
for
(
int
i
=
0
;
i
<
patterns
.
length
;
i
++)
{
String
cm
=
stack
[
i
].
getClassName
()
+
"."
+
stack
[
i
].
getMethodName
();
if
(!
cm
.
matches
(
patterns
[
i
]))
{
System
.
err
.
println
(
"Actual trace did not match expected trace at frame "
+
i
);
System
.
err
.
println
(
"Expected frame patterns:"
);
for
(
int
j
=
0
;
j
<
patterns
.
length
;
j
++)
{
System
.
err
.
println
(
" "
+
j
+
": "
+
patterns
[
j
]);
}
System
.
err
.
println
(
"Actual frames:"
);
for
(
int
j
=
0
;
j
<
patterns
.
length
;
j
++)
{
System
.
err
.
println
(
" "
+
j
+
": "
+
stack
[
j
]);
}
throw
new
Exception
(
"Incorrect stack frames found"
);
}
}
}
private
static
StackTraceElement
[]
call
(
String
clazz
,
String
method
)
throws
Exception
{
Class
<?>
c
=
Class
.
forName
(
clazz
);
try
{
Method
m
=
c
.
getDeclaredMethod
(
method
);
m
.
invoke
(
null
);
}
catch
(
InvocationTargetException
ex
)
{
return
ex
.
getTargetException
().
getStackTrace
();
}
throw
new
Exception
(
"Expected exception to be thrown"
);
}
}
test/java/util/zip/TestExtraTime.java
浏览文件 @
840d2f58
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013,
2015,
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
...
...
@@ -23,7 +23,7 @@
/**
* @test
* @bug 4759491 6303183 7012868 8015666 8023713 8068790
* @bug 4759491 6303183 7012868 8015666 8023713 8068790
8074694
* @summary Test ZOS and ZIS timestamp in extra field correctly
*/
...
...
@@ -71,6 +71,7 @@ public class TestExtraTime {
}
testNullHandling
();
testTimeConversions
();
}
static
void
test
(
FileTime
mtime
,
FileTime
atime
,
FileTime
ctime
,
...
...
@@ -178,4 +179,33 @@ public class TestExtraTime {
// pass
}
}
// verify that setting and getting any time is possible as per the intent
// of 4759491
static
void
testTimeConversions
()
{
// Sample across the entire range
long
step
=
Long
.
MAX_VALUE
/
100L
;
testTimeConversions
(
Long
.
MIN_VALUE
,
Long
.
MAX_VALUE
-
step
,
step
);
// Samples through the near future
long
currentTime
=
System
.
currentTimeMillis
();
testTimeConversions
(
currentTime
,
currentTime
+
1_000_000
,
10_000
);
}
static
void
testTimeConversions
(
long
from
,
long
to
,
long
step
)
{
ZipEntry
ze
=
new
ZipEntry
(
"TestExtraTime.java"
);
for
(
long
time
=
from
;
time
<=
to
;
time
+=
step
)
{
ze
.
setTime
(
time
);
FileTime
lastModifiedTime
=
ze
.
getLastModifiedTime
();
if
(
lastModifiedTime
.
toMillis
()
!=
time
)
{
throw
new
RuntimeException
(
"setTime should make getLastModifiedTime "
+
"return the specified instant: "
+
time
+
" got: "
+
lastModifiedTime
.
toMillis
());
}
if
(
ze
.
getTime
()
!=
time
)
{
throw
new
RuntimeException
(
"getTime after setTime, expected: "
+
time
+
" got: "
+
ze
.
getTime
());
}
}
}
}
test/javax/swing/JMenu/8072900/WrongSelectionOnMouseOver.java
0 → 100644
浏览文件 @
840d2f58
/*
* Copyright (c) 2015, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 8072900
@summary Mouse events are captured by the wrong menu in OS X
@author Anton Nashatyrev
@run main WrongSelectionOnMouseOver
*/
import
javax.swing.*
;
import
javax.swing.event.MenuEvent
;
import
javax.swing.event.MenuListener
;
import
java.awt.*
;
import
java.awt.event.MouseAdapter
;
import
java.awt.event.MouseEvent
;
import
java.util.concurrent.CountDownLatch
;
import
java.util.concurrent.TimeUnit
;
import
static
javax
.
swing
.
UIManager
.
getInstalledLookAndFeels
;
public
class
WrongSelectionOnMouseOver
implements
Runnable
{
CountDownLatch
firstMenuSelected
=
new
CountDownLatch
(
1
);
CountDownLatch
secondMenuMouseEntered
=
new
CountDownLatch
(
1
);
CountDownLatch
secondMenuSelected
=
new
CountDownLatch
(
1
);
JMenu
m1
,
m2
;
private
UIManager
.
LookAndFeelInfo
laf
;
JFrame
frame1
;
JFrame
frame2
;
public
WrongSelectionOnMouseOver
(
UIManager
.
LookAndFeelInfo
laf
)
throws
Exception
{
this
.
laf
=
laf
;
}
private
void
createUI
()
throws
Exception
{
System
.
out
.
println
(
"Testing UI: "
+
laf
);
UIManager
.
setLookAndFeel
(
laf
.
getClassName
());
{
frame1
=
new
JFrame
(
"Frame1"
);
JMenuBar
mb
=
new
JMenuBar
();
m1
=
new
JMenu
(
"File"
);
JMenuItem
i1
=
new
JMenuItem
(
"Save"
);
JMenuItem
i2
=
new
JMenuItem
(
"Load"
);
m1
.
addMenuListener
(
new
MenuListener
()
{
@Override
public
void
menuSelected
(
MenuEvent
e
)
{
firstMenuSelected
.
countDown
();
System
.
out
.
println
(
"Menu1: menuSelected"
);
}
@Override
public
void
menuDeselected
(
MenuEvent
e
)
{
System
.
out
.
println
(
"Menu1: menuDeselected"
);
}
@Override
public
void
menuCanceled
(
MenuEvent
e
)
{
System
.
out
.
println
(
"Menu1: menuCanceled"
);
}
});
frame1
.
setJMenuBar
(
mb
);
mb
.
add
(
m1
);
m1
.
add
(
i1
);
m1
.
add
(
i2
);
frame1
.
setLayout
(
new
FlowLayout
());
frame1
.
setBounds
(
200
,
200
,
200
,
200
);
frame1
.
setVisible
(
true
);
}
{
frame2
=
new
JFrame
(
"Frame2"
);
JMenuBar
mb
=
new
JMenuBar
();
m2
=
new
JMenu
(
"File"
);
JMenuItem
i1
=
new
JMenuItem
(
"Save"
);
JMenuItem
i2
=
new
JMenuItem
(
"Load"
);
m2
.
addMouseListener
(
new
MouseAdapter
()
{
@Override
public
void
mouseEntered
(
MouseEvent
e
)
{
secondMenuMouseEntered
.
countDown
();
System
.
out
.
println
(
"WrongSelectionOnMouseOver.mouseEntered"
);
}
});
m2
.
addMenuListener
(
new
MenuListener
()
{
@Override
public
void
menuSelected
(
MenuEvent
e
)
{
secondMenuSelected
.
countDown
();
System
.
out
.
println
(
"Menu2: menuSelected"
);
}
@Override
public
void
menuDeselected
(
MenuEvent
e
)
{
System
.
out
.
println
(
"Menu2: menuDeselected"
);
}
@Override
public
void
menuCanceled
(
MenuEvent
e
)
{
System
.
out
.
println
(
"Menu2: menuCanceled"
);
}
});
frame2
.
setJMenuBar
(
mb
);
mb
.
add
(
m2
);
m2
.
add
(
i1
);
m2
.
add
(
i2
);
frame2
.
setLayout
(
new
FlowLayout
());
frame2
.
setBounds
(
400
,
200
,
200
,
200
);
frame2
.
setVisible
(
true
);
}
}
public
void
disposeUI
()
{
frame1
.
dispose
();
frame2
.
dispose
();
}
@Override
public
void
run
()
{
try
{
if
(
frame1
==
null
)
{
createUI
();
}
else
{
disposeUI
();
}
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
}
public
void
test
()
throws
Exception
{
Robot
robot
=
new
Robot
();
robot
.
setAutoDelay
(
100
);
robot
.
waitForIdle
();
robot
.
mouseMove
((
int
)
m1
.
getLocationOnScreen
().
getX
()
+
5
,
(
int
)
m1
.
getLocationOnScreen
().
getY
()
+
5
);
robot
.
mousePress
(
MouseEvent
.
BUTTON1_MASK
);
robot
.
mouseRelease
(
MouseEvent
.
BUTTON1_MASK
);
if
(!
firstMenuSelected
.
await
(
5
,
TimeUnit
.
SECONDS
))
{
throw
new
RuntimeException
(
"Menu has not been selected."
);
};
robot
.
mouseMove
((
int
)
m2
.
getLocationOnScreen
().
getX
()
+
5
,
(
int
)
m2
.
getLocationOnScreen
().
getY
()
+
5
);
if
(!
secondMenuMouseEntered
.
await
(
5
,
TimeUnit
.
SECONDS
))
{
throw
new
RuntimeException
(
"MouseEntered event missed for the second menu"
);
};
if
(
secondMenuSelected
.
await
(
1
,
TimeUnit
.
SECONDS
))
{
throw
new
RuntimeException
(
"The second menu has been selected"
);
};
}
public
static
void
main
(
final
String
[]
args
)
throws
Exception
{
for
(
final
UIManager
.
LookAndFeelInfo
laf
:
getInstalledLookAndFeels
())
{
WrongSelectionOnMouseOver
test
=
new
WrongSelectionOnMouseOver
(
laf
);
SwingUtilities
.
invokeAndWait
(
test
);
test
.
test
();
SwingUtilities
.
invokeAndWait
(
test
);
}
System
.
out
.
println
(
"Test passed"
);
}
}
\ No newline at end of file
test/sun/text/resources/Format/Bug8074791.java
0 → 100644
浏览文件 @
840d2f58
/*
* Copyright (c) 2015, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8074791
* @summary Make sure that Finnish month names are correct in formatted text.
*/
import
java.text.DateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.GregorianCalendar
;
import
java.util.Locale
;
import
static
java
.
text
.
DateFormat
.*;
import
static
java
.
util
.
Calendar
.
JANUARY
;
public
class
Bug8074791
{
private
static
Locale
FINNISH
=
new
Locale
(
"fi"
);
private
static
String
JAN_FORMAT
=
"tammikuuta"
;
private
static
String
JAN_STANDALONE
=
"tammikuu"
;
public
static
void
main
(
String
[]
arg
)
{
int
errors
=
0
;
DateFormat
df
=
DateFormat
.
getDateInstance
(
LONG
,
FINNISH
);
Date
jan20
=
new
GregorianCalendar
(
2015
,
JANUARY
,
20
).
getTime
();
String
str
=
df
.
format
(
jan20
).
toString
();
// Extract the month name (locale data dependent)
String
month
=
str
.
replaceAll
(
".+\\s([a-z]+)\\s\\d+$"
,
"$1"
);
if
(!
month
.
equals
(
JAN_FORMAT
))
{
errors
++;
System
.
err
.
println
(
"wrong format month name: got '"
+
month
+
"', expected '"
+
JAN_FORMAT
+
"'"
);
}
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"LLLL"
,
FINNISH
);
// stand-alone month name
month
=
sdf
.
format
(
jan20
);
if
(!
month
.
equals
(
JAN_STANDALONE
))
{
errors
++;
System
.
err
.
println
(
"wrong stand-alone month name: got '"
+
month
+
"', expected '"
+
JAN_STANDALONE
+
"'"
);
}
if
(
errors
>
0
)
{
throw
new
RuntimeException
();
}
}
}
test/sun/text/resources/LocaleData
浏览文件 @
840d2f58
...
...
@@ -8276,3 +8276,9 @@ FormatData/zh/MonthNarrows/9=10
FormatData/zh/MonthNarrows/10=11
FormatData/zh/MonthNarrows/11=12
FormatData/zh/MonthNarrows/12=
# bug #8074791
FormatData/fi/DatePatterns/0=d. MMMM yyyy
FormatData/fi/DatePatterns/1=d. MMMM yyyy
FormatData/fi/DatePatterns/2=d.M.yyyy
FormatData/fi/DatePatterns/3=d.M.yyyy
test/sun/text/resources/LocaleDataTest.java
浏览文件 @
840d2f58
/*
* Copyright (c) 2007, 201
4
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 201
5
, 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
...
...
@@ -36,7 +36,7 @@
* 6919624 6998391 7019267 7020960 7025837 7020583 7036905 7066203 7101495
* 7003124 7085757 7028073 7171028 7189611 8000983 7195759 8004489 8006509
* 7114053 7074882 7040556 8013836 8021121 6192407 6931564 8027695 7090826
* 8017142 8037343 8055222 8042126
* 8017142 8037343 8055222 8042126
8074791
* @summary Verify locale data
*
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录