< prev index next >

src/jdk/nashorn/internal/objects/Global.java

Print this page
rev 1359 : 8080598: Javadoc warnings in Global.java after lazy initialization
Reviewed-by: lagergren, hannesw

@@ -218,74 +218,114 @@
 
     /** ECMA 15.1.4.6 - Number constructor */
     @Property(name = "Number", attributes = Attribute.NOT_ENUMERABLE)
     public volatile Object number;
 
-    /** ECMA 15.1.4.7 Date constructor */
+    /**
+     * Getter for ECMA 15.1.4.7 Date property
+     *
+     * @param self self reference
+     * @return Date property value
+     */
     @Getter(name = "Date", attributes = Attribute.NOT_ENUMERABLE)
     public static Object getDate(final Object self) {
         final Global global = Global.instanceFrom(self);
         if (global.date == LAZY_SENTINEL) {
             global.date = global.getBuiltinDate();
         }
         return global.date;
     }
 
+    /**
+     * Setter for ECMA 15.1.4.7 Date property
+     *
+     * @param self self reference
+     * @param value value for the Date property
+     */
     @Setter(name = "Date", attributes = Attribute.NOT_ENUMERABLE)
     public static void setDate(final Object self, final Object value) {
         final Global global = Global.instanceFrom(self);
         global.date = value;
     }
 
     private volatile Object date = LAZY_SENTINEL;
 
-    /** ECMA 15.1.4.8 RegExp constructor */
+    /**
+     * Getter for ECMA 15.1.4.8 RegExp property
+     *
+     * @param self self reference
+     * @return RegExp property value
+     */
     @Getter(name = "RegExp", attributes = Attribute.NOT_ENUMERABLE)
     public static Object getRegExp(final Object self) {
         final Global global = Global.instanceFrom(self);
         if (global.regexp == LAZY_SENTINEL) {
             global.regexp = global.getBuiltinRegExp();
         }
         return global.regexp;
     }
 
+    /**
+     * Setter for ECMA 15.1.4.8 RegExp property
+     *
+     * @param self self reference
+     * @param value value for the RegExp property
+     */
     @Setter(name = "RegExp", attributes = Attribute.NOT_ENUMERABLE)
     public static void setRegExp(final Object self, final Object value) {
         final Global global = Global.instanceFrom(self);
         global.regexp = value;
     }
 
     private volatile Object regexp = LAZY_SENTINEL;
 
-    /** ECMA 15.12 - The JSON object */
+    /**
+     * Getter for ECMA 15.12 - The JSON property
+     * @param self self reference
+     * @return the value of JSON property
+     */
     @Getter(name = "JSON", attributes = Attribute.NOT_ENUMERABLE)
     public static Object getJSON(final Object self) {
         final Global global = Global.instanceFrom(self);
         if (global.json == LAZY_SENTINEL) {
             global.json = global.getBuiltinJSON();
         }
         return global.json;
     }
 
+    /**
+     * Setter for ECMA 15.12 - The JSON property
+     * @param self self reference
+     * @param value value for the JSON property
+     */
     @Setter(name = "JSON", attributes = Attribute.NOT_ENUMERABLE)
     public static void setJSON(final Object self, final Object value) {
         final Global global = Global.instanceFrom(self);
         global.json = value;
     }
 
     private volatile Object json = LAZY_SENTINEL;
 
-    /** Nashorn extension: global.JSAdapter */
+    /**
+     * Getter for Nashorn extension: global.JSAdapter
+     * @param self self reference
+     * @return value of the JSAdapter property
+     */
     @Getter(name = "JSAdapter", attributes = Attribute.NOT_ENUMERABLE)
     public static Object getJSAdapter(final Object self) {
         final Global global = Global.instanceFrom(self);
         if (global.jsadapter == LAZY_SENTINEL) {
             global.jsadapter = global.getBuiltinJSAdapter();
         }
         return global.jsadapter;
     }
 
+    /**
+     * Setter for Nashorn extension: global.JSAdapter
+     * @param self self reference
+     * @param value value for the JSAdapter property
+     */
     @Setter(name = "JSAdapter", attributes = Attribute.NOT_ENUMERABLE)
     public static void setJSAdapter(final Object self, final Object value) {
         final Global global = Global.instanceFrom(self);
         global.jsadapter = value;
     }

