title: JRuby: extend Java class with two methods that have the same name
body: <p>Good morning every body,
  I am trying to extend an abstract Java class with two methods that have the same name. But only need to verride one of them.</p>
  
  <p>Here is my Java code:</p>
  
  <pre><code>public abstract class ClientHandler extends Handler implements SOAPHandler&lt;SOAPMessageContext&gt; {
      protected boolean disable = true;
      protected X509Certificate signatureCertificate;
      protected PrivateKey privateKey;
      protected Certificate[] signatureCertificationChain;
  
      //Constructeur 
      protected ClientHandler(boolean disable) {
          this.disable = disable;
      }
  
      private boolean handleMessage(VIHF vihf) {
          //This is the beginning of the method i am trying to redefine
          X509Certificate certificate = this.signatureCertificate
          String issuer = certificate.getSubjectDN().toString();
          //some code 
          ...
      }
  
      public boolean handleMessage(SOAPMessageContext smc) {
          //some code
      }
    }
  </code></pre>
  
  <p>Here is my JRuby code</p>
  
  <pre><code>#To make parent attributes accessible from subclasses
  class  ClientHandler
     field_accessor :disable, :signatureCertificate, :privateKey, :signatureCertificationChain
  end
  
  #first version referring to that post: &lt;http://stackoverflow.com/questions/6238734/jruby-calls-  the-wrong-method&gt;
  
  module RubyClientHandler
    class RClientHandler &lt; ClientHandler
      handleMessage =  ClientHandler.java_method :handleMessage,    java.lang.Class.for_name(Java::ComSubFolder::VIHF)]
  
      def handleMessage(vihf)
          super(self.disableSignature)  #is this line ok or note?
  
          certificate = self.signatureCertificate    #do i need to use the "self" or the "@" ?
          issuer = certificate.getSubjectDN().toString()
          ...
      end
     end
  end
  </code></pre>
  
  <p>With my first version when i try to use the "java_method", i am getting the following error:
  "no method 'forName' for arguments (org.jruby.RubyModule) on Java::JavaLang::Class"</p>
  
  <p>Then i have tried this second version of the RClientHandler class</p>
  
  <p>Second version : referring to that post: <a href="http://www.ruby-forum.com/topic/216636" rel="nofollow">http://www.ruby-forum.com/topic/216636</a></p>
  
  <pre><code> module RubyClientHandler
      class RClientHandler &lt; ClientHandler
       def handleMessage(vihf)
           super          #line causing the error 
           klass = vihf.class
  
           if(klass.eql?(Java::ComSubFolder::VIHF) )
              self.java_send :handleMessage,[VIHF], vihf
  
              certificate = self.signatureCertificate
              issuer = certificate.getSubjectDN().toString()
              ...
           end
       end
     end
   end
  </code></pre>
  
  <p>With this second version i am getting the following Exception that is pointing the first line of the "handleMessage" </p>
  
  <pre><code>HANDLER_RAISED_RUNTIME_EXCEPTION
  org.jruby.exceptions.RaiseException: Native Exception: 'class java.lang.StackOverflowError';     Message: null; StackTrace: java.lang.StackOverflowError
  at org.jruby.proxy.com.sub.folder.ClientHandler$Proxy0.__super$handleMessage(Unknown Source)
  </code></pre>
  
  <p>Is this line with "super" calling the parent class constructor or the parent "handleMessage" method ?
  Do i need some argument when calling "super" here according to the parent class constructor ?</p>
  
  <p>Any help will be appreciate to tell me how can i extend this "ClientHandler" class by overriding only one (or the two) "handleMessage" method in JRuby.
  Thanks in advance for your help.</p>