author | Stefan Vogel <sv@exept.de> |
Thu, 25 Apr 2013 15:09:57 +0200 | |
changeset 2552 | f4c15588965e |
parent 2551 | 6b1262d7f5a0 |
child 2555 | 655f39b36a10 |
permissions | -rw-r--r-- |
454 | 1 |
" |
2151 | 2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
3 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
4 |
New code and modifications done at SWING Research Group [1]: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
5 |
|
2151 | 6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
7 |
SWING Research Group, Czech Technical University in Prague |
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. |
|
2151 | 15 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
16 |
[1] Code written at SWING Research Group contains a signature |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
17 |
of one of the above copright owners. For exact set of such code, |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
18 |
see the differences between this version and version stx:libjava |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
19 |
as of 1.9.2010 |
2086 | 20 |
" |
678 | 21 |
"{ Package: 'stx:libjava' }" |
22 |
||
2551 | 23 |
CompiledCode variableSubclass:#JavaMethod |
2160 | 24 |
instanceVariableNames:'accessFlags selector javaClass descriptor signature lookupObject |
25 |
lineNumberTable localVariableTable sourceLineNumber annotations' |
|
26 |
classVariableNames:'AbstractMethodInvokationSignal SignatureTypeCodes |
|
27 |
ForceByteCodeDisplay UnresolvedClassSignal A_PUBLIC A_PRIVATE |
|
28 |
A_PROTECTED A_STATIC A_FINAL A_SYNCHRONIZED A_ABSTRACT A_NATIVE |
|
29 |
A_BREAKPOINT R_VOID R_LONG R_DOUBLE A_HASHANDLER A_BRIDGE |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
30 |
A_VARARGS A_STRICT A_SYNTHETIC A_RESOLVED A_HASFINALLY' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
31 |
poolDictionaries:'JavaConstants' |
2160 | 32 |
category:'Languages-Java-Classes' |
2 | 33 |
! |
34 |
||
454 | 35 |
!JavaMethod class methodsFor:'documentation'! |
36 |
||
37 |
copyright |
|
38 |
" |
|
2151 | 39 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
40 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
41 |
New code and modifications done at SWING Research Group [1]: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
42 |
|
2151 | 43 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
44 |
SWING Research Group, Czech Technical University in Prague |
454 | 45 |
|
46 |
This software is furnished under a license and may be used |
|
47 |
only in accordance with the terms of that license and with the |
|
48 |
inclusion of the above copyright notice. This software may not |
|
49 |
be provided or otherwise made available to, or used by, any |
|
50 |
other person. No title to or ownership of the software is |
|
51 |
hereby transferred. |
|
2151 | 52 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
53 |
[1] Code written at SWING Research Group contains a signature |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
54 |
of one of the above copright owners. For exact set of such code, |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
55 |
see the differences between this version and version stx:libjava |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
56 |
as of 1.9.2010 |
2151 | 57 |
|
2086 | 58 |
" |
454 | 59 |
! ! |
2 | 60 |
|
129 | 61 |
!JavaMethod class methodsFor:'initialization'! |
8 | 62 |
|
63 |
initialize |
|
277 | 64 |
AbstractMethodInvokationSignal isNil ifTrue:[ |
2114
cbdc4c02a8e2
ExecutionErrorSignal -> ExecutionError
Claus Gittinger <cg@exept.de>
parents:
2110
diff
changeset
|
65 |
AbstractMethodInvokationSignal := ExecutionError newSignalMayProceed:true. |
594 | 66 |
AbstractMethodInvokationSignal nameClass:self message:#abstractMethodInvokationSignal. |
67 |
AbstractMethodInvokationSignal notifierString:'attempt to execute abstract method'. |
|
68 |
||
2114
cbdc4c02a8e2
ExecutionErrorSignal -> ExecutionError
Claus Gittinger <cg@exept.de>
parents:
2110
diff
changeset
|
69 |
UnresolvedClassSignal := ExecutionError newSignalMayProceed:true. |
594 | 70 |
UnresolvedClassSignal nameClass:self message:#unresolvedClassSignal. |
71 |
UnresolvedClassSignal notifierString:'unresolved class'. |
|
277 | 72 |
]. |
73 |
||
252 | 74 |
A_PUBLIC := 16r0001. |
75 |
A_PRIVATE := 16r0002. |
|
76 |
A_PROTECTED := 16r0004. |
|
77 |
A_STATIC := 16r0008. |
|
78 |
A_FINAL := 16r0010. |
|
79 |
A_SYNCHRONIZED := 16r0020. |
|
2145 | 80 |
A_BRIDGE := 16r0040. |
81 |
A_VARARGS := 16r0080. |
|
252 | 82 |
A_NATIVE := 16r0100. |
83 |
A_ABSTRACT := 16r0400. |
|
2145 | 84 |
A_STRICT := 16r0800. |
85 |
A_SYNTHETIC := 16r1000. |
|
252 | 86 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
87 |
R_VOID := 16r01000000. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
88 |
R_LONG := 16r02000000. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
89 |
R_DOUBLE := 16r04000000. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
90 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
91 |
A_BREAKPOINT := 16r10000000. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
92 |
A_HASHANDLER := 16r20000000. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
93 |
A_HASFINALLY := 16r00004000. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
94 |
A_RESOLVED := 16r00000200. |
255 | 95 |
|
173 | 96 |
self flags:(self flags bitOr:Behavior flagJavaMethod). |
97 |
||
8 | 98 |
SignatureTypeCodes := IdentityDictionary new. |
99 |
SignatureTypeCodes at:$B put:#byte. |
|
100 |
SignatureTypeCodes at:$C put:#char. |
|
101 |
SignatureTypeCodes at:$D put:#double. |
|
102 |
SignatureTypeCodes at:$F put:#float. |
|
103 |
SignatureTypeCodes at:$I put:#int. |
|
104 |
SignatureTypeCodes at:$J put:#long. |
|
105 |
SignatureTypeCodes at:$S put:#'unsigned short'. |
|
106 |
SignatureTypeCodes at:$Z put:#boolean. |
|
107 |
SignatureTypeCodes at:$L put:#object. |
|
108 |
SignatureTypeCodes at:$[ put:#array. |
|
2151 | 109 |
SignatureTypeCodes at:$T put:#typevar. |
8 | 110 |
|
207 | 111 |
ForceByteCodeDisplay := false. |
112 |
||
8 | 113 |
" |
378 | 114 |
JavaMethod initialize. |
115 |
JavaMethodWithHandler initialize. |
|
209 | 116 |
ForceByteCodeDisplay := true. |
255 | 117 |
ForceByteCodeDisplay := false. |
8 | 118 |
" |
173 | 119 |
|
2151 | 120 |
"Modified: / 16-10-1998 / 01:29:48 / cg" |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
121 |
"Modified: / 28-03-2012 / 20:34:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2151 | 122 |
! |
123 |
||
124 |
reinitialize |
|
125 |
||
126 |
self flags:(self flags bitOr:Behavior flagJavaMethod). |
|
127 |
||
128 |
"Created: / 14-12-2010 / 20:58:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
378 | 129 |
! ! |
130 |
||
131 |
!JavaMethod class methodsFor:'instance creation'! |
|
132 |
||
133 |
fromMethod:aJavaMethod |
|
134 |
"create a new javaMethod, copying values from another javaMethod" |
|
135 |
||
136 |
^ self new fromMethod:aJavaMethod |
|
137 |
||
138 |
"Created: / 16.10.1998 / 01:25:12 / cg" |
|
139 |
! |
|
140 |
||
141 |
new |
|
142 |
"create a new javaMethod. |
|
143 |
Redefined, since constants are NOT stored in a literalArray, |
|
144 |
but my classes constantTable instead." |
|
145 |
||
146 |
^ self basicNew:0. |
|
147 |
||
148 |
"Created: / 16.10.1998 / 01:13:02 / cg" |
|
277 | 149 |
! ! |
150 |
||
151 |
!JavaMethod class methodsFor:'Signal constants'! |
|
152 |
||
153 |
abstractMethodInvokationSignal |
|
154 |
"return the signal raised when an abstract method is invoked" |
|
155 |
||
156 |
^ AbstractMethodInvokationSignal |
|
157 |
||
158 |
"Created: / 27.1.1998 / 21:50:05 / cg" |
|
594 | 159 |
! |
160 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
161 |
r_double |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
162 |
^R_DOUBLE |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
163 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
164 |
"Created: / 15-10-2012 / 23:21:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
165 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
166 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
167 |
r_long |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
168 |
^R_LONG |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
169 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
170 |
"Created: / 15-10-2012 / 23:20:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
171 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
172 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
173 |
r_void |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
174 |
^R_VOID |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
175 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
176 |
"Created: / 15-10-2012 / 23:20:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
177 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
178 |
|
594 | 179 |
unresolvedClassSignal |
180 |
"return the signal raised when an unresolved class is referenced" |
|
181 |
||
182 |
^ UnresolvedClassSignal |
|
183 |
||
184 |
"Created: / 27.1.1998 / 21:50:05 / cg" |
|
8 | 185 |
! ! |
186 |
||
169 | 187 |
!JavaMethod class methodsFor:'misc'! |
188 |
||
189 |
forceByteCodeDisplay |
|
190 |
^ ForceByteCodeDisplay |
|
191 |
||
192 |
"Created: 7.4.1997 / 20:11:39 / cg" |
|
309 | 193 |
! |
194 |
||
195 |
forceByteCodeDisplay:aBoolean |
|
196 |
ForceByteCodeDisplay := aBoolean |
|
197 |
||
198 |
" |
|
199 |
self forceByteCodeDisplay:true |
|
200 |
self forceByteCodeDisplay:false |
|
201 |
" |
|
202 |
||
203 |
"Created: / 4.2.1998 / 00:22:54 / cg" |
|
2151 | 204 |
! |
205 |
||
206 |
makeJavaMethod |
|
207 |
||
208 |
self flags:((self flags |
|
209 |
bitOr:Behavior flagJavaMethod) |
|
210 |
bitClear:Behavior flagMetaMethod) |
|
211 |
||
212 |
" |
|
213 |
JavaMethod makeJavaMethod |
|
214 |
JavaMethod makeMetaMethod |
|
215 |
" |
|
216 |
||
217 |
"Created: / 23-02-2011 / 12:56:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
218 |
! |
|
219 |
||
220 |
makeMetaMethod |
|
221 |
||
222 |
self flags:((self flags |
|
223 |
bitOr:Behavior flagMetaMethod) |
|
224 |
bitClear:Behavior flagJavaMethod) |
|
225 |
" |
|
226 |
JavaMethod makeJavaMethod |
|
227 |
JavaMethod makeMetaMethod |
|
228 |
" |
|
229 |
||
230 |
"Created: / 23-02-2011 / 12:56:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
169 | 231 |
! ! |
232 |
||
129 | 233 |
!JavaMethod class methodsFor:'signature parsing'! |
5 | 234 |
|
29 | 235 |
argSigArrayFromSignature:aSignature |
236 |
"given a signature, return a specArray for the arguments" |
|
237 |
||
238 | 238 |
|s| |
29 | 239 |
|
240 |
s := aSignature readStream. |
|
237 | 241 |
s next ~~ $( ifTrue:[self halt]. |
29 | 242 |
|
243 |
^ self argSigArrayFromStream:s. |
|
244 |
||
245 |
" |
|
246 |
JavaMethod argSigArrayFromSignature:'(LObject;)V' |
|
247 |
JavaMethod argSigArrayFromSignature:'(BB)S' |
|
248 |
JavaMethod argSigArrayFromSignature:'(LObject;LObject;II)V' |
|
249 |
" |
|
250 |
! |
|
251 |
||
252 |
argSigArrayFromStream:s |
|
253 |
"parse an argSpec, return an array of specs - see java doc" |
|
254 |
||
255 |
|argSpec spec| |
|
256 |
||
257 |
spec := #(). |
|
258 |
[s atEnd or:[s peek == $)]] whileFalse:[ |
|
259 |
"/ s peek == Character space ifTrue:[ |
|
260 |
"/ s next |
|
261 |
"/ ] ifFalse:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
262 |
argSpec := self fieldTypeFromStream:s in:nil. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
263 |
spec := spec copyWith:argSpec. |
29 | 264 |
"/ ] |
265 |
]. |
|
266 |
^ spec |
|
267 |
||
255 | 268 |
"Modified: / 8.1.1998 / 19:10:20 / cg" |
29 | 269 |
! |
270 |
||
2151 | 271 |
argSignatureFromArgTypeArray:arr |
272 |
| sig | |
|
321 | 273 |
|
274 |
sig := ''. |
|
2151 | 275 |
arr do: |
276 |
[:el | |
|
277 |
| jCLass | |
|
278 |
||
279 |
jCLass := el. |
|
280 |
jCLass isJavaClass |
|
281 |
ifFalse:[ jCLass := JavaVM reflection classForJavaClassObject:el ]. |
|
282 |
jCLass isJavaClass |
|
283 |
ifTrue: |
|
284 |
[ sig := sig , jCLass typeName. |
|
285 |
] |
|
286 |
ifFalse:[ self halt. ] ]. |
|
322 | 287 |
^ sig |
321 | 288 |
|
289 |
" |
|
290 |
self argSignatureFromArgTypeArray: |
|
2151 | 291 |
(Array |
292 |
with:(JavaVM javaClassObjectForClass:(Java at:'com.sun.java.swing.JComponent')))" |
|
293 |
||
294 |
"Modified: / 13-02-1998 / 14:57:58 / cg" |
|
295 |
"Modified: / 02-03-2011 / 22:49:24 / Marcel Hlopko <hlopik@gmail.com>" |
|
321 | 296 |
! |
297 |
||
113 | 298 |
argSpecFromSignature:aSignature withName:name |
299 |
"given a signature, return a spec" |
|
300 |
||
238 | 301 |
|s argSpec| |
113 | 302 |
|
303 |
s := aSignature readStream. |
|
304 |
s next ~~ $( ifTrue:[self halt. ^ name]. |
|
305 |
||
255 | 306 |
argSpec := self argSpecFromStream:s in:nil. |
113 | 307 |
|
308 |
s next ~~ $) ifTrue:[self halt. ^ name]. |
|
309 |
||
310 |
^ name , ' (' , argSpec , ')' |
|
311 |
||
312 |
" |
|
313 |
JavaMethod argSpecFromSignature:'(LObject;)V' withName:'foo' |
|
314 |
JavaMethod argSpecFromSignature:'(BB)S' withName:'foo' |
|
315 |
" |
|
316 |
||
255 | 317 |
"Modified: / 8.1.1998 / 19:05:36 / cg" |
5 | 318 |
! |
319 |
||
142 | 320 |
argSpecFromStream:s in:aPackage |
321 |
"parse an argSpec - see java doc" |
|
322 |
||
323 |
|argSpec spec| |
|
324 |
||
325 |
spec := ''. |
|
326 |
[s atEnd or:[s peek == $)]] whileFalse:[ |
|
327 |
"/ s peek == Character space ifTrue:[ |
|
328 |
"/ s next |
|
329 |
"/ ] ifFalse:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
330 |
argSpec := self fieldTypeFromStream:s in:aPackage. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
331 |
spec size ~~ 0 ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
332 |
spec := spec , ' ' |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
333 |
]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
334 |
spec := spec , argSpec. |
142 | 335 |
"/ ] |
336 |
]. |
|
337 |
^ spec |
|
338 |
||
339 |
"Created: 18.3.1997 / 11:06:44 / cg" |
|
340 |
! |
|
341 |
||
154 | 342 |
argSpecWithArgsFromStream:s in:aPackage |
343 |
"parse an argSpec - see java doc" |
|
344 |
||
255 | 345 |
^ self argSpecWithArgsFromStream:s in:aPackage argNames:nil |
346 |
||
347 |
"Modified: / 8.1.1998 / 19:21:00 / cg" |
|
348 |
! |
|
349 |
||
350 |
argSpecWithArgsFromStream:s in:aPackage argNames:argNames |
|
351 |
"parse an argSpec - see java doc" |
|
352 |
||
353 |
|argSpec spec argNr nm| |
|
154 | 354 |
|
355 |
argNr := 1. |
|
356 |
spec := ''. |
|
357 |
[s atEnd or:[s peek == $)]] whileFalse:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
358 |
argSpec := self fieldTypeFromStream:s in:aPackage. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
359 |
|
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
360 |
(argNames notNil |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
361 |
and:[argNames size >= argNr |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
362 |
and:[(nm := argNames at:argNr) notNil]]) ifFalse:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
363 |
nm := 'arg' , argNr printString. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
364 |
]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
365 |
argSpec := argSpec , ' ' , nm. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
366 |
|
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
367 |
spec size ~~ 0 ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
368 |
spec := spec , ', ' |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
369 |
]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
370 |
spec := spec , argSpec. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
371 |
|
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
372 |
argNr := argNr + 1. |
154 | 373 |
]. |
374 |
^ spec |
|
375 |
||
255 | 376 |
"Created: / 8.1.1998 / 19:20:36 / cg" |
377 |
"Modified: / 8.1.1998 / 21:14:33 / cg" |
|
8 | 378 |
! |
379 |
||
142 | 380 |
fieldTypeFromStream:s in:aPackage |
381 |
"parse a fieldTypeSpec - see java doc" |
|
382 |
||
2151 | 383 |
|typeChar typeSym elType size className nm out nangles | |
142 | 384 |
|
385 |
typeChar := s next. |
|
386 |
||
387 |
typeSym := SignatureTypeCodes at:typeChar ifAbsent:#unknown. |
|
388 |
||
389 |
typeSym == #unknown ifTrue:[ |
|
2151 | 390 |
^ typeSym |
142 | 391 |
]. |
2151 | 392 |
(typeSym == #object or: [typeSym == #typevar]) ifTrue:[ |
393 |
"Take care about type variables" |
|
394 |
out := String new writeStream. |
|
395 |
[ s peek ~~ $; and:[ s peek ~~ $< ] ] whileTrue:[ |
|
396 |
out nextPut: s next. |
|
397 |
]. |
|
398 |
className := out contents. |
|
399 |
"Eat possible type variables" |
|
400 |
(s peek == $<) ifTrue:[ |
|
401 |
nangles := 1. s next. |
|
402 |
[ nangles ~~ 0 ] whileTrue:[ |
|
403 |
s peek == $< ifTrue:[nangles := nangles + 1]. |
|
404 |
s peek == $> ifTrue:[nangles := nangles - 1]. |
|
405 |
s next. |
|
406 |
] |
|
407 |
]. |
|
408 |
s peek ~~ $; ifTrue:[self error: 'Signature corrupted?']. |
|
409 |
s next. "/eat ; |
|
410 |
||
411 |
||
412 |
typeSym == #typevar ifTrue:[^className]. |
|
413 |
"/ strip off default |
|
414 |
nm := className. |
|
415 |
aPackage notNil ifTrue:[ |
|
416 |
(nm startsWith:aPackage) ifTrue:[ |
|
417 |
nm := nm copyFrom:(aPackage size + 2). |
|
418 |
]. |
|
419 |
]. |
|
142 | 420 |
|
2151 | 421 |
nm := nm copyReplaceAll:$/ with:$.. |
422 |
^ nm |
|
142 | 423 |
]. |
189 | 424 |
|
142 | 425 |
typeSym == #array ifTrue:[ |
2151 | 426 |
s peek isDigit ifTrue:[ |
427 |
size := Integer readFrom:s. |
|
428 |
elType := self fieldTypeFromStream:s in:aPackage. |
|
429 |
^ elType , '[' , size printString , ']' |
|
430 |
]. |
|
431 |
elType := self fieldTypeFromStream:s in:aPackage. |
|
432 |
^ elType , '[]' |
|
142 | 433 |
]. |
189 | 434 |
|
142 | 435 |
^ typeSym |
436 |
||
2151 | 437 |
"Created: / 18-03-1997 / 11:07:56 / cg" |
438 |
"Modified: / 18-07-1998 / 22:57:06 / cg" |
|
439 |
"Modified: / 13-08-2011 / 01:05:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
142 | 440 |
! |
441 |
||
27 | 442 |
numArgsFromSignature:aSignature |
443 |
"given a signature, return the number of args" |
|
444 |
||
238 | 445 |
|s| |
27 | 446 |
|
447 |
s := aSignature readStream. |
|
2151 | 448 |
(aSignature includes: $() ifFalse:[self error:'Invalid signature']. |
449 |
[s next ~~ $(] whileTrue. |
|
27 | 450 |
|
451 |
^ self numArgsFromStream:s. |
|
452 |
||
453 |
" |
|
454 |
JavaMethod numArgsFromSignature:'(LObject;)V' |
|
455 |
JavaMethod numArgsFromSignature:'(BB)S' |
|
456 |
JavaMethod numArgsFromSignature:'()V' |
|
2151 | 457 |
JavaMethod numArgsFromSignature:'(Ljava/util/ArrayList<*>;)V' |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
458 |
JavaMethod numArgsFromSignature:'(L)V' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
459 |
|
27 | 460 |
" |
2151 | 461 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
462 |
"Modified (comment): / 12-10-2012 / 11:49:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
27 | 463 |
! |
464 |
||
465 |
numArgsFromStream:s |
|
466 |
"parse an argSpec - see java doc" |
|
467 |
||
238 | 468 |
|n t| |
27 | 469 |
|
470 |
n := 0. |
|
471 |
[s atEnd or:[s peek == $)]] whileFalse:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
472 |
t := self fieldTypeFromStream:s in:nil. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
473 |
"/ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
474 |
"/ some args count as 2 |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
475 |
"/ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
476 |
t == #long ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
477 |
n := n + 2. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
478 |
] ifFalse:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
479 |
t == #double ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
480 |
n := n + 2 |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
481 |
] ifFalse:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
482 |
n := n + 1. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
483 |
] |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
484 |
] |
27 | 485 |
]. |
486 |
^ n |
|
487 |
||
255 | 488 |
"Modified: / 8.1.1998 / 19:10:25 / cg" |
29 | 489 |
! |
490 |
||
142 | 491 |
retValSpecFromSignature:aSignature in:aPackage |
492 |
"given a signature, return a spec" |
|
493 |
||
494 |
|s argSpec retvalSpec| |
|
495 |
||
496 |
s := aSignature readStream. |
|
237 | 497 |
s next ~~ $( ifTrue:[self halt]. |
142 | 498 |
|
499 |
argSpec := self argSpecFromStream:s in:aPackage. |
|
500 |
||
237 | 501 |
s next ~~ $) ifTrue:[self halt]. |
142 | 502 |
|
503 |
retvalSpec := self retvalSpecFromStream:s in:aPackage. |
|
504 |
||
505 |
^ retvalSpec |
|
506 |
||
507 |
" |
|
508 |
JavaMethod retValSpecFromSignature:'(LObject;)V' |
|
509 |
JavaMethod retValSpecFromSignature:'(BB)S' |
|
510 |
" |
|
511 |
||
512 |
"Created: 18.3.1997 / 11:11:50 / cg" |
|
513 |
! |
|
514 |
||
189 | 515 |
returnTypeFromSignature:aSignature in:aPackage |
516 |
"given a signature, return its type as a string" |
|
517 |
||
238 | 518 |
|s c| |
189 | 519 |
|
520 |
s := aSignature readStream. |
|
521 |
(c := s peek) ~~ $( ifTrue:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
522 |
c == $' ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
523 |
[s peek ~= $'] whileTrue:[s next]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
524 |
s next. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
525 |
^ (self retvalSpecFromStream:s in:aPackage) |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
526 |
]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
527 |
^ (self retvalSpecFromStream:s in:aPackage) |
189 | 528 |
]. |
529 |
||
530 |
s next. |
|
255 | 531 |
self argSpecFromStream:s in:aPackage. |
189 | 532 |
s next ~~ $) ifTrue:[self halt. ^ nil]. |
533 |
||
534 |
^ (self retvalSpecFromStream:s in:aPackage) |
|
535 |
||
536 |
" |
|
537 |
JavaMethod returnTypeFromSignature:'(LObject;)V' |
|
538 |
JavaMethod returnTypeFromSignature:'(BB)S' |
|
539 |
JavaMethod returnTypeFromSignature:'()J' |
|
540 |
JavaMethod returnTypeFromSignature:'''first''J' |
|
541 |
" |
|
542 |
||
255 | 543 |
"Created: / 1.8.1997 / 10:54:31 / cg" |
544 |
"Modified: / 8.1.1998 / 19:09:06 / cg" |
|
72 | 545 |
! |
546 |
||
547 |
returnsVoidFromSignature:aSignature |
|
548 |
"given a signature, return true if it returns void, false if not" |
|
549 |
||
255 | 550 |
^ (self typeFromSignature:aSignature in:nil) = 'void' |
27 | 551 |
|
552 |
" |
|
553 |
JavaMethod returnsVoidFromSignature:'(LObject;)V' |
|
554 |
JavaMethod returnsVoidFromSignature:'(BB)S' |
|
555 |
" |
|
556 |
||
255 | 557 |
"Modified: / 8.1.1998 / 19:13:53 / cg" |
10 | 558 |
! |
559 |
||
142 | 560 |
retvalSpecFromStream:s in:aPackage |
561 |
"parse a retvalSpec - see java doc" |
|
562 |
||
332 | 563 |
|spec| |
564 |
||
142 | 565 |
s atEnd ifTrue:[self halt. ^ #void]. |
566 |
s peek == $V ifTrue:[^ #void]. |
|
332 | 567 |
spec := self fieldTypeFromStream:s in:aPackage. |
568 |
spec knownAsSymbol ifTrue:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
569 |
^ spec asSymbol |
332 | 570 |
]. |
571 |
^ spec |
|
142 | 572 |
|
332 | 573 |
"Created: / 18.3.1997 / 11:12:19 / cg" |
574 |
"Modified: / 7.4.1998 / 22:28:27 / cg" |
|
142 | 575 |
! |
576 |
||
189 | 577 |
specComponentsWithArgsFromSignature:aSignature withName:name in:aPackage |
578 |
"given a signature, return a spec" |
|
579 |
||
580 |
|s argSpec retvalSpec| |
|
581 |
||
582 |
s := aSignature readStream. |
|
583 |
s next ~~ $( ifTrue:[self halt. ^ name]. |
|
584 |
||
585 |
argSpec := self argSpecWithArgsFromStream:s in:aPackage. |
|
586 |
||
587 |
s next ~~ $) ifTrue:[self halt. ^ name]. |
|
588 |
||
589 |
retvalSpec := self retvalSpecFromStream:s in:aPackage. |
|
590 |
||
591 |
^ Array with:retvalSpec with:name with:argSpec |
|
592 |
||
593 |
" |
|
594 |
JavaMethod specWithArgsFromSignature:'(LObject;)V' withName:'foo' in:nil |
|
595 |
JavaMethod specComponentsWithArgsFromSignature:'(LObject;)V' withName:'foo' in:nil |
|
596 |
" |
|
597 |
||
598 |
"Created: 18.3.1997 / 11:06:22 / cg" |
|
599 |
"Modified: 1.8.1997 / 11:03:50 / cg" |
|
600 |
! |
|
601 |
||
255 | 602 |
specFromSignature:aSignature withName:name argNames:argNames in:aPackage |
10 | 603 |
"given a signature, return a spec" |
604 |
||
605 |
|s argSpec retvalSpec| |
|
606 |
||
607 |
s := aSignature readStream. |
|
608 |
s next ~~ $( ifTrue:[self halt. ^ name]. |
|
609 |
||
255 | 610 |
argSpec := self argSpecWithArgsFromStream:s in:aPackage argNames:argNames. |
10 | 611 |
|
612 |
s next ~~ $) ifTrue:[self halt. ^ name]. |
|
613 |
||
255 | 614 |
retvalSpec := self retvalSpecFromStream:s in:aPackage. |
10 | 615 |
|
616 |
^ retvalSpec , ' ' , name , ' (' , argSpec , ')' |
|
617 |
||
618 |
" |
|
255 | 619 |
JavaMethod specFromSignature:'(LObject;)V' withName:'foo' argNames:#('a') in:nil |
620 |
JavaMethod specFromSignature:'(BB)S' withName:'foo' argNames:#('a' 'b') in:nil |
|
10 | 621 |
" |
255 | 622 |
|
623 |
"Created: / 18.3.1997 / 11:06:22 / cg" |
|
624 |
"Modified: / 8.1.1998 / 21:14:43 / cg" |
|
83 | 625 |
! |
626 |
||
142 | 627 |
specFromSignature:aSignature withName:name in:aPackage |
628 |
"given a signature, return a spec" |
|
629 |
||
630 |
|s argSpec retvalSpec| |
|
631 |
||
632 |
s := aSignature readStream. |
|
633 |
s next ~~ $( ifTrue:[self halt. ^ name]. |
|
634 |
||
635 |
argSpec := self argSpecFromStream:s in:aPackage. |
|
636 |
||
637 |
s next ~~ $) ifTrue:[self halt. ^ name]. |
|
638 |
||
639 |
retvalSpec := self retvalSpecFromStream:s in:aPackage. |
|
640 |
||
641 |
^ retvalSpec , ' ' , name , ' (' , argSpec , ')' |
|
642 |
||
643 |
" |
|
255 | 644 |
JavaMethod specFromSignature:'(LObject;)V' withName:'foo' in:nil |
645 |
JavaMethod specFromSignature:'(BB)S' withName:'foo' in:nil |
|
142 | 646 |
" |
647 |
||
255 | 648 |
"Created: / 18.3.1997 / 11:06:22 / cg" |
649 |
"Modified: / 8.1.1998 / 21:06:32 / cg" |
|
142 | 650 |
! |
651 |
||
678 | 652 |
specTextFromSignature:aSignature in:aPackage withName:name |
653 |
"given a signature, return a spec as boldified text" |
|
654 |
||
655 |
|s argSpec retvalSpec| |
|
656 |
||
657 |
s := aSignature readStream. |
|
658 |
s next ~~ $( ifTrue:[self halt. ^ name]. |
|
659 |
||
660 |
argSpec := self argSpecFromStream:s in:aPackage. |
|
661 |
||
662 |
s next ~~ $) ifTrue:[self halt. ^ name]. |
|
663 |
||
664 |
retvalSpec := self retvalSpecFromStream:s in:aPackage. |
|
665 |
||
2110
6188ec8713ea
no need for asText when sending allBold
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
666 |
"/ ^ retvalSpec , ' ' , (name allBold) , ' (' , argSpec , ')' |
6188ec8713ea
no need for asText when sending allBold
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
667 |
^ (name allBold) , ' (' , argSpec , ')' |
678 | 668 |
|
669 |
" |
|
670 |
JavaMethod specTextFromSignature:'(LObject;)V' withName:'foo' |
|
671 |
JavaMethod specTextFromSignature:'(BB)S' withName:'foo' |
|
672 |
" |
|
673 |
||
674 |
"Modified: / 8.1.1998 / 19:11:20 / cg" |
|
675 |
! |
|
676 |
||
175 | 677 |
specTextFromSignature:aSignature withName:name |
678 |
"given a signature, return a spec as boldified text" |
|
679 |
||
680 |
|s argSpec retvalSpec| |
|
681 |
||
682 |
s := aSignature readStream. |
|
683 |
s next ~~ $( ifTrue:[self halt. ^ name]. |
|
684 |
||
255 | 685 |
argSpec := self argSpecFromStream:s in:nil. |
175 | 686 |
|
687 |
s next ~~ $) ifTrue:[self halt. ^ name]. |
|
688 |
||
255 | 689 |
retvalSpec := self retvalSpecFromStream:s in:nil. |
175 | 690 |
|
2110
6188ec8713ea
no need for asText when sending allBold
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
691 |
^ retvalSpec , ' ' , (name allBold) , ' (' , argSpec , ')' |
175 | 692 |
|
693 |
" |
|
694 |
JavaMethod specTextFromSignature:'(LObject;)V' withName:'foo' |
|
695 |
JavaMethod specTextFromSignature:'(BB)S' withName:'foo' |
|
696 |
" |
|
697 |
||
255 | 698 |
"Modified: / 8.1.1998 / 19:11:20 / cg" |
175 | 699 |
! |
700 |
||
189 | 701 |
specTextWithArgsFromSignature:aSignature withName:name in:aPackage |
702 |
"given a signature, return a spec" |
|
703 |
||
704 |
|s argSpec retvalSpec| |
|
705 |
||
706 |
s := aSignature readStream. |
|
707 |
s next ~~ $( ifTrue:[self halt. ^ name]. |
|
708 |
||
709 |
argSpec := self argSpecWithArgsFromStream:s in:aPackage. |
|
710 |
||
711 |
s next ~~ $) ifTrue:[self halt. ^ name]. |
|
712 |
||
713 |
retvalSpec := self retvalSpecFromStream:s in:aPackage. |
|
714 |
||
2110
6188ec8713ea
no need for asText when sending allBold
Claus Gittinger <cg@exept.de>
parents:
2107
diff
changeset
|
715 |
^ retvalSpec , ' ' , (name allBold) , ' (' , argSpec , ')' |
189 | 716 |
|
717 |
" |
|
718 |
JavaMethod specWithArgsFromSignature:'(LObject;)V' withName:'foo' in:nil |
|
719 |
JavaMethod specWithArgsFromSignature:'(BB)S' withName:'foo' in:nil |
|
720 |
" |
|
721 |
||
722 |
"Modified: 20.3.1997 / 12:50:10 / cg" |
|
723 |
"Created: 1.8.1997 / 10:43:57 / cg" |
|
724 |
! |
|
725 |
||
154 | 726 |
specWithArgsFromSignature:aSignature withName:name in:aPackage |
727 |
"given a signature, return a spec" |
|
728 |
||
729 |
|s argSpec retvalSpec| |
|
730 |
||
731 |
s := aSignature readStream. |
|
732 |
s next ~~ $( ifTrue:[self halt. ^ name]. |
|
733 |
||
734 |
argSpec := self argSpecWithArgsFromStream:s in:aPackage. |
|
735 |
||
736 |
s next ~~ $) ifTrue:[self halt. ^ name]. |
|
737 |
||
738 |
retvalSpec := self retvalSpecFromStream:s in:aPackage. |
|
739 |
||
740 |
^ retvalSpec , ' ' , name , ' (' , argSpec , ')' |
|
741 |
||
742 |
" |
|
743 |
JavaMethod specWithArgsFromSignature:'(LObject;)V' withName:'foo' in:nil |
|
744 |
JavaMethod specWithArgsFromSignature:'(BB)S' withName:'foo' in:nil |
|
745 |
" |
|
746 |
||
747 |
"Created: 18.3.1997 / 11:06:22 / cg" |
|
748 |
"Modified: 20.3.1997 / 12:50:10 / cg" |
|
749 |
! |
|
750 |
||
189 | 751 |
typeFromSignature:aSignature in:package |
752 |
"given a signature, return its type as a string" |
|
753 |
||
238 | 754 |
|s c| |
189 | 755 |
|
756 |
s := aSignature readStream. |
|
757 |
(c := s peek) ~~ $( ifTrue:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
758 |
c == $' ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
759 |
s next. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
760 |
[s peek ~= $'] whileTrue:[s next]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
761 |
s next. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
762 |
^ (self retvalSpecFromStream:s in:package) |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
763 |
]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
764 |
^ (self retvalSpecFromStream:s in:package) |
189 | 765 |
]. |
766 |
||
767 |
s next. |
|
255 | 768 |
self argSpecFromStream:s in:nil. |
189 | 769 |
s next ~~ $) ifTrue:[self halt. ^ nil]. |
770 |
||
771 |
^ (self retvalSpecFromStream:s in:package) |
|
772 |
||
773 |
" |
|
774 |
JavaMethod typeFromSignature:'(LObject;)Ljava/lang/Object' |
|
775 |
JavaMethod typeFromSignature:'(LObject;)Ljava/lang/Object' in:'java.lang' |
|
776 |
" |
|
777 |
||
255 | 778 |
"Created: / 1.8.1997 / 10:50:38 / cg" |
779 |
"Modified: / 8.1.1998 / 19:09:31 / cg" |
|
10 | 780 |
! ! |
781 |
||
2151 | 782 |
!JavaMethod methodsFor:'* As yet uncategorized *'! |
783 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
784 |
annotationIndexOf:aSymbol |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
785 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
786 |
^nil |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
787 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
788 |
"Created: / 24-02-2012 / 16:06:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
789 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
790 |
|
2151 | 791 |
sends:symbol1 or:symbol2 |
792 |
||
793 |
^false |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
794 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
795 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
796 |
sendsAny: selectors |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
797 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
798 |
^false |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
799 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
800 |
"Created: / 02-12-2011 / 23:05:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2151 | 801 |
! ! |
802 |
||
10 | 803 |
!JavaMethod methodsFor:'accessing'! |
804 |
||
334 | 805 |
accessFlags |
806 |
"java calls this the modifiers" |
|
807 |
||
808 |
^ accessFlags |
|
809 |
||
810 |
"Created: / 9.4.1998 / 17:49:44 / cg" |
|
811 |
! |
|
812 |
||
2151 | 813 |
annotations |
814 |
^ annotations ifNil:[JavaMethodAnnotationContainer empty]. |
|
815 |
||
816 |
"Modified: / 03-03-2011 / 23:51:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
817 |
! |
|
818 |
||
819 |
annotations:something |
|
820 |
annotations := something. |
|
821 |
! |
|
822 |
||
29 | 823 |
argSignature |
2151 | 824 |
^ self class argSigArrayFromSignature:descriptor |
825 |
! |
|
826 |
||
827 |
asByteCodeMethod |
|
828 |
||
829 |
"JavaMethods are always bytecode methods" |
|
830 |
||
831 |
^self |
|
832 |
||
833 |
"Created: / 18-07-2011 / 20:48:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
29 | 834 |
! |
835 |
||
678 | 836 |
comment |
837 |
"should access the source here, and parse any method comment" |
|
838 |
||
839 |
^ nil |
|
840 |
! |
|
841 |
||
10 | 842 |
constantPool |
843 |
^ javaClass constantPool |
|
844 |
||
845 |
"Modified: 16.4.1996 / 12:36:27 / cg" |
|
846 |
"Created: 16.4.1996 / 15:28:50 / cg" |
|
847 |
! |
|
848 |
||
129 | 849 |
containingClass |
850 |
^ javaClass |
|
851 |
||
852 |
! |
|
853 |
||
169 | 854 |
decompiledBytecode |
855 |
|s| |
|
856 |
||
857 |
s := '' writeStream. |
|
858 |
JavaDecompiler decompile:self to:s. |
|
859 |
^ s contents |
|
860 |
||
861 |
"Created: 7.4.1997 / 20:10:37 / cg" |
|
862 |
! |
|
863 |
||
75 | 864 |
decompiledSource |
865 |
|s| |
|
866 |
||
867 |
s := '' writeStream. |
|
175 | 868 |
self decompileSourceTo:s. |
75 | 869 |
^ s contents |
175 | 870 |
|
871 |
"Modified: 30.7.1997 / 16:27:55 / cg" |
|
75 | 872 |
! |
873 |
||
2151 | 874 |
descriptor |
875 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
876 |
^ (JavaDescriptor fromString: descriptor) name: self name |
2151 | 877 |
|
878 |
"Created: / 16-04-1996 / 11:34:29 / cg" |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
879 |
"Modified: / 06-12-2011 / 21:53:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
880 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
881 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
882 |
descriptorSymbol |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
883 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
884 |
^descriptor |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
885 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
886 |
"Created: / 16-04-1996 / 11:34:29 / cg" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
887 |
"Created: / 06-12-2011 / 23:00:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2151 | 888 |
! |
889 |
||
890 |
ensureHasAnnotations |
|
891 |
annotations |
|
892 |
ifNil:[ annotations := JavaMethodAnnotationContainer for:self ]. |
|
893 |
^ annotations |
|
894 |
||
895 |
"Created: / 25-02-2011 / 16:02:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
896 |
"Modified: / 28-02-2011 / 16:33:00 / Marcel Hlopko <hlopik@gmail.com>" |
|
897 |
! |
|
898 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
899 |
exceptionClasses |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
900 |
"Return a collection of declared exception classes that this method |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
901 |
throws" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
902 |
^#() |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
903 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
904 |
"Created: / 01-08-2012 / 10:06:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
905 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
906 |
|
135 | 907 |
exceptionHandlerTable |
378 | 908 |
^ nil |
135 | 909 |
|
378 | 910 |
"Created: / 16.10.1998 / 01:50:51 / cg" |
135 | 911 |
! |
912 |
||
83 | 913 |
exceptionTable |
378 | 914 |
^ nil |
83 | 915 |
|
378 | 916 |
"Created: / 16.10.1998 / 01:51:04 / cg" |
83 | 917 |
! |
918 |
||
2151 | 919 |
firstInstructionLineNumber |
920 |
ForceByteCodeDisplay == true ifTrue:[ ^ 1]. |
|
921 |
lineNumberTable notNil ifTrue:[ ^ lineNumberTable at:2]. |
|
922 |
^ 0. |
|
923 |
||
924 |
"Created: / 17-12-2010 / 17:02:46 / Jan Kurs <kurs.jan@post.cz>" |
|
925 |
"Modified: / 08-01-2011 / 16:30:16 / Jan Kurs <kurs.jan@post.cz>" |
|
926 |
! |
|
927 |
||
928 |
getExceptionTable |
|
929 |
||
930 |
^ nil |
|
931 |
||
932 |
"Created: / 04-02-2011 / 23:07:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
933 |
! |
|
934 |
||
2090 | 935 |
getSourcePosition |
936 |
^ 1 |
|
937 |
! |
|
938 |
||
90 | 939 |
hasLineNumberInformation |
940 |
^ lineNumberTable notNil |
|
941 |
||
942 |
"Created: 16.4.1996 / 12:34:04 / cg" |
|
943 |
"Modified: 16.4.1996 / 12:49:06 / cg" |
|
944 |
! |
|
945 |
||
10 | 946 |
javaByteCode |
184 | 947 |
"/ ^ javaByteCode |
948 |
^ byteCode |
|
10 | 949 |
|
950 |
"Created: 16.4.1996 / 14:55:44 / cg" |
|
184 | 951 |
"Modified: 1.8.1997 / 00:08:45 / cg" |
8 | 952 |
! |
953 |
||
27 | 954 |
javaClass |
955 |
^ javaClass |
|
956 |
||
957 |
"Modified: 16.4.1996 / 12:36:27 / cg" |
|
958 |
"Created: 16.4.1996 / 14:55:44 / cg" |
|
959 |
! |
|
960 |
||
2151 | 961 |
javaExceptionTable |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
962 |
<resource: #obsolete> |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
963 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
964 |
self obsoleteMethodWarning: 'Use #exceptionClasses instead'. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
965 |
^ self exceptionClasses |
2151 | 966 |
|
967 |
"Created: / 04-06-2011 / 18:16:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
968 |
"Modified: / 01-08-2012 / 10:08:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2151 | 969 |
! |
970 |
||
971 |
javaNumArgs |
|
972 |
^ self argSignature size. |
|
973 |
||
974 |
"Created: / 14-03-2011 / 15:50:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
975 |
! |
|
976 |
||
90 | 977 |
lineNumber |
252 | 978 |
lineNumberTable isNil ifTrue:[^ nil]. |
90 | 979 |
^ lineNumberTable at:2 |
980 |
||
981 |
"Created: 16.4.1996 / 12:34:04 / cg" |
|
982 |
"Modified: 16.4.1996 / 12:49:06 / cg" |
|
983 |
! |
|
984 |
||
50 | 985 |
lineNumberTable |
2151 | 986 |
"/ lineNumberTable ifNil:[ lineNumberTable := Dictionary new.]. |
50 | 987 |
^ lineNumberTable |
988 |
||
2151 | 989 |
"Created: / 16-04-1996 / 12:34:04 / cg" |
990 |
"Modified: / 13-12-2010 / 11:06:40 / Jan Kurs <kurs.jan@post.cz>" |
|
50 | 991 |
! |
992 |
||
618 | 993 |
literalsDetect:aBlock ifNone:exceptionBlock |
994 |
"execute a one arg block for each of our literals. |
|
995 |
return the first literal for which aBlock returns true" |
|
996 |
||
997 |
"/ sigh - must first extract all accessed literals ... |
|
998 |
"/ must deparse the byteCode in order to do this. |
|
999 |
||
1000 |
|walker| |
|
1001 |
||
1002 |
walker := JavaByteCodeEnumerator new. |
|
651 | 1003 |
walker literalAction:[:pc :slotIndex :const | |
1004 |
const isJavaMethodRef ifTrue:[ |
|
654 | 1005 |
(aBlock value:(const name)) ifTrue:[^ const name]. |
651 | 1006 |
] ifFalse:[ |
1007 |
const isJavaClassRef ifTrue:[ |
|
654 | 1008 |
(aBlock value:(const name)) ifTrue:[^ const name]. |
651 | 1009 |
] |
1010 |
] |
|
1011 |
]. |
|
618 | 1012 |
walker decompile:self to:nil. |
654 | 1013 |
^ nil |
618 | 1014 |
|
1015 |
"Created: / 9.11.1999 / 15:21:40 / cg" |
|
654 | 1016 |
"Modified: / 24.12.1999 / 02:55:55 / cg" |
618 | 1017 |
! |
1018 |
||
85 | 1019 |
localVariableTable |
1020 |
^ localVariableTable |
|
1021 |
||
1022 |
" |
|
1023 |
JavaMethod allInstancesDo:[:m| m localVariableTable notNil ifTrue:[self halt]] |
|
1024 |
" |
|
1025 |
! |
|
1026 |
||
2151 | 1027 |
mclass |
1028 |
^ self javaClass |
|
1029 |
! |
|
1030 |
||
1031 |
mclass: anObject |
|
1032 |
||
1033 |
javaClass := anObject |
|
1034 |
||
1035 |
"Created: / 18-10-2010 / 19:01:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1036 |
! |
|
1037 |
||
2086 | 1038 |
methodArgAndVarNames |
2151 | 1039 |
^ "((1 to:self numArgs) collect:[:i | 'arg' , i printString])" |
1040 |
self methodArgNames |
|
2086 | 1041 |
, |
2151 | 1042 |
"((1 to:self numVars) collect:[:i | 'local' , i printString])" |
1043 |
self methodVarNames |
|
1044 |
||
1045 |
"Modified: / 23-11-2010 / 19:32:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
31 | 1046 |
! |
1047 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1048 |
methodArgAndVarNamesInContext: context |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1049 |
| pc | |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1050 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1051 |
localVariableTable isNil ifTrue:[^self methodArgNames , self methodVarNames ]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1052 |
pc := context pc. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1053 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1054 |
^(1 to: self numArgs + self numVars) collect:[:i| |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1055 |
(localVariableTable nameForSlot: i - 1 atPC: pc) ? '???'. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1056 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1057 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1058 |
"Created: / 18-12-2012 / 18:17:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1059 |
"Modified: / 09-01-2013 / 18:00:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1060 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1061 |
|
31 | 1062 |
methodArgNames |
252 | 1063 |
|nA| |
1064 |
||
1065 |
nA := self numArgs. |
|
102 | 1066 |
localVariableTable notNil ifTrue:[ |
2151 | 1067 |
^ (1 to:nA) collect: |
1068 |
[:argIndex | |
|
1069 |
|slot name| |
|
1070 |
"/ search for an entry with that index (slot), |
|
1071 |
"/ which has is valid at PC 0 |
|
1072 |
||
1073 |
self isStatic ifTrue:[ |
|
1074 |
slot := argIndex - 1 |
|
1075 |
] ifFalse:[ |
|
1076 |
slot := argIndex "/+ 1 |
|
1077 |
]. |
|
1078 |
name := localVariableTable nameForSlot:slot atPC:0. |
|
1079 |
name isNil ifTrue:[ |
|
1080 |
'arg' , argIndex printString |
|
1081 |
] ifFalse:[ |
|
1082 |
name |
|
1083 |
]. |
|
1084 |
] |
|
102 | 1085 |
]. |
252 | 1086 |
^ (1 to:nA) collect:[:i | 'arg' , i printString] |
2151 | 1087 |
|
1088 |
"Modified: / 23-11-2010 / 19:47:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1089 |
! |
|
1090 |
||
1091 |
methodVarNames |
|
1092 |
|nV| |
|
1093 |
||
1094 |
nV := self numVars. |
|
1095 |
localVariableTable notNil ifTrue:[ |
|
1096 |
^ (self numArgs + 1 to: self numArgs + nV) collect: |
|
1097 |
[:argIndex | |
|
1098 |
|slot name| |
|
1099 |
"/ search for an entry with that index (slot), |
|
1100 |
"/ which has is valid at PC 0 |
|
1101 |
||
1102 |
self isStatic ifTrue:[ |
|
1103 |
slot := argIndex - 1 |
|
1104 |
] ifFalse:[ |
|
1105 |
slot := argIndex"/ + 1 |
|
1106 |
]. |
|
1107 |
name := localVariableTable nameForSlot:slot atPC:0. |
|
1108 |
name isNil ifTrue:[ |
|
1109 |
'local' , argIndex printString |
|
1110 |
] ifFalse:[ |
|
1111 |
name |
|
1112 |
]. |
|
1113 |
] |
|
1114 |
]. |
|
1115 |
^ (1 to:nV) collect:[:i | 'local' , i printString] |
|
1116 |
||
1117 |
"Created: / 23-11-2010 / 19:28:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
31 | 1118 |
! |
1119 |
||
29 | 1120 |
name |
2151 | 1121 |
^ (selector copyWithoutLast:descriptor size) asSymbol |
29 | 1122 |
|
1123 |
"Created: 16.4.1996 / 11:34:22 / cg" |
|
1124 |
! |
|
1125 |
||
2151 | 1126 |
nameSpaceName |
1127 |
||
1128 |
^'' |
|
1129 |
||
1130 |
"Created: / 18-10-2010 / 19:10:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1131 |
! |
|
1132 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1133 |
numJArgs |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1134 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1135 |
^self numberOfJavaArgs |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1136 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1137 |
"Created: / 25-10-2011 / 10:50:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1138 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1139 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1140 |
numJavaArgs |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1141 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1142 |
^self numberOfJavaArgs |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1143 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1144 |
"Created: / 25-10-2011 / 10:50:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
118 | 1145 |
! |
1146 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1147 |
numberOfJavaArgs |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1148 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1149 |
^(accessFlags bitAnd: 16r00FF0000) rightShift: 16. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1150 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1151 |
"Created: / 25-10-2011 / 10:45:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1152 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1153 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1154 |
numberOfJavaArgs: nArgs |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1155 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1156 |
( nArgs > 16rFF ) ifTrue:[ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1157 |
ArgumentError raiseRequestWith:self errorString:'too many args method - ', nArgs printString. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1158 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1159 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1160 |
accessFlags := accessFlags bitOr: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1161 |
((nArgs bitAnd: 16rFF) bitShift: 16) |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1162 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1163 |
"Created: / 25-10-2011 / 10:43:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
27 | 1164 |
! |
1165 |
||
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1166 |
originalMethodIfWrapped |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1167 |
"return the method the receiver is wrapping - none here" |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1168 |
|
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1169 |
^ self |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1170 |
|
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1171 |
"Created: / 22-10-2010 / 11:46:07 / cg" |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1172 |
! |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1173 |
|
175 | 1174 |
previousVersion |
1175 |
^ nil |
|
1176 |
||
1177 |
"Created: 30.7.1997 / 15:56:18 / cg" |
|
1178 |
! |
|
1179 |
||
2151 | 1180 |
previousVersionCode |
1181 |
||
1182 |
^nil |
|
1183 |
||
1184 |
"Created: / 18-10-2010 / 20:15:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1185 |
! |
|
1186 |
||
29 | 1187 |
retValSignature |
2151 | 1188 |
^ self class retValSpecFromSignature:descriptor in:nil |
29 | 1189 |
|
255 | 1190 |
"Modified: / 8.1.1998 / 19:06:40 / cg" |
29 | 1191 |
! |
1192 |
||
123 | 1193 |
returnType |
378 | 1194 |
"/ ^ returnType |
2151 | 1195 |
^ self class typeFromSignature:descriptor in:nil. |
378 | 1196 |
|
1197 |
"Modified: / 16.10.1998 / 00:17:43 / cg" |
|
123 | 1198 |
! |
1199 |
||
322 | 1200 |
returnTypeClass |
378 | 1201 |
|cls returnType| |
322 | 1202 |
|
378 | 1203 |
(returnType := self returnType) isNil ifTrue:[ |
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1204 |
self halt. |
322 | 1205 |
]. |
1206 |
cls := Java at:returnType. |
|
1207 |
cls notNil ifTrue:[^ cls]. |
|
1208 |
||
1209 |
returnType == #void ifTrue:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1210 |
^ nil |
322 | 1211 |
]. |
1212 |
returnType == #double ifTrue:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1213 |
'warning: no returnTypeClass for double' printCR. |
334 | 1214 |
"/ self halt:'no returnTypeClass for double'. |
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1215 |
^ nil |
322 | 1216 |
]. |
1217 |
returnType == #float ifTrue:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1218 |
'warning: no returnTypeClass for float' printCR. |
334 | 1219 |
"/ self halt:'no returnTypeClass for float'. |
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1220 |
^ nil |
322 | 1221 |
]. |
1222 |
returnType == #long ifTrue:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1223 |
'warning: no returnTypeClass for long' printCR. |
334 | 1224 |
"/ self halt:'no returnTypeClass for long'. |
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1225 |
^ nil |
334 | 1226 |
]. |
1227 |
returnType == #int ifTrue:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1228 |
'warning: no returnTypeClass for int' printCR. |
334 | 1229 |
"/ self halt:'no returnTypeClass for int'. |
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1230 |
^ nil |
334 | 1231 |
]. |
1232 |
returnType == #boolean ifTrue:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1233 |
'warning: no returnTypeClass for boolean' printCR. |
334 | 1234 |
"/ self halt:'no returnTypeClass for boolean'. |
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1235 |
^ nil |
322 | 1236 |
]. |
1237 |
self halt. |
|
1238 |
^ nil |
|
1239 |
||
1240 |
"Created: / 13.2.1998 / 15:08:26 / cg" |
|
378 | 1241 |
"Modified: / 16.10.1998 / 00:16:07 / cg" |
322 | 1242 |
! |
1243 |
||
116 | 1244 |
returnsDouble |
378 | 1245 |
^ self returnType == #double |
1246 |
||
1247 |
"Modified: / 16.10.1998 / 00:18:24 / cg" |
|
116 | 1248 |
! |
1249 |
||
72 | 1250 |
returnsLong |
378 | 1251 |
^ self returnType == #long |
1252 |
||
1253 |
"Modified: / 16.10.1998 / 00:18:41 / cg" |
|
72 | 1254 |
! |
1255 |
||
27 | 1256 |
returnsVoid |
378 | 1257 |
^ self returnType == #void |
1258 |
||
2151 | 1259 |
"Modified: / 16-10-1998 / 00:18:53 / cg" |
1260 |
"Modified: / 22-03-2011 / 12:27:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
27 | 1261 |
! |
1262 |
||
255 | 1263 |
selector |
378 | 1264 |
"/ could theoretically be extracted from my classes |
1265 |
"/ methodDictionary via: |
|
1266 |
"/ ^ javaClass methodDictionary keyAtValue:self ifAbsent:nil. |
|
1267 |
||
255 | 1268 |
^ selector |
1269 |
||
1270 |
"Created: / 7.1.1998 / 14:05:11 / cg" |
|
378 | 1271 |
"Modified: / 16.10.1998 / 13:41:06 / cg" |
255 | 1272 |
! |
1273 |
||
27 | 1274 |
signature |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1275 |
^ signature |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1276 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1277 |
"Modified: / 04-12-2011 / 19:39:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
31 | 1278 |
! |
1279 |
||
1280 |
source |
|
2151 | 1281 |
| classSource | |
1282 |
"/ self isNative ifTrue:[ |
|
1283 |
"/ ^ 'native method' |
|
1284 |
"/ ]. |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1285 |
(self isSynthetic or:[ForceByteCodeDisplay == true]) ifTrue:[ |
2151 | 1286 |
^ self decompiledBytecode |
169 | 1287 |
]. |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1288 |
"/ lineNumberTable notNil ifTrue:[ |
2151 | 1289 |
classSource := javaClass source. |
1290 |
classSource notNil ifTrue:[ ^ classSource]. |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1291 |
"/ ]. |
75 | 1292 |
^ self decompiledSource |
169 | 1293 |
|
2151 | 1294 |
"Modified: / 04-01-1998 / 13:48:35 / cg" |
1295 |
"Modified: / 13-12-2010 / 11:06:51 / Jan Kurs <kurs.jan@post.cz>" |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1296 |
"Modified: / 13-04-2012 / 18:18:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
31 | 1297 |
! |
1298 |
||
1299 |
sourceFilename |
|
1300 |
^ javaClass sourceFile |
|
175 | 1301 |
! |
1302 |
||
1303 |
sourceLineNumber |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1304 |
|
2151 | 1305 |
sourceLineNumber ifNil: [ |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1306 |
"/ sourceLineNumber := (JavaSourceCodeCache new) |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1307 |
"/ findLineForMethod: self |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1308 |
"/ inClass:javaClass. |
2151 | 1309 |
]. |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1310 |
|
2151 | 1311 |
sourceLineNumber := 0. |
1312 |
||
1313 |
sourceLineNumber == 0 ifTrue: |
|
1314 |
[ |
|
1315 |
"There is something wrong with parsing" |
|
1316 |
"/ self halt. |
|
1317 |
self breakPoint: #libjava. |
|
1318 |
sourceLineNumber := self firstInstructionLineNumber -2. |
|
175 | 1319 |
]. |
1320 |
||
2151 | 1321 |
^ sourceLineNumber. |
1322 |
||
1323 |
"Created: / 30-07-1997 / 15:40:45 / cg" |
|
1324 |
"Modified: / 13-12-2010 / 23:46:30 / Marcel Hlopko <hlopik@gmail.com>" |
|
1325 |
"Modified: / 08-01-2011 / 16:20:40 / Jan Kurs <kurs.jan@post.cz>" |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1326 |
"Modified: / 24-02-2012 / 19:24:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2151 | 1327 |
! |
1328 |
||
1329 |
wrapper |
|
1330 |
||
1331 |
^nil |
|
1332 |
||
1333 |
"Created: / 18-10-2010 / 19:11:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1334 |
! ! |
|
1335 |
||
1336 |
!JavaMethod methodsFor:'compiler interface'! |
|
1337 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1338 |
flushCode |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1339 |
"Flushes jitted code, effectively cause a recompile" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1340 |
self code: nil. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1341 |
ObjectMemory flushCachesForSelector: selector. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1342 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1343 |
"Created: / 15-10-2012 / 21:03:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1344 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1345 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1346 |
mcompile |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1347 |
"__mcompile(OBJ aMethod, unsigned char *bytecode, int nBytes, int nArgs, OBJ receiver, OBJ selector, OBJ srchClass, OBJ *pArgsOrNull)" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1348 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1349 |
| bytecode nBytes nArgs receiver mySelector srchClass pArgsOrNull retVal | |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1350 |
bytecode := self byteCode. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1351 |
nBytes := self byteCode size. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1352 |
nArgs := self numArgs. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1353 |
receiver := nil. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1354 |
mySelector := self selector. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1355 |
srchClass := self mclass. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1356 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1357 |
%{ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1358 |
retVal = __mcompile(self, __ByteArrayInstPtr(bytecode), __intVal(nBytes), __intVal(nArgs), receiver, mySelector, srchClass, pArgsOrNull); |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1359 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1360 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1361 |
%}. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1362 |
self halt. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1363 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1364 |
"Created: / 24-02-2012 / 11:39:13 / m" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1365 |
"Modified: / 24-02-2012 / 14:00:04 / Marcel Hlopko <hlopik@gmail.com>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1366 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1367 |
|
2151 | 1368 |
programmingLanguage |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1369 |
"Returns a programming language of the method" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1370 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1371 |
"Do not return JavaLanguage unconditionally here. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1372 |
Consider another JVM-based languages (such as Groovy)" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1373 |
^javaClass programmingLanguage |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1374 |
|
2151 | 1375 |
"Created: / 26-10-2010 / 23:42:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
8 | 1376 |
! ! |
1377 |
||
255 | 1378 |
!JavaMethod methodsFor:'debugging'! |
1379 |
||
1380 |
breakPoint |
|
1381 |
Debugger enter:thisContext sender withMessage:'breakpoint' |
|
1382 |
||
1383 |
"Modified: / 9.1.1998 / 23:01:17 / cg" |
|
1384 |
! |
|
1385 |
||
1386 |
clearBreakPoint |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1387 |
| clsInEvent | |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1388 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1389 |
accessFlags := (accessFlags bitClear:A_BREAKPOINT). |
449 | 1390 |
self hasCode ifTrue:[ |
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1391 |
MessageTracer unwrapMethod:self |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1392 |
] ifFalse:[ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1393 |
clsInEvent := self isStatic |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1394 |
ifTrue:[ javaClass theMetaclass ] |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1395 |
ifFalse:[ javaClass ]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1396 |
Smalltalk changed:#methodTrap with:{ clsInEvent . selector } |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1397 |
] |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1398 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1399 |
"Modified: / 13-11-1998 / 23:31:00 / cg" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1400 |
"Modified: / 30-05-2012 / 19:31:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
255 | 1401 |
! |
1402 |
||
257 | 1403 |
isCounting |
1404 |
^ false. |
|
1405 |
||
1406 |
"Created: / 12.1.1998 / 20:02:23 / cg" |
|
1407 |
! |
|
1408 |
||
1409 |
isCountingMemoryUsage |
|
1410 |
^ false. |
|
1411 |
||
1412 |
"Created: / 12.1.1998 / 20:03:22 / cg" |
|
1413 |
! |
|
1414 |
||
255 | 1415 |
setBreakPoint |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1416 |
| clsInEvent | |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1417 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1418 |
accessFlags := (accessFlags bitOr:A_BREAKPOINT). |
449 | 1419 |
self hasCode ifTrue:[ |
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1420 |
MessageTracer trapMethod:self |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1421 |
] ifFalse:[ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1422 |
clsInEvent := self isStatic |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1423 |
ifTrue:[ javaClass theMetaclass ] |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1424 |
ifFalse:[ javaClass ]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1425 |
Smalltalk changed:#methodTrap with:{ clsInEvent . selector } |
449 | 1426 |
]. |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1427 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1428 |
"Modified: / 13-11-1998 / 23:30:45 / cg" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1429 |
"Modified: / 30-05-2012 / 19:30:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
257 | 1430 |
! |
1431 |
||
1432 |
setTraceFullPoint |
|
1433 |
"not yet implemented" |
|
1434 |
||
1435 |
"Modified: / 9.1.1998 / 23:01:17 / cg" |
|
1436 |
"Created: / 12.1.1998 / 20:04:45 / cg" |
|
1437 |
! |
|
1438 |
||
1439 |
setTracePoint |
|
1440 |
"not yet implemented" |
|
1441 |
||
1442 |
"Modified: / 9.1.1998 / 23:01:17 / cg" |
|
1443 |
"Created: / 12.1.1998 / 20:04:02 / cg" |
|
1444 |
! |
|
1445 |
||
1446 |
setTraceSenderPoint |
|
1447 |
"not yet implemented" |
|
1448 |
||
1449 |
"Modified: / 9.1.1998 / 23:01:17 / cg" |
|
1450 |
"Created: / 12.1.1998 / 20:04:35 / cg" |
|
1451 |
! |
|
1452 |
||
1453 |
startCounting |
|
1454 |
"not yet implemented" |
|
1455 |
||
1456 |
"Modified: / 9.1.1998 / 23:01:17 / cg" |
|
1457 |
"Created: / 12.1.1998 / 20:05:01 / cg" |
|
1458 |
! |
|
1459 |
||
1460 |
startCountingMemoryUsage |
|
1461 |
"not yet implemented" |
|
1462 |
||
1463 |
"Modified: / 9.1.1998 / 23:01:17 / cg" |
|
1464 |
"Created: / 12.1.1998 / 20:05:04 / cg" |
|
1465 |
! |
|
1466 |
||
1467 |
startTiming |
|
1468 |
"not yet implemented" |
|
1469 |
||
1470 |
"Modified: / 9.1.1998 / 23:01:17 / cg" |
|
1471 |
"Created: / 12.1.1998 / 20:04:57 / cg" |
|
255 | 1472 |
! ! |
1473 |
||
18 | 1474 |
!JavaMethod methodsFor:'decompiling'! |
1475 |
||
175 | 1476 |
decompileSourceTo:aStream |
637 | 1477 |
|argNames| |
1478 |
||
1479 |
byteCode isNil ifTrue:[ |
|
1480 |
self isPublic ifTrue:[ |
|
1481 |
aStream nextPutAll:'public '. |
|
1482 |
]. |
|
1483 |
self isProtected ifTrue:[ |
|
1484 |
aStream nextPutAll:'protected '. |
|
1485 |
]. |
|
1486 |
self isPrivate ifTrue:[ |
|
1487 |
aStream nextPutAll:'private '. |
|
1488 |
]. |
|
1489 |
self isStatic ifTrue:[ |
|
1490 |
aStream nextPutAll:'static '. |
|
1491 |
]. |
|
1492 |
||
1493 |
self isNative ifTrue:[ |
|
1494 |
aStream nextPutAll:'native '. |
|
1495 |
]. |
|
1496 |
self isAbstract ifTrue:[ |
|
1497 |
aStream nextPutAll:'abstract '. |
|
1498 |
]. |
|
1499 |
argNames := #('arg1' 'arg2' 'arg3' 'arg4' 'arg5' 'arg6' 'arg7' 'arg8' 'arg9'). |
|
1500 |
aStream nextPutAll:(self signatureNameWithArgNames:argNames). |
|
1501 |
aStream nextPutAll:';'; cr. |
|
1502 |
^ self |
|
1503 |
]. |
|
1504 |
||
2151 | 1505 |
" |
637 | 1506 |
JavaDeparser isNil ifTrue:[ |
1507 |
aStream nextPutAll:'// Sorry - no decompiler'. |
|
1508 |
^ self |
|
1509 |
]. |
|
2151 | 1510 |
" |
637 | 1511 |
|
1512 |
||
252 | 1513 |
"/ self isNative ifFalse:[ |
1514 |
"/ self isAbstract ifFalse:[ |
|
2151 | 1515 |
aStream nextPutAll:'// source not available...'; cr. |
637 | 1516 |
SignalSet anySignal handle:[:ex | |
2551 | 1517 |
ex creator == Object haltSignal ifTrue:[ex reject]. |
1518 |
ex creator == MessageTracer breakpointSignal ifTrue:[ex reject]. |
|
1519 |
ex creator == Signal noHandlerSignal ifTrue:[ex reject]. |
|
506 | 1520 |
|
637 | 1521 |
aStream nextPutAll:'error while decompiling:'. |
1522 |
aStream cr; cr; spaces:4. |
|
1523 |
aStream nextPutAll:ex errorString. |
|
1524 |
aStream cr. |
|
1525 |
aStream nextPutAll:ex suspendedContext printString. |
|
1526 |
aStream cr. |
|
1527 |
aStream nextPutAll:ex suspendedContext sender printString. |
|
1528 |
aStream cr. |
|
1529 |
aStream nextPutAll:ex suspendedContext sender sender printString. |
|
1530 |
aStream cr. |
|
1531 |
aStream nextPutAll:ex suspendedContext sender sender sender printString. |
|
1532 |
aStream cr. |
|
1533 |
aStream nextPutAll:ex suspendedContext sender sender sender sender printString. |
|
1534 |
aStream cr. |
|
1535 |
aStream nextPutAll:ex suspendedContext sender sender sender sender sender printString. |
|
1536 |
aStream cr. |
|
2095 | 1537 |
aStream nextPutAll:ex suspendedContext sender sender sender sender sender sender printString. |
1538 |
aStream cr. |
|
1539 |
aStream nextPutAll:ex suspendedContext sender sender sender sender sender sender sender printString. |
|
1540 |
aStream cr. |
|
1541 |
aStream nextPutAll:ex suspendedContext sender sender sender sender sender sender sender sender printString. |
|
1542 |
aStream cr. |
|
506 | 1543 |
|
2151 | 1544 |
" |
1545 |
JavaByteCodeDisassembler isNil ifTrue:[ |
|
637 | 1546 |
aStream nextPutAll:'// Sorry - no decompiler' |
1547 |
] ifFalse:[ |
|
2151 | 1548 |
JavaByteCodeDisassembler diassemble:self to:aStream. |
637 | 1549 |
]. |
2151 | 1550 |
" |
637 | 1551 |
ex return |
1552 |
] do:[ |
|
2151 | 1553 |
"aStream nextPutAll:(JavaDeparser decompile:self)." |
1554 |
JavaByteCodeDisassembler diassemble:self to:aStream. |
|
637 | 1555 |
]. |
252 | 1556 |
"/ ]. |
1557 |
"/ ]. |
|
18 | 1558 |
|
2151 | 1559 |
"Created: / 30-07-1997 / 16:28:09 / cg" |
1560 |
"Modified: / 21-12-1999 / 14:31:54 / cg" |
|
1561 |
"Modified: / 22-03-2011 / 21:34:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
175 | 1562 |
! |
1563 |
||
1564 |
decompiler |
|
1565 |
^ JavaDecompiler |
|
1566 |
||
1567 |
"Created: 30.7.1997 / 16:36:48 / cg" |
|
261 | 1568 |
! |
1569 |
||
449 | 1570 |
isMethod |
1571 |
"return true, if the receiver is some kind of method; |
|
1572 |
true returned here - the method is redefined from Object." |
|
1573 |
||
1574 |
^ true |
|
1575 |
||
1576 |
"Created: / 13.11.1998 / 23:57:40 / cg" |
|
1577 |
! |
|
1578 |
||
261 | 1579 |
originalMethod |
1580 |
^ self |
|
1581 |
||
1582 |
"Created: / 13.1.1998 / 15:03:05 / cg" |
|
18 | 1583 |
! ! |
1584 |
||
277 | 1585 |
!JavaMethod methodsFor:'error handling'! |
1586 |
||
2151 | 1587 |
errorInvalidClassRefAt: index |
1588 |
||
1589 |
"Sent by the VM when an invalid entry in contant pool |
|
1590 |
is encountered - for instance when the VM expects |
|
1591 |
a classref but the entry is not a classref" |
|
1592 |
||
1593 |
" |
|
1594 |
javaClass constantPool at: index. |
|
1595 |
" |
|
1596 |
||
1597 |
JavaInvalidRefError new |
|
1598 |
javaClass: javaClass; |
|
1599 |
index: index; |
|
1600 |
raiseRequest |
|
1601 |
||
1602 |
"Created: / 18-07-2011 / 23:33:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1603 |
! |
|
1604 |
||
1605 |
errorInvalidFieldRefAt: index |
|
1606 |
||
1607 |
"Sent by the VM when an invalid entry in contant pool |
|
1608 |
is encountered - for instance when the VM expects |
|
1609 |
a classref but the entry is not a classref" |
|
1610 |
||
1611 |
" |
|
1612 |
javaClass constantPool at: index. |
|
1613 |
" |
|
1614 |
||
1615 |
JavaInvalidRefError new |
|
1616 |
javaClass: javaClass; |
|
1617 |
index: index; |
|
1618 |
raiseRequest |
|
1619 |
||
1620 |
"Created: / 18-07-2011 / 23:33:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1621 |
! |
|
1622 |
||
1623 |
errorInvalidMethodRefAt: index |
|
1624 |
||
1625 |
"Sent by the VM when an invalid entry in contant pool |
|
1626 |
is encountered - for instance when the VM expects |
|
1627 |
a classref but the entry is not a classref" |
|
1628 |
||
1629 |
" |
|
1630 |
javaClass constantPool at: index. |
|
1631 |
" |
|
1632 |
||
1633 |
JavaInvalidRefError new |
|
1634 |
javaClass: javaClass; |
|
1635 |
index: index; |
|
1636 |
raiseRequest |
|
1637 |
||
1638 |
"Created: / 18-07-2011 / 19:59:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1639 |
! |
|
1640 |
||
277 | 1641 |
invalidByteCode |
1642 |
self isAbstract ifTrue:[ |
|
2151 | 1643 |
^ AbstractMethodInvokationSignal raise. |
277 | 1644 |
]. |
2151 | 1645 |
((self class numArgsFromSignature:descriptor) > self class maxNumberOfArguments) ifTrue:[ |
1646 |
^ self error:'method cannot be executed - too many args' |
|
309 | 1647 |
]. |
277 | 1648 |
^ super invalidByteCode |
1649 |
||
2151 | 1650 |
"Created: / 27-01-1998 / 21:48:01 / cg" |
1651 |
"Modified: / 14-08-2011 / 19:29:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
378 | 1652 |
! |
1653 |
||
1654 |
invalidMethodRef |
|
1655 |
self halt. |
|
1656 |
^ nil. |
|
1657 |
||
1658 |
"Modified: / 27.1.1998 / 21:50:19 / cg" |
|
1659 |
"Created: / 16.10.1998 / 11:27:21 / cg" |
|
594 | 1660 |
! |
1661 |
||
1662 |
nullClassPointer |
|
1663 |
JavaVM throwClassNotFoundException |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1664 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1665 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1666 |
wrongNumberOfArguments:numArgsGiven |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1667 |
"{ Pragma: +optSpace }" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1668 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1669 |
"this error is triggered by the VM, if a method is called with a wrong number |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1670 |
of arguments. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1671 |
This only applies to #valueWithReceiverXXX and #perform:withArguments: - sends. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1672 |
With a normal send, this error cannot happen." |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1673 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1674 |
^ JavaVM |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1675 |
throwIllegalArgumentException:(' - %1 got %2 arg(s) where %3 expected' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1676 |
bindWith:self class name |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1677 |
with:numArgsGiven |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1678 |
with:self numArgs) |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1679 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1680 |
" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1681 |
2 perform:#+ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1682 |
" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1683 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1684 |
"Modified: / 01-08-1997 / 00:23:10 / cg" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1685 |
"Created: / 07-09-2011 / 14:17:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1686 |
! ! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1687 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1688 |
!JavaMethod methodsFor:'executing'! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1689 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1690 |
valueWithReceiver:anObject arguments:argArray selector:aSymbol search:aClass sender:virtualSender |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1691 |
self isStatic ifTrue:[ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1692 |
anObject == javaClass ifFalse:[ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1693 |
self error: 'Invalid receiver - only owning class can be a receiver of static method invocation!!' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1694 |
] |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1695 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1696 |
^super valueWithReceiver:anObject arguments:argArray selector:aSymbol search:aClass sender:virtualSender |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1697 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1698 |
"Created: / 31-10-2012 / 23:09:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
277 | 1699 |
! ! |
1700 |
||
2151 | 1701 |
!JavaMethod methodsFor:'initialization'! |
1702 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1703 |
resolve |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1704 |
"Called by VM to resolve all references used by this method. When |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1705 |
successful (i.e., all references has been successfully resolved, a |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1706 |
A_RESOLVED flag is set (to prevent VM from subsequent calls |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1707 |
to this method) |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1708 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1709 |
Returns 1 if successfull, 0 if not (at least one reference |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1710 |
could not been resolved) or -1 when some (unspecified) erorr |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1711 |
occurs." |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1712 |
"Marcel, continue here!! And ALWAYS commit ALL the code!! Sigh" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1713 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1714 |
[ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1715 |
JavaByteCodePreresolver preresolve: self. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1716 |
accessFlags := accessFlags | A_RESOLVED. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1717 |
^1. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1718 |
] on: Error do:[:ex| |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1719 |
self breakPoint: #mh. "Marcel, please fix it" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1720 |
^0. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1721 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1722 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1723 |
"/RETURN 1...OK, |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1724 |
"/ 0...Something could not be resolved |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1725 |
"/ -1...Some error |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1726 |
self breakPoint:#mh. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1727 |
^ 1. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1728 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1729 |
"Created: / 09-02-2012 / 20:59:22 / mh <hlopik@gmail.com>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1730 |
"Modified: / 11-02-2012 / 13:46:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1731 |
"Modified (format): / 23-02-2012 / 17:49:09 / Marcel Hlopko <hlopik@gmail.com>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1732 |
"Modified: / 24-02-2012 / 14:46:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1733 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1734 |
|
2151 | 1735 |
setAccessFlags:flags |
1736 |
accessFlags := flags. |
|
1737 |
||
1738 |
"Created: 16.4.1996 / 11:34:14 / cg" |
|
1739 |
! |
|
1740 |
||
1741 |
setCode:codeBytes maxStack:max_stack maxLocals:max_locals u1:unknown1 u2:unknown2 |
|
1742 |
"/ javaByteCode := codeBytes. |
|
1743 |
byteCode := codeBytes. |
|
1744 |
"/ numStack := max_stack. |
|
1745 |
"/ numLocals := max_locals. |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1746 |
super numberOfVars:max_locals - self numArgs - (self isStatic ifTrue:[0] ifFalse:[1]). |
2151 | 1747 |
super stackSize:max_stack. |
1748 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1749 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1750 |
|
2151 | 1751 |
"/ self displayString printNL. |
1752 |
"/ ' nStack: ' print. numStack print. |
|
1753 |
"/ ' nLocal: ' print. numLocals print. |
|
1754 |
"/ ' u1: ' print. unknown1 print. |
|
1755 |
"/ ' u2: ' print. unknown2 printNL. |
|
1756 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1757 |
"Modified: / 01-08-1997 / 00:08:32 / cg" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1758 |
"Modified: / 12-10-2012 / 11:46:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2151 | 1759 |
! |
1760 |
||
1761 |
setDescriptor:aString |
|
1762 |
||
1763 |
descriptor := aString asSymbol. |
|
1764 |
||
1765 |
"Created: / 16-04-1996 / 11:34:29 / cg" |
|
1766 |
"Modified: / 16-10-1998 / 00:17:12 / cg" |
|
1767 |
"Modified: / 13-08-2011 / 01:21:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1768 |
"Created: / 14-08-2011 / 19:41:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1769 |
! |
|
1770 |
||
1771 |
setJavaClass:aJavaClass |
|
1772 |
javaClass := aJavaClass |
|
1773 |
||
1774 |
"Modified: 16.4.1996 / 12:36:27 / cg" |
|
1775 |
"Created: 16.4.1996 / 15:28:15 / cg" |
|
1776 |
! |
|
1777 |
||
1778 |
setLineNumberTable:anArrayOfPCtoLineAssociations |
|
1779 |
"since this uses up lots of memory, compress it" |
|
1780 |
||
1781 |
|allBytes allWords idx| |
|
1782 |
||
1783 |
allBytes := allWords := true. |
|
1784 |
||
1785 |
anArrayOfPCtoLineAssociations do:[:assoc | |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1786 |
assoc key > 255 ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1787 |
allBytes := false. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1788 |
assoc key > 16rFFFF ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1789 |
allWords := false. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1790 |
]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1791 |
]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1792 |
assoc value > 255 ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1793 |
allBytes := false. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1794 |
assoc value > 16rFFFF ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1795 |
allWords := false |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1796 |
]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1797 |
]. |
2151 | 1798 |
]. |
1799 |
allBytes ifTrue:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1800 |
lineNumberTable := ByteArray new:(anArrayOfPCtoLineAssociations size * 2). |
2151 | 1801 |
] ifFalse:[ |
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1802 |
allWords ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1803 |
lineNumberTable := WordArray new:(anArrayOfPCtoLineAssociations size * 2). |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1804 |
] ifFalse:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1805 |
lineNumberTable := Array new:(anArrayOfPCtoLineAssociations size * 2). |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1806 |
] |
2151 | 1807 |
]. |
1808 |
||
1809 |
idx := 1. |
|
1810 |
anArrayOfPCtoLineAssociations do:[:assoc | |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1811 |
lineNumberTable at:idx put:assoc key. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1812 |
lineNumberTable at:idx+1 put:assoc value. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1813 |
idx := idx + 2. |
2151 | 1814 |
]. |
1815 |
||
1816 |
"Created: 16.4.1996 / 12:34:04 / cg" |
|
1817 |
"Modified: 16.4.1996 / 12:49:06 / cg" |
|
1818 |
! |
|
1819 |
||
1820 |
setLocalVariableTable:anArray |
|
1821 |
localVariableTable := anArray. |
|
1822 |
! |
|
1823 |
||
1824 |
setName:nameString descriptor:aString |
|
1825 |
||
1826 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1827 |
|numArgs numJArgs returnType| |
2151 | 1828 |
|
1829 |
selector := (nameString , aString) asSymbol. |
|
1830 |
self setDescriptor:aString. |
|
1831 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1832 |
numJArgs := self class numArgsFromSignature:aString. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1833 |
(numJArgs > self class maxNumberOfArguments) ifTrue:[ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1834 |
numArgs := 1. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1835 |
] ifFalse:[ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1836 |
numArgs := numJArgs. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1837 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1838 |
self numberOfArgs:numArgs. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1839 |
self numberOfJavaArgs:numJArgs. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1840 |
returnType := self class typeFromSignature:aString in:nil. |
2151 | 1841 |
|
1842 |
"/ for the convenience of the VM, also mirror the return type in |
|
1843 |
"/ the flags ... |
|
1844 |
||
1845 |
returnType == #void ifTrue:[ |
|
1846 |
accessFlags := accessFlags bitOr:R_VOID |
|
1847 |
] ifFalse:[ |
|
1848 |
returnType == #long ifTrue:[ |
|
1849 |
accessFlags := accessFlags bitOr:R_LONG |
|
1850 |
] ifFalse:[ |
|
1851 |
returnType == #double ifTrue:[ |
|
1852 |
accessFlags := accessFlags bitOr:R_DOUBLE |
|
1853 |
] |
|
1854 |
] |
|
1855 |
]. |
|
1856 |
||
1857 |
"Created: / 14-08-2011 / 19:41:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1858 |
! |
|
1859 |
||
1860 |
setSignature:aString |
|
1861 |
||
1862 |
signature := aString asSymbol. |
|
1863 |
||
1864 |
"Created: / 16-04-1996 / 11:34:29 / cg" |
|
1865 |
"Modified: / 16-10-1998 / 00:17:12 / cg" |
|
1866 |
"Modified (format): / 14-08-2011 / 19:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1867 |
! ! |
|
1868 |
||
1869 |
!JavaMethod methodsFor:'inspecting'! |
|
1870 |
||
1871 |
inspectorExtraAttributes |
|
1872 |
"extra (pseudo instvar) entries to be shown in an inspector." |
|
1873 |
||
1874 |
^ Dictionary new |
|
1875 |
declareAllNewFrom:(super inspectorExtraAttributes ? #()); |
|
1876 |
"/add:'-code' -> [ String streamContents:[:s | JavaDecompiler decompile: self to: s] ]; |
|
1877 |
add:'-code' -> [ String streamContents:[:s | JavaByteCodeDisassembler diassemble: self to: s] ]; |
|
1878 |
"/add:'-source' -> [ self source ]; |
|
1879 |
yourself |
|
1880 |
||
1881 |
"Modified: / 22-03-2011 / 21:13:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1882 |
! ! |
|
1883 |
||
1884 |
!JavaMethod methodsFor:'interpretation'! |
|
1885 |
||
1886 |
interpretWithReceiver: receiver |
|
1887 |
||
1888 |
^self |
|
1889 |
interpretWithReceiver: receiver |
|
1890 |
arguments: #() |
|
1891 |
||
1892 |
"Created: / 24-02-2011 / 22:05:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1893 |
! |
|
1894 |
||
1895 |
interpretWithReceiver: receiver arg: a1 |
|
1896 |
||
1897 |
^self |
|
1898 |
interpretWithReceiver: receiver |
|
1899 |
arguments: (Array with: a1) |
|
1900 |
||
1901 |
"Created: / 24-02-2011 / 22:05:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1902 |
! |
|
1903 |
||
1904 |
interpretWithReceiver: receiver arg: a1 arg: a2 |
|
1905 |
||
1906 |
^self |
|
1907 |
interpretWithReceiver: receiver |
|
1908 |
arguments: (Array with: a1 with: a2) |
|
1909 |
||
1910 |
"Created: / 24-02-2011 / 22:05:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1911 |
! |
|
1912 |
||
1913 |
interpretWithReceiver: receiver arg: a1 arg: a2 arg: a3 |
|
1914 |
||
1915 |
^self |
|
1916 |
interpretWithReceiver: receiver |
|
1917 |
arguments: (Array with: a1 with: a2 with: a3) |
|
1918 |
||
1919 |
"Created: / 24-02-2011 / 22:06:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1920 |
! |
|
1921 |
||
1922 |
interpretWithReceiver: receiver arguments:args |
|
1923 |
||
1924 |
^ JavaByteCodeInterpreter |
|
1925 |
interpret:self |
|
1926 |
receiver:receiver |
|
1927 |
arguments:args |
|
1928 |
||
1929 |
"Modified: / 24-02-2011 / 23:00:42 / Marcel Hlopko <hlopik@gmail.com>" |
|
1930 |
"Created: / 24-02-2011 / 22:04:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1931 |
! ! |
|
1932 |
||
118 | 1933 |
!JavaMethod methodsFor:'methodref interchangability'! |
1934 |
||
673 | 1935 |
homeMethod |
1936 |
^ self |
|
1937 |
! |
|
1938 |
||
118 | 1939 |
method |
1940 |
^ self |
|
692 | 1941 |
! |
1942 |
||
1943 |
setPackage:newPackage |
|
1944 |
newPackage ~= javaClass package ifTrue:[ |
|
1945 |
self halt:'java method cannot be in a package different from its class'. |
|
1946 |
] |
|
118 | 1947 |
! ! |
1948 |
||
148 | 1949 |
!JavaMethod methodsFor:'misc'! |
1950 |
||
378 | 1951 |
fromMethod:aJavaMethod |
1952 |
"copy values from another javaMethod" |
|
149 | 1953 |
|
378 | 1954 |
flags := aJavaMethod flags. |
1955 |
byteCode := aJavaMethod byteCode. |
|
1956 |
accessFlags := aJavaMethod accessFlags. |
|
1957 |
selector := aJavaMethod selector. |
|
1958 |
javaClass := aJavaMethod javaClass. |
|
2151 | 1959 |
descriptor := aJavaMethod instVarNamed:#descriptor. |
1960 |
signature := aJavaMethod instVarNamed:#signature. |
|
378 | 1961 |
lineNumberTable := aJavaMethod lineNumberTable. |
1962 |
localVariableTable := aJavaMethod localVariableTable. |
|
2151 | 1963 |
annotations := aJavaMethod annotations. |
1964 |
||
1965 |
"Modified: / 16-10-1998 / 01:27:19 / cg" |
|
1966 |
"Modified: / 14-08-2011 / 19:30:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
255 | 1967 |
! |
252 | 1968 |
|
255 | 1969 |
updateClassRefsFrom:oldClass to:newClass |
1970 |
javaClass == oldClass ifTrue:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1971 |
"/ invalidate |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1972 |
byteCode := nil. |
255 | 1973 |
] |
252 | 1974 |
|
255 | 1975 |
"Created: / 6.1.1998 / 18:19:48 / cg" |
252 | 1976 |
! ! |
1977 |
||
8 | 1978 |
!JavaMethod methodsFor:'printing & storing'! |
1979 |
||
29 | 1980 |
displayString |
168 | 1981 |
javaClass isNil ifTrue:[ |
611 | 1982 |
^ self class name , '(???)' |
168 | 1983 |
]. |
611 | 1984 |
^ self class name , '(' , javaClass displayString , '::' , self signatureName , ')' |
423 | 1985 |
|
611 | 1986 |
"Modified: / 25.9.1999 / 23:04:01 / cg" |
29 | 1987 |
! |
1988 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1989 |
printOn: aStream |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1990 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1991 |
super printOn: aStream. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1992 |
aStream nextPut: $(. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1993 |
javaClass name printOn: aStream. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1994 |
aStream nextPut: $.. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1995 |
selector printOn: aStream. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1996 |
aStream nextPut: $). |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1997 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1998 |
"Created: / 05-12-2011 / 01:30:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1999 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2000 |
|
670 | 2001 |
printStringForBrowserWithSelector:dummySelector inClass:dummyClass |
43 | 2002 |
"/ self isStatic ifTrue:[ |
2003 |
"/ ^ 'static ' , self signatureName |
|
2004 |
"/ ]. |
|
168 | 2005 |
"/ self isBreakpointed ifTrue:[ |
2006 |
"/ ^ (LabelAndIcon '!! ' , self signatureName |
|
2007 |
"/ ]. |
|
175 | 2008 |
|
252 | 2009 |
self name = #'<init>' ifTrue:[ |
2151 | 2010 |
^ self class specTextFromSignature:descriptor in:javaClass package withName:(javaClass lastName). |
166 | 2011 |
]. |
2151 | 2012 |
^ self class specTextFromSignature:descriptor in:javaClass package withName:(self name) |
10 | 2013 |
! |
2014 |
||
118 | 2015 |
shortDisplayString |
2016 |
^ javaClass name , '::' , self signatureNameWithoutReturnType |
|
2017 |
! |
|
2018 |
||
10 | 2019 |
signatureName |
2020 |
"return a string to be used when browsing" |
|
2021 |
||
2151 | 2022 |
^ self class specFromSignature:descriptor withName:(self name) in:nil |
255 | 2023 |
|
2024 |
"Modified: / 8.1.1998 / 19:15:33 / cg" |
|
113 | 2025 |
! |
2026 |
||
164 | 2027 |
signatureNameFor:name withArgsIn:aPackage |
2028 |
"return a string to be used when decompiling" |
|
2029 |
||
2151 | 2030 |
^ self class specWithArgsFromSignature:descriptor withName:name in:aPackage |
164 | 2031 |
|
2032 |
"Created: 25.3.1997 / 18:49:45 / cg" |
|
2033 |
! |
|
2034 |
||
142 | 2035 |
signatureNameIn:aPackage |
2036 |
"return a string to be used when browsing" |
|
2037 |
||
2151 | 2038 |
^ self class specFromSignature:descriptor withName:(self name) in:aPackage |
142 | 2039 |
|
2040 |
"Created: 18.3.1997 / 11:11:01 / cg" |
|
2041 |
! |
|
2042 |
||
175 | 2043 |
signatureNameText |
2044 |
"return a text to be used when browsing" |
|
2045 |
||
2151 | 2046 |
^ self class specTextFromSignature:descriptor withName:(self name) |
175 | 2047 |
|
2048 |
"Created: 30.7.1997 / 14:40:29 / cg" |
|
2049 |
! |
|
2050 |
||
189 | 2051 |
signatureNameTextFor:name withArgsIn:aPackage |
2052 |
"return a text to be used when decompiling" |
|
2053 |
||
2151 | 2054 |
^ self class specTextWithArgsFromSignature:descriptor withName:name in:aPackage |
189 | 2055 |
|
2056 |
"Created: 25.3.1997 / 18:49:45 / cg" |
|
2057 |
"Modified: 1.8.1997 / 10:44:28 / cg" |
|
2058 |
! |
|
2059 |
||
255 | 2060 |
signatureNameWithArgNames:argNames |
2061 |
"return a string to be used when browsing" |
|
2062 |
||
2063 |
|myName| |
|
2064 |
||
2065 |
myName := self name. |
|
2066 |
myName = '<init>' ifTrue:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2067 |
myName := javaClass name |
255 | 2068 |
]. |
2151 | 2069 |
^ self class specFromSignature:descriptor withName:myName argNames:argNames in:nil |
255 | 2070 |
|
2071 |
"Created: / 8.1.1998 / 21:04:03 / cg" |
|
2072 |
"Modified: / 8.1.1998 / 21:22:38 / cg" |
|
2073 |
! |
|
2074 |
||
2075 |
signatureNameWithArgNames:argNames in:package |
|
2076 |
"return a string to be used when browsing" |
|
2077 |
||
2078 |
|myName| |
|
2079 |
||
2080 |
myName := self name. |
|
2081 |
myName = '<init>' ifTrue:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2082 |
myName := javaClass name |
255 | 2083 |
]. |
2151 | 2084 |
^ self class specFromSignature:descriptor withName:myName argNames:argNames in:package |
255 | 2085 |
|
2086 |
"Modified: / 8.1.1998 / 21:05:52 / cg" |
|
2087 |
"Created: / 8.1.1998 / 21:23:03 / cg" |
|
2088 |
! |
|
2089 |
||
154 | 2090 |
signatureNameWithArgsIn:aPackage |
2091 |
"return a string to be used when browsing" |
|
2092 |
||
2151 | 2093 |
^ self class specWithArgsFromSignature:descriptor withName:(self name) in:aPackage |
2094 |
||
2095 |
"Created: / 20-03-1997 / 12:44:17 / cg" |
|
2096 |
"Modified: / 14-08-2011 / 19:29:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2097 |
! |
|
2098 |
||
2099 |
signatureNameWithModifiers |
|
2100 |
"return a string to be used when deassembling" |
|
2101 |
||
2102 |
| result | |
|
2103 |
||
2104 |
result := self signatureName. |
|
2105 |
self isFinal ifTrue: [ result := 'final ' , result ]. |
|
2106 |
self isStatic ifTrue: [ result := 'static ' , result ]. |
|
2107 |
self isSynchronized ifTrue: [ result := 'synchronized ' , result ]. |
|
2108 |
self isPrivate |
|
2109 |
ifTrue: [ result := 'private ' , result ] |
|
2110 |
ifFalse: |
|
2111 |
[ self isProtected |
|
2112 |
ifTrue: [ result := 'protected ' , result ] |
|
2113 |
ifFalse: [ self isPublic ifTrue: [ result := 'public ' , result ] ] ]. |
|
2114 |
self isAbstract ifTrue: [ result := 'abstract ' , result ]. |
|
2115 |
^ result. |
|
2116 |
||
2117 |
"Modified: / 08-01-1998 / 19:15:33 / cg" |
|
2118 |
"Created: / 22-03-2011 / 16:25:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
154 | 2119 |
! |
2120 |
||
113 | 2121 |
signatureNameWithoutReturnType |
2122 |
"return a string to be used when browsing" |
|
2123 |
||
2151 | 2124 |
^ self class argSpecFromSignature:descriptor withName:(self name) |
113 | 2125 |
|
8 | 2126 |
! ! |
2127 |
||
2128 |
!JavaMethod methodsFor:'queries'! |
|
2129 |
||
111 | 2130 |
handlerFor:anException at:pc |
611 | 2131 |
"return an exceptionHandlers pc, for an exception of the given type, |
2132 |
occurring at pc. Returns nil, if there is none." |
|
2133 |
||
2134 |
|handlerTable| |
|
2135 |
||
2136 |
(handlerTable := self exceptionHandlerTable) isNil ifTrue:[^ nil]. |
|
2137 |
||
2138 |
handlerTable do:[:entry | |
|
2139 |
|hpc| |
|
2140 |
||
2141 |
hpc := entry handlerPCFor:anException at:pc in:self. |
|
2142 |
hpc notNil ifTrue:[^ hpc]. |
|
2143 |
]. |
|
2144 |
||
378 | 2145 |
^ nil |
48 | 2146 |
|
611 | 2147 |
"Created: / 16.10.1998 / 01:18:40 / cg" |
2148 |
"Modified: / 25.9.1999 / 23:07:01 / cg" |
|
31 | 2149 |
! |
2150 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2151 |
hasFinally |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2152 |
^ (accessFlags bitAnd:A_HASFINALLY) ~~ 0 |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2153 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2154 |
"Created: / 28-03-2012 / 20:35:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2155 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2156 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2157 |
hasFinallyBasedOnExceptionTable |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2158 |
"Returns true if the exeption table has at least one |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2159 |
entry for finally block" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2160 |
^false |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2161 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2162 |
"Created: / 28-03-2012 / 23:18:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2163 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2164 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2165 |
hasHandler |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2166 |
^ (accessFlags bitAnd:A_HASHANDLER) ~~ 0 |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2167 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2168 |
"Created: / 28-03-2012 / 20:35:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2169 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2170 |
|
2151 | 2171 |
hasPrimitiveCode |
2172 |
||
2173 |
^false |
|
2174 |
||
2175 |
"Created: / 18-07-2011 / 20:45:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2176 |
! |
|
2177 |
||
127 | 2178 |
hasResource |
2179 |
^ false |
|
2180 |
! |
|
2181 |
||
19 | 2182 |
isAbstract |
252 | 2183 |
^ (accessFlags bitAnd:A_ABSTRACT) ~~ 0 |
19 | 2184 |
! |
2185 |
||
80 | 2186 |
isBreakpointed |
256 | 2187 |
^ (accessFlags bitAnd:A_BREAKPOINT) ~~ 0 |
2188 |
||
2189 |
"Modified: / 11.1.1998 / 13:28:43 / cg" |
|
80 | 2190 |
! |
2191 |
||
19 | 2192 |
isFinal |
252 | 2193 |
^ (accessFlags bitAnd:A_FINAL) ~~ 0 |
19 | 2194 |
! |
2195 |
||
175 | 2196 |
isIgnored |
2197 |
"not really a java attribute; |
|
2198 |
added to allow browsing" |
|
2199 |
||
2200 |
^ false. |
|
2201 |
||
2202 |
"Created: 30.7.1997 / 15:34:33 / cg" |
|
2203 |
! |
|
2204 |
||
625 | 2205 |
isJavaClassRef |
2206 |
^ false |
|
2207 |
||
2208 |
"Created: / 9.11.1999 / 17:16:20 / cg" |
|
2209 |
! |
|
2210 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2211 |
isJavaConstructor |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2212 |
^((selector first) == $<) and:[selector startsWith:'<init>('] |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2213 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2214 |
"Created: / 01-08-2012 / 00:21:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2215 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2216 |
|
431 | 2217 |
isJavaMethod |
2218 |
^ true |
|
2219 |
||
2220 |
"Created: / 10.11.1998 / 18:24:51 / cg" |
|
2221 |
! |
|
2222 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2223 |
isJavaStaticInitializer |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2224 |
^((selector first) == $<) and:[selector startsWith:'<clinit>('] |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2225 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2226 |
"Created: / 19-09-2012 / 16:26:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2227 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2228 |
|
19 | 2229 |
isNative |
252 | 2230 |
^ (accessFlags bitAnd:A_NATIVE) ~~ 0 |
19 | 2231 |
! |
2232 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2233 |
isPackagePrivate |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2234 |
^ (accessFlags bitAnd:A_PRIVATE | A_PUBLIC | A_PROTECTED) = 0 |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2235 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2236 |
"Created: / 05-07-2012 / 10:12:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2237 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2238 |
|
19 | 2239 |
isPrivate |
252 | 2240 |
^ (accessFlags bitAnd:A_PRIVATE) ~~ 0 |
19 | 2241 |
! |
2242 |
||
2243 |
isProtected |
|
252 | 2244 |
^ (accessFlags bitAnd:A_PROTECTED) ~~ 0 |
19 | 2245 |
! |
2246 |
||
2247 |
isPublic |
|
252 | 2248 |
^ (accessFlags bitAnd:A_PUBLIC) ~~ 0 |
19 | 2249 |
! |
2250 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2251 |
isResolved |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2252 |
"Return true, if the receiver is fully resolved, i.e., |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2253 |
if all references used by the method are resolved" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2254 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2255 |
^ (accessFlags bitAnd:A_RESOLVED) ~~ 0 |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2256 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2257 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2258 |
|
19 | 2259 |
isStatic |
252 | 2260 |
^ (accessFlags bitAnd:A_STATIC) ~~ 0 |
19 | 2261 |
! |
2262 |
||
2263 |
isSynchronized |
|
252 | 2264 |
^ (accessFlags bitAnd:A_SYNCHRONIZED) ~~ 0 |
18 | 2265 |
! |
2266 |
||
256 | 2267 |
isTraced |
2268 |
^ false |
|
2269 |
||
2270 |
"Modified: / 11.1.1998 / 13:28:43 / cg" |
|
2271 |
"Created: / 11.1.1998 / 13:38:11 / cg" |
|
2272 |
! |
|
2273 |
||
8 | 2274 |
isUnloaded |
2275 |
^ false |
|
18 | 2276 |
! |
2277 |
||
2151 | 2278 |
isUnresolved |
2279 |
"return true, if the receiver is unresolved;" |
|
2280 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2281 |
^ self isResolved not |
2151 | 2282 |
|
2283 |
"Created: / 06-03-2011 / 22:57:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
2284 |
! |
|
2285 |
||
256 | 2286 |
isWrapped |
2287 |
^ self isBreakpointed |
|
2288 |
||
2289 |
"Modified: / 11.1.1998 / 13:28:43 / cg" |
|
2290 |
"Created: / 11.1.1998 / 13:38:04 / cg" |
|
2291 |
! |
|
2292 |
||
31 | 2293 |
lineNumberForPC:pc |
75 | 2294 |
|last num text classSource| |
31 | 2295 |
|
2296 |
num := nil. |
|
2297 |
||
207 | 2298 |
ForceByteCodeDisplay == true ifFalse:[ |
169 | 2299 |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2300 |
lineNumberTable notNil ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2301 |
classSource := javaClass source. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2302 |
classSource notNil ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2303 |
lineNumberTable pairWiseDo:[:lPc :lNr | |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2304 |
lPc >= pc ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2305 |
lPc == pc ifTrue:[^ lNr]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2306 |
last isNil ifTrue:[^ lNr]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2307 |
^ last. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2308 |
]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2309 |
last := lNr. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2310 |
]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2311 |
last notNil ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2312 |
^ last |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2313 |
]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2314 |
^ lineNumberTable at:2 |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2315 |
]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2316 |
]. |
46 | 2317 |
]. |
31 | 2318 |
|
46 | 2319 |
"/ decompile and look which line the pc falls into |
209 | 2320 |
|
2321 |
ForceByteCodeDisplay == true ifTrue:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2322 |
text := self decompiledBytecode asCollectionOfLines. |
209 | 2323 |
] ifFalse:[ |
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2324 |
text := self decompiledSource asCollectionOfLines. |
209 | 2325 |
]. |
31 | 2326 |
|
46 | 2327 |
text keysAndValuesDo:[:lineNr :line | |
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2328 |
|nr| |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2329 |
|
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2330 |
(line startsWith:' ') ifFalse:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2331 |
nr := Integer readFrom:line onError:0. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2332 |
nr >= pc ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2333 |
^ lineNr |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2334 |
] |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2335 |
] |
31 | 2336 |
]. |
2337 |
^ num |
|
141 | 2338 |
|
261 | 2339 |
"Modified: / 14.1.1998 / 13:30:54 / cg" |
31 | 2340 |
! |
2341 |
||
2087 | 2342 |
messagesSent |
2343 |
"return a collection of messages sent by this method" |
|
2344 |
||
2091 | 2345 |
|walker selectors| |
2087 | 2346 |
|
2347 |
"/ sigh - must extract all accessed literals ... |
|
2348 |
"/ must deparse the byteCode in order to do this. |
|
2349 |
||
2350 |
selectors := IdentitySet new. |
|
2351 |
walker := JavaByteCodeEnumerator new. |
|
2352 |
walker |
|
2353 |
literalAction: |
|
2354 |
[:pc :slotIndex :const | |
|
2355 |
|mSel| |
|
2356 |
||
2357 |
(const isNumber |
|
2358 |
or:[const isString |
|
2359 |
or:[const isNil]]) ifFalse:[ |
|
2360 |
const isJavaMethod ifTrue:[ |
|
2361 |
mSel := const selector. |
|
2362 |
] ifFalse:[ |
|
2363 |
const isJavaMethodRef ifTrue:[ |
|
2364 |
mSel := const selector "/ signature. |
|
2365 |
] |
|
2366 |
]. |
|
2367 |
]. |
|
2368 |
mSel notNil ifTrue:[ |
|
2369 |
"/ Transcript showCR:mSel. |
|
2370 |
selectors add:mSel |
|
2371 |
]. |
|
2372 |
]. |
|
2373 |
walker decompile:self to:nil. |
|
2374 |
^ selectors |
|
2375 |
! |
|
2376 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2377 |
overrides: anotherMethod |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2378 |
"Returns true, if the receiver overwrites anotherMethod. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2379 |
This method implements algorithm described in JVM spec, sec. 5.4.2.1" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2380 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2381 |
anotherMethod isJavaMethod ifFalse:[ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2382 |
"It is questionable what to return here. Best seems to be |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2383 |
do following: if anotherMethod belongs to one of my superclasses |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2384 |
(either JavaObject or Object in current impl), then return true, |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2385 |
false otherwise" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2386 |
^javaClass inheritsFrom: anotherMethod mclass. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2387 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2388 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2389 |
"An instance method m1 (self) declared in class C overrides another instance method m2 |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2390 |
(anotherMethod) declared in class A iff all of the following are true:" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2391 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2392 |
" - m2 has the same name and descriptor as m1. " |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2393 |
selector == anotherMethod selector ifFalse:[ ^ false ]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2394 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2395 |
" - C is a subclass of A." |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2396 |
(javaClass isSubclassOf: anotherMethod javaClass) ifFalse:[ ^ false ]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2397 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2398 |
"- either: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2399 |
- m2 is marked ACC_PUBLIC; or is marked ACC_PROTECTED; or is marked nei- |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2400 |
ther ACC_PUBLIC nor ACC_PROTECTED nor ACC_PRIVATE and belongs to the |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2401 |
same runtime package as C, or" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2402 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2403 |
(anotherMethod isPublic or:[anotherMethod isProtected]) ifTrue:[ ^ true ]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2404 |
(anotherMethod isPackagePrivate |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2405 |
and:[javaClass package == anotherMethod javaClass package]) |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2406 |
ifTrue:[ ^ true ]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2407 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2408 |
^false. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2409 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2410 |
"Created: / 05-07-2012 / 11:04:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2411 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2412 |
|
156 | 2413 |
package |
685 | 2414 |
"in java, class extensions are not possible; |
2415 |
all methods MUST be in their classes package" |
|
156 | 2416 |
|
685 | 2417 |
^ javaClass package |
156 | 2418 |
! |
2419 |
||
428 | 2420 |
quickLineNumberForPC:pc |
2421 |
|last| |
|
2422 |
||
2423 |
lineNumberTable notNil ifTrue:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2424 |
lineNumberTable pairWiseDo:[:lPc :lNr | |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2425 |
lPc >= pc ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2426 |
lPc == pc ifTrue:[^ lNr]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2427 |
last isNil ifTrue:[^ lNr]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2428 |
^ last. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2429 |
]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2430 |
last := lNr. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2431 |
]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2432 |
last notNil ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2433 |
^ last |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2434 |
]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2435 |
^ lineNumberTable at:2 |
428 | 2436 |
]. |
2437 |
^ nil |
|
2438 |
||
2439 |
"Modified: / 14.1.1998 / 13:30:54 / cg" |
|
2440 |
"Created: / 10.11.1998 / 14:18:22 / cg" |
|
2441 |
! |
|
2442 |
||
625 | 2443 |
referencesGlobal:aGlobalName |
2444 |
"return true, if this method refers to a global named aGlobalName" |
|
2445 |
||
2446 |
|walker any| |
|
2447 |
||
2448 |
"/ quick check, if constantPool includes a methodRef for this |
|
2449 |
"/ selector. |
|
2450 |
||
2451 |
any := false. |
|
2452 |
self javaClass constantPool do:[:const | |
|
2453 |
(const isNumber |
|
2454 |
or:[const isString |
|
2455 |
or:[const isNil]]) ifFalse:[ |
|
2456 |
const isJavaClass ifTrue:[ |
|
2457 |
any := any or:[const fullName = aGlobalName]. |
|
2458 |
] ifFalse:[ |
|
2459 |
const isJavaClassRef ifTrue:[ |
|
2460 |
any := any or:[const fullName = aGlobalName]. |
|
2461 |
] |
|
2462 |
]. |
|
2463 |
]. |
|
2464 |
]. |
|
2465 |
any ifFalse:[^ false]. |
|
2466 |
||
2467 |
"/ sigh - must extract all accessed literals ... |
|
2468 |
"/ must deparse the byteCode in order to do this. |
|
2469 |
||
2470 |
walker := JavaByteCodeEnumerator new. |
|
2471 |
walker |
|
2472 |
literalAction: |
|
2473 |
[:pc :slotIndex :const | |
|
2474 |
|mSel| |
|
2475 |
||
2476 |
(const isNumber |
|
2477 |
or:[const isString |
|
2478 |
or:[const isNil]]) ifFalse:[ |
|
2479 |
const isJavaClass ifTrue:[ |
|
2480 |
mSel := const fullName. |
|
2481 |
] ifFalse:[ |
|
2482 |
const isJavaClassRef ifTrue:[ |
|
2483 |
mSel := const fullName. |
|
2484 |
] |
|
2485 |
]. |
|
2486 |
]. |
|
2487 |
mSel notNil ifTrue:[ |
|
2488 |
"/ Transcript showCR:mSel. |
|
2489 |
mSel = aGlobalName ifTrue:[ |
|
2490 |
^ true |
|
2491 |
] |
|
2492 |
]. |
|
2493 |
]. |
|
2494 |
walker decompile:self to:nil. |
|
2495 |
||
2496 |
"Created: / 9.11.1999 / 17:15:46 / cg" |
|
2497 |
"Modified: / 9.11.1999 / 17:18:02 / cg" |
|
2498 |
! |
|
2499 |
||
618 | 2500 |
sends:aSelectorSymbol |
2501 |
"return true, if this method contains a message-send |
|
2502 |
with aSelectorSymbol as selector." |
|
2503 |
||
2504 |
|walker any| |
|
2505 |
||
2506 |
"/ quick check, if constantPool includes a methodRef for this |
|
2507 |
"/ selector. |
|
2508 |
||
2509 |
any := false. |
|
2510 |
self javaClass constantPool do:[:const | |
|
2511 |
(const isNumber |
|
2512 |
or:[const isString |
|
2513 |
or:[const isNil]]) ifFalse:[ |
|
2514 |
const isJavaMethod ifTrue:[ |
|
2515 |
any := any or:[const selector = aSelectorSymbol]. |
|
2516 |
] ifFalse:[ |
|
2517 |
const isJavaMethodRef ifTrue:[ |
|
2518 |
any := any or:[const signature = aSelectorSymbol]. |
|
2519 |
] |
|
2520 |
]. |
|
2521 |
]. |
|
2522 |
]. |
|
2523 |
any ifFalse:[^ false]. |
|
2524 |
||
625 | 2525 |
"/ sigh - must extract all accessed literals ... |
2526 |
"/ must deparse the byteCode in order to do this. |
|
2527 |
||
618 | 2528 |
walker := JavaByteCodeEnumerator new. |
2529 |
walker |
|
2530 |
literalAction: |
|
2531 |
[:pc :slotIndex :const | |
|
2532 |
|mSel| |
|
2533 |
||
2534 |
(const isNumber |
|
2535 |
or:[const isString |
|
2536 |
or:[const isNil]]) ifFalse:[ |
|
2537 |
const isJavaMethod ifTrue:[ |
|
2538 |
mSel := const selector. |
|
2539 |
] ifFalse:[ |
|
2540 |
const isJavaMethodRef ifTrue:[ |
|
2541 |
mSel := const signature. |
|
2542 |
] |
|
2543 |
]. |
|
2544 |
]. |
|
2545 |
mSel notNil ifTrue:[ |
|
2546 |
"/ Transcript showCR:mSel. |
|
2547 |
mSel = aSelectorSymbol ifTrue:[ |
|
2548 |
^ true |
|
2549 |
] |
|
2550 |
]. |
|
2551 |
]. |
|
2552 |
walker decompile:self to:nil. |
|
2553 |
||
2554 |
"Created: / 9.11.1999 / 15:38:14 / cg" |
|
625 | 2555 |
"Modified: / 9.11.1999 / 17:06:03 / cg" |
618 | 2556 |
! |
2557 |
||
2151 | 2558 |
shouldBeSkippedInDebuggersWalkBack |
2559 |
||
2560 |
^false |
|
2561 |
||
2562 |
"Created: / 30-11-2010 / 15:35:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2563 |
! |
|
2564 |
||
18 | 2565 |
who |
2566 |
"return the class and selector of where I am defined in." |
|
2567 |
||
64 | 2568 |
|sel| |
18 | 2569 |
|
252 | 2570 |
javaClass isNil ifTrue:[^ nil]. |
378 | 2571 |
sel := selector. |
2572 |
"/ sel := javaClass methodDictionary keyAtValue:self ifAbsent:nil. |
|
64 | 2573 |
sel isNil ifTrue:[^ nil]. |
129 | 2574 |
^ Method::MethodWhoInfo class:javaClass selector:sel. |
378 | 2575 |
|
2576 |
"Modified: / 16.10.1998 / 13:42:10 / cg" |
|
5 | 2577 |
! ! |
2578 |
||
154 | 2579 |
!JavaMethod methodsFor:'signature parsing'! |
2580 |
||
255 | 2581 |
XXXspecWithArgsFromSignature:aSignature withName:name in:aPackage |
154 | 2582 |
"given a signature, return a spec with args" |
2583 |
||
2584 |
|s argSpec retvalSpec| |
|
2585 |
||
2586 |
s := aSignature readStream. |
|
2587 |
s next ~~ $( ifTrue:[self halt. ^ name]. |
|
2588 |
||
2589 |
argSpec := self argSpecWithArgsFromStream:s in:aPackage. |
|
2590 |
||
2591 |
s next ~~ $) ifTrue:[self halt. ^ name]. |
|
2592 |
||
2593 |
retvalSpec := self retvalSpecFromStream:s in:aPackage. |
|
2594 |
||
2595 |
^ retvalSpec , ' ' , name , ' (' , argSpec , ')' |
|
2596 |
||
2597 |
" |
|
2598 |
JavaMethod specFromSignature:'(LObject;)V' withName:'foo' |
|
2599 |
JavaMethod specFromSignature:'(BB)S' withName:'foo' |
|
2600 |
" |
|
2601 |
||
255 | 2602 |
"Created: / 8.1.1998 / 19:17:58 / cg" |
154 | 2603 |
! ! |
2604 |
||
2151 | 2605 |
!JavaMethod methodsFor:'testing'! |
2606 |
||
2607 |
isSynthetic |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2608 |
^ (accessFlags bitAnd:A_SYNTHETIC) ~~ 0 |
2151 | 2609 |
|
2610 |
"Created: / 18-10-2010 / 19:09:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2611 |
! ! |
|
2612 |
||
129 | 2613 |
!JavaMethod class methodsFor:'documentation'! |
2 | 2614 |
|
2615 |
version |
|
2551 | 2616 |
^ '$Header: /cvs/stx/stx/libjava/JavaMethod.st,v 1.113 2013-04-24 20:23:16 cg Exp $' |
2145 | 2617 |
! |
2618 |
||
2619 |
version_CVS |
|
2551 | 2620 |
^ '$Header: /cvs/stx/stx/libjava/JavaMethod.st,v 1.113 2013-04-24 20:23:16 cg Exp $' |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2621 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2622 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2623 |
version_HG |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2624 |
|
2551 | 2625 |
^ '§Changeset: <not expanded> §' |
2151 | 2626 |
! |
2627 |
||
2628 |
version_SVN |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2629 |
^ '§Id§' |
2 | 2630 |
! ! |
2107 | 2631 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2632 |
|
2086 | 2633 |
JavaMethod initialize! |