@@ -298,38 +338,57 @@
 
     /** Error object */
     @Property(name = "Error", attributes = Attribute.NOT_ENUMERABLE)
     public volatile Object error;
 
-    /** EvalError object */
+    /**
+     * Getter for the EvalError property
+     * @param self self reference
+     * @return the value of EvalError property
+     */
     @Getter(name = "EvalError", attributes = Attribute.NOT_ENUMERABLE)
     public static Object getEvalError(final Object self) {
         final Global global = Global.instanceFrom(self);
         if (global.evalError == LAZY_SENTINEL) {
             global.evalError = global.getBuiltinEvalError();
         }
         return global.evalError;
     }
 
+    /**
+     * Setter for the EvalError property
+     * @param self self reference
+     * @param value value of the EvalError property
+     */
     @Setter(name = "EvalError", attributes = Attribute.NOT_ENUMERABLE)
     public static void setEvalError(final Object self, final Object value) {
         final Global global = Global.instanceFrom(self);
         global.evalError = value;
     }
 
     private volatile Object evalError = LAZY_SENTINEL;
 
-    /** RangeError object */
+    /**
+     * Getter for the RangeError property.
+     * @param self self reference
+     * @return the value of RangeError property
+     */
     @Getter(name = "RangeError", attributes = Attribute.NOT_ENUMERABLE)
     public static Object getRangeError(final Object self) {
         final Global global = Global.instanceFrom(self);
         if (global.rangeError == LAZY_SENTINEL) {
             global.rangeError = global.getBuiltinRangeError();
         }
         return global.rangeError;
     }
 
+
+    /**
+     * Setter for the RangeError property.
+     * @param self self reference
+     * @param value value for the RangeError property
+     */
     @Setter(name = "RangeError", attributes = Attribute.NOT_ENUMERABLE)
     public static void setRangeError(final Object self, final Object value) {
         final Global global = Global.instanceFrom(self);
         global.rangeError = value;
     }

@@ -346,218 +405,337 @@
 
     /** TypeError object */
     @Property(name = "TypeError", attributes = Attribute.NOT_ENUMERABLE)
     public volatile Object typeError;
 
-    /** URIError object */
+    /**
+     * Getter for the URIError property.
+     * @param self self reference
+     * @return the value of URIError property
+     */
     @Getter(name = "URIError", attributes = Attribute.NOT_ENUMERABLE)
     public static Object getURIError(final Object self) {
         final Global global = Global.instanceFrom(self);
         if (global.uriError == LAZY_SENTINEL) {
             global.uriError = global.getBuiltinURIError();
         }
         return global.uriError;
     }
 
+    /**
+     * Setter for the URIError property.
+     * @param self self reference
+     * @param value value for the URIError property
+     */
     @Setter(name = "URIError", attributes = Attribute.NOT_ENUMERABLE)
     public static void setURIError(final Object self, final Object value) {
         final Global global = Global.instanceFrom(self);
         global.uriError = value;
     }
 
     private volatile Object uriError = LAZY_SENTINEL;
 
-    /** ArrayBuffer object */
+    /**
+     * Getter for the ArrayBuffer property.
+     * @param self self reference
+     * @return the value of the ArrayBuffer property
+     */
     @Getter(name = "ArrayBuffer", attributes = Attribute.NOT_ENUMERABLE)
     public static Object getArrayBuffer(final Object self) {
         final Global global = Global.instanceFrom(self);
         if (global.arrayBuffer == LAZY_SENTINEL) {
             global.arrayBuffer = global.getBuiltinArrayBuffer();
         }
         return global.arrayBuffer;
     }
 
+    /**
+     * Setter for the ArrayBuffer property.
+     * @param self self reference
+     * @param value value of the ArrayBuffer property
+     */
     @Setter(name = "ArrayBuffer", attributes = Attribute.NOT_ENUMERABLE)
     public static void setArrayBuffer(final Object self, final Object value) {
         final Global global = Global.instanceFrom(self);
         global.arrayBuffer = value;
     }
 
     private volatile Object arrayBuffer;
 
-    /** DataView object */
+    /**
+     * Getter for the DataView property.
+     * @param self self reference
+     * @return the value of the DataView property
+     */
     @Getter(name = "DataView", attributes = Attribute.NOT_ENUMERABLE)
     public static Object getDataView(final Object self) {
         final Global global = Global.instanceFrom(self);
         if (global.dataView == LAZY_SENTINEL) {
             global.dataView = global.getBuiltinDataView();
         }
         return global.dataView;
     }
 
