454
|
1 |
"
|
749
|
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger
|
|
3 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
|
|
4 |
SWING Research Group, Czech Technical University in Prague
|
|
5 |
|
|
6 |
Parts of the code written by Claus Gittinger are under following
|
|
7 |
license:
|
454
|
8 |
|
|
9 |
This software is furnished under a license and may be used
|
|
10 |
only in accordance with the terms of that license and with the
|
|
11 |
inclusion of the above copyright notice. This software may not
|
|
12 |
be provided or otherwise made available to, or used by, any
|
|
13 |
other person. No title to or ownership of the software is
|
|
14 |
hereby transferred.
|
749
|
15 |
|
|
16 |
Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
|
|
17 |
|
|
18 |
Permission is hereby granted, free of charge, to any person
|
|
19 |
obtaining a copy of this software and associated documentation
|
|
20 |
files (the 'Software'), to deal in the Software without
|
|
21 |
restriction, including without limitation the rights to use,
|
|
22 |
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
23 |
copies of the Software, and to permit persons to whom the
|
|
24 |
Software is furnished to do so, subject to the following
|
|
25 |
conditions:
|
454
|
26 |
|
749
|
27 |
The above copyright notice and this permission notice shall be
|
|
28 |
included in all copies or substantial portions of the Software.
|
454
|
29 |
|
749
|
30 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
31 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
32 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
33 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
34 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
35 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
36 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
37 |
OTHER DEALINGS IN THE SOFTWARE.
|
454
|
38 |
|
749
|
39 |
[1] Code written at SWING Research Group contain a signature
|
|
40 |
of one of the above copright owners.
|
|
41 |
"
|
713
|
42 |
"{ Package: 'stx:libjava' }"
|
|
43 |
|
6
|
44 |
Object subclass:#JavaExceptionTableEntry
|
|
45 |
instanceVariableNames:'startPC endPC handlerPC catchType'
|
|
46 |
classVariableNames:''
|
|
47 |
poolDictionaries:''
|
713
|
48 |
category:'Languages-Java-Support'
|
6
|
49 |
!
|
|
50 |
|
454
|
51 |
!JavaExceptionTableEntry class methodsFor:'documentation'!
|
|
52 |
|
|
53 |
copyright
|
|
54 |
"
|
749
|
55 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger
|
|
56 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
|
|
57 |
SWING Research Group, Czech Technical University in Prague
|
|
58 |
|
|
59 |
Parts of the code written by Claus Gittinger are under following
|
|
60 |
license:
|
454
|
61 |
|
|
62 |
This software is furnished under a license and may be used
|
|
63 |
only in accordance with the terms of that license and with the
|
|
64 |
inclusion of the above copyright notice. This software may not
|
|
65 |
be provided or otherwise made available to, or used by, any
|
|
66 |
other person. No title to or ownership of the software is
|
|
67 |
hereby transferred.
|
749
|
68 |
|
|
69 |
Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
|
|
70 |
|
|
71 |
Permission is hereby granted, free of charge, to any person
|
|
72 |
obtaining a copy of this software and associated documentation
|
|
73 |
files (the 'Software'), to deal in the Software without
|
|
74 |
restriction, including without limitation the rights to use,
|
|
75 |
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
76 |
copies of the Software, and to permit persons to whom the
|
|
77 |
Software is furnished to do so, subject to the following
|
|
78 |
conditions:
|
454
|
79 |
|
749
|
80 |
The above copyright notice and this permission notice shall be
|
|
81 |
included in all copies or substantial portions of the Software.
|
454
|
82 |
|
749
|
83 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
84 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
85 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
86 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
87 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
88 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
89 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
90 |
OTHER DEALINGS IN THE SOFTWARE.
|
|
91 |
|
|
92 |
[1] Code written at SWING Research Group contain a signature
|
|
93 |
of one of the above copright owners.
|
|
94 |
|
|
95 |
"
|
454
|
96 |
! !
|
6
|
97 |
|
135
|
98 |
!JavaExceptionTableEntry class methodsFor:'instance creation'!
|
6
|
99 |
|
|
100 |
startPC:start_pc endPC:end_pc handlerPC:handler_pc catchType:catch_type
|
|
101 |
^ self new startPC:start_pc endPC:end_pc handlerPC:handler_pc catchType:catch_type
|
|
102 |
|
|
103 |
"Created: 16.4.1996 / 12:11:13 / cg"
|
|
104 |
! !
|
|
105 |
|
135
|
106 |
!JavaExceptionTableEntry methodsFor:'accessing'!
|
|
107 |
|
|
108 |
catchType
|
|
109 |
"return the value of the instance variable 'catchType' (automatically generated)"
|
|
110 |
|
|
111 |
^ catchType
|
|
112 |
|
|
113 |
"Created: 7.2.1997 / 21:01:23 / cg"
|
|
114 |
!
|
|
115 |
|
|
116 |
endPC
|
|
117 |
"return the value of the instance variable 'endPC' (automatically generated)"
|
|
118 |
|
|
119 |
^ endPC
|
|
120 |
|
|
121 |
"Created: 7.2.1997 / 20:53:23 / cg"
|
|
122 |
!
|
|
123 |
|
|
124 |
handlerPC
|
|
125 |
"return the value of the instance variable 'handlerPC' (automatically generated)"
|
|
126 |
|
|
127 |
^ handlerPC
|
|
128 |
|
|
129 |
"Created: 7.2.1997 / 20:06:31 / cg"
|
|
130 |
!
|
|
131 |
|
|
132 |
startPC
|
|
133 |
"return the value of the instance variable 'startPC' (automatically generated)"
|
|
134 |
|
|
135 |
^ startPC
|
|
136 |
|
|
137 |
"Created: 7.2.1997 / 20:53:20 / cg"
|
|
138 |
! !
|
|
139 |
|
164
|
140 |
!JavaExceptionTableEntry methodsFor:'printing & storing'!
|
|
141 |
|
|
142 |
displayString
|
226
|
143 |
^ super displayString , '(' , catchType displayString,
|
|
144 |
' in ' , startPC printString , '..' ,
|
164
|
145 |
endPC printString , '->' ,
|
|
146 |
handlerPC printString , ')'
|
|
147 |
|
226
|
148 |
"Modified: 15.8.1997 / 03:33:51 / cg"
|
749
|
149 |
!
|
|
150 |
|
|
151 |
printOn: aStream
|
|
152 |
super printOn: aStream.
|
|
153 |
aStream nextPut:$(.
|
|
154 |
catchType printOn: aStream.
|
|
155 |
aStream nextPutAll:' in ' , startPC printString , '..' ,
|
|
156 |
endPC printString , '->' ,
|
|
157 |
handlerPC printString , ')'
|
|
158 |
|
|
159 |
"Modified: / 15-08-1997 / 03:33:51 / cg"
|
|
160 |
"Created: / 25-02-2011 / 09:08:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
164
|
161 |
! !
|
|
162 |
|
6
|
163 |
!JavaExceptionTableEntry methodsFor:'private accessing'!
|
|
164 |
|
47
|
165 |
handlerPCFor:exception at:pc in:aMethod
|
|
166 |
"if there is a handler for exceptionClass, with given pc,
|
|
167 |
return the handler-PC; otherwise, return nil."
|
|
168 |
|
107
|
169 |
|cls|
|
749
|
170 |
"JV+MH@2011-02-25: You may wonder why there is endPC - 1:
|
|
171 |
The Java VM Spec, 3rd edition, sec 4.7.3, page 78:
|
47
|
172 |
|
749
|
173 |
The fact that end_pc is exclusive is a historical mistake in the design of the
|
|
174 |
Java virtual machine: if the Java virtual machine code for a method is exactly
|
|
175 |
65535 bytes long and ends with an instruction that is 1 byte long, then that
|
|
176 |
instruction cannot be protected by an exception handler. A compiler writer can
|
|
177 |
work around this bug by limiting the maximum size of the generated Java
|
|
178 |
virtual machine code for any method, instance initialization method, or static
|
|
179 |
initializer (the size of any code array) to 65534 bytes.
|
|
180 |
|
|
181 |
"
|
|
182 |
|
|
183 |
(pc between:startPC and:endPC - 1) ifTrue:[
|
107
|
184 |
(catchType == 0) ifTrue:[^ handlerPC].
|
122
|
185 |
(catchType isNil) ifTrue:[^ handlerPC].
|
100
|
186 |
cls := aMethod javaClass.
|
749
|
187 |
catchType := catchType javaClass.
|
|
188 |
|
107
|
189 |
(catchType isKindOf:JavaClass) ifFalse:[
|
47
|
190 |
self halt.
|
|
191 |
^ nil
|
|
192 |
].
|
111
|
193 |
(exception isKindOf:catchType) ifTrue:[
|
47
|
194 |
^ handlerPC
|
|
195 |
].
|
|
196 |
^ nil
|
|
197 |
].
|
|
198 |
^ nil
|
255
|
199 |
|
749
|
200 |
"Modified: / 07-01-1998 / 15:30:14 / cg"
|
|
201 |
"Modified: / 31-05-2011 / 09:53:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
47
|
202 |
!
|
|
203 |
|
6
|
204 |
startPC:start_pc endPC:end_pc handlerPC:handler_pc catchType:catch_type
|
|
205 |
startPC := start_pc.
|
|
206 |
endPC := end_pc.
|
|
207 |
handlerPC := handler_pc.
|
|
208 |
catchType := catch_type
|
|
209 |
|
|
210 |
"Created: 16.4.1996 / 12:11:45 / cg"
|
|
211 |
! !
|
|
212 |
|
135
|
213 |
!JavaExceptionTableEntry class methodsFor:'documentation'!
|
6
|
214 |
|
|
215 |
version
|
749
|
216 |
^ '$Id: JavaExceptionTableEntry.st,v 1.16 2011/08/18 18:42:48 vrany Exp $'
|
|
217 |
!
|
|
218 |
|
|
219 |
version_SVN
|
|
220 |
^ '$Id: JavaExceptionTableEntry.st,v 1.16 2011/08/18 18:42:48 vrany Exp $'
|
|
221 |
! ! |