<commit_before>package com.mangofactory.swagger.models;

import com.fasterxml.classmate.ResolvedType;

import java.util.Collection;
import java.util.List;
import java.util.Set;

public class Collections {
    public static <T extends Collection> ResolvedType elementType(ResolvedType container, Class<T> collectionType) {
        return container.typeParametersFor(collectionType).get(0);
    }

    public static ResolvedType collectionElementType(ResolvedType type) {
        if (List.class.isAssignableFrom(type.getErasedType())) {
            return Collections.elementType(type, List.class);
        } else if (Set.class.isAssignableFrom(type.getErasedType())) {
            return Collections.elementType(type, Set.class);
        } else if (type.isArray()) {
            return type.getArrayElementType();
        } else {
            return null;
        }
    }

    public static boolean isContainerType(ResolvedType type) {
        if (List.class.isAssignableFrom(type.getErasedType()) ||
                Set.class.isAssignableFrom(type.getErasedType()) ||
                type.isArray()) {
            return true;<commit_msg>Fix for controller methods returning non-generic List type causes initialization error<commit_after>package com.mangofactory.swagger.models;

import com.fasterxml.classmate.ResolvedType;
import com.fasterxml.classmate.TypeResolver;

import java.util.Collection;
import java.util.List;
import java.util.Set;

public class Collections {
    public static <T extends Collection> ResolvedType elementType(ResolvedType container, Class<T> collectionType) {
      List<ResolvedType> resolvedTypes = container.typeParametersFor(collectionType);
      if (resolvedTypes.size() == 1) {
        return resolvedTypes.get(0);
      }
      return new TypeResolver().resolve(Object.class);
    }

    public static ResolvedType collectionElementType(ResolvedType type) {
        if (List.class.isAssignableFrom(type.getErasedType())) {
            return Collections.elementType(type, List.class);
        } else if (Set.class.isAssignableFrom(type.getErasedType())) {
            return Collections.elementType(type, Set.class);
        } else if (type.isArray()) {
            return type.getArrayElementType();
        } else {
            return null;
        }
    }

    public static boolean isContainerType(ResolvedType type) {
        if (List.class.isAssignableFrom(type.getErasedType()) ||
                Set.class.isAssignableFrom(type.getErasedType()) ||
                type.isArray()) {
            return true;
{'fraction_non_alphanumeric': 0.10148902821316615, 'fraction_numerical': 0.0011755485893416929, 'mean_word_length': 3.111111111111111, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 3}, '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': '6002714', 'n_tokens_mistral': 695, 'n_tokens_neox': 682, 'n_words': 140}