+
+    /**
+     * Setter for the DataView property.
+     * @param self self reference
+     * @param value value of the DataView property
+     */
     @Setter(name = "DataView", attributes = Attribute.NOT_ENUMERABLE)
     public static void setDataView(final Object self, final Object value) {
         final Global global = Global.instanceFrom(self);
         global.dataView = value;
     }
 
     private volatile Object dataView;
 
-    /** TypedArray (int8) */
+    /**
+     * Getter for the Int8Array property.
+     * @param self self reference
+     * @return the value of the Int8Array property.
+     */
     @Getter(name = "Int8Array", attributes = Attribute.NOT_ENUMERABLE)
     public static Object getInt8Array(final Object self) {
         final Global global = Global.instanceFrom(self);
         if (global.int8Array == LAZY_SENTINEL) {
             global.int8Array = global.getBuiltinInt8Array();
         }
         return global.int8Array;
     }
 
+    /**
+     * Setter for the Int8Array property.
+     * @param self self reference
+     * @param value value of the Int8Array property
+     */
     @Setter(name = "Int8Array", attributes = Attribute.NOT_ENUMERABLE)
     public static void setInt8Array(final Object self, final Object value) {
         final Global global = Global.instanceFrom(self);
         global.int8Array = value;
     }
 
     private volatile Object int8Array;
 
-    /** TypedArray (uint8) */
+    /**
+     * Getter for the Uin8Array property.
+     * @param self self reference
+     * @return the value of the Uint8Array property
+     */
     @Getter(name = "Uint8Array", attributes = Attribute.NOT_ENUMERABLE)
     public static Object getUint8Array(final Object self) {
         final Global global = Global.instanceFrom(self);
         if (global.uint8Array == LAZY_SENTINEL) {
             global.uint8Array = global.getBuiltinUint8Array();
         }
         return global.uint8Array;
     }
 
+    /**
+     * Setter for the Uin8Array property.
+     * @param self self reference
+     * @param value value of the Uin8Array property
+     */
     @Setter(name = "Uint8Array", attributes = Attribute.NOT_ENUMERABLE)
     public static void setUint8Array(final Object self, final Object value) {
         final Global global = Global.instanceFrom(self);
         global.uint8Array = value;
     }
 
     private volatile Object uint8Array;
 
-    /** TypedArray (uint8) - Clamped */
+    /**
+     * Getter for the Uint8ClampedArray property.
+     * @param self self reference
+     * @return the value of the Uint8ClampedArray property
+     */
     @Getter(name = "Uint8ClampedArray", attributes = Attribute.NOT_ENUMERABLE)
     public static Object getUint8ClampedArray(final Object self) {
         final Global global = Global.instanceFrom(self);
         if (global.uint8ClampedArray == LAZY_SENTINEL) {
             global.uint8ClampedArray = global.getBuiltinUint8ClampedArray();
         }
         return global.uint8ClampedArray;
     }
 
+    /**
+     * Setter for the Uint8ClampedArray property.
+     * @param self self reference
+     * @param value value of the Uint8ClampedArray property
+     */
     @Setter(name = "Uint8ClampedArray", attributes = Attribute.NOT_ENUMERABLE)
     public static void setUint8ClampedArray(final Object self, final Object value) {
         final Global global = Global.instanceFrom(self);
         global.uint8ClampedArray = value;
     }
 
     private volatile Object uint8ClampedArray;
 
-    /** TypedArray (int16) */
+    /**
+     * Getter for the Int16Array property.
+     * @param self self reference
+     * @return the value of the Int16Array property
+     */
     @Getter(name = "Int16Array", attributes = Attribute.NOT_ENUMERABLE)
     public static Object getInt16Array(final Object self) {
         final Global global = Global.instanceFrom(self);
         if (global.int16Array == LAZY_SENTINEL) {
             global.int16Array = global.getBuiltinInt16Array();
         }
         return global.int16Array;
     }
 
+    /**
+     * Setter for the Int16Array property.
+     * @param self self reference
+     * @param value value of the Int16Array property
+     */
     @Setter(name = "Int16Array", attributes = Attribute.NOT_ENUMERABLE)
     public static void setInt16Array(final Object self, final Object value) {
         final Global global = Global.instanceFrom(self);
         global.int16Array = value;
     }
 
     private volatile Object int16Array;
 
