/*
 * Copyright 2014 The Closure Compiler Authors.
 *
 * Licensed 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;

/**
 * Checks for combinations of options that are incompatible, i.e. will produce
 * incorrect code.
 */
final class CompilerOptionsValidator {
  /**
   * Checks for incompatible options.
   */
  static void validate(CompilerOptions options) {
    if (options.checkMissingGetCssNameLevel.isOn() &&
        (options.checkMissingGetCssNameBlacklist == null ||
            options.checkMissingGetCssNameBlacklist.isEmpty())) {
      throw new InvalidOptionsException(
          "Cannot check use of goog.getCssName because of empty blacklist.");
    }
  }

  /**
   * Exception to indicate incompatible options in the CompilerOptions.
   */
  public static class InvalidOptionsException extends RuntimeException {
    private InvalidOptionsException(String message) {
      super(message);
    }
  }

  // Don't instantiate.
  private CompilerOptionsValidator() {
  }
}


/*
 * Copyright 2014 The Closure Compiler Authors.
 *
 * Licensed 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;

/**
 * Checks for combinations of options that are incompatible, i.e. will produce
 * incorrect code.
 */
final class CompilerOptionsValidator {
  /**
   * Checks for incompatible options.
   * @author tbreisacher@google.com (Tyler Breisacher)
   */
  static void validate(CompilerOptions options) {
    if (options.checkMissingGetCssNameLevel.isOn() &&
        (options.checkMissingGetCssNameBlacklist == null ||
            options.checkMissingGetCssNameBlacklist.isEmpty())) {
      throw new InvalidOptionsException(
          "Cannot check use of goog.getCssName because of empty blacklist.");
    }
  }

  /**
   * Exception to indicate incompatible options in the CompilerOptions.
   */
  public static class InvalidOptionsException extends RuntimeException {
    private InvalidOptionsException(String message) {
      super(message);
    }
  }

  // Don't instantiate.
  private CompilerOptionsValidator() {
  }
}


Add author tag to CompilerOptionsValidator ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=62958597