8071678: javax.script.ScriptContext setAttribute method should clarify behavior when GLOBAL_SCOPE is used and global scope object is null
authorsundar
Tue, 18 Oct 2016 17:15:11 +0530
changeset 41554 fc6a35a87a52
parent 41553 eb5002231dfa
child 41555 8a2a5a88376a
8071678: javax.script.ScriptContext setAttribute method should clarify behavior when GLOBAL_SCOPE is used and global scope object is null Reviewed-by: jlaskey, hannesw
jdk/src/java.scripting/share/classes/javax/script/ScriptContext.java
jdk/src/java.scripting/share/classes/javax/script/SimpleScriptContext.java
--- a/jdk/src/java.scripting/share/classes/javax/script/ScriptContext.java	Mon Oct 17 17:07:55 2016 -0700
+++ b/jdk/src/java.scripting/share/classes/javax/script/ScriptContext.java	Tue Oct 18 17:15:11 2016 +0530
@@ -85,7 +85,8 @@
     public Bindings getBindings(int scope);
 
     /**
-     * Sets the value of an attribute in a given scope.
+     * Sets the value of an attribute in a given scope. If the scope is <code>GLOBAL_SCOPE</code>
+     * and no Bindings is set for <code>GLOBAL_SCOPE</code>, then setAttribute call is a no-op.
      *
      * @param name The name of the attribute to set
      * @param value The value of the attribute
--- a/jdk/src/java.scripting/share/classes/javax/script/SimpleScriptContext.java	Mon Oct 17 17:07:55 2016 -0700
+++ b/jdk/src/java.scripting/share/classes/javax/script/SimpleScriptContext.java	Tue Oct 18 17:15:11 2016 +0530
@@ -213,7 +213,8 @@
     }
 
     /**
-     * Sets the value of an attribute in a given scope.
+     * Sets the value of an attribute in a given scope. If the scope is <code>GLOBAL_SCOPE</code>
+     * and no Bindings is set for <code>GLOBAL_SCOPE</code>, then setAttribute call is a no-op.
      *
      * @param name The name of the attribute to set
      * @param value The value of the attribute