-    /** TypedArray (uint16) */
+    /**
+     * Getter for the Uint16Array property.
+     * @param self self reference
+     * @return the value of the Uint16Array property
+     */
     @Getter(name = "Uint16Array", attributes = Attribute.NOT_ENUMERABLE)
     public static Object getUint16Array(final Object self) {
         final Global global = Global.instanceFrom(self);
         if (global.uint16Array == LAZY_SENTINEL) {
             global.uint16Array = global.getBuiltinUint16Array();
         }
         return global.uint16Array;
     }
 
+    /**
+     * Setter for the Uint16Array property.
+     * @param self self reference
+     * @param value value of the Uint16Array property
+     */
     @Setter(name = "Uint16Array", attributes = Attribute.NOT_ENUMERABLE)
     public static void setUint16Array(final Object self, final Object value) {
         final Global global = Global.instanceFrom(self);
         global.uint16Array = value;
     }
 
     private volatile Object uint16Array;
 
-    /** TypedArray (int32) */
+    /**
+     * Getter for the Int32Array property.
+     *
+     * @param self self reference
+     * @return the value of the Int32Array property
+     */
     @Getter(name = "Int32Array", attributes = Attribute.NOT_ENUMERABLE)
     public static Object getInt32Array(final Object self) {
         final Global global = Global.instanceFrom(self);
         if (global.int32Array == LAZY_SENTINEL) {
             global.int32Array = global.getBuiltinInt32Array();
         }
         return global.int32Array;
     }
 
+
+    /**
+     * Setter for the Int32Array property.
+     *
+     * @param self self reference
+     * @param value value of the Int32Array property
+     */
     @Setter(name = "Int32Array", attributes = Attribute.NOT_ENUMERABLE)
     public static void setInt32Array(final Object self, final Object value) {
         final Global global = Global.instanceFrom(self);
         global.int32Array = value;
     }
 
     private volatile Object int32Array;
 
-    /** TypedArray (uint32) */
+    /**
+     * Getter of the Uint32Array property.
+     *
+     * @param self self reference
+     * @return the value of the Uint32Array property
+     */
     @Getter(name = "Uint32Array", attributes = Attribute.NOT_ENUMERABLE)
     public static Object getUint32Array(final Object self) {
         final Global global = Global.instanceFrom(self);
         if (global.uint32Array == LAZY_SENTINEL) {
             global.uint32Array = global.getBuiltinUint32Array();
         }
         return global.uint32Array;
     }
 
+
+    /**
+     * Setter of the Uint32Array property.
+     *
+     * @param self self reference
+     * @param value value of the Uint32Array property
+     */
     @Setter(name = "Uint32Array", attributes = Attribute.NOT_ENUMERABLE)
     public static void setUint32Array(final Object self, final Object value) {
         final Global global = Global.instanceFrom(self);
         global.uint32Array = value;
     }
 
     private volatile Object uint32Array;
 
-    /** TypedArray (float32) */
+    /**
+     * Getter for the Float32Array property.
+     *
+     * @param self self reference
+     * @return the value of the Float32Array property
+     */
     @Getter(name = "Float32Array", attributes = Attribute.NOT_ENUMERABLE)
     public static Object getFloat32Array(final Object self) {
         final Global global = Global.instanceFrom(self);
         if (global.float32Array == LAZY_SENTINEL) {
             global.float32Array = global.getBuiltinFloat32Array();
         }
         return global.float32Array;
     }
 
+    /**
+     * Setter for the Float32Array property.
+     *
+     * @param self self reference
+     * @param value value of the Float32Array property
+     */
     @Setter(name = "Float32Array", attributes = Attribute.NOT_ENUMERABLE)
     public static void setFloat32Array(final Object self, final Object value) {
         final Global global = Global.instanceFrom(self);
         global.float32Array = value;
     }
 
     private volatile Object float32Array;
 
-    /** TypedArray (float64) */
+    /**
+     * Getter for the Float64Array property.
+     *
+     * @param self self reference
+     * @return the value of the Float64Array property
+     */
     @Getter(name = "Float64Array", attributes = Attribute.NOT_ENUMERABLE)
     public static Object getFloat64Array(final Object self) {
         final Global global = Global.instanceFrom(self);
         if (global.float64Array == LAZY_SENTINEL) {
             global.float64Array = global.getBuiltinFloat64Array();
         }
         return global.float64Array;
     }
 
