<commit_before>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package com.dumptruckman.minecraft.pluginbase.config;

import com.dumptruckman.minecraft.pluginbase.locale.Message;
import com.dumptruckman.minecraft.pluginbase.util.Logging;

import java.util.ArrayList;
import java.util.List;

class DefaultListConfigEntry<T> extends DefaultConfigEntry<T> implements ListConfigEntry<T> {

    private final Class<? extends List> listClass;
    private final List<T> defList;

    public DefaultListConfigEntry(Class<T> type, String path, List<T> def, List<String> comments,
                                  EntrySerializer<T> serializer, EntryValidator validator, Message description,
                                  boolean deprecated, boolean defaultIfMissing, Class<? extends List> listClass) {
        super(type, null, comments, serializer, validator, description, deprecated, defaultIfMissing);
        this.listClass = listClass;
        this.defList = def;
    }

    public List<T> getDefault() {
        return defList;
    }

    @Override
    public List<T> getNewTypeList() {
        try {
            return (List<T>) listClass.newInstance();
        } catch (InstantiationException e) {
            Logging.warning("Could not instantiate desired class, defaulting to ArrayList");
        } catch (IllegalAccessException e) {
            Logging.warning("Could not instantiate desired class, defaulting to ArrayList");
        }
        return new ArrayList<T>();
    }
}
<commit_msg>Fixed NPE caused by previous inheritance change.<commit_after>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package com.dumptruckman.minecraft.pluginbase.config;

import com.dumptruckman.minecraft.pluginbase.locale.Message;
import com.dumptruckman.minecraft.pluginbase.util.Logging;

import java.util.ArrayList;
import java.util.List;

class DefaultListConfigEntry<T> extends DefaultConfigEntry<T> implements ListConfigEntry<T> {

    private final Class<? extends List> listClass;
    private final List<T> defList;

    public DefaultListConfigEntry(Class<T> type, String path, List<T> def, List<String> comments,
                                  EntrySerializer<T> serializer, EntryValidator validator, Message description,
                                  boolean deprecated, boolean defaultIfMissing, Class<? extends List> listClass) {
        super(type, path, comments, serializer, validator, description, deprecated, defaultIfMissing);
        this.listClass = listClass;
        this.defList = def;
    }

    public List<T> getDefault() {
        return defList;
    }

    @Override
    public List<T> getNewTypeList() {
        try {
            return (List<T>) listClass.newInstance();
        } catch (InstantiationException e) {
            Logging.warning("Could not instantiate desired class, defaulting to ArrayList");
        } catch (IllegalAccessException e) {
            Logging.warning("Could not instantiate desired class, defaulting to ArrayList");
        }
        return new ArrayList<T>();
    }
}

{'fraction_non_alphanumeric': 0.09118086696562033, 'fraction_numerical': 0.002391629297458894, 'mean_word_length': 3.0410628019323673, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2897786', 'n_tokens_mistral': 903, 'n_tokens_neox': 885, 'n_words': 274}