<commit_before>/*
 * Copyright (C) 2004 <NAME>.
 * Copyright (C) 2006, 2007 XStream Committers.
 * All rights reserved.
 *
 * The software in this package is published under the terms of the BSD
 * style license a copy of which has been included with this distribution in
 * the LICENSE.txt file.
 * 
 * Created on 25. April 2004 by <NAME>
 */
package com.thoughtworks.acceptance.objects;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class SampleDynamicProxy implements InvocationHandler {

    private String aField = "hello";

    public static interface InterfaceOne {
        String doSomething();
    }

    public static interface InterfaceTwo {
        String doSomething();
    }

    public static Object newInstance() {
        return Proxy.newProxyInstance(InterfaceOne.class.getClassLoader(),
                new Class[]{InterfaceOne.class, InterfaceTwo.class},
                new SampleDynamicProxy());
    }

    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        if (method.getName().equals("equals")) {
            return equals(args[0]) ? Boolean.TRUE : Boolean.FALSE;
        } else if (method.getName().equals("hashCode")) {
            return System.identityHashCode(proxy);
        } else {
            return aField;
        }
    }

    public boolean equals(Object obj) {
        return equalsInterfaceOne(obj) && equalsInterfaceTwo(obj);<commit_msg>Fix simple proxy.<commit_after>/*
 * Copyright (C) 2004 <NAME>.
 * Copyright (C) 2006, 2007 XStream Committers.
 * All rights reserved.
 *
 * The software in this package is published under the terms of the BSD
 * style license a copy of which has been included with this distribution in
 * the LICENSE.txt file.
 * 
 * Created on 25. April 2004 by <NAME>
 */
package com.thoughtworks.acceptance.objects;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class SampleDynamicProxy implements InvocationHandler {

    private String aField = "hello";

    public static interface InterfaceOne {
        String doSomething();
    }

    public static interface InterfaceTwo {
        String doSomething();
    }

    public static Object newInstance() {
        return Proxy.newProxyInstance(InterfaceOne.class.getClassLoader(),
                new Class[]{InterfaceOne.class, InterfaceTwo.class},
                new SampleDynamicProxy());
    }

    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        if (method.getName().equals("equals")) {
            return equals(args[0]) ? Boolean.TRUE : Boolean.FALSE;
        } else if (method.getName().equals("hashCode")) {
            return new Integer(System.identityHashCode(proxy));
        } else {
            return aField;
        }
    }

    public boolean equals(Object obj) {
        return equalsInterfaceOne(obj) && equalsInterfaceTwo(obj);
{'fraction_non_alphanumeric': 0.09649415692821368, 'fraction_numerical': 0.012687813021702838, 'mean_word_length': 2.989347536617843, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1118797', 'n_tokens_mistral': 806, 'n_tokens_neox': 745, 'n_words': 244}