From f7220728078bbbe367f0af0d213a26044f7674b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Vr=C3=A1na?= Date: Tue, 10 Mar 2020 14:40:46 +0100 Subject: [PATCH] GUACAMOLE-986: Add non-nullable modifier to return type of functions never returning null Alternatively use a primitive type instead of nullable boxed type. --- .../src/main/webapp/modules/AudioPlayer.js | 8 ++++---- .../src/main/webapp/modules/AudioRecorder.js | 12 ++++++------ .../src/main/webapp/modules/BlobWriter.js | 2 +- .../src/main/webapp/modules/Client.js | 12 ++++++------ .../src/main/webapp/modules/Display.js | 18 +++++++++--------- .../src/main/webapp/modules/JSONReader.js | 2 +- .../src/main/webapp/modules/Keyboard.js | 12 ++++++------ .../src/main/webapp/modules/Layer.js | 4 ++-- .../src/main/webapp/modules/Mouse.js | 4 ++-- .../main/webapp/modules/OnScreenKeyboard.js | 8 ++++---- .../main/webapp/modules/SessionRecording.js | 4 ++-- .../src/main/webapp/modules/Status.js | 2 +- .../src/main/webapp/modules/StringReader.js | 2 +- .../src/main/webapp/modules/Tunnel.js | 6 +++--- .../src/main/webapp/modules/VideoPlayer.js | 4 ++-- 15 files changed, 50 insertions(+), 50 deletions(-) diff --git a/guacamole-common-js/src/main/webapp/modules/AudioPlayer.js b/guacamole-common-js/src/main/webapp/modules/AudioPlayer.js index 9cc6b3a3c..0097355f9 100644 --- a/guacamole-common-js/src/main/webapp/modules/AudioPlayer.js +++ b/guacamole-common-js/src/main/webapp/modules/AudioPlayer.js @@ -261,7 +261,7 @@ Guacamole.RawAudioPlayer = function RawAudioPlayer(stream, mimetype) { * @param {SampleArray} data * The audio packet to split. * - * @returns {SampleArray[]} + * @returns {!SampleArray[]} * An array of audio packets containing the result of splitting the * provided audio packet. If splitting is possible, this array will * contain two packets. If splitting is not possible, this array will @@ -371,7 +371,7 @@ Guacamole.RawAudioPlayer = function RawAudioPlayer(stream, mimetype) { * The raw audio packet that should be converted into a Web Audio API * AudioBuffer. * - * @returns {AudioBuffer} + * @returns {!AudioBuffer} * A new Web Audio API AudioBuffer containing the provided audio data, * converted to the format used by the Web Audio API. */ @@ -463,7 +463,7 @@ Guacamole.RawAudioPlayer.prototype = new Guacamole.AudioPlayer(); * @param {String} mimetype * The mimetype to check. * - * @returns {Boolean} + * @returns {boolean} * true if the given mimetype is supported by Guacamole.RawAudioPlayer, * false otherwise. */ @@ -485,7 +485,7 @@ Guacamole.RawAudioPlayer.isSupportedType = function isSupportedType(mimetype) { * additional parameters. Something like "audio/L8;rate=44100" would be valid, * however (see https://tools.ietf.org/html/rfc4856). * - * @returns {String[]} + * @returns {string[]} * A list of all mimetypes supported by Guacamole.RawAudioPlayer, excluding * any parameters. If the necessary JavaScript APIs for playing raw audio * are absent, this list will be empty. diff --git a/guacamole-common-js/src/main/webapp/modules/AudioRecorder.js b/guacamole-common-js/src/main/webapp/modules/AudioRecorder.js index 7a1df8be8..2f28ee6c9 100644 --- a/guacamole-common-js/src/main/webapp/modules/AudioRecorder.js +++ b/guacamole-common-js/src/main/webapp/modules/AudioRecorder.js @@ -278,7 +278,7 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) { * @param {Number} x * The point at which the normalized sinc function should be computed. * - * @returns {Number} + * @returns {number} * The value of the normalized sinc function at x. */ var sinc = function sinc(x) { @@ -305,7 +305,7 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) { * @param {Number} a * The window size to use for the Lanczos kernel. * - * @returns {Number} + * @returns {number} * The value of the Lanczos kernel at the given point for the given * window size. */ @@ -336,7 +336,7 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) { * 0 and 1 inclusive, where 0 represents the earliest point in time and * 1 represents the latest. * - * @returns {Number} + * @returns {number} * The value of the waveform at the given location. */ var interpolateSample = function getValueAt(audioData, t) { @@ -371,7 +371,7 @@ Guacamole.RawAudioRecorder = function RawAudioRecorder(stream, mimetype) { * The Web Audio API AudioBuffer that should be converted to a raw * audio packet. * - * @returns {SampleArray} + * @returns {!SampleArray} * A new raw audio packet containing the audio data from the provided * AudioBuffer. */ @@ -561,7 +561,7 @@ Guacamole.RawAudioRecorder.prototype = new Guacamole.AudioRecorder(); * @param {String} mimetype * The mimetype to check. * - * @returns {Boolean} + * @returns {boolean} * true if the given mimetype is supported by Guacamole.RawAudioRecorder, * false otherwise. */ @@ -583,7 +583,7 @@ Guacamole.RawAudioRecorder.isSupportedType = function isSupportedType(mimetype) * additional parameters. Something like "audio/L8;rate=44100" would be valid, * however (see https://tools.ietf.org/html/rfc4856). * - * @returns {String[]} + * @returns {string[]} * A list of all mimetypes supported by Guacamole.RawAudioRecorder, * excluding any parameters. If the necessary JavaScript APIs for recording * raw audio are absent, this list will be empty. diff --git a/guacamole-common-js/src/main/webapp/modules/BlobWriter.js b/guacamole-common-js/src/main/webapp/modules/BlobWriter.js index bcb422aeb..08213fdce 100644 --- a/guacamole-common-js/src/main/webapp/modules/BlobWriter.js +++ b/guacamole-common-js/src/main/webapp/modules/BlobWriter.js @@ -67,7 +67,7 @@ Guacamole.BlobWriter = function BlobWriter(stream) { * @param {Number} end * The ending offset of the slice, in bytes, exclusive. * - * @returns {Blob} + * @returns {!Blob} * A Blob containing the data within the given Blob starting at * start and ending at end - 1. */ diff --git a/guacamole-common-js/src/main/webapp/modules/Client.js b/guacamole-common-js/src/main/webapp/modules/Client.js index ed8085d29..bfc9be362 100644 --- a/guacamole-common-js/src/main/webapp/modules/Client.js +++ b/guacamole-common-js/src/main/webapp/modules/Client.js @@ -359,7 +359,7 @@ Guacamole.Client = function(tunnel) { * instruction which creates the stream, such as a "clipboard", "file", or * "pipe" instruction. * - * @returns {Guacamole.OutputStream} + * @returns {!Guacamole.OutputStream} * A new Guacamole.OutputStream with a newly-allocated index and * associated with this Guacamole.Client. */ @@ -383,7 +383,7 @@ Guacamole.Client = function(tunnel) { * The mimetype of the audio data that will be sent along the returned * stream. * - * @return {Guacamole.OutputStream} + * @return {!Guacamole.OutputStream} * The created audio stream. */ this.createAudioStream = function(mimetype) { @@ -402,7 +402,7 @@ Guacamole.Client = function(tunnel) { * * @param {String} mimetype The mimetype of the file being sent. * @param {String} filename The filename of the file being sent. - * @return {Guacamole.OutputStream} The created file stream. + * @return {!Guacamole.OutputStream} The created file stream. */ this.createFileStream = function(mimetype, filename) { @@ -419,7 +419,7 @@ Guacamole.Client = function(tunnel) { * * @param {String} mimetype The mimetype of the data being sent. * @param {String} name The name of the pipe. - * @return {Guacamole.OutputStream} The created file stream. + * @return {!Guacamole.OutputStream} The created file stream. */ this.createPipeStream = function(mimetype, name) { @@ -436,7 +436,7 @@ Guacamole.Client = function(tunnel) { * * @param {String} mimetype The mimetype of the data being sent. * @param {String} name The name of the pipe. - * @return {Guacamole.OutputStream} The created file stream. + * @return {!Guacamole.OutputStream} The created file stream. */ this.createClipboardStream = function(mimetype) { @@ -488,7 +488,7 @@ Guacamole.Client = function(tunnel) { * @param {String} name * The defined name of an output stream within the given object. * - * @returns {Guacamole.OutputStream} + * @returns {!Guacamole.OutputStream} * An output stream which will write blobs to the named output stream * of the given object. */ diff --git a/guacamole-common-js/src/main/webapp/modules/Display.js b/guacamole-common-js/src/main/webapp/modules/Display.js index 41f04c7b3..31c22aaa5 100644 --- a/guacamole-common-js/src/main/webapp/modules/Display.js +++ b/guacamole-common-js/src/main/webapp/modules/Display.js @@ -194,7 +194,7 @@ Guacamole.Display = function() { * Returns whether this frame is ready to be rendered. This function * returns true if and only if ALL underlying tasks are unblocked. * - * @returns {Boolean} true if all underlying tasks are unblocked, + * @returns {boolean} true if all underlying tasks are unblocked, * false otherwise. */ this.isReady = function() { @@ -282,7 +282,7 @@ Guacamole.Display = function() { * @private * @param {function} handler The function to call when possible, if any. * @param {boolean} blocked Whether the task should start blocked. - * @returns {Task} The Task created and added to the queue for future + * @returns {!Task} The Task created and added to the queue for future * running. */ function scheduleTask(handler, blocked) { @@ -294,7 +294,7 @@ Guacamole.Display = function() { /** * Returns the element which contains the Guacamole display. * - * @return {Element} The element containing the Guacamole display. + * @return {!Element} The element containing the Guacamole display. */ this.getElement = function() { return bounds; @@ -324,7 +324,7 @@ Guacamole.Display = function() { * this layer, but the default layer cannot be removed and is the absolute * ancestor of all other layers. * - * @return {Guacamole.Display.VisibleLayer} The default layer. + * @return {!Guacamole.Display.VisibleLayer} The default layer. */ this.getDefaultLayer = function() { return default_layer; @@ -335,7 +335,7 @@ Guacamole.Display = function() { * a layer for the image of the mouse cursor. This layer is a special case * and exists above all other layers, similar to the hardware mouse cursor. * - * @return {Guacamole.Display.VisibleLayer} The cursor layer. + * @return {!Guacamole.Display.VisibleLayer} The cursor layer. */ this.getCursorLayer = function() { return cursor; @@ -346,7 +346,7 @@ Guacamole.Display = function() { * layer, but can be moved to be a child of any other layer. Layers returned * by this function are visible. * - * @return {Guacamole.Display.VisibleLayer} The newly-created layer. + * @return {!Guacamole.Display.VisibleLayer} The newly-created layer. */ this.createLayer = function() { var layer = new Guacamole.Display.VisibleLayer(displayWidth, displayHeight); @@ -359,7 +359,7 @@ Guacamole.Display = function() { * are implemented in the same manner as layers, but do not provide the * same nesting semantics. * - * @return {Guacamole.Layer} The newly-created buffer. + * @return {!Guacamole.Layer} The newly-created buffer. */ this.createBuffer = function() { var buffer = new Guacamole.Layer(0, 0); @@ -1202,7 +1202,7 @@ Guacamole.Display = function() { * Returns a canvas element containing the entire display, with all child * layers composited within. * - * @return {HTMLCanvasElement} A new canvas element containing a copy of + * @return {!HTMLCanvasElement} A new canvas element containing a copy of * the display. */ this.flatten = function() { @@ -1400,7 +1400,7 @@ Guacamole.Display.VisibleLayer = function(width, height) { /** * Returns the element containing the canvas and any other elements * associated with this layer. - * @returns {Element} The element containing this layer's canvas. + * @returns {!Element} The element containing this layer's canvas. */ this.getElement = function() { return div; diff --git a/guacamole-common-js/src/main/webapp/modules/JSONReader.js b/guacamole-common-js/src/main/webapp/modules/JSONReader.js index 6d083b066..19b354df5 100644 --- a/guacamole-common-js/src/main/webapp/modules/JSONReader.js +++ b/guacamole-common-js/src/main/webapp/modules/JSONReader.js @@ -58,7 +58,7 @@ Guacamole.JSONReader = function guacamoleJSONReader(stream) { /** * Returns the current length of this Guacamole.JSONReader, in characters. * - * @return {Number} + * @return {!Number} * The current length of this Guacamole.JSONReader. */ this.getLength = function getLength() { diff --git a/guacamole-common-js/src/main/webapp/modules/Keyboard.js b/guacamole-common-js/src/main/webapp/modules/Keyboard.js index ead938f6d..c6b40eb7b 100644 --- a/guacamole-common-js/src/main/webapp/modules/Keyboard.js +++ b/guacamole-common-js/src/main/webapp/modules/Keyboard.js @@ -181,7 +181,7 @@ Guacamole.Keyboard = function Keyboard(element) { * Returns the number of milliseconds elapsed since this event was * received. * - * @return {Number} The number of milliseconds elapsed since this + * @return {!Number} The number of milliseconds elapsed since this * event was received. */ this.getAge = function() { @@ -693,7 +693,7 @@ Guacamole.Keyboard = function Keyboard(element) { * @param {Number} keysym * The keysym to check. * - * @returns {Boolean} + * @returns {boolean} * true if the given keysym corresponds to a printable character, * false otherwise. */ @@ -778,7 +778,7 @@ Guacamole.Keyboard = function Keyboard(element) { * @param {String} keyIdentifier * The legacy keyIdentifier from a browser keydown/keyup event. * - * @returns {Boolean} + * @returns {boolean} * true if the keyIdentifier looks sane, false if the keyIdentifier * appears incorrectly derived or is missing entirely. */ @@ -1046,7 +1046,7 @@ Guacamole.Keyboard = function Keyboard(element) { * inspection of other key events. * * @private - * @returns {Boolean} + * @returns {boolean} * true if all currently pressed keys were implicitly pressed, false * otherwise. */ @@ -1263,7 +1263,7 @@ Guacamole.Keyboard = function Keyboard(element) { * @param {Event} e * The Event to mark. * - * @returns {Boolean} + * @returns {boolean} * true if the given Event was successfully marked, false if the given * Event was already marked. */ @@ -1487,7 +1487,7 @@ Guacamole.Keyboard.ModifierState = function() { * Returns the modifier state applicable to the keyboard event given. * * @param {KeyboardEvent} e The keyboard event to read. - * @returns {Guacamole.Keyboard.ModifierState} The current state of keyboard + * @returns {!Guacamole.Keyboard.ModifierState} The current state of keyboard * modifiers. */ Guacamole.Keyboard.ModifierState.fromKeyboardEvent = function(e) { diff --git a/guacamole-common-js/src/main/webapp/modules/Layer.js b/guacamole-common-js/src/main/webapp/modules/Layer.js index cd87d8d1d..9561be423 100644 --- a/guacamole-common-js/src/main/webapp/modules/Layer.js +++ b/guacamole-common-js/src/main/webapp/modules/Layer.js @@ -271,7 +271,7 @@ Guacamole.Layer = function(width, height) { * of the canvas may not exactly match those of the Layer, as resizing a * canvas while maintaining its state is an expensive operation. * - * @returns {HTMLCanvasElement} + * @returns {!HTMLCanvasElement} * The canvas element backing this Layer. */ this.getCanvas = function getCanvas() { @@ -283,7 +283,7 @@ Guacamole.Layer = function(width, height) { * Unlike getCanvas(), the canvas element returned is guaranteed to have * the exact same dimensions as the Layer. * - * @returns {HTMLCanvasElement} + * @returns {!HTMLCanvasElement} * A new canvas element containing a copy of the image content this * Layer. */ diff --git a/guacamole-common-js/src/main/webapp/modules/Mouse.js b/guacamole-common-js/src/main/webapp/modules/Mouse.js index 48f81f010..e14ca2edc 100644 --- a/guacamole-common-js/src/main/webapp/modules/Mouse.js +++ b/guacamole-common-js/src/main/webapp/modules/Mouse.js @@ -375,7 +375,7 @@ Guacamole.Mouse = function(element) { * @param {HTMLCanvasElement} canvas The cursor image. * @param {Number} x The X-coordinate of the cursor hotspot. * @param {Number} y The Y-coordinate of the cursor hotspot. - * @return {Boolean} true if the cursor was successfully set, false if the + * @return {!Boolean} true if the cursor was successfully set, false if the * cursor could not be set for any reason. */ this.setCursor = function(canvas, x, y) { @@ -951,7 +951,7 @@ Guacamole.Mouse.Touchscreen = function(element) { * * @private * @param {TouchEvent} e The touch event to check. - * @return {Boolean} true if the movement threshold is exceeded, false + * @return {!Boolean} true if the movement threshold is exceeded, false * otherwise. */ function finger_moved(e) { diff --git a/guacamole-common-js/src/main/webapp/modules/OnScreenKeyboard.js b/guacamole-common-js/src/main/webapp/modules/OnScreenKeyboard.js index 4fe2ed7a9..f66779496 100644 --- a/guacamole-common-js/src/main/webapp/modules/OnScreenKeyboard.js +++ b/guacamole-common-js/src/main/webapp/modules/OnScreenKeyboard.js @@ -217,7 +217,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * @param {String[]} names * The names of all modifiers to test. * - * @returns {Boolean} + * @returns {boolean} * true if all specified modifiers are pressed, false otherwise. */ var modifiersPressed = function modifiersPressed(names) { @@ -428,7 +428,7 @@ Guacamole.OnScreenKeyboard = function(layout) { /** * Returns the element containing the entire on-screen keyboard. - * @returns {Element} The element containing the entire on-screen keyboard. + * @returns {!Element} The element containing the entire on-screen keyboard. */ this.getElement = function() { return keyboard; @@ -470,7 +470,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * which may be the title of the key (a string), the keysym (a number), * a single Key object, or an array of Key objects. * - * @returns {Guacamole.OnScreenKeyboard.Key[]} + * @returns {!Guacamole.OnScreenKeyboard.Key[]} * An array of all keys associated with the given name. */ var asKeyArray = function asKeyArray(name, object) { @@ -554,7 +554,7 @@ Guacamole.OnScreenKeyboard = function(layout) { * An arbitrary string representing the name of some component of the * on-screen keyboard. * - * @returns {String} + * @returns {string} * A string formatted for use as a CSS class name. */ var getCSSName = function getCSSName(name) { diff --git a/guacamole-common-js/src/main/webapp/modules/SessionRecording.js b/guacamole-common-js/src/main/webapp/modules/SessionRecording.js index 87be39c2e..b30fe467b 100644 --- a/guacamole-common-js/src/main/webapp/modules/SessionRecording.js +++ b/guacamole-common-js/src/main/webapp/modules/SessionRecording.js @@ -215,7 +215,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { * @param {Number} timestamp * The timestamp to convert to a relative timestamp. * - * @returns {Number} + * @returns {number} * The difference in milliseconds between the given timestamp and the * first frame of the recording, or zero if no frames yet exist. */ @@ -506,7 +506,7 @@ Guacamole.SessionRecording = function SessionRecording(tunnel) { /** * Returns whether playback is currently in progress. * - * @returns {Boolean} + * @returns {boolean} * true if playback is currently in progress, false otherwise. */ this.isPlaying = function isPlaying() { diff --git a/guacamole-common-js/src/main/webapp/modules/Status.js b/guacamole-common-js/src/main/webapp/modules/Status.js index 3acfd63c8..c831246fe 100644 --- a/guacamole-common-js/src/main/webapp/modules/Status.js +++ b/guacamole-common-js/src/main/webapp/modules/Status.js @@ -58,7 +58,7 @@ Guacamole.Status = function(code, message) { /** * Returns whether this status represents an error. - * @returns {Boolean} true if this status represents an error, false + * @returns {boolean} true if this status represents an error, false * otherwise. */ this.isError = function() { diff --git a/guacamole-common-js/src/main/webapp/modules/StringReader.js b/guacamole-common-js/src/main/webapp/modules/StringReader.js index fa42503e1..fb3125327 100644 --- a/guacamole-common-js/src/main/webapp/modules/StringReader.js +++ b/guacamole-common-js/src/main/webapp/modules/StringReader.js @@ -65,7 +65,7 @@ Guacamole.StringReader = function(stream) { * * @private * @param {ArrayBuffer} buffer Arbitrary UTF-8 data. - * @return {String} A decoded Unicode string. + * @return {string} A decoded Unicode string. */ function __decode_utf8(buffer) { diff --git a/guacamole-common-js/src/main/webapp/modules/Tunnel.js b/guacamole-common-js/src/main/webapp/modules/Tunnel.js index 149dce464..f84c6d067 100644 --- a/guacamole-common-js/src/main/webapp/modules/Tunnel.js +++ b/guacamole-common-js/src/main/webapp/modules/Tunnel.js @@ -76,7 +76,7 @@ Guacamole.Tunnel = function() { /** * Returns whether this tunnel is currently connected. * - * @returns {Boolean} + * @returns {boolean} * true if this tunnel is currently connected, false otherwise. */ this.isConnected = function isConnected() { @@ -389,7 +389,7 @@ Guacamole.HTTPTunnel = function(tunnelURL, crossDomain, extraTunnelHeaders) { * * @private * @param value The value to convert. - * @return {String} The converted value. + * @return {string} The converted value. */ function getElement(value) { var string = new String(value); @@ -911,7 +911,7 @@ Guacamole.WebSocketTunnel = function(tunnelURL) { * * @private * @param value The value to convert. - * @return {String} The converted value. + * @return {string} The converted value. */ function getElement(value) { var string = new String(value); diff --git a/guacamole-common-js/src/main/webapp/modules/VideoPlayer.js b/guacamole-common-js/src/main/webapp/modules/VideoPlayer.js index 9581d51af..641e06eb3 100644 --- a/guacamole-common-js/src/main/webapp/modules/VideoPlayer.js +++ b/guacamole-common-js/src/main/webapp/modules/VideoPlayer.js @@ -50,7 +50,7 @@ Guacamole.VideoPlayer = function VideoPlayer() { * @param {String} mimetype * The mimetype to check. * - * @returns {Boolean} + * @returns {boolean} * true if the given mimetype is supported by any built-in * Guacamole.VideoPlayer, false otherwise. */ @@ -68,7 +68,7 @@ Guacamole.VideoPlayer.isSupportedType = function isSupportedType(mimetype) { * mimetypes themselves will be listed. Any mimetype parameters, even required * ones, will not be included in the list. * - * @returns {String[]} + * @returns {string[]} * A list of all mimetypes supported by any built-in Guacamole.VideoPlayer, * excluding any parameters. */