Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
98d108a2
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看板
提交
98d108a2
编写于
3月 11, 2010
作者:
M
malenkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6707226: java.beans.Statement & java.beans.Expression miss one important usecase
Reviewed-by: rupashka
上级
1be3e28e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
83 addition
and
6 deletion
+83
-6
src/share/classes/java/beans/Expression.java
src/share/classes/java/beans/Expression.java
+23
-0
src/share/classes/java/beans/Statement.java
src/share/classes/java/beans/Statement.java
+15
-6
test/java/beans/Statement/Test6707226.java
test/java/beans/Statement/Test6707226.java
+45
-0
未找到文件。
src/share/classes/java/beans/Expression.java
浏览文件 @
98d108a2
...
...
@@ -98,6 +98,29 @@ public class Expression extends Statement {
setValue
(
value
);
}
/**
* {@inheritDoc}
* <p>
* If the invoked method completes normally,
* the value it returns is copied in the {@code value} property.
* Note that the {@code value} property is set to {@code null},
* if the return type of the underlying method is {@code void}.
*
* @throws NullPointerException if the value of the {@code target} or
* {@code methodName} property is {@code null}
* @throws NoSuchMethodException if a matching method is not found
* @throws SecurityException if a security manager exists and
* it denies the method invocation
* @throws Exception that is thrown by the invoked method
*
* @see java.lang.reflect.Method
* @since 1.7
*/
@Override
public
void
execute
()
throws
Exception
{
setValue
(
invoke
());
}
/**
* If the value property of this instance is not already set,
* this method dynamically finds the method with the specified
...
...
src/share/classes/java/beans/Statement.java
浏览文件 @
98d108a2
...
...
@@ -127,8 +127,8 @@ public class Statement {
}
/**
* The
execute
method finds a method whose name is the same
* as the
methodName
property, and invokes the method on
* The
{@code execute}
method finds a method whose name is the same
* as the
{@code methodName}
property, and invokes the method on
* the target.
*
* When the target's class defines many methods with the given name
...
...
@@ -136,7 +136,7 @@ public class Statement {
* the algorithm specified in the Java Language Specification
* (15.11). The dynamic class of the target and arguments are used
* in place of the compile-time type information and, like the
*
<code>java.lang.reflect.Method</code>
class itself, conversion between
*
{@link java.lang.reflect.Method}
class itself, conversion between
* primitive values and their associated wrapper classes is handled
* internally.
* <p>
...
...
@@ -147,13 +147,22 @@ public class Statement {
* <li>
* The reserved method name "new" may be used to call a class's constructor
* as if all classes defined static "new" methods. Constructor invocations
* are typically considered
<code>Expression</code>s rather than <code>Statement</code>
s
* are typically considered
{@code Expression}s rather than {@code Statement}
s
* as they return a value.
* <li>
* The method names "get" and "set" defined in the
<code>java.util.List</code>
* The method names "get" and "set" defined in the
{@link java.util.List}
* interface may also be applied to array instances, mapping to
* the static methods of the same name in the
<code>Array</code>
class.
* the static methods of the same name in the
{@code Array}
class.
* </ul>
*
* @throws NullPointerException if the value of the {@code target} or
* {@code methodName} property is {@code null}
* @throws NoSuchMethodException if a matching method is not found
* @throws SecurityException if a security manager exists and
* it denies the method invocation
* @throws Exception that is thrown by the invoked method
*
* @see java.lang.reflect.Method
*/
public
void
execute
()
throws
Exception
{
invoke
();
...
...
test/java/beans/Statement/Test6707226.java
0 → 100644
浏览文件 @
98d108a2
/*
* Copyright 2010 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 6707226
* @summary Tests the value updating in Expression
* @author Sergey Malenkov
*/
import
java.beans.Expression
;
public
class
Test6707226
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Object
value
=
new
Object
();
Expression
expression
=
new
Expression
(
value
,
Object
.
class
,
"new"
,
null
);
if
(!
value
.
equals
(
expression
.
getValue
()))
throw
new
Error
(
"the value is updated unexpectedly"
);
expression
.
execute
();
if
(
value
.
equals
(
expression
.
getValue
()))
throw
new
Error
(
"the value is not updated as expected"
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录