"
COPYRIGHT (c) 1996-2011 by Claus Gittinger
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
SWING Research Group, Czech Technical University in Prague (*)
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
(*) extensions, changes and fixes for java1.1 compatibility.
For a list of changes, see a list of diffs against the last stable version before 2011-08.
"
"{ Package: 'stx:libjava' }"
Object subclass:#JavaExceptionTableEntry
instanceVariableNames:'startPC endPC handlerPC catchType'
classVariableNames:''
poolDictionaries:''
category:'Languages-Java-Support'
!
!JavaExceptionTableEntry class methodsFor:'documentation'!
copyright
"
COPYRIGHT (c) 1996-2011 by Claus Gittinger
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
SWING Research Group, Czech Technical University in Prague (*)
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
(*) extensions, changes and fixes for java1.1 compatibility.
For a list of changes, see a list of diffs against the last stable version before 2011-08.
"
! !
!JavaExceptionTableEntry class methodsFor:'instance creation'!
startPC:start_pc endPC:end_pc handlerPC:handler_pc catchType:catch_type
^ self new startPC:start_pc endPC:end_pc handlerPC:handler_pc catchType:catch_type
"Created: 16.4.1996 / 12:11:13 / cg"
! !
!JavaExceptionTableEntry methodsFor:'accessing'!
catchType
"return the value of the instance variable 'catchType' (automatically generated)"
^ catchType
"Created: 7.2.1997 / 21:01:23 / cg"
!
endPC
"return the value of the instance variable 'endPC' (automatically generated)"
^ endPC
"Created: 7.2.1997 / 20:53:23 / cg"
!
handlerPC
"return the value of the instance variable 'handlerPC' (automatically generated)"
^ handlerPC
"Created: 7.2.1997 / 20:06:31 / cg"
!
startPC
"return the value of the instance variable 'startPC' (automatically generated)"
^ startPC
"Created: 7.2.1997 / 20:53:20 / cg"
! !
!JavaExceptionTableEntry methodsFor:'printing & storing'!
displayString
^ super displayString , '(' , catchType displayString,
' in ' , startPC printString , '..' ,
endPC printString , '->' ,
handlerPC printString , ')'
"Modified: 15.8.1997 / 03:33:51 / cg"
!
printOn: aStream
super printOn: aStream.
aStream nextPut:$(.
catchType printOn: aStream.
aStream nextPutAll:' in ' , startPC printString , '..' ,
endPC printString , '->' ,
handlerPC printString , ')'
"Modified: / 15-08-1997 / 03:33:51 / cg"
"Created: / 25-02-2011 / 09:08:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaExceptionTableEntry methodsFor:'private accessing'!
handlerPCFor:exception at:pc in:aMethod
"if there is a handler for exceptionClass, with given pc,
return the handler-PC; otherwise, return nil."
|cls|
"JV+MH@2011-02-25: You may wonder why there is endPC - 1:
The Java VM Spec, 3rd edition, sec 4.7.3, page 78:
The fact that end_pc is exclusive is a historical mistake in the design of the
Java virtual machine: if the Java virtual machine code for a method is exactly
65535 bytes long and ends with an instruction that is 1 byte long, then that
instruction cannot be protected by an exception handler. A compiler writer can
work around this bug by limiting the maximum size of the generated Java
virtual machine code for any method, instance initialization method, or static
initializer (the size of any code array) to 65534 bytes.
"
(pc between:startPC and:endPC - 1) ifTrue:[
(catchType == 0) ifTrue:[^ handlerPC].
(catchType isNil) ifTrue:[^ handlerPC].
cls := aMethod javaClass.
catchType := catchType javaClass.
(catchType isKindOf:JavaClass) ifFalse:[
self halt.
^ nil
].
(exception isKindOf:catchType) ifTrue:[
^ handlerPC
].
^ nil
].
^ nil
"Modified: / 07-01-1998 / 15:30:14 / cg"
"Modified: / 31-05-2011 / 09:53:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
startPC:start_pc endPC:end_pc handlerPC:handler_pc catchType:catch_type
startPC := start_pc.
endPC := end_pc.
handlerPC := handler_pc.
catchType := catch_type
"Created: 16.4.1996 / 12:11:45 / cg"
! !
!JavaExceptionTableEntry class methodsFor:'documentation'!
version
^ '$Header: /cvs/stx/stx/libjava/JavaExceptionTableEntry.st,v 1.18 2011-11-24 11:52:51 cg Exp $'
!
version_CVS
^ '$Header: /cvs/stx/stx/libjava/JavaExceptionTableEntry.st,v 1.18 2011-11-24 11:52:51 cg Exp $'
!
version_SVN
^ '§Id: JavaExceptionTableEntry.st,v 1.16 2011/08/18 18:42:48 vrany Exp §'
! !