5

I'm using Google Closure and Google Library with my projects and I'm meeting troubles with warnings.

My project is made of ~50 files with somme small warnings (JSDoc mistakes). The problem is Google Library, when I'm compiling my project, a huge list of warnings come from the google's library, like this :

../Libs/Closure/closure/goog/uri/utils.js:255: WARNING - inconsistent return type
found   : (null|string|undefined)
required: (null|string)
  return uri && decodeURIComponent(uri);
         ^

../Libs/Closure/closure/goog/uri/utils.js:634: WARNING - inconsistent return type
found   : (Array.<(string|undefined)>|undefined)
required: Array.<(string|undefined)>
  return buffer;
         ^

../Libs/Closure/closure/goog/uri/utils.js:671: WARNING - inconsistent return type
found   : (Array.<(string|undefined)>|undefined)
required: Array.<(string|undefined)>
  return buffer;
         ^

../Libs/Closure/third_party/closure/goog/mochikit/async/deferred.js:623: WARNING - assignment to property deferred of goog.async.Deferred.AlreadyCalledError
found   : (goog.async.Deferred|undefined)
required: (goog.async.Deferred|null)
  this.deferred = deferred;
  ^

../Libs/Closure/third_party/closure/goog/mochikit/async/deferred.js:651: WARNING - assignment to property deferred of goog.async.Deferred.CancelledError
found   : (goog.async.Deferred|undefined)
required: (goog.async.Deferred|null)
  this.deferred = deferred;
  ^

I've got more than 300 warnings from Google Library and ~50 from my project. So, how can I hide google's library warnings and show my project warnings ?

I've tried to build my project with the stable Google Library and with the last from the SVN repository but I've always all this warning.

My compilation configuration :

../Libs/Closure/closure/bin/build/closurebuilder.py \
--root=../Libs/Closure/ \
--root=../Projects/myProject/ \
--namespace="Project" \
--output_mode=compiled \
--compiler_jar=../Libs/Closure/compiler.jar \
--compiler_flags="--third_party=../Libs/Raphael/raphaeljs_extern.js" \
--compiler_flags="--compilation_level=SIMPLE_OPTIMIZATIONS" \
--compiler_flags="--warning_level=VERBOSE" \
> ../../Projects/js/project_release.js

Thanks for your time!

Louis
  • 51
  • 2

3 Answers3

2

To suppress all warning messages you should use:

--compiler_flags="--warning_level=QUIET"

instead of the verbose setting you currently have.

You may also want to check the grunt-closure-tools plugin for grunt that automates using closure's tools like the builder, compiler and depswritter.

thanpolas
  • 848
  • 1
  • 8
  • 20
0

You can use the @suppress tag in a file overview. http://code.google.com/p/closure-compiler/wiki/Warnings#@suppress_Tags

heff
  • 3,171
  • 1
  • 20
  • 21
0

Another way is using --warnings_whitelist_file. Though, it's kind of tricky to make it working as expected. See details here: Supressing or resolving compiler errors in goog.base

Community
  • 1
  • 1
real4x
  • 1,433
  • 12
  • 11