"incomplete alias created for namespace xxx" - incorrect and confusing warning

404 views
Skip to first unread message

Guido Tapia

unread,
Aug 20, 2013, 7:25:25 PM8/20/13
to closure-comp...@googlegroups.com
Hi All,

I've recently seen 2 of my projects start suffering from the following warnings:
"incomplete alias created for namespace xxx.yyy.zzz"

If I go into the file zzz.js and just change its name to zzz2 (so change all usages in the codebase from xxx.yyy.zzz -> xxx.yyy.zzz2) then the error goes away.  However, I want to stop having to randomly rename my classes to work around this issue.  Note, in one project the class xxx.yyy.zzz has always had the same name and its only after adding other files to the system that the compiler complains.  I can only assume this is because the dependency tree has changed.

Has anyone else encountered this issue??  Its actually really hard to reproduce, if I take the xxx.yyy.zzz file and put it in another project (and add references to it) the compiler works just fine.  This is whats stopping me raising an issue as I cannot fully describe the problem with a self contained code sample.

Anyone have a solution? Workaround?

I updated my compiler version today (to latest source code) and its still happening.

Tnx

Guido

John Lenz

unread,
Aug 20, 2013, 7:40:21 PM8/20/13
to closure-compiler
Are you not getting a source reference for where the compiler thinks the alias is being created?


--
 
---
You received this message because you are subscribed to the Google Groups "Closure Compiler Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to closure-compiler-d...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Guido Tapia

unread,
Aug 20, 2013, 9:23:34 PM8/20/13
to closure-comp...@googlegroups.com
Hi John,

This is the full compiler output (trimmed, but no warnings trimmed):

Note: If I rename the class below from pn.lrs.dal.Status -> pn.lrs.dal.Status2 no more warnings appear.

... misc compiler flags here..
--source_map_format=V3
Src\Status.js:16: WARNING - incomplete alias created for namespace pn.lrs.dal
pn.lrs.dal.Status = function(opt_data) {
^

Src\Status.js:51: WARNING - incomplete alias created for namespace pn.lrs.dal
goog.inherits(pn.lrs.dal.Status, pn.data.Entity);
              ^

Src\Status.js:58: WARNING - incomplete alias created for namespace pn.lrs.dal
    pn.lrs.dal.Status);
    ^

Src\Status.js:62: WARNING - incomplete alias created for namespace pn.lrs.dal
pn.lrs.dal.Status.prototype.getFieldSchema = function(name) {
^

Src\Status.js:102: WARNING - incomplete alias created for namespace pn.lrs.dal
pn.lrs.dal.Status.prototype.LRequest_StatusEntities =
^

Src\Status.js:115: WARNING - incomplete alias created for namespace pn.lrs.dal
pn.lrs.dal.Status.prototype.LRequest_LastSubmitedStatusEntities =
^

Src\Status.js:128: WARNING - incomplete alias created for namespace pn.lrs.dal
pn.lrs.dal.Status.prototype.LRequest_LastOutsourcedStatusEntities =
^

0 error(s), 7 warning(s), 97.6% typed
j:\libs\closure-library\closure\bin\build\closurebuilder.py: JavaScript compilation succeeded.

Nick Santos

unread,
Aug 20, 2013, 9:32:19 PM8/20/13
to closure-compiler

Are you exposing a property named Status?

--

Guido Tapia

unread,
Aug 20, 2013, 10:10:08 PM8/20/13
to closure-comp...@googlegroups.com
The warnings in the log above are for the class 'pn.lrs.dal.Status'  and yes several other classes have a 'Status' field/function (some even return pn.lrs.dal.Status from the Status function).

Note: This is not unique for Status, I have a pn.lrs.dal.User class and some other classes also have 'User' field/functions.

Do you think having a class named Status (even though its actually named pn.lrs.dal.Status) and a field called 'Status' is causing the compiler confusions??  This would explain why renaming to Status2 fixes the issue.

Nick Santos

unread,
Aug 20, 2013, 11:21:24 PM8/20/13
to closure-compiler
The @expose annotation causes the compiler to back off on large
numbers of optimizations, and is known to sometimes cause this warning
because it has backed off so much.

Guido Tapia

unread,
Aug 21, 2013, 1:13:47 AM8/21/13
to closure-comp...@googlegroups.com
Ahhhhhhh I use @expose quite heavily.  Maybe I'll try to remove my usage of expose.

Thanks Nick
Reply all
Reply to author
Forward
0 new messages