我在我的项目中使用 Google Closure 和 Google Library,但遇到了警告问题。
我的项目由大约 50 个带有一些小警告(JSDoc 错误)的文件组成。问题是谷歌图书馆,当我编译我的项目时,大量的警告来自谷歌的图书馆,就像这样:
../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;
^
我从谷歌图书馆收到了 300 多个警告,从我的项目中收到了大约 50 个警告。那么,如何隐藏 google 的库警告并显示我的项目警告?
我尝试使用稳定的 Google 库和 SVN 存储库中的最后一个来构建我的项目,但我总是收到所有这些警告。
我的编译配置:
../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
谢谢你的时间!