<commit_before>package org.hildan.livedoc.springmvc.scanner;

import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

import org.hildan.livedoc.core.scanner.types.records.FieldTypesScanner;
import org.hildan.livedoc.core.scanner.types.filters.DefaultTypeFilter;
import org.hildan.livedoc.core.scanner.types.TypesExplorer;
import org.hildan.livedoc.springmvc.scanner.builder.SpringRequestBodyBuilder;
import org.hildan.livedoc.springmvc.scanner.utils.ClasspathUtils;
import org.reflections.Reflections;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.simp.annotation.SubscribeMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import com.google.common.collect.Sets;

public class TypesScanner {

    private final Reflections reflections;

    public TypesScanner(Reflections reflections) {
        this.reflections = reflections;
    }

    public Set<Class<?>> findJsondocObjects(List<String> packages) {
        Set<Type> rootTypes = getRootApiTypes();

        TypesExplorer explorer = new TypesExplorer(reflections, new FieldTypesScanner(),
                new DefaultTypeFilter());
        Set<Class<?>> classes = explorer.findTypes(rootTypes);

        return classes.stream().filter(clazz -> inWhiteListedPackages(packages, clazz)).collect(Collectors.toSet());
    }

    private Set<Type> getRootApiTypes() {
        Set<Type> types = Sets.newHashSet();
        Set<Method> methodsToDocument = getMethodsToDocument();
        for (Method method : methodsToDocument) {
            types.add(method.getGenericReturnType());
            Type requestBodyType = getBodyParamType(method);
            if (requestBodyType != null) {
                types.add(requestBodyType);
            }
        }
        return types;<commit_msg>Fix compile error in Spring TypesScanner since refac<commit_after>package org.hildan.livedoc.springmvc.scanner;

import java.lang.reflect.Method;
import java.lang.reflect.Type;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

import org.hildan.livedoc.core.scanner.properties.FieldPropertyScanner;
import org.hildan.livedoc.core.scanner.types.filters.DefaultTypeFilter;
import org.hildan.livedoc.core.scanner.types.TypesExplorer;
import org.hildan.livedoc.springmvc.scanner.builder.SpringRequestBodyBuilder;
import org.hildan.livedoc.springmvc.scanner.utils.ClasspathUtils;
import org.reflections.Reflections;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.simp.annotation.SubscribeMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import com.google.common.collect.Sets;

public class TypesScanner {

    private final Reflections reflections;

    public TypesScanner(Reflections reflections) {
        this.reflections = reflections;
    }

    public Set<Class<?>> findJsondocObjects(List<String> packages) {
        Set<Type> rootTypes = getRootApiTypes();

        TypesExplorer explorer = new TypesExplorer(reflections, new FieldPropertyScanner(), new DefaultTypeFilter());
        Set<Class<?>> classes = explorer.findTypes(rootTypes);

        return classes.stream().filter(clazz -> inWhiteListedPackages(packages, clazz)).collect(Collectors.toSet());
    }

    private Set<Type> getRootApiTypes() {
        Set<Type> types = Sets.newHashSet();
        Set<Method> methodsToDocument = getMethodsToDocument();
        for (Method method : methodsToDocument) {
            types.add(method.getGenericReturnType());
            Type requestBodyType = getBodyParamType(method);
            if (requestBodyType != null) {
                types.add(requestBodyType);
            }
        }
        return types;
{'fraction_non_alphanumeric': 0.1028110359187923, 'fraction_numerical': 0.0, 'mean_word_length': 4.07661822985469, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 23, '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': '538026', 'n_tokens_mistral': 1122, 'n_tokens_neox': 1071, 'n_words': 184}