[jboss-dev-forums] [Javassist Development] - javassist and interfaces defining a method which throws an exception question

ami tabak do-not-reply at jboss.com
Sun Nov 18 03:57:32 EST 2012


ami tabak [https://community.jboss.org/people/amitabakoptier] created the discussion

"javassist and interfaces defining a method which throws an exception question"

To view the discussion, visit: https://community.jboss.org/message/777034#777034

--------------------------------------------------------------
A Question regarding the JVM spec and how javassist is expected to handle it.
I’ve an interface IMyFactory extending the Remote interface.
It declares a method foo() which declares throws RemoteException so will be deemed as remotable API

The implementing class implements the method but *doesn’t* declare itself as throwing the remote.
Code wise the JVM picked this method as valid Remote API
Javassist when interrogated class MyFactory.foo() method doesn’t provide any data on its being a throwing RemoteException 

*Questions*
1. The JVM spec defines a method by its name and properties, not by its exception throwing.
In addition it allows an implementing method to declare less “throws” then its super / defining interface without loss of polymorphism
1. e.g. this foo() implementer is deemed the same as in the interface.

Why wont javassist provide me the exception data defined in the Interface’s CtClass ? 

   2) Is there a “recoursive” API in javassist that will wllow me to intergoate a method up to its interface definition to see if some one above it has defined it to be an   
      Throwable thrower or do I need to implement such search myself ? 


*Code example:* 

1. 1. MyFactory implements IMyFactory
   {...
     @Override
     public int foo() //on purpose didn’t declare “throws java.rmi.RemoteException”
     { 
       // TODO Auto-generated method stub
       return 0;
     }   

1. 2. public interface IMyFactory extends Remote
   {
     public int foo() throws RemoteException;
   }
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/777034#777034]

Start a new discussion in Javassist Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2063]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20121118/2ec147d7/attachment.html 


More information about the jboss-dev-forums mailing list