com.google.javascript.jscomp
Class ComposeWarningsGuard

java.lang.Object
  extended by com.google.javascript.jscomp.WarningsGuard
      extended by com.google.javascript.jscomp.ComposeWarningsGuard
All Implemented Interfaces:
Serializable

public class ComposeWarningsGuard
extends WarningsGuard

WarningsGuard that represents just a chain of other guards. For example we could have following chain 1) all warnings outside of /foo/ should be suppressed 2) errors with key JSC_BAR should be marked as warning 3) the rest should be reported as error This class is designed for such behaviour.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.javascript.jscomp.WarningsGuard
WarningsGuard.Priority
 
Constructor Summary
ComposeWarningsGuard(List<WarningsGuard> guards)
           
ComposeWarningsGuard(WarningsGuard... guards)
           
 
Method Summary
 boolean disables(DiagnosticGroup group)
          Returns whether all warnings in the given diagnostic group will be filtered out.
 boolean enables(DiagnosticGroup group)
          Determines whether this guard will "elevate" the status of any disabled diagnostic type in the group to a warning or an error.
 CheckLevel level(JSError error)
          Returns a new check level for a given error.
 String toString()
           
 
Methods inherited from class com.google.javascript.jscomp.WarningsGuard
getPriority
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComposeWarningsGuard

public ComposeWarningsGuard(List<WarningsGuard> guards)

ComposeWarningsGuard

public ComposeWarningsGuard(WarningsGuard... guards)
Method Detail

level

public CheckLevel level(JSError error)
Description copied from class: WarningsGuard
Returns a new check level for a given error. OFF - suppress it, ERROR - report as error. null means that this guard does not know what to do with the error. Null is extremely helpful when you have a chain of guards. If current guard returns null, then the next in the chain should process it.

Specified by:
level in class WarningsGuard
Parameters:
error - a reported error.
Returns:
what level given error should have.

disables

public boolean disables(DiagnosticGroup group)
Description copied from class: WarningsGuard
Returns whether all warnings in the given diagnostic group will be filtered out. Used to determine which passes to skip.

Overrides:
disables in class WarningsGuard
Parameters:
group - A group of DiagnosticTypes.
Returns:
Whether all warnings of these types are disabled by this guard.

enables

public boolean enables(DiagnosticGroup group)
Determines whether this guard will "elevate" the status of any disabled diagnostic type in the group to a warning or an error.

Overrides:
enables in class WarningsGuard
Parameters:
group - A group of DiagnosticTypes.
Returns:
Whether any warnings of these types are enabled by this guard.

toString

public String toString()
Overrides:
toString in class Object