+    /**
+     * Setter for the Float64Array property.
+     *
+     * @param self self reference
+     * @param value value of the Float64Array property
+     */
     @Setter(name = "Float64Array", attributes = Attribute.NOT_ENUMERABLE)
     public static void setFloat64Array(final Object self, final Object value) {
         final Global global = Global.instanceFrom(self);
         global.float64Array = value;
     }

@@ -590,38 +768,60 @@
 
     /** Nashorn extension: Java access - global.org */
     @Property(attributes = Attribute.NOT_ENUMERABLE)
     public volatile Object org;
 
-    /** Nashorn extension: Java access - global.javaImporter */
+    /**
+     * Getter for the Nashorn extension: Java access - global.javaImporter.
+     *
+     * @param self self reference
+     * @return the value of the JavaImporter property
+     */
     @Getter(name = "JavaImporter", attributes = Attribute.NOT_ENUMERABLE)
     public static Object getJavaImporter(final Object self) {
         final Global global = Global.instanceFrom(self);
         if (global.javaImporter == LAZY_SENTINEL) {
             global.javaImporter = global.getBuiltinJavaImporter();
         }
         return global.javaImporter;
     }
 
+    /**
+     * Setter for the Nashorn extension: Java access - global.javaImporter.
+     *
+     * @param self self reference
+     * @param value value of the JavaImporter property
+     */
     @Setter(name = "JavaImporter", attributes = Attribute.NOT_ENUMERABLE)
     public static void setJavaImporter(final Object self, final Object value) {
         final Global global = Global.instanceFrom(self);
         global.javaImporter = value;
     }
 
     private volatile Object javaImporter;
 
-    /** Nashorn extension: global.Java Object constructor. */
+    /**
+     * Getter for the Nashorn extension: global.Java property.
+     *
+     * @param self self reference
+     * @return the value of the Java property
+     */
     @Getter(name = "Java", attributes = Attribute.NOT_ENUMERABLE)
     public static Object getJavaApi(final Object self) {
         final Global global = Global.instanceFrom(self);
         if (global.javaApi == LAZY_SENTINEL) {
             global.javaApi = global.getBuiltinJavaApi();
         }
         return global.javaApi;
     }
 
+    /**
+     * Setter for the Nashorn extension: global.Java property.
+     *
+     * @param self self reference
+     * @param value value of the Java property
+     */
     @Setter(name = "Java", attributes = Attribute.NOT_ENUMERABLE)
     public static void setJavaApi(final Object self, final Object value) {
         final Global global = Global.instanceFrom(self);
         global.javaApi = value;
     }

@@ -2138,17 +2338,17 @@
     }
 
     @Override
     public void addBoundProperties(final ScriptObject source, final jdk.nashorn.internal.runtime.Property[] properties) {
         PropertyMap ownMap = getMap();
-        LexicalScope lexicalScope = null;
+        LexicalScope lexScope = null;
         PropertyMap lexicalMap = null;
         boolean hasLexicalDefinitions = false;
 
         if (context.getEnv()._es6) {
-            lexicalScope = (LexicalScope) getLexicalScope();
-            lexicalMap = lexicalScope.getMap();
+            lexScope = (LexicalScope) getLexicalScope();
+            lexicalMap = lexScope.getMap();
 
             for (final jdk.nashorn.internal.runtime.Property property : properties) {
                 if (property.isLexicalBinding()) {
                     hasLexicalDefinitions = true;
                 }

@@ -2164,12 +2364,12 @@
             }
         }
 
         for (final jdk.nashorn.internal.runtime.Property property : properties) {
             if (property.isLexicalBinding()) {
-                assert lexicalScope != null;
-                lexicalMap = lexicalScope.addBoundProperty(lexicalMap, source, property);
+                assert lexScope != null;
+                lexicalMap = lexScope.addBoundProperty(lexicalMap, source, property);
 
                 if (ownMap.findProperty(property.getKey()) != null) {
                     // If property exists in the global object invalidate any global constant call sites.
                     invalidateGlobalConstant(property.getKey());
                 }

@@ -2179,11 +2379,12 @@
         }
 
         setMap(ownMap);
 
         if (hasLexicalDefinitions) {
-            lexicalScope.setMap(lexicalMap);
+            assert lexScope != null;
+            lexScope.setMap(lexicalMap);
             invalidateLexicalSwitchPoint();
         }
     }
 
     @Override
< prev index next >