<commit_before>package org.kie.dmn.feel.lang.impl;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Stream;

import org.kie.dmn.feel.lang.CompositeType;
import org.kie.dmn.feel.lang.FEELProperty;
import org.kie.dmn.feel.lang.FEELType;
import org.kie.dmn.feel.lang.Type;
import org.kie.dmn.feel.lang.types.BuiltInType;
import org.kie.dmn.feel.parser.feel11.ParserHelper;
import org.kie.dmn.feel.util.EvalHelper;

public class JavaBackedType implements CompositeType {
    private static Map<Class<?>, JavaBackedType> cache = new HashMap<>();
    
    private static Set<Method> javaObjectMethods = new HashSet<>( Arrays.asList( Object.class.getMethods() ) );
    
    private Class<?> wrapped;
    private Map<String, Type> properties = new LinkedHashMap<>();

    private JavaBackedType(Class<?> class1) {
        this.wrapped = class1;
        
        Stream.of( class1.getMethods() )
            .filter( m -> Modifier.isPublic( m.getModifiers() ) || Modifier.isProtected( m.getModifiers() ) )
            .filter( m -> ! javaObjectMethods.contains(m) )
            .flatMap( m -> Stream.<Function<Method, Optional<String>>>of(JavaBackedType::methodToCustomProperty, EvalHelper::propertyFromAccessor)<commit_msg>fix JavaBackendTypeTest.testPerson fails on ConcurrentModificationExcptn (#1583)<commit_after>package org.kie.dmn.feel.lang.impl;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.stream.Stream;

import org.kie.dmn.feel.lang.CompositeType;
import org.kie.dmn.feel.lang.FEELProperty;
import org.kie.dmn.feel.lang.FEELType;
import org.kie.dmn.feel.lang.Type;
import org.kie.dmn.feel.lang.types.BuiltInType;
import org.kie.dmn.feel.parser.feel11.ParserHelper;
import org.kie.dmn.feel.util.EvalHelper;

public class JavaBackedType implements CompositeType {

    private static Map<Class<?>, JavaBackedType> cache = new ConcurrentHashMap<>();
    
    private static Set<Method> javaObjectMethods = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(Object.class.getMethods())));
    
    private Class<?> wrapped;
    private Map<String, Type> properties = new LinkedHashMap<>();

    private JavaBackedType(Class<?> class1) {
        this.wrapped = class1;
        
        Stream.of( class1.getMethods() )
            .filter( m -> Modifier.isPublic( m.getModifiers() ) || Modifier.isProtected( m.getModifiers() ) )
            .filter( m -> ! javaObjectMethods.contains(m) )
            .flatMap( m -> Stream.<Function<Method, Optional<String>>>of(JavaBackedType::methodToCustomProperty, EvalHelper::propertyFromAccessor)
{'fraction_non_alphanumeric': 0.12907608695652173, 'fraction_numerical': 0.004755434782608696, 'mean_word_length': 4.277777777777778, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 33, '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': '262452', 'n_tokens_mistral': 935, 'n_tokens_neox': 922, 'n_words': 168}