<commit_before>package net.ssehub.kernel_haven.util;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.file.Files;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;

import net.ssehub.kernel_haven.util.null_checks.NonNull;

/**
 * <p>Utility class for loading and executing a static initialization method of all classes specified in
 * "loadClasses.txt" files. This mechanism allows plugins to dynamically set themselves up, without being hard-coded
 * in the infrastructure. This can be used to e.g. register handlers for certain factories.
 * </p>
 * <p>
 * The "loadClasses.txt" files can be located in any location accessible by the system class loader. They contain
 * one fully qualified class name per line. Empty lines (ignoring whitespace characters) and lines starting with a hash
 * (&#35;) are ignored. 
 * </p>
 * <p>
 * Classes that are specified in these files will be loaded (via {@link Class#forName(String)}) and the static
 * <code>public static void initialize()</code> method of the class will be called (if it is available).
 * </p>
 *
 * @author Adam
 */
public class StaticClassLoader {

    private static final Logger LOGGER = Logger.get();
    
    private static final String LOAD_CLASSES_FILENAME = "loadClasses.txt";
    
    private static final String INIT_METHOD_NAME = "initialize";

    /**
     * Don't allow any instances.
     */
    private StaticClassLoader() {
    }<commit_msg>Make constants in StaticClassLoader public<commit_after>package net.ssehub.kernel_haven.util;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.file.Files;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;

import net.ssehub.kernel_haven.util.null_checks.NonNull;

/**
 * <p>Utility class for loading and executing a static initialization method of all classes specified in
 * "loadClasses.txt" files. This mechanism allows plugins to dynamically set themselves up, without being hard-coded
 * in the infrastructure. This can be used to e.g. register handlers for certain factories.
 * </p>
 * <p>
 * The "loadClasses.txt" files can be located in any location accessible by the system class loader. They contain
 * one fully qualified class name per line. Empty lines (ignoring whitespace characters) and lines starting with a hash
 * (&#35;) are ignored. 
 * </p>
 * <p>
 * Classes that are specified in these files will be loaded (via {@link Class#forName(String)}) and the static
 * <code>public static void initialize()</code> method of the class will be called (if it is available).
 * </p>
 *
 * @author Adam
 */
public class StaticClassLoader {

    /**
     * The file name that text files that specify classes to load must have.
     */
    public static final String LOAD_CLASSES_FILENAME = "loadClasses.txt";
    
    /**
     * The method name that is called if it exists in the loaded classes. Must be public static void and take no
     * parameters. 
     */
    public static final String INIT_METHOD_NAME = "initialize";
    
    private static final Logger LOGGER = Logger.get();

    /**
     * Don't allow any instances.
     */
    private StaticClassLoader() {
    }
{'fraction_non_alphanumeric': 0.09210159084566007, 'fraction_numerical': 0.0011163829193413341, 'mean_word_length': 3.856368563685637, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2492387', 'n_tokens_mistral': 1028, 'n_tokens_neox': 986, 'n_words': 391}