<commit_before>/*
 * Copyright (c) 2016 Mockito contributors
 * This program is made available under the terms of the MIT License.
 */
package org.mockito.internal.configuration.plugins;

import org.mockito.Mockito;
import org.mockito.internal.util.collections.Iterables;
import org.mockito.plugins.MockitoPlugins;
import org.mockito.plugins.PluginSwitch;

import java.io.IOException;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.net.URL;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;

class PluginLoader {

    private final MockitoPlugins plugins = Mockito.framework().getPlugins();

    private final PluginSwitch pluginSwitch;

    private final Map<String, String> alias;

    public PluginLoader(PluginSwitch pluginSwitch) {
        this.pluginSwitch = pluginSwitch;
        this.alias = new HashMap<String, String>();
    }

    /**
     * Adds an alias for a class name to this plugin loader. Instead of the fully qualified type name,
     * the alias can be used as a convenience name for a known plugin.
     */
    PluginLoader withAlias(String name, String type) {
        alias.put(name, type);
        return this;
    }

    /**
     * Scans the classpath for given pluginType. If not found, default class is used.
     */
    @SuppressWarnings("unchecked")
    <T> T loadPlugin(final Class<T> pluginType) {<commit_msg>Deprecated alias so that we don't add more<commit_after>/*
 * Copyright (c) 2016 Mockito contributors
 * This program is made available under the terms of the MIT License.
 */
package org.mockito.internal.configuration.plugins;

import org.mockito.Mockito;
import org.mockito.internal.util.collections.Iterables;
import org.mockito.plugins.MockitoPlugins;
import org.mockito.plugins.PluginSwitch;

import java.io.IOException;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.net.URL;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;

class PluginLoader {

    private final MockitoPlugins plugins = Mockito.framework().getPlugins();

    private final PluginSwitch pluginSwitch;

    private final Map<String, String> alias;

    public PluginLoader(PluginSwitch pluginSwitch) {
        this.pluginSwitch = pluginSwitch;
        this.alias = new HashMap<String, String>();
    }

    /**
     * @Deprecated Let's avoid adding more aliases. It complicates the API.
     * Instead of an alias, one just configure a different class name for the plugin.
     *
     * Adds an alias for a class name to this plugin loader. Instead of the fully qualified type name,
     * the alias can be used as a convenience name for a known plugin.
     */
    @Deprecated
    PluginLoader withAlias(String name, String type) {
        alias.put(name, type);
        return this;
    }

    /**
     * Scans the classpath for given pluginType. If not found, default class is used.
     */
    @SuppressWarnings("unchecked")
    <T> T loadPlugin(final Class<T> pluginType) {
{'fraction_non_alphanumeric': 0.08876694641704326, 'fraction_numerical': 0.0025823111684958036, 'mean_word_length': 3.5573529411764704, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '1221409', 'n_tokens_mistral': 877, 'n_tokens_neox': 849, 'n_words': 288}