<commit_before>package com.github.igorperikov.hollow;

import io.github.lukehutch.fastclasspathscanner.FastClasspathScanner;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.*;

public class ClassExtractorUtility {

    public static Collection<Class<?>> extractClasses(
            MavenProject project,
            List<String> packagesToScan
    )
            throws MojoExecutionException
    {
        Set<Class<?>> classes = new HashSet<>();
        ClassLoader projectClassloader = getProjectClassloader(project);

        FastClasspathScanner scanner =
                new FastClasspathScanner(packagesToScan.toArray(new String[packagesToScan.size()])).addClassLoader(projectClassloader);
        List<String> classNames = scanner.scan().getNamesOfAllClasses();
        for (String className : classNames) {
            try {
                classes.add(Class.forName(className, false, projectClassloader));
            } catch (ClassNotFoundException e) {
                throw new MojoExecutionException("Couldn't add class " + className + " to the set of classes for some reason", e);
            }
        }
        return classes;
    }

    private static ClassLoader getProjectClassloader(MavenProject project) {
        List<String> classpathElements;
        try {
            classpathElements = project.getCompileClasspathElements();
            List<URL> projectClasspathList = new ArrayList<>();
            for (String element : classpathElements) {
                try {
                    projectClasspathList.add(new File(element).toURI().toURL());
                } catch (MalformedURLException e) {
                    throw new MojoExecutionException(element + " is an invalid classpath element", e);
                }
            }

            return URLClassLoader.newInstance(
                    projectClasspathList.toArray(new URL[0]),
                    Thread.currentThread().getContextClassLoader()
            );

        } catch (Exception e) {
            throw new RuntimeException("Dependency resolution failed", e);
        }
    }
}<commit_msg>dont generate api for annotations or interfaces<commit_after>package com.github.igorperikov.hollow;

import io.github.lukehutch.fastclasspathscanner.FastClasspathScanner;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.*;

public class ClassExtractorUtility {

    public static Collection<Class<?>> extractClasses(
            MavenProject project,
            List<String> packagesToScan
    )
            throws MojoExecutionException
    {
        Set<Class<?>> classes = new HashSet<>();
        ClassLoader projectClassloader = getProjectClassloader(project);

        FastClasspathScanner scanner =
                new FastClasspathScanner(packagesToScan.toArray(new String[packagesToScan.size()])).addClassLoader(projectClassloader);
        List<String> classNames = scanner.scan().getNamesOfAllClasses();
        for (String className : classNames) {
            try {
                Clazz<?> clazz = Class.forName(className, false, projectClassloader);
                if (!clazz.isAnnotation() && !clazz.isInterface()) {
                    classes.add(clazz);
                }
            } catch (ClassNotFoundException e) {
                throw new MojoExecutionException("Couldn't add class " + className + " to the set of classes for some reason", e);
            }
        }
        return classes;
    }

    private static ClassLoader getProjectClassloader(MavenProject project) {
        List<String> classpathElements;
        try {
            classpathElements = project.getCompileClasspathElements();
            List<URL> projectClasspathList = new ArrayList<>();
            for (String element : classpathElements) {
                try {
                    projectClasspathList.add(new File(element).toURI().toURL());
                } catch (MalformedURLException e) {
                    throw new MojoExecutionException(element + " is an invalid classpath element", e);
                }
            }

            return URLClassLoader.newInstance(
                    projectClasspathList.toArray(new URL[0]),
                    Thread.currentThread().getContextClassLoader()
            );

        } catch (Exception e) {
            throw new RuntimeException("Dependency resolution failed", e);
        }
    }
}
{'fraction_non_alphanumeric': 0.08975175047740293, 'fraction_numerical': 0.000424358158285593, 'mean_word_length': 2.438366156090445, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 24, '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': '4628346', 'n_tokens_mistral': 1190, 'n_tokens_neox': 1144, 'n_words': 254}