<commit_before>package com.domingosuarez.diable;

import io.github.lukehutch.fastclasspathscanner.FastClasspathScanner;

import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

import static java.util.stream.Stream.of;

/**
 * Created by domix on 18/05/15.
 */
public class ProviderFactory {
  static List<Provider> registry = new ArrayList<>();

  static {
    new FastClasspathScanner().matchClassesImplementing(Provider.class, c -> {
      try {
        Provider provider = c.newInstance();
        registry.add(provider);
      } catch (InstantiationException e) {
        e.printStackTrace();
      } catch (IllegalAccessException e) {
        e.printStackTrace();
      }
    }).scan();<commit_msg>change a little the logic to register Providers<commit_after>package com.domingosuarez.diable;

import io.github.lukehutch.fastclasspathscanner.FastClasspathScanner;

import java.lang.Throwable;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

import static java.util.stream.Stream.of;

/**
 * Created by domix on 18/05/15.
 */
public class ProviderFactory {
  static List<com.domingosuarez.diable.Provider> registry = new ArrayList<>();

  static {
    /*new FastClasspathScanner().matchClassesImplementing(Provider.class, c -> {
      try {
        Provider provider = c.newInstance();
        registry.add(provider);
      } catch (InstantiationException e) {
        e.printStackTrace();
      } catch (IllegalAccessException e) {
        e.printStackTrace();
      }
    }).scan();*/

    FastClasspathScanner scanner = new FastClasspathScanner();
    scanner.scan();

    List<String> classesImplementingProvider = scanner.getClassesImplementing(com.domingosuarez.diable.Provider.class);

    System.out.println(classesImplementingProvider);

    classesImplementingProvider.forEach(providerClass -> {
      System.out.println("Provider found: " + providerClass);
      Class classProvider;

      try {
        classProvider = Class.forName(providerClass);
        com.domingosuarez.diable.Provider provider = (com.domingosuarez.diable.Provider) classProvider.newInstance();
        registry.add(provider);
        System.out.println("Provider registered.");
      } catch (Throwable exception) {
        exception.printStackTrace();
      }

    });
{'fraction_non_alphanumeric': 0.11397670549084858, 'fraction_numerical': 0.004991680532445923, 'mean_word_length': 3.625, 'pattern_counts': {'":': 0, '<': 8, '<?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': '4635631', 'n_tokens_mistral': 701, 'n_tokens_neox': 678, 'n_words': 129}