// Path: src/main/java/de/thetaphi/forbiddenapis/Checker.java
// public static enum Option {
//   FAIL_ON_MISSING_CLASSES,
//   FAIL_ON_VIOLATION,
//   FAIL_ON_UNRESOLVABLE_SIGNATURES,
//   IGNORE_SIGNATURES_OF_MISSING_CLASSES,
//   DISABLE_CLASSLOADING_CACHE
// }


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringReader;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.objectweb.asm.Type;
import org.objectweb.asm.commons.Method;
import de.thetaphi.forbiddenapis.Checker.Option;
    };
    
    private UnresolvableReporting(boolean reportClassNotFound) {
      this.reportClassNotFound = reportClassNotFound;
    }
    
    public final boolean reportClassNotFound;
    public abstract void parseFailed(Logger logger, String message, String signature) throws ParseException;
  }
  
  private final RelatedClassLookup lookup;
  private final Logger logger;
  private final boolean failOnUnresolvableSignatures, ignoreSignaturesOfMissingClasses;

  /** Key is used to lookup forbidden signature in following formats. Keys are generated by the corresponding
   * {@link #getKey(String)} (classes), {@link #getKey(String, Method)} (methods),
   * {@link #getKey(String, String)} (fields) call.
   */
  final Map<String,String> signatures = new HashMap<>();
  
  /** set of patterns of forbidden classes */
  final Set<ClassPatternRule> classPatterns = new LinkedHashSet<>();
  
  /** if enabled, the bundled signature to enable heuristics for detection of non-portable runtime calls is used */
  private boolean forbidNonPortableRuntime = false;
  
  /** number of files that were interpreted as signatures file. If 0, no (bundled) signatures files were added at all */
  private int numberOfFiles = 0;

  public Signatures(Checker checker) {
// Path: src/main/java/de/thetaphi/forbiddenapis/Checker.java
// public static enum Option {
//   FAIL_ON_MISSING_CLASSES,
//   FAIL_ON_VIOLATION,
//   FAIL_ON_UNRESOLVABLE_SIGNATURES,
//   IGNORE_SIGNATURES_OF_MISSING_CLASSES,
//   DISABLE_CLASSLOADING_CACHE
// }


// Path: src/main/java/de/thetaphi/forbiddenapis/Signatures.java
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringReader;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.objectweb.asm.Type;
import org.objectweb.asm.commons.Method;
import de.thetaphi.forbiddenapis.Checker.Option;

    };
    
    private UnresolvableReporting(boolean reportClassNotFound) {
      this.reportClassNotFound = reportClassNotFound;
    }
    
    public final boolean reportClassNotFound;
    public abstract void parseFailed(Logger logger, String message, String signature) throws ParseException;
  }
  
  private final RelatedClassLookup lookup;
  private final Logger logger;
  private final boolean failOnUnresolvableSignatures, ignoreSignaturesOfMissingClasses;

  /** Key is used to lookup forbidden signature in following formats. Keys are generated by the corresponding
   * {@link #getKey(String)} (classes), {@link #getKey(String, Method)} (methods),
   * {@link #getKey(String, String)} (fields) call.
   */
  final Map<String,String> signatures = new HashMap<>();
  
  /** set of patterns of forbidden classes */
  final Set<ClassPatternRule> classPatterns = new LinkedHashSet<>();
  
  /** if enabled, the bundled signature to enable heuristics for detection of non-portable runtime calls is used */
  private boolean forbidNonPortableRuntime = false;
  
  /** number of files that were interpreted as signatures file. If 0, no (bundled) signatures files were added at all */
  private int numberOfFiles = 0;

  public Signatures(Checker checker) {
    this(checker, checker.logger, checker.options.contains(Option.IGNORE_SIGNATURES_OF_MISSING_CLASSES), checker.options.contains(Option.FAIL_ON_UNRESOLVABLE_SIGNATURES));