jreversepro.reflect
Class JException

java.lang.Object
  |
  +--jreversepro.reflect.JException

public class JException
extends java.lang.Object

JException is an abstraction of the exception table , that is an optional part of the Method attributes .

Author:
Karthik Kumar.

Constructor Summary
JException(int rhsStart, int rhsEnd, int rhsHandler, java.lang.String rhsType)
          Constructor.
 
Method Summary
 void addCatchBlock(int rhsHandlerPc, java.lang.String rhsType)
          Adds a new catch block to the code block { startpc, endpc }
 boolean containsANYCatchBlock()
           
 boolean equals(java.lang.Object obj)
           
 int getEffectiveEndPc(java.util.List instructions)
          This minor adjustment of endPc with handler pc is necessary since in some cases the compiled code generated by javac and jikes are different.
 int getEndPc()
           
 java.lang.String getExceptionClass(int rhsHandlerPc)
          Given a pc, if an exceptiontable entry exists such that the the handler begins with this pc, then the handler type is returned.
 java.util.Enumeration getHandlers()
           
 int getStartPc()
           
 boolean isAny()
           
 boolean sameTryBlock(JException exc)
          Checks if the new exception block passed as parameter has the same code block { startpc, endpc } as the current one.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JException

public JException(int rhsStart,
                  int rhsEnd,
                  int rhsHandler,
                  java.lang.String rhsType)
Constructor.

Parameters:
rhsStart - StartPc
rhsEnd - EndPc
rhsHandler - HandlerPc of the first handler block for the above mentioned code block.
rhsType - Handler data type.
Method Detail

addCatchBlock

public void addCatchBlock(int rhsHandlerPc,
                          java.lang.String rhsType)
Adds a new catch block to the code block { startpc, endpc }

Parameters:
rhsHandlerPc - Handler Pc
rhsType - Handler data type.

getStartPc

public int getStartPc()
Returns:
Returns startpc of this code block.

getEndPc

public int getEndPc()
Returns:
Returns endpc of this code block.

getEffectiveEndPc

public int getEffectiveEndPc(java.util.List instructions)
This minor adjustment of endPc with handler pc is necessary since in some cases the compiled code generated by javac and jikes are different. Jikes generates code such that the endPc of try . block is the beginning of the first handler beginning pc. Javac generates such that the endPc of try..block is 1 less than the one where the handler block begins. Bug with javac/jikes/jreversepro ??? Any clues ??

Parameters:
instructions - List of instructions.
Returns:
Effective endPc of the try ..block

getHandlers

public java.util.Enumeration getHandlers()
Returns:
Returns the Enumeration of handler types.

getExceptionClass

public java.lang.String getExceptionClass(int rhsHandlerPc)
Given a pc, if an exceptiontable entry exists such that the the handler begins with this pc, then the handler type is returned. Else this returns null.

Parameters:
rhsHandlerPc - HandlerPc for which type is queried.
Returns:
Handler type of the exception handler, if one exists beginning with rhsHandlerPc. null, otherwise.

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
Parameters:
obj - Object to be compared with.
Returns:
if two JException objects are equal. false, otherwise.

sameTryBlock

public boolean sameTryBlock(JException exc)
Checks if the new exception block passed as parameter has the same code block { startpc, endpc } as the current one.

Parameters:
exc - New Exception Block
Returns:
Returns true if the code blocks are same for both of them. false, otherwise.

containsANYCatchBlock

public boolean containsANYCatchBlock()
Returns:
true. if at least one of the exception handlers is for ANY block. false, otherwise.

isAny

public boolean isAny()
Returns:
Value of Any

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
Stringified form of the class.


Submit Feedback to akkumar@users.sourceforge.net