I upgraded to 2021.3.3.3645_LTS and now the constructors have warnings.
For example the mod_dialogs “globals.DIALOGS.showErrorDialog()”. Seems that Servoy doesn’t recognizes the return values. Is this a bug or do I need to adjust the code?
var DIALOGS = new function() {
/**
* Show an error dialog
*
* @param {String} title
* @param {String} message
* @param {...String} buttons
* @return {String}
*
* @SuppressWarnings(wrongparameters)
*/
this.showErrorDialog = function(title, message, buttons) {
if (application.getApplicationType() == APPLICATION_TYPES.NG_CLIENT) {
return plugins.dialogs.showErrorDialog(title, message, getButtons(arguments));
}
return showDialog('dialogs_message', 'error', arguments, 'dialogs_icon_error');
}
}
upgraded from which release?
i guess you didn’t put the full source in right (so the js doc above that)
https://www.servoyforge.net/projects/mo … bals.js#L2
because that should be ok because there is a @constructor (or @parse)
see the release notes of 2020.06:
https://wiki.servoy.com/display/DOCS/2020.06+Whats+new
“All these changes in the ScriptBuilder did result in that we needed to drop the “none shallow parsing” mode that we still had as an option in the preferences.
This option is removed and now the your javascript files are always build in shallow parsing mode, this means that having @param and especially @return is quite important to have (besides @constructor and @parse for functions that needs to be fully parsed anyway)”
so things like that (globals.DIALOGS) must be marked as @parse (or @constructor)
then i think it should be fine
I see but it was only a code snipped and the JSDoc looks fine:
/**
* @constructor
*
* @description Dialog module - https://www.servoyforge.net/projects/mod-dialog
* @version 1.1.5
*
* Written by Robert J.C. Ivens and Paul Bakker
* OS dependent button-reverse patch by Harjo Kompagnie
*
* @properties={typeid:35,uuid:"EFF9564C-DBDB-4087-A9DF-A56826FE2CC7",variableType:-4}
*/
var DIALOGS = new function() {...
I’ve also seen this in my solutions.
Haven’t tried yet, but it could be that @constructor only works on functions, not on variables defined as functions.
Just out of interest: are you using the dialog module because you are still running a web-client solution?
NG/Titanium client would not require this anymore as there is a direct replacement for the dialogs plugin. ![Very Happy :D]()
Yes, Iam using Smart/Webclient. My solution is that big (abt. 150 modules) that there is currenctly no time to switch to NG.
It seems that there is a bug regarding scopes. I created a test constructor:
-
Call the constructor with scopes… gives warnings. No code completion
-
Call the constructor directly: Everything fine. Code completion works
you now tell it that it needs to parse the variable (or see the variable as a constructor) but that is not what it needs to parse:
var check = new /** @constructor */ function() {
this.updateRecord = function() {
}
}
Hi Johan,
Thanks for the clarification. That also fixed my problem for the mod_dialog. Perfect.