google / closure-compiler

A JavaScript checker and optimizer.
https://developers.google.com/closure/compiler/
Apache License 2.0
7.4k stars 1.15k forks source link

Access flags ignored in externs file #295

Open blickly opened 10 years ago

blickly commented 10 years ago

This issue was imported from Closure Compiler's previous home at http://closure-compiler.googlecode.com

The original discussion is archived at: http://blickly.github.io/closure-compiler-issues/#852

Dominator008 commented 8 years ago

Repro:

Extern:

var ns = {};

/**
 * @constructor 
 * @private
 */
ns.Foo = function() {};

Code:

new ns.Foo();

Compile with

--jscomp_error=accessControls
--jscomp_error=visibility
--warning_level=VERBOSE

and saw no warning / error.

From @ChadKillingsworth: The workaround for is to mark the parent namespace with @const.