Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
f0559fb6
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看板
提交
f0559fb6
编写于
8月 07, 2012
作者:
L
lana
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
9bb2b2aa
a00a999d
变更
30
隐藏空白更改
内联
并排
Showing
30 changed file
with
844 addition
and
340 deletion
+844
-340
.hgtags
.hgtags
+1
-0
make/Makefile
make/Makefile
+1
-1
make/common/Release.gmk
make/common/Release.gmk
+1
-2
make/docs/CORE_PKGS.gmk
make/docs/CORE_PKGS.gmk
+0
-1
make/sunw/Makefile
make/sunw/Makefile
+0
-49
makefiles/CreateJars.gmk
makefiles/CreateJars.gmk
+1
-2
makefiles/docs/CORE_PKGS.gmk
makefiles/docs/CORE_PKGS.gmk
+0
-1
src/macosx/classes/com/apple/laf/AquaComboBoxUI.java
src/macosx/classes/com/apple/laf/AquaComboBoxUI.java
+4
-1
src/macosx/classes/sun/lwawt/LWTextAreaPeer.java
src/macosx/classes/sun/lwawt/LWTextAreaPeer.java
+0
-10
src/macosx/classes/sun/lwawt/LWTextComponentPeer.java
src/macosx/classes/sun/lwawt/LWTextComponentPeer.java
+1
-1
src/share/classes/com/sun/beans/TypeResolver.java
src/share/classes/com/sun/beans/TypeResolver.java
+63
-106
src/share/classes/com/sun/beans/finder/MethodFinder.java
src/share/classes/com/sun/beans/finder/MethodFinder.java
+4
-2
src/share/classes/java/awt/GraphicsEnvironment.java
src/share/classes/java/awt/GraphicsEnvironment.java
+3
-3
src/share/classes/java/awt/TextComponent.java
src/share/classes/java/awt/TextComponent.java
+6
-1
src/share/classes/java/beans/IndexedPropertyDescriptor.java
src/share/classes/java/beans/IndexedPropertyDescriptor.java
+4
-3
src/share/classes/java/beans/Introspector.java
src/share/classes/java/beans/Introspector.java
+66
-46
src/share/classes/java/beans/PropertyDescriptor.java
src/share/classes/java/beans/PropertyDescriptor.java
+4
-3
src/share/classes/javax/swing/TimerQueue.java
src/share/classes/javax/swing/TimerQueue.java
+3
-0
src/share/classes/sun/misc/MetaIndex.java
src/share/classes/sun/misc/MetaIndex.java
+0
-1
src/share/classes/sunw/util/EventObject.java
src/share/classes/sunw/util/EventObject.java
+0
-61
src/solaris/classes/sun/awt/X11/XTextAreaPeer.java
src/solaris/classes/sun/awt/X11/XTextAreaPeer.java
+0
-7
src/solaris/native/java/lang/java_props_md.c
src/solaris/native/java/lang/java_props_md.c
+1
-3
src/windows/native/sun/windows/awt_TextArea.cpp
src/windows/native/sun/windows/awt_TextArea.cpp
+1
-36
src/windows/native/sun/windows/awt_TextComponent.cpp
src/windows/native/sun/windows/awt_TextComponent.cpp
+44
-0
src/windows/native/sun/windows/awt_TextComponent.h
src/windows/native/sun/windows/awt_TextComponent.h
+1
-0
test/java/awt/Focus/OverrideRedirectWindowActivationTest/OverrideRedirectWindowActivationTest.java
...wActivationTest/OverrideRedirectWindowActivationTest.java
+157
-0
test/java/awt/Window/Grab/GrabTest.java
test/java/awt/Window/Grab/GrabTest.java
+212
-0
test/java/awt/event/TextEvent/TextEventSequenceTest/TextEventSequenceTest.java
...extEvent/TextEventSequenceTest/TextEventSequenceTest.java
+138
-0
test/java/beans/Performance/Test7122740.java
test/java/beans/Performance/Test7122740.java
+57
-0
test/java/beans/Performance/Test7184799.java
test/java/beans/Performance/Test7184799.java
+71
-0
未找到文件。
.hgtags
浏览文件 @
f0559fb6
...
...
@@ -171,3 +171,4 @@ b92353a01aa049bc508fc56f0347d5934b7c4390 jdk8-b45
00b22b23269a57d0bb46c57753be2fe9a9d2c1a3 jdk8-b47
3e4ab821f46166fcf63e8fe5c8046216003c941f jdk8-b48
51707c3b75c0f521794d9ab425f4e5b2351c70c1 jdk8-b49
e4bae5c53fca8fcb9393d47fd36a34b9e2e8d4ec jdk8-b50
make/Makefile
浏览文件 @
f0559fb6
...
...
@@ -237,7 +237,7 @@ ifeq ($(PLATFORM), macosx)
SUBDIRS
+=
apple
endif
SUBDIRS_tools
=
launchers
SUBDIRS_misc
=
org
sunw
jpda
SUBDIRS_misc
=
org jpda
# demos
ifndef
NO_DEMOS
...
...
make/common/Release.gmk
浏览文件 @
f0559fb6
...
...
@@ -305,8 +305,7 @@ SOURCES = \
org/ietf \
org/omg \
org/w3c/dom \
org/xml/sax \
sunw
org/xml/sax
#
# Directories where sources may be found. If a file with the same path
# name exists in more than one of these places, the one found last on this
...
...
make/docs/CORE_PKGS.gmk
浏览文件 @
f0559fb6
...
...
@@ -33,7 +33,6 @@ EXCLUDE_PKGS = \
java.awt.peer \
java.awt.dnd.peer \
sun.* \
sunw.* \
com.sun.* \
org.apache.* \
org.jcp.* \
...
...
make/sunw/Makefile
已删除
100644 → 0
浏览文件 @
9bb2b2aa
#
# Copyright (c) 1996, 2005, 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. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# 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.
#
BUILDDIR
=
..
PACKAGE
=
sunw
PRODUCT
=
sun
include
$(BUILDDIR)/common/Defs.gmk
#
# Files
#
FILES_java
=
\
sunw/util/EventObject.java
\
sunw/util/EventListener.java
\
sunw/io/Serializable.java
#
# include rules
#
include
$(BUILDDIR)/common/Rules.gmk
#
# Rules
#
clean clobber
::
.delete.classlist
$(RM)
-r
$(CLASSBINDIR)
/sunw
makefiles/CreateJars.gmk
浏览文件 @
f0559fb6
...
...
@@ -807,8 +807,7 @@ SRC_ZIP_INCLUDES = \
org/ietf \
org/omg \
org/w3c/dom \
org/xml/sax \
sunw
org/xml/sax
SRC_ZIP_SRCS = $(JDK_TOPDIR)/src/share/classes $(JDK_TOPDIR)/src/$(LEGACY_OPENJDK_TARGET_OS_API)/classes
SRC_ZIP_SRCS += $(JDK_OUTPUTDIR)/gensrc
...
...
makefiles/docs/CORE_PKGS.gmk
浏览文件 @
f0559fb6
...
...
@@ -33,7 +33,6 @@ EXCLUDE_PKGS = \
java.awt.peer \
java.awt.dnd.peer \
sun.* \
sunw.* \
com.sun.* \
org.apache.* \
org.jcp.* \
...
...
src/macosx/classes/com/apple/laf/AquaComboBoxUI.java
浏览文件 @
f0559fb6
...
...
@@ -259,7 +259,8 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
protected
void
installKeyboardActions
()
{
super
.
installKeyboardActions
();
final
ActionMap
actionMap
=
comboBox
.
getActionMap
();
ActionMap
actionMap
=
new
ActionMapUIResource
();
actionMap
.
put
(
"aquaSelectNext"
,
highlightNextAction
);
actionMap
.
put
(
"aquaSelectPrevious"
,
highlightPreviousAction
);
actionMap
.
put
(
"aquaEnterPressed"
,
triggerSelectionAction
);
...
...
@@ -269,6 +270,8 @@ public class AquaComboBoxUI extends BasicComboBoxUI implements Sizeable {
actionMap
.
put
(
"aquaSelectEnd"
,
highlightLastAction
);
actionMap
.
put
(
"aquaSelectPageUp"
,
highlightPageUpAction
);
actionMap
.
put
(
"aquaSelectPageDown"
,
highlightPageDownAction
);
SwingUtilities
.
replaceUIActionMap
(
comboBox
,
actionMap
);
}
abstract
class
ComboBoxAction
extends
AbstractAction
{
...
...
src/macosx/classes/sun/lwawt/LWTextAreaPeer.java
浏览文件 @
f0559fb6
...
...
@@ -128,16 +128,6 @@ final class LWTextAreaPeer
repaintPeer
();
}
@Override
public
void
setText
(
final
String
l
)
{
// Please note that we do not want to post an event
// if TextArea.setText() replaces an empty text by an empty text,
// that is, if component's text remains unchanged.
if
(!
l
.
isEmpty
()
||
getTextComponent
().
getDocument
().
getLength
()
!=
0
)
{
super
.
setText
(
l
);
}
}
@Override
public
void
replaceRange
(
final
String
text
,
final
int
start
,
final
int
end
)
{
...
...
src/macosx/classes/sun/lwawt/LWTextComponentPeer.java
浏览文件 @
f0559fb6
...
...
@@ -124,7 +124,7 @@ abstract class LWTextComponentPeer<T extends TextComponent, D extends JComponent
}
@Override
public
void
setText
(
final
String
l
)
{
public
final
void
setText
(
final
String
l
)
{
synchronized
(
getDelegateLock
())
{
// JTextArea.setText() posts two different events (remove & insert).
// Since we make no differences between text events,
...
...
src/share/classes/com/sun/beans/TypeResolver.java
浏览文件 @
f0559fb6
/*
* Copyright (c) 2003, 20
06
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
12
, 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
...
...
@@ -45,6 +45,9 @@ import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl;
* @author Sergey Malenkov
*/
public
final
class
TypeResolver
{
private
static
final
WeakCache
<
Type
,
Map
<
Type
,
Type
>>
CACHE
=
new
WeakCache
<>();
/**
* Replaces the given {@code type} in an inherited method
* with the actual type it has in the given {@code inClass}.
...
...
@@ -149,12 +152,55 @@ public final class TypeResolver {
* @param formal the type where occurrences of the variables
* in {@code actual} will be replaced by the corresponding bound values
* @return a resolved type
*
* @see #TypeResolver(Type)
* @see #resolve(Type)
*/
public
static
Type
resolve
(
Type
actual
,
Type
formal
)
{
return
getTypeResolver
(
actual
).
resolve
(
formal
);
if
(
formal
instanceof
Class
)
{
return
formal
;
}
if
(
formal
instanceof
GenericArrayType
)
{
Type
comp
=
((
GenericArrayType
)
formal
).
getGenericComponentType
();
comp
=
resolve
(
actual
,
comp
);
return
(
comp
instanceof
Class
)
?
Array
.
newInstance
((
Class
<?>)
comp
,
0
).
getClass
()
:
GenericArrayTypeImpl
.
make
(
comp
);
}
if
(
formal
instanceof
ParameterizedType
)
{
ParameterizedType
fpt
=
(
ParameterizedType
)
formal
;
Type
[]
actuals
=
resolve
(
actual
,
fpt
.
getActualTypeArguments
());
return
ParameterizedTypeImpl
.
make
(
(
Class
<?>)
fpt
.
getRawType
(),
actuals
,
fpt
.
getOwnerType
());
}
if
(
formal
instanceof
WildcardType
)
{
WildcardType
fwt
=
(
WildcardType
)
formal
;
Type
[]
upper
=
resolve
(
actual
,
fwt
.
getUpperBounds
());
Type
[]
lower
=
resolve
(
actual
,
fwt
.
getLowerBounds
());
return
new
WildcardTypeImpl
(
upper
,
lower
);
}
if
(
formal
instanceof
TypeVariable
)
{
Map
<
Type
,
Type
>
map
;
synchronized
(
CACHE
)
{
map
=
CACHE
.
get
(
actual
);
if
(
map
==
null
)
{
map
=
new
HashMap
<>();
prepare
(
map
,
actual
);
CACHE
.
put
(
actual
,
map
);
}
}
Type
result
=
map
.
get
(
formal
);
if
(
result
==
null
||
result
.
equals
(
formal
))
{
return
formal
;
}
result
=
fixGenericArray
(
result
);
// A variable can be bound to another variable that is itself bound
// to something. For example, given:
// class Super<T> {...}
// class Mid<X> extends Super<T> {...}
// class Sub extends Mid<String>
// the variable T is bound to X, which is in turn bound to String.
// So if we have to resolve T, we need the tail recursion here.
return
resolve
(
actual
,
result
);
}
throw
new
IllegalArgumentException
(
"Bad Type kind: "
+
formal
.
getClass
());
}
/**
...
...
@@ -164,12 +210,14 @@ public final class TypeResolver {
* @param actual the type that supplies bindings for type variables
* @param formals the array of types to resolve
* @return an array of resolved types
*
* @see #TypeResolver(Type)
* @see #resolve(Type[])
*/
public
static
Type
[]
resolve
(
Type
actual
,
Type
[]
formals
)
{
return
getTypeResolver
(
actual
).
resolve
(
formals
);
int
length
=
formals
.
length
;
Type
[]
actuals
=
new
Type
[
length
];
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
actuals
[
i
]
=
resolve
(
actual
,
formals
[
i
]);
}
return
actuals
;
}
/**
...
...
@@ -228,32 +276,6 @@ public final class TypeResolver {
return
classes
;
}
public
static
TypeResolver
getTypeResolver
(
Type
type
)
{
synchronized
(
CACHE
)
{
TypeResolver
resolver
=
CACHE
.
get
(
type
);
if
(
resolver
==
null
)
{
resolver
=
new
TypeResolver
(
type
);
CACHE
.
put
(
type
,
resolver
);
}
return
resolver
;
}
}
private
static
final
WeakCache
<
Type
,
TypeResolver
>
CACHE
=
new
WeakCache
<>();
private
final
Map
<
TypeVariable
<?>,
Type
>
map
=
new
HashMap
<>();
/**
* Constructs the type resolver for the given actual type.
*
* @param actual the type that supplies bindings for type variables
*
* @see #prepare(Type)
*/
private
TypeResolver
(
Type
actual
)
{
prepare
(
actual
);
}
/**
* Fills the map from type parameters
* to types as seen by the given {@code type}.
...
...
@@ -265,9 +287,10 @@ public final class TypeResolver {
* to a {@link ParameterizedType ParameterizedType} with no parameters,
* or it represents the erasure of a {@link ParameterizedType ParameterizedType}.
*
* @param map the mappings of all type variables
* @param type the next type in the hierarchy
*/
private
void
prepare
(
Type
type
)
{
private
static
void
prepare
(
Map
<
Type
,
Type
>
map
,
Type
type
)
{
Class
<?>
raw
=
(
Class
<?>)((
type
instanceof
Class
<?>)
?
type
:
((
ParameterizedType
)
type
).
getRawType
());
...
...
@@ -280,90 +303,24 @@ public final class TypeResolver {
assert
formals
.
length
==
actuals
.
length
;
for
(
int
i
=
0
;
i
<
formals
.
length
;
i
++)
{
this
.
map
.
put
(
formals
[
i
],
actuals
[
i
]);
map
.
put
(
formals
[
i
],
actuals
[
i
]);
}
Type
gSuperclass
=
raw
.
getGenericSuperclass
();
if
(
gSuperclass
!=
null
)
{
prepare
(
gSuperclass
);
prepare
(
map
,
gSuperclass
);
}
for
(
Type
gInterface
:
raw
.
getGenericInterfaces
())
{
prepare
(
gInterface
);
prepare
(
map
,
gInterface
);
}
// If type is the raw version of a parameterized class, we type-erase
// all of its type variables, including inherited ones.
if
(
type
instanceof
Class
<?>
&&
formals
.
length
>
0
)
{
for
(
Map
.
Entry
<
Type
Variable
<?>,
Type
>
entry
:
this
.
map
.
entrySet
())
{
for
(
Map
.
Entry
<
Type
,
Type
>
entry
:
map
.
entrySet
())
{
entry
.
setValue
(
erase
(
entry
.
getValue
()));
}
}
}
/**
* Replaces the given {@code formal} type
* with the type it stand for in this type resolver.
*
* @param formal the array of types to resolve
* @return a resolved type
*/
private
Type
resolve
(
Type
formal
)
{
if
(
formal
instanceof
Class
)
{
return
formal
;
}
if
(
formal
instanceof
GenericArrayType
)
{
Type
comp
=
((
GenericArrayType
)
formal
).
getGenericComponentType
();
comp
=
resolve
(
comp
);
return
(
comp
instanceof
Class
)
?
Array
.
newInstance
((
Class
<?>)
comp
,
0
).
getClass
()
:
GenericArrayTypeImpl
.
make
(
comp
);
}
if
(
formal
instanceof
ParameterizedType
)
{
ParameterizedType
fpt
=
(
ParameterizedType
)
formal
;
Type
[]
actuals
=
resolve
(
fpt
.
getActualTypeArguments
());
return
ParameterizedTypeImpl
.
make
(
(
Class
<?>)
fpt
.
getRawType
(),
actuals
,
fpt
.
getOwnerType
());
}
if
(
formal
instanceof
WildcardType
)
{
WildcardType
fwt
=
(
WildcardType
)
formal
;
Type
[]
upper
=
resolve
(
fwt
.
getUpperBounds
());
Type
[]
lower
=
resolve
(
fwt
.
getLowerBounds
());
return
new
WildcardTypeImpl
(
upper
,
lower
);
}
if
(!(
formal
instanceof
TypeVariable
))
{
throw
new
IllegalArgumentException
(
"Bad Type kind: "
+
formal
.
getClass
());
}
Type
actual
=
this
.
map
.
get
((
TypeVariable
)
formal
);
if
(
actual
==
null
||
actual
.
equals
(
formal
))
{
return
formal
;
}
actual
=
fixGenericArray
(
actual
);
return
resolve
(
actual
);
// A variable can be bound to another variable that is itself bound
// to something. For example, given:
// class Super<T> {...}
// class Mid<X> extends Super<T> {...}
// class Sub extends Mid<String>
// the variable T is bound to X, which is in turn bound to String.
// So if we have to resolve T, we need the tail recursion here.
}
/**
* Replaces all formal types in the given array
* with the types they stand for in this type resolver.
*
* @param formals the array of types to resolve
* @return an array of resolved types
*
* @see #resolve(Type)
*/
private
Type
[]
resolve
(
Type
[]
formals
)
{
int
length
=
formals
.
length
;
Type
[]
actuals
=
new
Type
[
length
];
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
actuals
[
i
]
=
resolve
(
formals
[
i
]);
}
return
actuals
;
}
/**
* Replaces a {@link GenericArrayType GenericArrayType}
* with plain array class where it is possible.
...
...
src/share/classes/com/sun/beans/finder/MethodFinder.java
浏览文件 @
f0559fb6
...
...
@@ -164,8 +164,10 @@ public final class MethodFinder extends AbstractFinder<Method> {
return
findAccessibleMethod
(
m
);
}
Type
[]
gpts
=
m
.
getGenericParameterTypes
();
if
(
Arrays
.
equals
(
params
,
TypeResolver
.
erase
(
TypeResolver
.
resolve
(
pt
,
gpts
))))
{
return
findAccessibleMethod
(
m
);
if
(
params
.
length
==
gpts
.
length
)
{
if
(
Arrays
.
equals
(
params
,
TypeResolver
.
erase
(
TypeResolver
.
resolve
(
pt
,
gpts
))))
{
return
findAccessibleMethod
(
m
);
}
}
}
}
...
...
src/share/classes/java/awt/GraphicsEnvironment.java
浏览文件 @
f0559fb6
...
...
@@ -170,12 +170,12 @@ public abstract class GraphicsEnvironment {
if
(
System
.
getProperty
(
"javaplugin.version"
)
!=
null
)
{
headless
=
defaultHeadless
=
Boolean
.
FALSE
;
}
else
{
if
(
"sun.awt.HeadlessGraphicsEnvironment"
.
equals
(
System
.
getProperty
(
"java.awt.graphicsenv"
)))
String
osName
=
System
.
getProperty
(
"os.name"
);
if
(
osName
.
contains
(
"OS X"
)
&&
"sun.awt.HToolkit"
.
equals
(
System
.
getProperty
(
"awt.toolkit"
)))
{
headless
=
defaultHeadless
=
Boolean
.
TRUE
;
}
else
{
String
osName
=
System
.
getProperty
(
"os.name"
);
headless
=
defaultHeadless
=
Boolean
.
valueOf
((
"Linux"
.
equals
(
osName
)
||
"SunOS"
.
equals
(
osName
)
||
...
...
src/share/classes/java/awt/TextComponent.java
浏览文件 @
f0559fb6
...
...
@@ -235,9 +235,14 @@ public class TextComponent extends Component implements Accessible {
* @see java.awt.TextComponent#getText
*/
public
synchronized
void
setText
(
String
t
)
{
boolean
skipTextEvent
=
(
text
==
null
||
text
.
isEmpty
())
&&
(
t
==
null
||
t
.
isEmpty
());
text
=
(
t
!=
null
)
?
t
:
""
;
TextComponentPeer
peer
=
(
TextComponentPeer
)
this
.
peer
;
if
(
peer
!=
null
)
{
// Please note that we do not want to post an event
// if TextArea.setText() or TextField.setText() replaces an empty text
// by an empty text, that is, if component's text remains unchanged.
if
(
peer
!=
null
&&
!
skipTextEvent
)
{
peer
.
setText
(
text
);
}
}
...
...
src/share/classes/java/beans/IndexedPropertyDescriptor.java
浏览文件 @
f0559fb6
...
...
@@ -181,20 +181,21 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor {
// the Indexed readMethod was explicitly set to null.
return
null
;
}
String
nextMethodName
=
Introspector
.
GET_PREFIX
+
getBaseName
();
if
(
indexedReadMethodName
==
null
)
{
Class
<?>
type
=
getIndexedPropertyType0
();
if
(
type
==
boolean
.
class
||
type
==
null
)
{
indexedReadMethodName
=
Introspector
.
IS_PREFIX
+
getBaseName
();
}
else
{
indexedReadMethodName
=
Introspector
.
GET_PREFIX
+
getBaseName
()
;
indexedReadMethodName
=
nextMethodName
;
}
}
Class
<?>[]
args
=
{
int
.
class
};
indexedReadMethod
=
Introspector
.
findMethod
(
cls
,
indexedReadMethodName
,
1
,
args
);
if
(
indexedReadMethod
==
null
)
{
if
(
(
indexedReadMethod
==
null
)
&&
!
indexedReadMethodName
.
equals
(
nextMethodName
)
)
{
// no "is" method, so look for a "get" method.
indexedReadMethodName
=
Introspector
.
GET_PREFIX
+
getBaseName
()
;
indexedReadMethodName
=
nextMethodName
;
indexedReadMethod
=
Introspector
.
findMethod
(
cls
,
indexedReadMethodName
,
1
,
args
);
}
setIndexedReadMethod0
(
indexedReadMethod
);
...
...
src/share/classes/java/beans/Introspector.java
浏览文件 @
f0559fb6
...
...
@@ -25,6 +25,7 @@
package
java.beans
;
import
com.sun.beans.TypeResolver
;
import
com.sun.beans.WeakCache
;
import
com.sun.beans.finder.ClassFinder
;
...
...
@@ -34,6 +35,7 @@ import java.lang.ref.Reference;
import
java.lang.ref.SoftReference
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Modifier
;
import
java.lang.reflect.Type
;
import
java.util.Map
;
import
java.util.ArrayList
;
...
...
@@ -951,44 +953,61 @@ public class Introspector {
continue
;
}
Class
<?>[]
argTypes
=
FeatureDescriptor
.
getParameterTypes
(
beanClass
,
method
);
Class
<?>
resultType
=
FeatureDescriptor
.
getReturnType
(
beanClass
,
method
);
if
(
name
.
startsWith
(
ADD_PREFIX
)
&&
argTypes
.
length
==
1
&&
resultType
==
Void
.
TYPE
&&
Introspector
.
isSubclass
(
argTypes
[
0
],
eventListenerType
))
{
String
listenerName
=
name
.
substring
(
3
);
if
(
listenerName
.
length
()
>
0
&&
argTypes
[
0
].
getName
().
endsWith
(
listenerName
))
{
if
(
adds
==
null
)
{
adds
=
new
HashMap
<>();
if
(
name
.
startsWith
(
ADD_PREFIX
))
{
Class
<?>
returnType
=
method
.
getReturnType
();
if
(
returnType
==
void
.
class
)
{
Type
[]
parameterTypes
=
method
.
getGenericParameterTypes
();
if
(
parameterTypes
.
length
==
1
)
{
Class
<?>
type
=
TypeResolver
.
erase
(
TypeResolver
.
resolveInClass
(
beanClass
,
parameterTypes
[
0
]));
if
(
Introspector
.
isSubclass
(
type
,
eventListenerType
))
{
String
listenerName
=
name
.
substring
(
3
);
if
(
listenerName
.
length
()
>
0
&&
type
.
getName
().
endsWith
(
listenerName
))
{
if
(
adds
==
null
)
{
adds
=
new
HashMap
<>();
}
adds
.
put
(
listenerName
,
method
);
}
}
}
adds
.
put
(
listenerName
,
method
);
}
}
else
if
(
name
.
startsWith
(
REMOVE_PREFIX
)
&&
argTypes
.
length
==
1
&&
resultType
==
Void
.
TYPE
&&
Introspector
.
isSubclass
(
argTypes
[
0
],
eventListenerType
))
{
String
listenerName
=
name
.
substring
(
6
);
if
(
listenerName
.
length
()
>
0
&&
argTypes
[
0
].
getName
().
endsWith
(
listenerName
))
{
if
(
removes
==
null
)
{
removes
=
new
HashMap
<>();
else
if
(
name
.
startsWith
(
REMOVE_PREFIX
))
{
Class
<?>
returnType
=
method
.
getReturnType
();
if
(
returnType
==
void
.
class
)
{
Type
[]
parameterTypes
=
method
.
getGenericParameterTypes
();
if
(
parameterTypes
.
length
==
1
)
{
Class
<?>
type
=
TypeResolver
.
erase
(
TypeResolver
.
resolveInClass
(
beanClass
,
parameterTypes
[
0
]));
if
(
Introspector
.
isSubclass
(
type
,
eventListenerType
))
{
String
listenerName
=
name
.
substring
(
6
);
if
(
listenerName
.
length
()
>
0
&&
type
.
getName
().
endsWith
(
listenerName
))
{
if
(
removes
==
null
)
{
removes
=
new
HashMap
<>();
}
removes
.
put
(
listenerName
,
method
);
}
}
}
removes
.
put
(
listenerName
,
method
);
}
}
else
if
(
name
.
startsWith
(
GET_PREFIX
)
&&
argTypes
.
length
==
0
&&
resultType
.
isArray
()
&&
Introspector
.
isSubclass
(
resultType
.
getComponentType
(),
eventListenerType
))
{
String
listenerName
=
name
.
substring
(
3
,
name
.
length
()
-
1
);
if
(
listenerName
.
length
()
>
0
&&
resultType
.
getComponentType
().
getName
().
endsWith
(
listenerName
))
{
if
(
gets
==
null
)
{
gets
=
new
HashMap
<>();
else
if
(
name
.
startsWith
(
GET_PREFIX
))
{
Class
<?>[]
parameterTypes
=
method
.
getParameterTypes
();
if
(
parameterTypes
.
length
==
0
)
{
Class
<?>
returnType
=
FeatureDescriptor
.
getReturnType
(
beanClass
,
method
);
if
(
returnType
.
isArray
())
{
Class
<?>
type
=
returnType
.
getComponentType
();
if
(
Introspector
.
isSubclass
(
type
,
eventListenerType
))
{
String
listenerName
=
name
.
substring
(
3
,
name
.
length
()
-
1
);
if
(
listenerName
.
length
()
>
0
&&
type
.
getName
().
endsWith
(
listenerName
))
{
if
(
gets
==
null
)
{
gets
=
new
HashMap
<>();
}
gets
.
put
(
listenerName
,
method
);
}
}
}
gets
.
put
(
listenerName
,
method
);
}
}
}
...
...
@@ -1240,11 +1259,11 @@ public class Introspector {
private
boolean
isEventHandler
(
Method
m
)
{
// We assume that a method is an event handler if it has a single
// argument, whose type inherit from java.util.Event.
Class
argTypes
[]
=
FeatureDescriptor
.
getParameterTypes
(
beanClass
,
m
);
Type
argTypes
[]
=
m
.
getGenericParameterTypes
(
);
if
(
argTypes
.
length
!=
1
)
{
return
false
;
}
return
isSubclass
(
argTypes
[
0
]
,
EventObject
.
class
);
return
isSubclass
(
TypeResolver
.
erase
(
TypeResolver
.
resolveInClass
(
beanClass
,
argTypes
[
0
]))
,
EventObject
.
class
);
}
/*
...
...
@@ -1296,24 +1315,25 @@ public class Introspector {
}
// make sure method signature matches.
Class
params
[]
=
FeatureDescriptor
.
getParameterTypes
(
start
,
method
);
if
(
method
.
getName
().
equals
(
methodName
)
&&
params
.
length
==
argCount
)
{
if
(
args
!=
null
)
{
boolean
different
=
false
;
if
(
argCount
>
0
)
{
for
(
int
j
=
0
;
j
<
argCount
;
j
++)
{
if
(
params
[
j
]
!=
args
[
j
])
{
different
=
true
;
if
(
method
.
getName
().
equals
(
methodName
))
{
Type
[]
params
=
method
.
getGenericParameterTypes
();
if
(
params
.
length
==
argCount
)
{
if
(
args
!=
null
)
{
boolean
different
=
false
;
if
(
argCount
>
0
)
{
for
(
int
j
=
0
;
j
<
argCount
;
j
++)
{
if
(
TypeResolver
.
erase
(
TypeResolver
.
resolveInClass
(
start
,
params
[
j
]))
!=
args
[
j
])
{
different
=
true
;
continue
;
}
}
if
(
different
)
{
continue
;
}
}
if
(
different
)
{
continue
;
}
}
return
method
;
}
return
method
;
}
}
}
...
...
src/share/classes/java/beans/PropertyDescriptor.java
浏览文件 @
f0559fb6
...
...
@@ -210,12 +210,13 @@ public class PropertyDescriptor extends FeatureDescriptor {
// The read method was explicitly set to null.
return
null
;
}
String
nextMethodName
=
Introspector
.
GET_PREFIX
+
getBaseName
();
if
(
readMethodName
==
null
)
{
Class
<?>
type
=
getPropertyType0
();
if
(
type
==
boolean
.
class
||
type
==
null
)
{
readMethodName
=
Introspector
.
IS_PREFIX
+
getBaseName
();
}
else
{
readMethodName
=
Introspector
.
GET_PREFIX
+
getBaseName
()
;
readMethodName
=
nextMethodName
;
}
}
...
...
@@ -225,8 +226,8 @@ public class PropertyDescriptor extends FeatureDescriptor {
// methods. If an "is" method exists, this is the official
// reader method so look for this one first.
readMethod
=
Introspector
.
findMethod
(
cls
,
readMethodName
,
0
);
if
(
readMethod
==
null
)
{
readMethodName
=
Introspector
.
GET_PREFIX
+
getBaseName
()
;
if
(
(
readMethod
==
null
)
&&
!
readMethodName
.
equals
(
nextMethodName
)
)
{
readMethodName
=
nextMethodName
;
readMethod
=
Introspector
.
findMethod
(
cls
,
readMethodName
,
0
);
}
try
{
...
...
src/share/classes/javax/swing/TimerQueue.java
浏览文件 @
f0559fb6
...
...
@@ -187,6 +187,9 @@ class TimerQueue implements Runnable
addTimer
(
delayedTimer
);
}
}
// Allow run other threads on systems without kernel threads
timer
.
getLock
().
newCondition
().
awaitNanos
(
1
);
}
catch
(
SecurityException
ignore
)
{
}
finally
{
timer
.
getLock
().
unlock
();
...
...
src/share/classes/sun/misc/MetaIndex.java
浏览文件 @
f0559fb6
...
...
@@ -71,7 +71,6 @@ com/sun/jndi/
org/w3c/
com/sun/imageio/
javax/
sunw/util/
java/
sun/
...
...
...
src/share/classes/sunw/util/EventObject.java
已删除
100644 → 0
浏览文件 @
9bb2b2aa
/*
* Copyright (c) 1996, 2003, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/
package
sunw.util
;
/**
* FOR BACKWARD COMPATIBILITY ONLY - DO NOT USE.
* <p>
* This is a backwards compatibility class to allow Java Beans that
* were developed under JDK 1.0.2 to run correctly under JDK 1.1
* <p>
* To allow beans development under JDK 1.0.2, JavaSoft delivered three
* no-op interfaces/classes (sunw.io.Serializable, sunw.util.EventObject
* and sunw.util.EventListener) that could be downloaded into JDK 1.0.2
* systems and which would act as placeholders for the real JDK 1.1
* classes.
* <p>
* Now under JDK 1.1 we provide versions of these classes and interfaces
* that inherit from the real version in java.util and java.io. These
* mean that beans developed under JDK 1.0.2 against the sunw.* classes
* will now continue to work on JDK 1.1 and will (indirectly) inherit
* from the approrpiate java.* interfaces/classes.
*
* @deprecated This is a compatibility type to allow Java Beans that
* were developed under JDK 1.0.2 to run correctly under JDK 1.1. The
* corresponding JDK1.1 type is java.util.EventObject
*
* @see java.util.EventObject
*/
public
class
EventObject
extends
java
.
util
.
EventObject
{
private
static
final
long
serialVersionUID
=
6723767567830330255L
;
public
EventObject
(
Object
source
)
{
super
(
source
);
}
}
src/solaris/classes/sun/awt/X11/XTextAreaPeer.java
浏览文件 @
f0559fb6
...
...
@@ -463,13 +463,6 @@ class XTextAreaPeer extends XComponentPeer implements TextAreaPeer {
protected
boolean
setTextImpl
(
String
txt
)
{
if
(
jtext
!=
null
)
{
// Please note that we do not want to post an event
// if setText() replaces an empty text by an empty text,
// that is, if component's text remains unchanged.
if
(
jtext
.
getDocument
().
getLength
()
==
0
&&
txt
.
length
()
==
0
)
{
return
true
;
}
// JTextArea.setText() posts two different events (remove & insert).
// Since we make no differences between text events,
// the document listener has to be disabled while
...
...
src/solaris/native/java/lang/java_props_md.c
浏览文件 @
f0559fb6
...
...
@@ -431,6 +431,7 @@ GetJavaProperties(JNIEnv *env)
PreferredToolkit
prefToolkit
=
getPreferredToolkit
();
switch
(
prefToolkit
)
{
case
CToolkit
:
case
HToolkit
:
sprops
.
graphics_env
=
"sun.awt.CGraphicsEnvironment"
;
break
;
case
XToolkit
:
...
...
@@ -438,9 +439,6 @@ GetJavaProperties(JNIEnv *env)
sprops
.
graphics_env
=
"sun.awt.X11GraphicsEnvironment"
;
#ifdef MACOSX
break
;
default:
sprops
.
graphics_env
=
"sun.java2d.HeadlessGraphicsEnvironment"
;
break
;
}
#endif
/* AWT properties */
...
...
src/windows/native/sun/windows/awt_TextArea.cpp
浏览文件 @
f0559fb6
...
...
@@ -131,48 +131,13 @@ AwtTextArea::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) {
MsgRouting
mr
=
mrDoDefault
;
switch
(
message
)
{
case
WM_PRINTCLIENT
:
{
FORMATRANGE
fr
;
HDC
hPrinterDC
=
(
HDC
)
wParam
;
int
nHorizRes
=
::
GetDeviceCaps
(
hPrinterDC
,
HORZRES
);
int
nVertRes
=
::
GetDeviceCaps
(
hPrinterDC
,
VERTRES
);
int
nLogPixelsX
=
::
GetDeviceCaps
(
hPrinterDC
,
LOGPIXELSX
);
int
nLogPixelsY
=
::
GetDeviceCaps
(
hPrinterDC
,
LOGPIXELSY
);
// Ensure the printer DC is in MM_TEXT mode.
::
SetMapMode
(
hPrinterDC
,
MM_TEXT
);
// Rendering to the same DC we are measuring.
::
ZeroMemory
(
&
fr
,
sizeof
(
fr
));
fr
.
hdc
=
fr
.
hdcTarget
=
hPrinterDC
;
// Set up the page.
fr
.
rcPage
.
left
=
fr
.
rcPage
.
top
=
0
;
fr
.
rcPage
.
right
=
(
nHorizRes
/
nLogPixelsX
)
*
1440
;
// in twips
fr
.
rcPage
.
bottom
=
(
nVertRes
/
nLogPixelsY
)
*
1440
;
fr
.
rc
.
left
=
fr
.
rcPage
.
left
;
fr
.
rc
.
top
=
fr
.
rcPage
.
top
;
fr
.
rc
.
right
=
fr
.
rcPage
.
right
;
fr
.
rc
.
bottom
=
fr
.
rcPage
.
bottom
;
// start printing from the first visible line
LRESULT
nLine
=
SendMessage
(
EM_GETFIRSTVISIBLELINE
,
0
,
0
);
LONG
startCh
=
static_cast
<
LONG
>
(
SendMessage
(
EM_LINEINDEX
,
(
WPARAM
)
nLine
,
0
));
fr
.
chrg
.
cpMin
=
startCh
;
fr
.
chrg
.
cpMax
=
-
1
;
SendMessage
(
EM_FORMATRANGE
,
TRUE
,
(
LPARAM
)
&
fr
);
}
break
;
case
EM_SETCHARFORMAT
:
case
WM_SETFONT
:
SetIgnoreEnChange
(
TRUE
);
break
;
}
retValue
=
AwtComponent
::
WindowProc
(
message
,
wParam
,
lParam
);
retValue
=
Awt
Text
Component
::
WindowProc
(
message
,
wParam
,
lParam
);
switch
(
message
)
{
case
EM_SETCHARFORMAT
:
...
...
src/windows/native/sun/windows/awt_TextComponent.cpp
浏览文件 @
f0559fb6
...
...
@@ -215,6 +215,50 @@ done:
return
c
;
}
LRESULT
AwtTextComponent
::
WindowProc
(
UINT
message
,
WPARAM
wParam
,
LPARAM
lParam
)
{
switch
(
message
)
{
case
WM_PRINTCLIENT
:
{
FORMATRANGE
fr
;
HDC
hPrinterDC
=
(
HDC
)
wParam
;
int
nHorizRes
=
::
GetDeviceCaps
(
hPrinterDC
,
HORZRES
);
int
nVertRes
=
::
GetDeviceCaps
(
hPrinterDC
,
VERTRES
);
int
nLogPixelsX
=
::
GetDeviceCaps
(
hPrinterDC
,
LOGPIXELSX
);
int
nLogPixelsY
=
::
GetDeviceCaps
(
hPrinterDC
,
LOGPIXELSY
);
// Ensure the printer DC is in MM_TEXT mode.
::
SetMapMode
(
hPrinterDC
,
MM_TEXT
);
// Rendering to the same DC we are measuring.
::
ZeroMemory
(
&
fr
,
sizeof
(
fr
));
fr
.
hdc
=
fr
.
hdcTarget
=
hPrinterDC
;
// Set up the page.
fr
.
rcPage
.
left
=
fr
.
rcPage
.
top
=
0
;
fr
.
rcPage
.
right
=
(
nHorizRes
/
nLogPixelsX
)
*
1440
;
// in twips
fr
.
rcPage
.
bottom
=
(
nVertRes
/
nLogPixelsY
)
*
1440
;
fr
.
rc
.
left
=
fr
.
rcPage
.
left
;
fr
.
rc
.
top
=
fr
.
rcPage
.
top
;
fr
.
rc
.
right
=
fr
.
rcPage
.
right
;
fr
.
rc
.
bottom
=
fr
.
rcPage
.
bottom
;
// start printing from the first visible line
LRESULT
nLine
=
SendMessage
(
EM_GETFIRSTVISIBLELINE
,
0
,
0
);
LONG
startCh
=
static_cast
<
LONG
>
(
SendMessage
(
EM_LINEINDEX
,
(
WPARAM
)
nLine
,
0
));
fr
.
chrg
.
cpMin
=
startCh
;
fr
.
chrg
.
cpMax
=
-
1
;
SendMessage
(
EM_FORMATRANGE
,
TRUE
,
(
LPARAM
)
&
fr
);
}
break
;
}
return
AwtComponent
::
WindowProc
(
message
,
wParam
,
lParam
);
}
LONG
AwtTextComponent
::
EditGetCharFromPos
(
POINT
&
pt
)
{
return
static_cast
<
LONG
>
(
SendMessage
(
EM_CHARFROMPOS
,
0
,
reinterpret_cast
<
LPARAM
>
(
&
pt
)));
...
...
src/windows/native/sun/windows/awt_TextComponent.h
浏览文件 @
f0559fb6
...
...
@@ -50,6 +50,7 @@ public:
static
AwtTextComponent
*
Create
(
jobject
self
,
jobject
parent
,
BOOL
isMultiline
);
virtual
LPCTSTR
GetClassName
();
LRESULT
WindowProc
(
UINT
message
,
WPARAM
wParam
,
LPARAM
lParam
);
int
RemoveCR
(
WCHAR
*
pStr
);
...
...
test/java/awt/Focus/OverrideRedirectWindowActivationTest/OverrideRedirectWindowActivationTest.java
0 → 100644
浏览文件 @
f0559fb6
/*
* Copyright (c) 2012, 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 6385277
* @summary Tests that override redirect window gets activated on click.
* @author anton.tarasov@sun.com: area=awt.focus
* @library ../../regtesthelpers
* @build Util
* @run main OverrideRedirectWindowActivationTest
*/
import
java.awt.*
;
import
java.awt.event.*
;
import
java.util.concurrent.Callable
;
import
javax.swing.SwingUtilities
;
import
sun.awt.SunToolkit
;
import
test.java.awt.regtesthelpers.Util
;
public
class
OverrideRedirectWindowActivationTest
{
private
static
Frame
frame
;
private
static
Window
window
;
private
static
Button
fbutton
;
private
static
Button
wbutton
;
private
static
Label
label
;
private
static
Robot
robot
;
private
static
SunToolkit
toolkit
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
if
(
"sun.awt.motif.MToolkit"
.
equals
(
Toolkit
.
getDefaultToolkit
().
getClass
().
getName
()))
{
System
.
out
.
println
(
"No testing on Motif. Test passed."
);
return
;
}
toolkit
=
(
SunToolkit
)
Toolkit
.
getDefaultToolkit
();
robot
=
new
Robot
();
robot
.
setAutoDelay
(
50
);
Toolkit
.
getDefaultToolkit
().
addAWTEventListener
(
new
AWTEventListener
()
{
public
void
eventDispatched
(
AWTEvent
e
)
{
System
.
out
.
println
(
e
);
}
},
FocusEvent
.
FOCUS_EVENT_MASK
|
WindowEvent
.
WINDOW_FOCUS_EVENT_MASK
);
createAndShowWindow
();
toolkit
.
realSync
();
createAndShowFrame
();
toolkit
.
realSync
();
// click on Frame
clickOn
(
getClickPoint
(
frame
));
if
(!
frame
.
isFocused
())
{
throw
new
RuntimeException
(
"Error: a frame couldn't be focused by click."
);
}
//click on Label in Window
clickOn
(
getClickPoint
(
label
));
if
(!
window
.
isFocused
())
{
throw
new
RuntimeException
(
"Test failed: the window couldn't be activated by click!"
);
}
// bring focus back to the frame
clickOn
(
getClickPoint
(
fbutton
));
if
(!
frame
.
isFocused
())
{
throw
new
RuntimeException
(
"Error: a frame couldn't be focused by click."
);
}
// Test 2. Verifies that clicking on a component of unfocusable Window
// won't activate it.
window
.
setFocusableWindowState
(
false
);
toolkit
.
realSync
();
clickOn
(
getClickPoint
(
label
));
if
(
window
.
isFocused
())
{
throw
new
RuntimeException
(
"Test failed: unfocusable window got activated by click!"
);
}
System
.
out
.
println
(
"Test passed."
);
}
private
static
void
createAndShowWindow
()
{
frame
=
new
Frame
(
"Test Frame"
);
window
=
new
Window
(
frame
);
wbutton
=
new
Button
(
"wbutton"
);
label
=
new
Label
(
"label"
);
window
.
setBounds
(
800
,
200
,
200
,
100
);
window
.
setLayout
(
new
FlowLayout
());
window
.
add
(
wbutton
);
window
.
add
(
label
);
window
.
setVisible
(
true
);
}
private
static
void
createAndShowFrame
()
{
fbutton
=
new
Button
(
"fbutton"
);
frame
.
setBounds
(
800
,
0
,
200
,
100
);
frame
.
setLayout
(
new
FlowLayout
());
frame
.
add
(
fbutton
);
frame
.
setVisible
(
true
);
}
static
void
clickOn
(
Point
point
)
{
robot
.
mouseMove
(
point
.
x
,
point
.
y
);
robot
.
mousePress
(
InputEvent
.
BUTTON1_MASK
);
robot
.
mouseRelease
(
InputEvent
.
BUTTON1_MASK
);
toolkit
.
realSync
();
}
static
Point
getClickPoint
(
Component
c
)
{
Point
p
=
c
.
getLocationOnScreen
();
Dimension
d
=
c
.
getSize
();
return
new
Point
(
p
.
x
+
(
int
)
(
d
.
getWidth
()
/
2
),
p
.
y
+
(
int
)
(
d
.
getHeight
()
/
2
));
}
static
Point
getClickPoint
(
Frame
frame
)
{
Point
p
=
frame
.
getLocationOnScreen
();
Dimension
d
=
frame
.
getSize
();
return
new
Point
(
p
.
x
+
(
int
)
(
d
.
getWidth
()
/
2
),
p
.
y
+
(
frame
.
getInsets
().
top
/
2
));
}
}
test/java/awt/Window/Grab/GrabTest.java
0 → 100644
浏览文件 @
f0559fb6
/*
* Copyright (c) 2012, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 7124430
@summary Tests that SunToolkit.grab API works
@author anton.tarasov@oracle.com: area=awt.toolkit
@library ../../regtesthelpers
@build Util
@run main GrabTest
*/
import
java.awt.*
;
import
java.awt.event.*
;
import
test.java.awt.regtesthelpers.Util
;
public
class
GrabTest
{
private
static
Frame
f
;
private
static
Frame
f1
;
private
static
Window
w
;
private
static
Button
b
;
private
static
Robot
robot
;
private
static
sun
.
awt
.
SunToolkit
tk
;
static
volatile
boolean
ungrabbed
;
static
volatile
boolean
buttonPressed
;
static
volatile
boolean
windowPressed
;
static
volatile
boolean
framePressed
;
static
volatile
boolean
passed
=
true
;
public
static
void
main
(
String
[]
args
)
{
Toolkit
.
getDefaultToolkit
().
addAWTEventListener
(
new
AWTEventListener
()
{
public
void
eventDispatched
(
AWTEvent
e
)
{
System
.
out
.
println
(
e
);
if
(
e
instanceof
sun
.
awt
.
UngrabEvent
)
{
ungrabbed
=
true
;
}
}
},
sun
.
awt
.
SunToolkit
.
GRAB_EVENT_MASK
);
f
=
new
Frame
(
"Frame"
);
f
.
setBounds
(
0
,
0
,
300
,
300
);
f
.
addMouseListener
(
new
MouseAdapter
()
{
public
void
mousePressed
(
MouseEvent
e
)
{
System
.
out
.
println
(
e
);
framePressed
=
true
;
}
});
f1
=
new
Frame
(
"OtherFrame"
);
f1
.
setBounds
(
700
,
100
,
200
,
200
);
w
=
new
Window
(
f
);
w
.
setLayout
(
new
FlowLayout
());
b
=
new
Button
(
"Press"
);
b
.
addActionListener
(
new
ActionListener
()
{
public
void
actionPerformed
(
ActionEvent
e
)
{
System
.
out
.
println
(
e
);
buttonPressed
=
true
;
}
});
w
.
add
(
b
);
w
.
setBounds
(
400
,
100
,
200
,
200
);
w
.
setBackground
(
Color
.
blue
);
w
.
addMouseListener
(
new
MouseAdapter
()
{
public
void
mousePressed
(
MouseEvent
e
)
{
System
.
out
.
println
(
e
);
windowPressed
=
true
;
}
});
f
.
setVisible
(
true
);
w
.
setVisible
(
true
);
tk
=
(
sun
.
awt
.
SunToolkit
)
Toolkit
.
getDefaultToolkit
();
try
{
robot
=
new
Robot
();
}
catch
(
AWTException
ex
)
{
throw
new
RuntimeException
(
ex
);
}
Util
.
waitForIdle
(
robot
);
test
();
}
public
static
void
test
()
{
tk
.
grab
(
w
);
// 1. Check that button press doesn't cause ungrab
Util
.
clickOnComp
(
b
,
robot
);
Util
.
waitForIdle
(
robot
);
checkAndThrow
(
buttonPressed
,
"Error: Button can not be pressed"
);
if
(
ungrabbed
)
{
passed
=
false
;
tk
.
grab
(
w
);
System
.
err
.
println
(
"Failure: [1] Press inside of Window (on Button) caused ungrab"
);
}
// 2. Check that press on the window itself doesn't cause ungrab
Util
.
clickOnComp
(
w
,
robot
);
Util
.
waitForIdle
(
robot
);
checkAndThrow
(
windowPressed
,
"Error: Window can't be pressed"
);
if
(
ungrabbed
)
{
passed
=
false
;
tk
.
grab
(
w
);
System
.
err
.
println
(
"Failure: [2] Press inside of Window caused ungrab"
);
}
// 3. Check that press on the frame causes ungrab, event must be dispatched
Util
.
clickOnComp
(
f
,
robot
);
Util
.
waitForIdle
(
robot
);
checkAndThrow
(
framePressed
,
"Error: Frame can't be pressed"
);
if
(!
ungrabbed
)
{
passed
=
false
;
System
.
err
.
println
(
"Failure: [3] Press inside of Frame didn't cause ungrab"
);
}
ungrabbed
=
false
;
tk
.
grab
(
w
);
// 4. Check that press on the frame's title causes ungrab
Util
.
clickOnTitle
(
f
,
robot
);
Util
.
waitForIdle
(
robot
);
if
(!
ungrabbed
)
{
passed
=
false
;
System
.
err
.
println
(
"Failure: [4] Press inside of Frame's title didn't cause ungrab"
);
}
ungrabbed
=
false
;
tk
.
grab
(
w
);
// 5. Check that press on the other frame's title causes ungrab
f1
.
setVisible
(
true
);
Util
.
waitForIdle
(
robot
);
Util
.
clickOnTitle
(
f1
,
robot
);
if
(!
ungrabbed
)
{
passed
=
false
;
System
.
err
.
println
(
"Failure: [5] Press inside of other Frame's title didn't cause ungrab"
);
}
f
.
requestFocus
();
// restore focus
Util
.
waitForIdle
(
robot
);
if
(!
f
.
hasFocus
())
{
System
.
err
.
println
(
"Error: Frame can't be focused"
);
}
ungrabbed
=
false
;
tk
.
grab
(
w
);
// 6. Check that press on the outside area causes ungrab
Point
loc
=
f
.
getLocationOnScreen
();
robot
.
mouseMove
(
loc
.
x
+
100
,
loc
.
y
+
f
.
getSize
().
height
+
1
);
Util
.
waitForIdle
(
robot
);
robot
.
mousePress
(
InputEvent
.
BUTTON1_MASK
);
robot
.
delay
(
50
);
robot
.
mouseRelease
(
InputEvent
.
BUTTON1_MASK
);
Util
.
waitForIdle
(
robot
);
if
(!
ungrabbed
)
{
passed
=
false
;
System
.
err
.
println
(
"Failure: [6] Press on the outside area didn't cause ungrab"
);
}
ungrabbed
=
false
;
tk
.
grab
(
w
);
// 7. Check that disposing the window causes ungrab
w
.
dispose
();
Util
.
waitForIdle
(
robot
);
if
(!
ungrabbed
)
{
passed
=
false
;
System
.
err
.
println
(
"Failure: [7] Window disposal didn't cause ungrab"
);
}
if
(
passed
)
{
System
.
out
.
println
(
"Test passed."
);
}
else
{
throw
new
RuntimeException
(
"Test failed."
);
}
}
public
static
void
checkAndThrow
(
boolean
condition
,
String
msg
)
{
if
(!
condition
)
{
throw
new
RuntimeException
(
msg
);
}
}
}
test/java/awt/event/TextEvent/TextEventSequenceTest/TextEventSequenceTest.java
0 → 100644
浏览文件 @
f0559fb6
/*
* Copyright (c) 2012, 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 4028580
* @summary TextArea does not send TextEvent when setText. Does for insert
* @author kdm@sparc.spb.su: area= awt.TextAvent
* @run main TextEventSequenceTest
*/
import
java.awt.*
;
import
java.awt.event.*
;
import
sun.awt.SunToolkit
;
public
class
TextEventSequenceTest
{
private
static
Frame
f
;
private
static
TextField
tf
;
private
static
TextArea
t
;
private
static
int
cntEmptyStrings
=
0
;
private
static
int
cntNonEmptyStrings
=
0
;
public
static
void
main
(
String
[]
args
)
{
test
(
"non-empty text string"
);
test
(
""
);
test
(
null
);
}
private
static
void
test
(
String
test
)
{
SunToolkit
toolkit
=
(
SunToolkit
)
Toolkit
.
getDefaultToolkit
();
createAndShowGUI
(
test
);
toolkit
.
realSync
();
initCounts
();
t
.
setText
(
"Hello "
);
toolkit
.
realSync
();
t
.
append
(
"World! !"
);
toolkit
.
realSync
();
t
.
insert
(
"from Roger Pham"
,
13
);
toolkit
.
realSync
();
t
.
replaceRange
(
"Java Duke"
,
18
,
28
);
toolkit
.
realSync
();
checkCounts
(
0
,
4
);
initCounts
();
t
.
setText
(
""
);
toolkit
.
realSync
();
t
.
setText
(
""
);
toolkit
.
realSync
();
t
.
setText
(
""
);
toolkit
.
realSync
();
checkCounts
(
1
,
0
);
initCounts
();
tf
.
setText
(
"Hello There!"
);
toolkit
.
realSync
();
checkCounts
(
0
,
1
);
initCounts
();
tf
.
setText
(
""
);
toolkit
.
realSync
();
tf
.
setText
(
""
);
toolkit
.
realSync
();
tf
.
setText
(
""
);
toolkit
.
realSync
();
checkCounts
(
1
,
0
);
f
.
dispose
();
}
private
static
void
createAndShowGUI
(
String
text
)
{
f
=
new
Frame
(
"TextEventSequenceTest"
);
f
.
setLayout
(
new
FlowLayout
());
TextListener
listener
=
new
MyTextListener
();
tf
=
new
TextField
(
text
);
tf
.
addTextListener
(
listener
);
f
.
add
(
tf
);
t
=
new
TextArea
(
text
,
10
,
30
);
t
.
addTextListener
(
listener
);
f
.
add
(
t
);
f
.
pack
();
f
.
setVisible
(
true
);
}
static
class
MyTextListener
implements
TextListener
{
public
synchronized
void
textValueChanged
(
TextEvent
e
)
{
TextComponent
tc
=
(
TextComponent
)
e
.
getSource
();
String
text
=
tc
.
getText
();
if
(
text
.
length
()
==
0
)
{
cntEmptyStrings
++;
}
else
{
cntNonEmptyStrings
++;
}
}
}
synchronized
static
void
initCounts
()
{
cntEmptyStrings
=
0
;
cntNonEmptyStrings
=
0
;
}
synchronized
static
void
checkCounts
(
int
empty
,
int
nonempty
)
{
if
(
empty
!=
cntEmptyStrings
||
nonempty
!=
cntNonEmptyStrings
)
{
throw
new
RuntimeException
(
String
.
format
(
"Expected events: empty = %d, nonempty = %d, "
+
"actual events: empty = %d, nonempty = %d"
,
empty
,
nonempty
,
cntEmptyStrings
,
cntNonEmptyStrings
));
}
}
}
src/share/classes/sunw/util/EventListener
.java
→
test/java/beans/Performance/Test7122740
.java
浏览文件 @
f0559fb6
/*
* Copyright (c)
1996
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c)
2012
, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
* 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
...
...
@@ -23,32 +21,37 @@
* questions.
*/
package
sunw.util
;
/**
* FOR BACKWARD COMPATIBILITY ONLY - DO NOT USE.
* <p>
* This is a backwards compatibility class to allow Java Beans that
* were developed under JDK 1.0.2 to run correctly under JDK 1.1
* <p>
* To allow beans development under JDK 1.0.2, JavaSoft delivered three
* no-op interfaces/classes (sunw.io.Serializable, sunw.util.EventObject
* and sunw.util.EventListener) that could be downloaded into JDK 1.0.2
* systems and which would act as placeholders for the real JDK 1.1
* classes.
* <p>
* Now under JDK 1.1 we provide versions of these classes and interfaces
* that inherit from the real version in java.util and java.io. These
* mean that beans developed under JDK 1.0.2 against the sunw.* classes
* will now continue to work on JDK 1.1 and will (indirectly) inherit
* from the approrpiate java.* interfaces/classes.
*
* @deprecated This is a compatibility type to allow Java Beans that
* were developed under JDK 1.0.2 to run correctly under JDK 1.1. The
* corresponding JDK1.1 type is java.util.EventListener
*
* @see java.util.EventListener
/*
* @test
* @bug 7122740
* @summary Tests just a benchmark of PropertyDescriptor(String, Class) performance
* @author Sergey Malenkov
* @run main/manual Test7122740
*/
public
interface
EventListener
extends
java
.
util
.
EventListener
{
import
java.beans.PropertyDescriptor
;
public
class
Test7122740
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
long
time
=
System
.
nanoTime
();
for
(
int
i
=
0
;
i
<
1000
;
i
++)
{
new
PropertyDescriptor
(
"name"
,
PropertyDescriptor
.
class
);
new
PropertyDescriptor
(
"value"
,
Concrete
.
class
);
}
time
-=
System
.
nanoTime
();
System
.
out
.
println
(
"Time (ms): "
+
(-
time
/
1000000
));
}
public
static
class
Abstract
<
T
>
{
private
T
value
;
public
T
getValue
()
{
return
this
.
value
;
}
public
void
setValue
(
T
value
)
{
this
.
value
=
value
;
}
}
private
static
class
Concrete
extends
Abstract
<
String
>
{
}
}
src/share/classes/sunw/io/Serializable
.java
→
test/java/beans/Performance/Test7184799
.java
浏览文件 @
f0559fb6
/*
* Copyright (c)
1996, 1997
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c)
2012
, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
* 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
...
...
@@ -23,32 +21,51 @@
* questions.
*/
package
sunw.io
;
/**
* FOR BACKWARD COMPATIBILITY ONLY - DO NOT USE.
* <p>
* This is a backwards compatibility class to allow Java Beans that
* were developed under JDK 1.0.2 to run correctly under JDK 1.1
* <p>
* To allow beans development under JDK 1.0.2, JavaSoft delivered three
* no-op interfaces/classes (sunw.io.Serializable, sunw.util.EventObject
* and sunw.util.EventListener) that could be downloaded into JDK 1.0.2
* systems and which would act as placeholders for the real JDK 1.1
* classes.
* <p>
* Now under JDK 1.1 we provide versions of these classes and interfaces
* that inherit from the real version in java.util and java.io. These
* mean that beans developed under JDK 1.0.2 against the sunw.* classes
* will now continue to work on JDK 1.1 and will (indirectly) inherit
* from the appropriate java.* interfaces/classes.
*
* @deprecated This is a compatibility type to allow Java Beans that
* were developed under JDK 1.0.2 to run correctly under JDK 1.1. The
* corresponding JDK1.1 type is java.io.Serializable
*
* @see java.io.Serializable
/*
* @test
* @bug 7184799
* @summary Tests just a benchmark of Introspector.getBeanInfo(Class) performance
* @author Sergey Malenkov
* @run main/manual Test7184799
*/
public
interface
Serializable
extends
java
.
io
.
Serializable
{
import
java.beans.Introspector
;
import
java.util.*
;
import
java.util.concurrent.ConcurrentHashMap
;
public
class
Test7184799
{
private
static
final
Class
[]
TYPES
=
{
Class
.
class
,
String
.
class
,
Character
.
class
,
Boolean
.
class
,
Byte
.
class
,
Short
.
class
,
Integer
.
class
,
Long
.
class
,
Float
.
class
,
Double
.
class
,
Collection
.
class
,
Set
.
class
,
HashSet
.
class
,
TreeSet
.
class
,
LinkedHashSet
.
class
,
Map
.
class
,
HashMap
.
class
,
TreeMap
.
class
,
LinkedHashMap
.
class
,
WeakHashMap
.
class
,
ConcurrentHashMap
.
class
,
Dictionary
.
class
,
Exception
.
class
,
};
public
static
void
main
(
String
[]
args
)
throws
Exception
{
long
time
=
System
.
nanoTime
();
for
(
Class
type
:
TYPES
)
{
Introspector
.
getBeanInfo
(
type
);
}
time
-=
System
.
nanoTime
();
System
.
out
.
println
(
"Time (ms): "
+
(-
time
/
1000000
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录