diff --git a/jdk/src/share/classes/java/beans/Expression.java b/jdk/src/share/classes/java/beans/Expression.java
index 1eee7e1cb95..35761cae63b 100644
--- a/jdk/src/share/classes/java/beans/Expression.java
+++ b/jdk/src/share/classes/java/beans/Expression.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2000-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
@@ -51,12 +51,19 @@ public class Expression extends Statement {
private Object value = unbound;
/**
- * Creates a new Statement
object with a target
,
- * methodName
and arguments
as per the parameters.
+ * Creates a new {@link Expression} object
+ * for the specified target object to invoke the method
+ * specified by the name and by the array of arguments.
+ *
+ * The {@code target} and the {@code methodName} values should not be {@code null}.
+ * Otherwise an attempt to execute this {@code Expression}
+ * will result in a {@code NullPointerException}.
+ * If the {@code arguments} value is {@code null},
+ * an empty array is used as the value of the {@code arguments} property.
*
- * @param target The target of this expression.
- * @param methodName The methodName of this expression.
- * @param arguments The arguments of this expression. If null
then an empty array will be used.
+ * @param target the target object of this expression
+ * @param methodName the name of the method to invoke on the specified target
+ * @param arguments the array of arguments to invoke the specified method
*
* @see #getValue
*/
@@ -66,16 +73,23 @@ public class Expression extends Statement {
}
/**
- * Creates a new Expression
object for a method
- * that returns a result. The result will never be calculated
- * however, since this constructor uses the value
- * parameter to set the value property by calling the
- * setValue
method.
+ * Creates a new {@link Expression} object with the specified value
+ * for the specified target object to invoke the method
+ * specified by the name and by the array of arguments.
+ * The {@code value} value is used as the value of the {@code value} property,
+ * so the {@link #getValue} method will return it
+ * without executing this {@code Expression}.
+ *
+ * The {@code target} and the {@code methodName} values should not be {@code null}.
+ * Otherwise an attempt to execute this {@code Expression}
+ * will result in a {@code NullPointerException}.
+ * If the {@code arguments} value is {@code null},
+ * an empty array is used as the value of the {@code arguments} property.
*
- * @param value The value of this expression.
- * @param target The target of this expression.
- * @param methodName The methodName of this expression.
- * @param arguments The arguments of this expression. If null
then an empty array will be used.
+ * @param value the value of this expression
+ * @param target the target object of this expression
+ * @param methodName the name of the method to invoke on the specified target
+ * @param arguments the array of arguments to invoke the specified method
*
* @see #setValue
*/
diff --git a/jdk/src/share/classes/java/beans/Statement.java b/jdk/src/share/classes/java/beans/Statement.java
index 6169f92742f..f498f0b2fb4 100644
--- a/jdk/src/share/classes/java/beans/Statement.java
+++ b/jdk/src/share/classes/java/beans/Statement.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2000-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
@@ -69,13 +69,19 @@ public class Statement {
ClassLoader loader;
/**
- * Creates a new Statement
object with a target
,
- * methodName
and arguments
as per the parameters.
- *
- * @param target The target of this statement.
- * @param methodName The methodName of this statement.
- * @param arguments The arguments of this statement. If null
then an empty array will be used.
+ * Creates a new {@link Statement} object
+ * for the specified target object to invoke the method
+ * specified by the name and by the array of arguments.
+ *
+ * The {@code target} and the {@code methodName} values should not be {@code null}. + * Otherwise an attempt to execute this {@code Expression} + * will result in a {@code NullPointerException}. + * If the {@code arguments} value is {@code null}, + * an empty array is used as the value of the {@code arguments} property. * + * @param target the target object of this statement + * @param methodName the name of the method to invoke on the specified target + * @param arguments the array of arguments to invoke the specified method */ @ConstructorProperties({"target", "methodName", "arguments"}) public Statement(Object target, String methodName, Object[] arguments) { @@ -85,27 +91,36 @@ public class Statement { } /** - * Returns the target of this statement. + * Returns the target object of this statement. + * If this method returns {@code null}, + * the {@link #execute} method + * throws a {@code NullPointerException}. * - * @return The target of this statement. + * @return the target object of this statement */ public Object getTarget() { return target; } /** - * Returns the name of the method. + * Returns the name of the method to invoke. + * If this method returns {@code null}, + * the {@link #execute} method + * throws a {@code NullPointerException}. * - * @return The name of the method. + * @return the name of the method */ public String getMethodName() { return methodName; } /** - * Returns the arguments of this statement. + * Returns the arguments for the method to invoke. + * The number of arguments and their types + * must match the method being called. + * {@code null} can be used as a synonym of an empty array. * - * @return the arguments of this statement. + * @return the array of arguments */ public Object[] getArguments() { return arguments; @@ -154,6 +169,9 @@ public class Statement { } Object[] arguments = getArguments(); + if (arguments == null) { + arguments = emptyArray; + } // Class.forName() won't load classes outside // of core from a class inside core. Special // case this method. @@ -285,7 +303,9 @@ public class Statement { Object target = getTarget(); String methodName = getMethodName(); Object[] arguments = getArguments(); - + if (arguments == null) { + arguments = emptyArray; + } StringBuffer result = new StringBuffer(instanceName(target) + "." + methodName + "("); int n = arguments.length; for(int i = 0; i < n; i++) {