You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@royale.apache.org by Harbs <ha...@gmail.com> on 2018/12/18 11:54:36 UTC

Exporting private getters

I just noticed that I have over 900 qualified variable names in my release app (com_printui_model_foo_baz etc.)

It seems like a significant number of them are due to private getters.

Why are we @exporting private getters in the JS output?

Harbs

Re: Exporting private getters

Posted by Harbs <ha...@gmail.com>.
[Bindable]private vars likewise end up with long qualified names.

> On Dec 18, 2018, at 1:54 PM, Harbs <ha...@gmail.com> wrote:
> 
> I just noticed that I have over 900 qualified variable names in my release app (com_printui_model_foo_baz etc.)
> 
> It seems like a significant number of them are due to private getters.
> 
> Why are we @exporting private getters in the JS output?
> 
> Harbs


Re: Exporting private getters

Posted by Alex Harui <ah...@adobe.com.INVALID>.
Many years ago, we chose to use Object.defineProperties for getter/setters.   Google Closure Compiler sees the Object structure and will not rename the keys in the structure and then will not rename property fetches used in prototype methods.  We might be able to take away the @export in the JSDoc, but I'm pretty sure it won't cause Closure Compiler to rename the keys.  Without preventing Closure Compiler from renaming keys, the property fetches in the prototype methods get different minified names than the keys in the structure and getter/setters don't work.

If you are worried about private property access, keep in mind that there really isn't such a thing in the JS we currently output.  If you are worried about obfuscation, I think even before we renamed private variables, the undecorated private variable name was not renamed in the production output.  If you are worried about download size now that private names are decorated, now that you've seen how formatPrivateNames is used in the compiler, maybe you can devise a shorter decoration scheme.

HTH,
-Alex

On 12/18/18, 3:54 AM, "Harbs" <ha...@gmail.com> wrote:

    I just noticed that I have over 900 qualified variable names in my release app (com_printui_model_foo_baz etc.)
    
    It seems like a significant number of them are due to private getters.
    
    Why are we @exporting private getters in the JS output?
    
    Harbs