suppress some warnings
Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/3ff5c3c2 Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/3ff5c3c2 Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/3ff5c3c2 Branch: refs/heads/develop Commit: 3ff5c3c266960246a9905d32f0d5da5230ab9600 Parents: 0d2c3f3 Author: Alex Harui <aha...@apache.org> Authored: Mon Nov 17 17:09:00 2014 -0800 Committer: Alex Harui <aha...@apache.org> Committed: Fri Nov 21 14:58:15 2014 -0800 ---------------------------------------------------------------------- .../jscomp/FlexJSDiagnosticGroups.java | 40 ++++++++++++++++++++ .../utils/JSClosureCompilerWrapper.java | 6 +++ 2 files changed, 46 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3ff5c3c2/compiler.jx/src/com/google/javascript/jscomp/FlexJSDiagnosticGroups.java ---------------------------------------------------------------------- diff --git a/compiler.jx/src/com/google/javascript/jscomp/FlexJSDiagnosticGroups.java b/compiler.jx/src/com/google/javascript/jscomp/FlexJSDiagnosticGroups.java new file mode 100644 index 0000000..e28c8df --- /dev/null +++ b/compiler.jx/src/com/google/javascript/jscomp/FlexJSDiagnosticGroups.java @@ -0,0 +1,40 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.google.javascript.jscomp; + +/** + * Custom DiagnosticGroups allow @suppress directives to disable + * certain warnings while letting other warnings in the group + * show. + */ +public class FlexJSDiagnosticGroups { + + /** + * Flex ItemRenderer Factories store the constructor in a variable + * resulting in this warning. + */ + public static final DiagnosticGroup FLEXJS_NOT_A_CONSTRUCTOR = + DiagnosticGroups.registerGroup("flexjsNotAConstructor", + TypeCheck.NOT_A_CONSTRUCTOR); + + public static final DiagnosticGroup FLEXJS_REFERENCE_BEFORE_DECLARE = + DiagnosticGroups.registerGroup("flexjsReferenceBeforeDeclare", + VariableReferenceCheck.UNDECLARED_REFERENCE); +} http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/3ff5c3c2/compiler.jx/src/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java ---------------------------------------------------------------------- diff --git a/compiler.jx/src/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java b/compiler.jx/src/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java index 6f3543d..e8bfb8c 100644 --- a/compiler.jx/src/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java +++ b/compiler.jx/src/org/apache/flex/compiler/utils/JSClosureCompilerWrapper.java @@ -32,6 +32,7 @@ import com.google.javascript.jscomp.CompilationLevel; import com.google.javascript.jscomp.Compiler; import com.google.javascript.jscomp.CompilerOptions; import com.google.javascript.jscomp.DiagnosticGroups; +import com.google.javascript.jscomp.FlexJSDiagnosticGroups; import com.google.javascript.jscomp.SourceFile; import com.google.javascript.jscomp.SourceMap; import com.google.javascript.jscomp.WarningLevel; @@ -230,6 +231,11 @@ public class JSClosureCompilerWrapper options_.setWarningLevel(DiagnosticGroups.UNNECESSARY_CASTS, CheckLevel.OFF); // OFF options_.setWarningLevel(DiagnosticGroups.USE_OF_GOOG_BASE, CheckLevel.WARNING); options_.setWarningLevel(DiagnosticGroups.VIOLATED_MODULE_DEP, CheckLevel.WARNING); + + // create custom DiagnosticGroups to shut off some individual warnings when we + // still want warnings for others in the group. + options_.setWarningLevel(FlexJSDiagnosticGroups.FLEXJS_NOT_A_CONSTRUCTOR, CheckLevel.OFF); + options_.setWarningLevel(FlexJSDiagnosticGroups.FLEXJS_REFERENCE_BEFORE_DECLARE, CheckLevel.OFF); } options_.sourceMapFormat = SourceMap.Format.V3;