Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
cf2fc83f
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看板
提交
cf2fc83f
编写于
5月 20, 2010
作者:
M
malenkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6479191: LTP: XMLEncoder does not update initialized property of GridBagConstraints type
Reviewed-by: rupashka
上级
9d98d838
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
41 addition
and
104 deletion
+41
-104
src/share/classes/java/beans/DefaultPersistenceDelegate.java
src/share/classes/java/beans/DefaultPersistenceDelegate.java
+19
-0
src/share/classes/java/beans/MetaData.java
src/share/classes/java/beans/MetaData.java
+0
-98
src/share/classes/java/beans/XMLEncoder.java
src/share/classes/java/beans/XMLEncoder.java
+21
-4
test/java/beans/XMLEncoder/java_awt_GridBagConstraints.java
test/java/beans/XMLEncoder/java_awt_GridBagConstraints.java
+1
-2
未找到文件。
src/share/classes/java/beans/DefaultPersistenceDelegate.java
浏览文件 @
cf2fc83f
...
...
@@ -222,6 +222,25 @@ public class DefaultPersistenceDelegate extends PersistenceDelegate {
// Write out the properties of this instance.
private
void
initBean
(
Class
type
,
Object
oldInstance
,
Object
newInstance
,
Encoder
out
)
{
for
(
Field
field
:
type
.
getFields
())
{
int
mod
=
field
.
getModifiers
();
if
(
Modifier
.
isFinal
(
mod
)
||
Modifier
.
isStatic
(
mod
)
||
Modifier
.
isTransient
(
mod
))
{
continue
;
}
try
{
Expression
oldGetExp
=
new
Expression
(
field
,
"get"
,
new
Object
[]
{
oldInstance
});
Expression
newGetExp
=
new
Expression
(
field
,
"get"
,
new
Object
[]
{
newInstance
});
Object
oldValue
=
oldGetExp
.
getValue
();
Object
newValue
=
newGetExp
.
getValue
();
out
.
writeExpression
(
oldGetExp
);
if
(!
equals
(
newValue
,
out
.
get
(
oldValue
)))
{
out
.
writeStatement
(
new
Statement
(
field
,
"set"
,
new
Object
[]
{
oldInstance
,
oldValue
}));
}
}
catch
(
Exception
exception
)
{
out
.
getExceptionListener
().
exceptionThrown
(
exception
);
}
}
BeanInfo
info
;
try
{
info
=
Introspector
.
getBeanInfo
(
type
);
...
...
src/share/classes/java/beans/MetaData.java
浏览文件 @
cf2fc83f
...
...
@@ -700,56 +700,6 @@ class java_beans_beancontext_BeanContextSupport_PersistenceDelegate extends java
// AWT
/**
* The persistence delegate for {@link Dimension}.
* It is impossible to use {@link DefaultPersistenceDelegate}
* because all getters have return types that differ from parameter types
* of the constructor {@link Dimension#Dimension(int, int)}.
*
* @author Sergey A. Malenkov
*/
final
class
java_awt_Dimension_PersistenceDelegate
extends
PersistenceDelegate
{
protected
boolean
mutatesTo
(
Object
oldInstance
,
Object
newInstance
)
{
return
oldInstance
.
equals
(
newInstance
);
}
protected
Expression
instantiate
(
Object
oldInstance
,
Encoder
out
)
{
Dimension
dimension
=
(
Dimension
)
oldInstance
;
Object
[]
args
=
new
Object
[]
{
dimension
.
width
,
dimension
.
height
,
};
return
new
Expression
(
dimension
,
dimension
.
getClass
(),
"new"
,
args
);
}
}
/**
* The persistence delegate for {@link GridBagConstraints}.
* It is impossible to use {@link DefaultPersistenceDelegate}
* because this class does not have any properties.
*
* @author Sergey A. Malenkov
*/
final
class
java_awt_GridBagConstraints_PersistenceDelegate
extends
PersistenceDelegate
{
protected
Expression
instantiate
(
Object
oldInstance
,
Encoder
out
)
{
GridBagConstraints
gbc
=
(
GridBagConstraints
)
oldInstance
;
Object
[]
args
=
new
Object
[]
{
gbc
.
gridx
,
gbc
.
gridy
,
gbc
.
gridwidth
,
gbc
.
gridheight
,
gbc
.
weightx
,
gbc
.
weighty
,
gbc
.
anchor
,
gbc
.
fill
,
gbc
.
insets
,
gbc
.
ipadx
,
gbc
.
ipady
,
};
return
new
Expression
(
gbc
,
gbc
.
getClass
(),
"new"
,
args
);
}
}
/**
* The persistence delegate for {@link Insets}.
* It is impossible to use {@link DefaultPersistenceDelegate}
...
...
@@ -774,54 +724,6 @@ final class java_awt_Insets_PersistenceDelegate extends PersistenceDelegate {
}
}
/**
* The persistence delegate for {@link Point}.
* It is impossible to use {@link DefaultPersistenceDelegate}
* because all getters have return types that differ from parameter types
* of the constructor {@link Point#Point(int, int)}.
*
* @author Sergey A. Malenkov
*/
final
class
java_awt_Point_PersistenceDelegate
extends
PersistenceDelegate
{
protected
boolean
mutatesTo
(
Object
oldInstance
,
Object
newInstance
)
{
return
oldInstance
.
equals
(
newInstance
);
}
protected
Expression
instantiate
(
Object
oldInstance
,
Encoder
out
)
{
Point
point
=
(
Point
)
oldInstance
;
Object
[]
args
=
new
Object
[]
{
point
.
x
,
point
.
y
,
};
return
new
Expression
(
point
,
point
.
getClass
(),
"new"
,
args
);
}
}
/**
* The persistence delegate for {@link Rectangle}.
* It is impossible to use {@link DefaultPersistenceDelegate}
* because all getters have return types that differ from parameter types
* of the constructor {@link Rectangle#Rectangle(int, int, int, int)}.
*
* @author Sergey A. Malenkov
*/
final
class
java_awt_Rectangle_PersistenceDelegate
extends
PersistenceDelegate
{
protected
boolean
mutatesTo
(
Object
oldInstance
,
Object
newInstance
)
{
return
oldInstance
.
equals
(
newInstance
);
}
protected
Expression
instantiate
(
Object
oldInstance
,
Encoder
out
)
{
Rectangle
rectangle
=
(
Rectangle
)
oldInstance
;
Object
[]
args
=
new
Object
[]
{
rectangle
.
x
,
rectangle
.
y
,
rectangle
.
width
,
rectangle
.
height
,
};
return
new
Expression
(
rectangle
,
rectangle
.
getClass
(),
"new"
,
args
);
}
}
/**
* The persistence delegate for {@link Font}.
* It is impossible to use {@link DefaultPersistenceDelegate}
...
...
src/share/classes/java/beans/XMLEncoder.java
浏览文件 @
cf2fc83f
...
...
@@ -407,7 +407,20 @@ public class XMLEncoder extends Encoder {
os.writeObject(this);
*/
mark
(
oldStm
);
statementList
(
oldStm
.
getTarget
()).
add
(
oldStm
);
Object
target
=
oldStm
.
getTarget
();
if
(
target
instanceof
Field
)
{
String
method
=
oldStm
.
getMethodName
();
Object
[]
args
=
oldStm
.
getArguments
();
if
((
method
==
null
)
||
(
args
==
null
))
{
}
else
if
(
method
.
equals
(
"get"
)
&&
(
args
.
length
==
1
))
{
target
=
args
[
0
];
}
else
if
(
method
.
equals
(
"set"
)
&&
(
args
.
length
==
2
))
{
target
=
args
[
0
];
}
}
statementList
(
target
).
add
(
oldStm
);
}
catch
(
Exception
e
)
{
getExceptionListener
().
exceptionThrown
(
new
Exception
(
"XMLEncoder: discarding statement "
+
oldStm
,
e
));
...
...
@@ -703,7 +716,9 @@ public class XMLEncoder extends Encoder {
statements
.
add
(
exp
);
}
outputValue
(
target
,
outer
,
false
);
outputValue
(
value
,
outer
,
isArgument
);
if
(
expression
)
{
outputValue
(
value
,
outer
,
isArgument
);
}
return
;
}
if
(
expression
&&
(
d
.
refs
>
1
))
{
...
...
@@ -722,8 +737,10 @@ public class XMLEncoder extends Encoder {
}
else
if
((!
expression
&&
methodName
.
startsWith
(
"set"
)
&&
args
.
length
==
1
)
||
(
expression
&&
methodName
.
startsWith
(
"get"
)
&&
args
.
length
==
0
))
{
attributes
=
attributes
+
" property="
+
quote
(
Introspector
.
decapitalize
(
methodName
.
substring
(
3
)));
if
(
3
<
methodName
.
length
())
{
attributes
=
attributes
+
" property="
+
quote
(
Introspector
.
decapitalize
(
methodName
.
substring
(
3
)));
}
}
else
if
(!
methodName
.
equals
(
"new"
)
&&
!
methodName
.
equals
(
"newInstance"
))
{
attributes
=
attributes
+
" method="
+
quote
(
methodName
);
...
...
test/java/beans/XMLEncoder/java_awt_GridBagConstraints.java
浏览文件 @
cf2fc83f
...
...
@@ -55,7 +55,6 @@ public final class java_awt_GridBagConstraints extends AbstractTest<GridBagConst
}
protected
GridBagConstraints
getAnotherObject
()
{
return
null
;
// TODO: could not update property
// return new GridBagConstraints();
return
new
GridBagConstraints
();
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录