<commit_before>package org.jboss.webbeans.util;

import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.List;

import javassist.util.proxy.MethodHandler;

import javax.webbeans.manager.Bean;
import javax.webbeans.manager.Context;

import org.jboss.webbeans.ManagerImpl;

public class ProxyMethodHandler implements MethodHandler, Serializable
{
   private static final long serialVersionUID = -5391564935097267888L;

   private transient Bean<?> bean;
   private int beanIndex;
   private static ManagerImpl manager;

   public ProxyMethodHandler(Bean<?> bean, int beanIndex, ManagerImpl manager)
   {
      this.bean = bean;
      this.beanIndex = beanIndex;
      ProxyMethodHandler.manager = manager;
   }

   @Override
   public Object invoke(Object self, Method method, Method proceed, Object[] args) throws Throwable
   {
      if (bean == null)
      {
         bean = manager.getBeans().get(beanIndex);
      }
      Context context = manager.getContext(bean.getScopeType());
      Object proxiedInstance = context.get(bean, true);
      Method proxiedMethod = proxiedInstance.getClass().getMethod(method.getName(), method.getParameterTypes());
      return proxiedMethod.invoke(proxiedInstance, args);
   }

}
<commit_msg>@Override does not work with interface methods in JDK5<commit_after>package org.jboss.webbeans.util;

import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.List;

import javassist.util.proxy.MethodHandler;

import javax.webbeans.manager.Bean;
import javax.webbeans.manager.Context;

import org.jboss.webbeans.ManagerImpl;

public class ProxyMethodHandler implements MethodHandler, Serializable
{
   private static final long serialVersionUID = -5391564935097267888L;

   private transient Bean<?> bean;
   private int beanIndex;
   private static ManagerImpl manager;

   public ProxyMethodHandler(Bean<?> bean, int beanIndex, ManagerImpl manager)
   {
      this.bean = bean;
      this.beanIndex = beanIndex;
      ProxyMethodHandler.manager = manager;
   }

   //@Override Let's stay compatible with JDK5 :-)
   public Object invoke(Object self, Method method, Method proceed, Object[] args) throws Throwable
   {
      if (bean == null)
      {
         bean = manager.getBeans().get(beanIndex);
      }
      Context context = manager.getContext(bean.getScopeType());
      Object proxiedInstance = context.get(bean, true);
      Method proxiedMethod = proxiedInstance.getClass().getMethod(method.getName(), method.getParameterTypes());
      return proxiedMethod.invoke(proxiedInstance, args);
   }

}

{'fraction_non_alphanumeric': 0.09322351179333582, 'fraction_numerical': 0.01497566454511419, 'mean_word_length': 3.468227424749164, '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': '6126253', 'n_tokens_mistral': 795, 'n_tokens_neox': 736, 'n_words': 181}