public CtClass[] mayThrow(){
  ClassPool pool=thisClass.getClassPool();
  ConstPool cp=thisMethod.getConstPool();
  LinkedList list=new LinkedList();
  try {
    CodeAttribute ca=thisMethod.getCodeAttribute();
    ExceptionTable et=ca.getExceptionTable();
    int pos=currentPos;
    int n=et.size();
    for (int i=0; i < n; ++i)     if (et.startPc(i) <= pos && pos < et.endPc(i)) {
      int t=et.catchType(i);
      if (t > 0)       try {
        addClass(list,pool.get(cp.getClassInfo(t)));
      }
 catch (      NotFoundException e) {
      }
    }
  }
 catch (  NullPointerException e) {
  }
  ExceptionsAttribute ea=thisMethod.getExceptionsAttribute();
  if (ea != null) {
    String[] exceptions=ea.getExceptions();
    if (exceptions != null) {
      int n=exceptions.length;
      for (int i=0; i < n; ++i)       try {
        addClass(list,pool.get(exceptions[i]));
      }
 catch (      NotFoundException e) {
      }
    }
  }
  return (CtClass[])list.toArray(new CtClass[list.size()]);
}

public CtClass [ ] mayThrow ( ) { ClassPool pool = thisClass . getClassPool ( ) ; ConstPool cp = thisMethod . getConstPool ( ) ; LinkedList list = new LinkedList ( ) ; try { CodeAttribute ca = thisMethod . getCodeAttribute ( ) ; ExceptionTable et = ca . getExceptionTable ( ) ; int pos = currentPos ; int n = et . size ( ) ; for ( int i = 0 ; i < n ; ++ i ) if ( et . startPc ( i ) <= pos && pos < et . endPc ( i ) ) { int t = et . catchType ( i ) ; if ( t > 0 ) try { addClass ( list , pool . get ( cp . getClassInfo ( t ) ) ) ; } catch ( NotFoundException e ) { } } } catch ( NullPointerException e ) { } ExceptionsAttribute ea = thisMethod . getExceptionsAttribute ( ) ; if ( ea != null ) { String [ ] exceptions = ea . getExceptions ( ) ; if ( exceptions != null ) { int n = exceptions . length ; for ( int i = 0 ; i < n ; ++ i ) try { addClass ( list , pool . get ( exceptions [ i ] ) ) ; } catch ( NotFoundException e ) { } } } return ( CtClass [ ] ) list . toArray ( new CtClass [ list . size ( ) ] ) ; }
returns the list of exceptions that the expression may throw . this list includes both the exceptions that the try - catch statements including the expression can catch and the exceptions that the throws declaration allows the method to throw .
