author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Fri, 19 Apr 2013 13:50:19 +0200 | |
branch | development |
changeset 2532 | 64a784c73d1e |
parent 2528 | bc5ce044d5a1 |
child 2566 | f1cea8b752ba |
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 |
||
2476
d24ce8174195
JavaClass can now keep it's classfile bytes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2429
diff
changeset
|
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 |
|
2476
d24ce8174195
JavaClass can now keep it's classfile bytes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2429
diff
changeset
|
791 |
messagesSentToSuper |
d24ce8174195
JavaClass can now keep it's classfile bytes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2429
diff
changeset
|
792 |
^#() |
d24ce8174195
JavaClass can now keep it's classfile bytes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2429
diff
changeset
|
793 |
|
d24ce8174195
JavaClass can now keep it's classfile bytes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2429
diff
changeset
|
794 |
"Created: / 30-03-2013 / 09:59:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
d24ce8174195
JavaClass can now keep it's classfile bytes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2429
diff
changeset
|
795 |
! |
d24ce8174195
JavaClass can now keep it's classfile bytes.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2429
diff
changeset
|
796 |
|
2151 | 797 |
sends:symbol1 or:symbol2 |
798 |
||
799 |
^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
|
800 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
801 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
802 |
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
|
803 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
804 |
^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
|
805 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
806 |
"Created: / 02-12-2011 / 23:05:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2151 | 807 |
! ! |
808 |
||
10 | 809 |
!JavaMethod methodsFor:'accessing'! |
810 |
||
334 | 811 |
accessFlags |
812 |
"java calls this the modifiers" |
|
813 |
||
814 |
^ accessFlags |
|
815 |
||
816 |
"Created: / 9.4.1998 / 17:49:44 / cg" |
|
817 |
! |
|
818 |
||
2151 | 819 |
annotations |
820 |
^ annotations ifNil:[JavaMethodAnnotationContainer empty]. |
|
821 |
||
822 |
"Modified: / 03-03-2011 / 23:51:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
823 |
! |
|
824 |
||
825 |
annotations:something |
|
826 |
annotations := something. |
|
827 |
! |
|
828 |
||
29 | 829 |
argSignature |
2151 | 830 |
^ self class argSigArrayFromSignature:descriptor |
831 |
! |
|
832 |
||
833 |
asByteCodeMethod |
|
834 |
||
835 |
"JavaMethods are always bytecode methods" |
|
836 |
||
837 |
^self |
|
838 |
||
839 |
"Created: / 18-07-2011 / 20:48:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
29 | 840 |
! |
841 |
||
678 | 842 |
comment |
843 |
"should access the source here, and parse any method comment" |
|
844 |
||
845 |
^ nil |
|
846 |
! |
|
847 |
||
10 | 848 |
constantPool |
849 |
^ javaClass constantPool |
|
850 |
||
851 |
"Modified: 16.4.1996 / 12:36:27 / cg" |
|
852 |
"Created: 16.4.1996 / 15:28:50 / cg" |
|
853 |
! |
|
854 |
||
129 | 855 |
containingClass |
856 |
^ javaClass |
|
857 |
||
858 |
! |
|
859 |
||
169 | 860 |
decompiledBytecode |
861 |
|s| |
|
862 |
||
863 |
s := '' writeStream. |
|
864 |
JavaDecompiler decompile:self to:s. |
|
865 |
^ s contents |
|
866 |
||
867 |
"Created: 7.4.1997 / 20:10:37 / cg" |
|
868 |
! |
|
869 |
||
75 | 870 |
decompiledSource |
871 |
|s| |
|
872 |
||
873 |
s := '' writeStream. |
|
175 | 874 |
self decompileSourceTo:s. |
75 | 875 |
^ s contents |
175 | 876 |
|
877 |
"Modified: 30.7.1997 / 16:27:55 / cg" |
|
75 | 878 |
! |
879 |
||
2151 | 880 |
descriptor |
881 |
||
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
|
882 |
^ (JavaDescriptor fromString: descriptor) name: self name |
2151 | 883 |
|
884 |
"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
|
885 |
"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
|
886 |
! |
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 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
888 |
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
|
889 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
890 |
^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
|
891 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
892 |
"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
|
893 |
"Created: / 06-12-2011 / 23:00:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2151 | 894 |
! |
895 |
||
896 |
ensureHasAnnotations |
|
897 |
annotations |
|
898 |
ifNil:[ annotations := JavaMethodAnnotationContainer for:self ]. |
|
899 |
^ annotations |
|
900 |
||
901 |
"Created: / 25-02-2011 / 16:02:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
902 |
"Modified: / 28-02-2011 / 16:33:00 / Marcel Hlopko <hlopik@gmail.com>" |
|
903 |
! |
|
904 |
||
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
|
905 |
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
|
906 |
"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
|
907 |
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
|
908 |
^#() |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
909 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
910 |
"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
|
911 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
912 |
|
135 | 913 |
exceptionHandlerTable |
378 | 914 |
^ nil |
135 | 915 |
|
378 | 916 |
"Created: / 16.10.1998 / 01:50:51 / cg" |
135 | 917 |
! |
918 |
||
83 | 919 |
exceptionTable |
378 | 920 |
^ nil |
83 | 921 |
|
378 | 922 |
"Created: / 16.10.1998 / 01:51:04 / cg" |
83 | 923 |
! |
924 |
||
2151 | 925 |
firstInstructionLineNumber |
926 |
ForceByteCodeDisplay == true ifTrue:[ ^ 1]. |
|
927 |
lineNumberTable notNil ifTrue:[ ^ lineNumberTable at:2]. |
|
928 |
^ 0. |
|
929 |
||
930 |
"Created: / 17-12-2010 / 17:02:46 / Jan Kurs <kurs.jan@post.cz>" |
|
931 |
"Modified: / 08-01-2011 / 16:30:16 / Jan Kurs <kurs.jan@post.cz>" |
|
932 |
! |
|
933 |
||
934 |
getExceptionTable |
|
935 |
||
936 |
^ nil |
|
937 |
||
938 |
"Created: / 04-02-2011 / 23:07:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
939 |
! |
|
940 |
||
2514
5eff0cf4b818
Added JavaMethod>>getMClass - needed by recent libtool.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2498
diff
changeset
|
941 |
getMclass |
5eff0cf4b818
Added JavaMethod>>getMClass - needed by recent libtool.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2498
diff
changeset
|
942 |
^javaClass |
5eff0cf4b818
Added JavaMethod>>getMClass - needed by recent libtool.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2498
diff
changeset
|
943 |
|
5eff0cf4b818
Added JavaMethod>>getMClass - needed by recent libtool.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2498
diff
changeset
|
944 |
"Created: / 15-04-2013 / 17:57:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5eff0cf4b818
Added JavaMethod>>getMClass - needed by recent libtool.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2498
diff
changeset
|
945 |
! |
5eff0cf4b818
Added JavaMethod>>getMClass - needed by recent libtool.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2498
diff
changeset
|
946 |
|
2090 | 947 |
getSourcePosition |
948 |
^ 1 |
|
949 |
! |
|
950 |
||
90 | 951 |
hasLineNumberInformation |
952 |
^ lineNumberTable notNil |
|
953 |
||
954 |
"Created: 16.4.1996 / 12:34:04 / cg" |
|
955 |
"Modified: 16.4.1996 / 12:49:06 / cg" |
|
956 |
! |
|
957 |
||
10 | 958 |
javaByteCode |
184 | 959 |
"/ ^ javaByteCode |
960 |
^ byteCode |
|
10 | 961 |
|
962 |
"Created: 16.4.1996 / 14:55:44 / cg" |
|
184 | 963 |
"Modified: 1.8.1997 / 00:08:45 / cg" |
8 | 964 |
! |
965 |
||
27 | 966 |
javaClass |
967 |
^ javaClass |
|
968 |
||
969 |
"Modified: 16.4.1996 / 12:36:27 / cg" |
|
970 |
"Created: 16.4.1996 / 14:55:44 / cg" |
|
971 |
! |
|
972 |
||
2151 | 973 |
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
|
974 |
<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
|
975 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
976 |
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
|
977 |
^ self exceptionClasses |
2151 | 978 |
|
979 |
"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
|
980 |
"Modified: / 01-08-2012 / 10:08:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2151 | 981 |
! |
982 |
||
983 |
javaNumArgs |
|
984 |
^ self argSignature size. |
|
985 |
||
986 |
"Created: / 14-03-2011 / 15:50:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
987 |
! |
|
988 |
||
90 | 989 |
lineNumber |
252 | 990 |
lineNumberTable isNil ifTrue:[^ nil]. |
90 | 991 |
^ lineNumberTable at:2 |
992 |
||
993 |
"Created: 16.4.1996 / 12:34:04 / cg" |
|
994 |
"Modified: 16.4.1996 / 12:49:06 / cg" |
|
995 |
! |
|
996 |
||
50 | 997 |
lineNumberTable |
2151 | 998 |
"/ lineNumberTable ifNil:[ lineNumberTable := Dictionary new.]. |
50 | 999 |
^ lineNumberTable |
1000 |
||
2151 | 1001 |
"Created: / 16-04-1996 / 12:34:04 / cg" |
1002 |
"Modified: / 13-12-2010 / 11:06:40 / Jan Kurs <kurs.jan@post.cz>" |
|
50 | 1003 |
! |
1004 |
||
618 | 1005 |
literalsDetect:aBlock ifNone:exceptionBlock |
1006 |
"execute a one arg block for each of our literals. |
|
1007 |
return the first literal for which aBlock returns true" |
|
1008 |
||
1009 |
"/ sigh - must first extract all accessed literals ... |
|
1010 |
"/ must deparse the byteCode in order to do this. |
|
1011 |
||
1012 |
|walker| |
|
1013 |
||
1014 |
walker := JavaByteCodeEnumerator new. |
|
651 | 1015 |
walker literalAction:[:pc :slotIndex :const | |
1016 |
const isJavaMethodRef ifTrue:[ |
|
654 | 1017 |
(aBlock value:(const name)) ifTrue:[^ const name]. |
651 | 1018 |
] ifFalse:[ |
1019 |
const isJavaClassRef ifTrue:[ |
|
654 | 1020 |
(aBlock value:(const name)) ifTrue:[^ const name]. |
651 | 1021 |
] |
1022 |
] |
|
1023 |
]. |
|
618 | 1024 |
walker decompile:self to:nil. |
654 | 1025 |
^ nil |
618 | 1026 |
|
1027 |
"Created: / 9.11.1999 / 15:21:40 / cg" |
|
654 | 1028 |
"Modified: / 24.12.1999 / 02:55:55 / cg" |
618 | 1029 |
! |
1030 |
||
85 | 1031 |
localVariableTable |
1032 |
^ localVariableTable |
|
1033 |
||
1034 |
" |
|
1035 |
JavaMethod allInstancesDo:[:m| m localVariableTable notNil ifTrue:[self halt]] |
|
1036 |
" |
|
1037 |
! |
|
1038 |
||
2151 | 1039 |
mclass |
1040 |
^ self javaClass |
|
1041 |
! |
|
1042 |
||
1043 |
mclass: anObject |
|
1044 |
||
1045 |
javaClass := anObject |
|
1046 |
||
1047 |
"Created: / 18-10-2010 / 19:01:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1048 |
! |
|
1049 |
||
2086 | 1050 |
methodArgAndVarNames |
2151 | 1051 |
^ "((1 to:self numArgs) collect:[:i | 'arg' , i printString])" |
1052 |
self methodArgNames |
|
2086 | 1053 |
, |
2151 | 1054 |
"((1 to:self numVars) collect:[:i | 'local' , i printString])" |
1055 |
self methodVarNames |
|
1056 |
||
1057 |
"Modified: / 23-11-2010 / 19:32:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
31 | 1058 |
! |
1059 |
||
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
|
1060 |
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
|
1061 |
| 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
|
1062 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1063 |
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
|
1064 |
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
|
1065 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1066 |
^(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
|
1067 |
(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
|
1068 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1069 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1070 |
"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
|
1071 |
"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
|
1072 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1073 |
|
31 | 1074 |
methodArgNames |
252 | 1075 |
|nA| |
1076 |
||
1077 |
nA := self numArgs. |
|
102 | 1078 |
localVariableTable notNil ifTrue:[ |
2151 | 1079 |
^ (1 to:nA) collect: |
1080 |
[:argIndex | |
|
1081 |
|slot name| |
|
1082 |
"/ search for an entry with that index (slot), |
|
1083 |
"/ which has is valid at PC 0 |
|
1084 |
||
1085 |
self isStatic ifTrue:[ |
|
1086 |
slot := argIndex - 1 |
|
1087 |
] ifFalse:[ |
|
1088 |
slot := argIndex "/+ 1 |
|
1089 |
]. |
|
1090 |
name := localVariableTable nameForSlot:slot atPC:0. |
|
1091 |
name isNil ifTrue:[ |
|
1092 |
'arg' , argIndex printString |
|
1093 |
] ifFalse:[ |
|
1094 |
name |
|
1095 |
]. |
|
1096 |
] |
|
102 | 1097 |
]. |
252 | 1098 |
^ (1 to:nA) collect:[:i | 'arg' , i printString] |
2151 | 1099 |
|
1100 |
"Modified: / 23-11-2010 / 19:47:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1101 |
! |
|
1102 |
||
1103 |
methodVarNames |
|
1104 |
|nV| |
|
1105 |
||
1106 |
nV := self numVars. |
|
1107 |
localVariableTable notNil ifTrue:[ |
|
1108 |
^ (self numArgs + 1 to: self numArgs + nV) collect: |
|
1109 |
[:argIndex | |
|
1110 |
|slot name| |
|
1111 |
"/ search for an entry with that index (slot), |
|
1112 |
"/ which has is valid at PC 0 |
|
1113 |
||
1114 |
self isStatic ifTrue:[ |
|
1115 |
slot := argIndex - 1 |
|
1116 |
] ifFalse:[ |
|
1117 |
slot := argIndex"/ + 1 |
|
1118 |
]. |
|
1119 |
name := localVariableTable nameForSlot:slot atPC:0. |
|
1120 |
name isNil ifTrue:[ |
|
1121 |
'local' , argIndex printString |
|
1122 |
] ifFalse:[ |
|
1123 |
name |
|
1124 |
]. |
|
1125 |
] |
|
1126 |
]. |
|
1127 |
^ (1 to:nV) collect:[:i | 'local' , i printString] |
|
1128 |
||
1129 |
"Created: / 23-11-2010 / 19:28:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
31 | 1130 |
! |
1131 |
||
29 | 1132 |
name |
2151 | 1133 |
^ (selector copyWithoutLast:descriptor size) asSymbol |
29 | 1134 |
|
1135 |
"Created: 16.4.1996 / 11:34:22 / cg" |
|
1136 |
! |
|
1137 |
||
2151 | 1138 |
nameSpaceName |
1139 |
||
1140 |
^'' |
|
1141 |
||
1142 |
"Created: / 18-10-2010 / 19:10:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1143 |
! |
|
1144 |
||
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
|
1145 |
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
|
1146 |
|
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 |
^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
|
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 |
"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
|
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 |
|
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 |
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
|
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 |
^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
|
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 |
"Created: / 25-10-2011 / 10:50:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
118 | 1157 |
! |
1158 |
||
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
|
1159 |
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
|
1160 |
|
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 |
^(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
|
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: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
|
1164 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1165 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1166 |
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
|
1167 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1168 |
( 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
|
1169 |
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
|
1170 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1171 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1172 |
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
|
1173 |
((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
|
1174 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1175 |
"Created: / 25-10-2011 / 10:43:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
27 | 1176 |
! |
1177 |
||
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1178 |
originalMethodIfWrapped |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1179 |
"return the method the receiver is wrapping - none here" |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1180 |
|
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1181 |
^ self |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1182 |
|
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1183 |
"Created: / 22-10-2010 / 11:46:07 / cg" |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1184 |
! |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1185 |
|
175 | 1186 |
previousVersion |
1187 |
^ nil |
|
1188 |
||
1189 |
"Created: 30.7.1997 / 15:56:18 / cg" |
|
1190 |
! |
|
1191 |
||
2151 | 1192 |
previousVersionCode |
1193 |
||
1194 |
^nil |
|
1195 |
||
1196 |
"Created: / 18-10-2010 / 20:15:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1197 |
! |
|
1198 |
||
29 | 1199 |
retValSignature |
2151 | 1200 |
^ self class retValSpecFromSignature:descriptor in:nil |
29 | 1201 |
|
255 | 1202 |
"Modified: / 8.1.1998 / 19:06:40 / cg" |
29 | 1203 |
! |
1204 |
||
123 | 1205 |
returnType |
378 | 1206 |
"/ ^ returnType |
2151 | 1207 |
^ self class typeFromSignature:descriptor in:nil. |
378 | 1208 |
|
1209 |
"Modified: / 16.10.1998 / 00:17:43 / cg" |
|
123 | 1210 |
! |
1211 |
||
322 | 1212 |
returnTypeClass |
378 | 1213 |
|cls returnType| |
322 | 1214 |
|
378 | 1215 |
(returnType := self returnType) isNil ifTrue:[ |
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1216 |
self halt. |
322 | 1217 |
]. |
1218 |
cls := Java at:returnType. |
|
1219 |
cls notNil ifTrue:[^ cls]. |
|
1220 |
||
1221 |
returnType == #void ifTrue:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1222 |
^ nil |
322 | 1223 |
]. |
1224 |
returnType == #double ifTrue:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1225 |
'warning: no returnTypeClass for double' printCR. |
334 | 1226 |
"/ self halt:'no returnTypeClass for double'. |
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1227 |
^ nil |
322 | 1228 |
]. |
1229 |
returnType == #float ifTrue:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1230 |
'warning: no returnTypeClass for float' printCR. |
334 | 1231 |
"/ self halt:'no returnTypeClass for float'. |
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1232 |
^ nil |
322 | 1233 |
]. |
1234 |
returnType == #long ifTrue:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1235 |
'warning: no returnTypeClass for long' printCR. |
334 | 1236 |
"/ self halt:'no returnTypeClass for long'. |
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1237 |
^ nil |
334 | 1238 |
]. |
1239 |
returnType == #int ifTrue:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1240 |
'warning: no returnTypeClass for int' printCR. |
334 | 1241 |
"/ self halt:'no returnTypeClass for int'. |
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1242 |
^ nil |
334 | 1243 |
]. |
1244 |
returnType == #boolean ifTrue:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1245 |
'warning: no returnTypeClass for boolean' printCR. |
334 | 1246 |
"/ self halt:'no returnTypeClass for boolean'. |
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1247 |
^ nil |
322 | 1248 |
]. |
1249 |
self halt. |
|
1250 |
^ nil |
|
1251 |
||
1252 |
"Created: / 13.2.1998 / 15:08:26 / cg" |
|
378 | 1253 |
"Modified: / 16.10.1998 / 00:16:07 / cg" |
322 | 1254 |
! |
1255 |
||
116 | 1256 |
returnsDouble |
378 | 1257 |
^ self returnType == #double |
1258 |
||
1259 |
"Modified: / 16.10.1998 / 00:18:24 / cg" |
|
116 | 1260 |
! |
1261 |
||
72 | 1262 |
returnsLong |
378 | 1263 |
^ self returnType == #long |
1264 |
||
1265 |
"Modified: / 16.10.1998 / 00:18:41 / cg" |
|
72 | 1266 |
! |
1267 |
||
27 | 1268 |
returnsVoid |
378 | 1269 |
^ self returnType == #void |
1270 |
||
2151 | 1271 |
"Modified: / 16-10-1998 / 00:18:53 / cg" |
1272 |
"Modified: / 22-03-2011 / 12:27:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
27 | 1273 |
! |
1274 |
||
255 | 1275 |
selector |
378 | 1276 |
"/ could theoretically be extracted from my classes |
1277 |
"/ methodDictionary via: |
|
1278 |
"/ ^ javaClass methodDictionary keyAtValue:self ifAbsent:nil. |
|
1279 |
||
255 | 1280 |
^ selector |
1281 |
||
1282 |
"Created: / 7.1.1998 / 14:05:11 / cg" |
|
378 | 1283 |
"Modified: / 16.10.1998 / 13:41:06 / cg" |
255 | 1284 |
! |
1285 |
||
27 | 1286 |
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
|
1287 |
^ 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
|
1288 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1289 |
"Modified: / 04-12-2011 / 19:39:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
31 | 1290 |
! |
1291 |
||
1292 |
source |
|
2151 | 1293 |
| classSource | |
1294 |
"/ self isNative ifTrue:[ |
|
1295 |
"/ ^ 'native method' |
|
1296 |
"/ ]. |
|
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
|
1297 |
(self isSynthetic or:[ForceByteCodeDisplay == true]) ifTrue:[ |
2151 | 1298 |
^ self decompiledBytecode |
169 | 1299 |
]. |
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
|
1300 |
"/ lineNumberTable notNil ifTrue:[ |
2151 | 1301 |
classSource := javaClass source. |
1302 |
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
|
1303 |
"/ ]. |
75 | 1304 |
^ self decompiledSource |
169 | 1305 |
|
2151 | 1306 |
"Modified: / 04-01-1998 / 13:48:35 / cg" |
1307 |
"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
|
1308 |
"Modified: / 13-04-2012 / 18:18:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
31 | 1309 |
! |
1310 |
||
1311 |
sourceFilename |
|
1312 |
^ javaClass sourceFile |
|
175 | 1313 |
! |
1314 |
||
1315 |
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
|
1316 |
|
2151 | 1317 |
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
|
1318 |
"/ 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
|
1319 |
"/ 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
|
1320 |
"/ inClass:javaClass. |
2151 | 1321 |
]. |
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
|
1322 |
|
2151 | 1323 |
sourceLineNumber := 0. |
1324 |
||
1325 |
sourceLineNumber == 0 ifTrue: |
|
1326 |
[ |
|
1327 |
"There is something wrong with parsing" |
|
1328 |
"/ self halt. |
|
1329 |
self breakPoint: #libjava. |
|
1330 |
sourceLineNumber := self firstInstructionLineNumber -2. |
|
175 | 1331 |
]. |
1332 |
||
2151 | 1333 |
^ sourceLineNumber. |
1334 |
||
1335 |
"Created: / 30-07-1997 / 15:40:45 / cg" |
|
1336 |
"Modified: / 13-12-2010 / 23:46:30 / Marcel Hlopko <hlopik@gmail.com>" |
|
1337 |
"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
|
1338 |
"Modified: / 24-02-2012 / 19:24:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2151 | 1339 |
! |
1340 |
||
1341 |
wrapper |
|
1342 |
||
1343 |
^nil |
|
1344 |
||
1345 |
"Created: / 18-10-2010 / 19:11:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1346 |
! ! |
|
1347 |
||
1348 |
!JavaMethod methodsFor:'compiler interface'! |
|
1349 |
||
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
|
1350 |
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
|
1351 |
"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
|
1352 |
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
|
1353 |
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
|
1354 |
|
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 |
"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
|
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 |
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
|
1359 |
"__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
|
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 |
| 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
|
1362 |
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
|
1363 |
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
|
1364 |
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
|
1365 |
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
|
1366 |
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
|
1367 |
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
|
1368 |
|
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 |
%{ |
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 |
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
|
1371 |
|
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 |
|
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 |
%}. |
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 |
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
|
1375 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1376 |
"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
|
1377 |
"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
|
1378 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1379 |
|
2151 | 1380 |
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
|
1381 |
"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
|
1382 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1383 |
"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
|
1384 |
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
|
1385 |
^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
|
1386 |
|
2151 | 1387 |
"Created: / 26-10-2010 / 23:42:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2528
bc5ce044d5a1
Preserve method identity when updating class methods (when possible).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2527
diff
changeset
|
1388 |
! |
bc5ce044d5a1
Preserve method identity when updating class methods (when possible).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2527
diff
changeset
|
1389 |
|
bc5ce044d5a1
Preserve method identity when updating class methods (when possible).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2527
diff
changeset
|
1390 |
updateFrom: anotherMethod |
bc5ce044d5a1
Preserve method identity when updating class methods (when possible).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2527
diff
changeset
|
1391 |
|
bc5ce044d5a1
Preserve method identity when updating class methods (when possible).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2527
diff
changeset
|
1392 |
self class allInstVarNames keysAndValuesDo:[:index :name| |
bc5ce044d5a1
Preserve method identity when updating class methods (when possible).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2527
diff
changeset
|
1393 |
(#(#'code*' #'javaClass') includes: name) ifFalse:[ |
bc5ce044d5a1
Preserve method identity when updating class methods (when possible).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2527
diff
changeset
|
1394 |
self instVarAt: index put: (anotherMethod instVarAt: index) |
bc5ce044d5a1
Preserve method identity when updating class methods (when possible).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2527
diff
changeset
|
1395 |
] |
bc5ce044d5a1
Preserve method identity when updating class methods (when possible).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2527
diff
changeset
|
1396 |
] |
bc5ce044d5a1
Preserve method identity when updating class methods (when possible).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2527
diff
changeset
|
1397 |
|
bc5ce044d5a1
Preserve method identity when updating class methods (when possible).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2527
diff
changeset
|
1398 |
"Created: / 19-04-2013 / 00:08:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
8 | 1399 |
! ! |
1400 |
||
255 | 1401 |
!JavaMethod methodsFor:'debugging'! |
1402 |
||
1403 |
breakPoint |
|
1404 |
Debugger enter:thisContext sender withMessage:'breakpoint' |
|
1405 |
||
1406 |
"Modified: / 9.1.1998 / 23:01:17 / cg" |
|
1407 |
! |
|
1408 |
||
1409 |
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
|
1410 |
| 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
|
1411 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1412 |
accessFlags := (accessFlags bitClear:A_BREAKPOINT). |
449 | 1413 |
self hasCode ifTrue:[ |
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1414 |
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
|
1415 |
] 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
|
1416 |
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
|
1417 |
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
|
1418 |
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
|
1419 |
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
|
1420 |
] |
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 |
|
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 |
"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
|
1423 |
"Modified: / 30-05-2012 / 19:31:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
255 | 1424 |
! |
1425 |
||
257 | 1426 |
isCounting |
1427 |
^ false. |
|
1428 |
||
1429 |
"Created: / 12.1.1998 / 20:02:23 / cg" |
|
1430 |
! |
|
1431 |
||
1432 |
isCountingMemoryUsage |
|
1433 |
^ false. |
|
1434 |
||
1435 |
"Created: / 12.1.1998 / 20:03:22 / cg" |
|
1436 |
! |
|
1437 |
||
255 | 1438 |
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
|
1439 |
| 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
|
1440 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1441 |
accessFlags := (accessFlags bitOr:A_BREAKPOINT). |
449 | 1442 |
self hasCode ifTrue:[ |
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1443 |
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
|
1444 |
] 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
|
1445 |
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
|
1446 |
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
|
1447 |
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
|
1448 |
Smalltalk changed:#methodTrap with:{ clsInEvent . selector } |
449 | 1449 |
]. |
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
|
1450 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1451 |
"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
|
1452 |
"Modified: / 30-05-2012 / 19:30:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
257 | 1453 |
! |
1454 |
||
1455 |
setTraceFullPoint |
|
1456 |
"not yet implemented" |
|
1457 |
||
1458 |
"Modified: / 9.1.1998 / 23:01:17 / cg" |
|
1459 |
"Created: / 12.1.1998 / 20:04:45 / cg" |
|
1460 |
! |
|
1461 |
||
1462 |
setTracePoint |
|
1463 |
"not yet implemented" |
|
1464 |
||
1465 |
"Modified: / 9.1.1998 / 23:01:17 / cg" |
|
1466 |
"Created: / 12.1.1998 / 20:04:02 / cg" |
|
1467 |
! |
|
1468 |
||
1469 |
setTraceSenderPoint |
|
1470 |
"not yet implemented" |
|
1471 |
||
1472 |
"Modified: / 9.1.1998 / 23:01:17 / cg" |
|
1473 |
"Created: / 12.1.1998 / 20:04:35 / cg" |
|
1474 |
! |
|
1475 |
||
1476 |
startCounting |
|
1477 |
"not yet implemented" |
|
1478 |
||
1479 |
"Modified: / 9.1.1998 / 23:01:17 / cg" |
|
1480 |
"Created: / 12.1.1998 / 20:05:01 / cg" |
|
1481 |
! |
|
1482 |
||
1483 |
startCountingMemoryUsage |
|
1484 |
"not yet implemented" |
|
1485 |
||
1486 |
"Modified: / 9.1.1998 / 23:01:17 / cg" |
|
1487 |
"Created: / 12.1.1998 / 20:05:04 / cg" |
|
1488 |
! |
|
1489 |
||
1490 |
startTiming |
|
1491 |
"not yet implemented" |
|
1492 |
||
1493 |
"Modified: / 9.1.1998 / 23:01:17 / cg" |
|
1494 |
"Created: / 12.1.1998 / 20:04:57 / cg" |
|
255 | 1495 |
! ! |
1496 |
||
18 | 1497 |
!JavaMethod methodsFor:'decompiling'! |
1498 |
||
175 | 1499 |
decompileSourceTo:aStream |
637 | 1500 |
|argNames| |
1501 |
||
1502 |
byteCode isNil ifTrue:[ |
|
1503 |
self isPublic ifTrue:[ |
|
1504 |
aStream nextPutAll:'public '. |
|
1505 |
]. |
|
1506 |
self isProtected ifTrue:[ |
|
1507 |
aStream nextPutAll:'protected '. |
|
1508 |
]. |
|
1509 |
self isPrivate ifTrue:[ |
|
1510 |
aStream nextPutAll:'private '. |
|
1511 |
]. |
|
1512 |
self isStatic ifTrue:[ |
|
1513 |
aStream nextPutAll:'static '. |
|
1514 |
]. |
|
1515 |
||
1516 |
self isNative ifTrue:[ |
|
1517 |
aStream nextPutAll:'native '. |
|
1518 |
]. |
|
1519 |
self isAbstract ifTrue:[ |
|
1520 |
aStream nextPutAll:'abstract '. |
|
1521 |
]. |
|
1522 |
argNames := #('arg1' 'arg2' 'arg3' 'arg4' 'arg5' 'arg6' 'arg7' 'arg8' 'arg9'). |
|
1523 |
aStream nextPutAll:(self signatureNameWithArgNames:argNames). |
|
1524 |
aStream nextPutAll:';'; cr. |
|
1525 |
^ self |
|
1526 |
]. |
|
1527 |
||
2151 | 1528 |
" |
637 | 1529 |
JavaDeparser isNil ifTrue:[ |
1530 |
aStream nextPutAll:'// Sorry - no decompiler'. |
|
1531 |
^ self |
|
1532 |
]. |
|
2151 | 1533 |
" |
637 | 1534 |
|
1535 |
||
252 | 1536 |
"/ self isNative ifFalse:[ |
1537 |
"/ self isAbstract ifFalse:[ |
|
2151 | 1538 |
aStream nextPutAll:'// source not available...'; cr. |
637 | 1539 |
SignalSet anySignal handle:[:ex | |
1540 |
ex signal == Object haltSignal ifTrue:[ex reject]. |
|
1541 |
ex signal == MessageTracer breakpointSignal ifTrue:[ex reject]. |
|
1542 |
ex signal == Signal noHandlerSignal ifTrue:[ex reject]. |
|
506 | 1543 |
|
637 | 1544 |
aStream nextPutAll:'error while decompiling:'. |
1545 |
aStream cr; cr; spaces:4. |
|
1546 |
aStream nextPutAll:ex errorString. |
|
1547 |
aStream cr. |
|
1548 |
aStream nextPutAll:ex suspendedContext printString. |
|
1549 |
aStream cr. |
|
1550 |
aStream nextPutAll:ex suspendedContext sender printString. |
|
1551 |
aStream cr. |
|
1552 |
aStream nextPutAll:ex suspendedContext sender sender printString. |
|
1553 |
aStream cr. |
|
1554 |
aStream nextPutAll:ex suspendedContext sender sender sender printString. |
|
1555 |
aStream cr. |
|
1556 |
aStream nextPutAll:ex suspendedContext sender sender sender sender printString. |
|
1557 |
aStream cr. |
|
1558 |
aStream nextPutAll:ex suspendedContext sender sender sender sender sender printString. |
|
1559 |
aStream cr. |
|
2095 | 1560 |
aStream nextPutAll:ex suspendedContext sender sender sender sender sender sender printString. |
1561 |
aStream cr. |
|
1562 |
aStream nextPutAll:ex suspendedContext sender sender sender sender sender sender sender printString. |
|
1563 |
aStream cr. |
|
1564 |
aStream nextPutAll:ex suspendedContext sender sender sender sender sender sender sender sender printString. |
|
1565 |
aStream cr. |
|
506 | 1566 |
|
2151 | 1567 |
" |
1568 |
JavaByteCodeDisassembler isNil ifTrue:[ |
|
637 | 1569 |
aStream nextPutAll:'// Sorry - no decompiler' |
1570 |
] ifFalse:[ |
|
2151 | 1571 |
JavaByteCodeDisassembler diassemble:self to:aStream. |
637 | 1572 |
]. |
2151 | 1573 |
" |
637 | 1574 |
ex return |
1575 |
] do:[ |
|
2151 | 1576 |
"aStream nextPutAll:(JavaDeparser decompile:self)." |
1577 |
JavaByteCodeDisassembler diassemble:self to:aStream. |
|
637 | 1578 |
]. |
252 | 1579 |
"/ ]. |
1580 |
"/ ]. |
|
18 | 1581 |
|
2151 | 1582 |
"Created: / 30-07-1997 / 16:28:09 / cg" |
1583 |
"Modified: / 21-12-1999 / 14:31:54 / cg" |
|
1584 |
"Modified: / 22-03-2011 / 21:34:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
175 | 1585 |
! |
1586 |
||
1587 |
decompiler |
|
1588 |
^ JavaDecompiler |
|
1589 |
||
1590 |
"Created: 30.7.1997 / 16:36:48 / cg" |
|
261 | 1591 |
! |
1592 |
||
449 | 1593 |
isMethod |
1594 |
"return true, if the receiver is some kind of method; |
|
1595 |
true returned here - the method is redefined from Object." |
|
1596 |
||
1597 |
^ true |
|
1598 |
||
1599 |
"Created: / 13.11.1998 / 23:57:40 / cg" |
|
1600 |
! |
|
1601 |
||
261 | 1602 |
originalMethod |
1603 |
^ self |
|
1604 |
||
1605 |
"Created: / 13.1.1998 / 15:03:05 / cg" |
|
18 | 1606 |
! ! |
1607 |
||
277 | 1608 |
!JavaMethod methodsFor:'error handling'! |
1609 |
||
2151 | 1610 |
errorInvalidClassRefAt: index |
1611 |
||
1612 |
"Sent by the VM when an invalid entry in contant pool |
|
1613 |
is encountered - for instance when the VM expects |
|
1614 |
a classref but the entry is not a classref" |
|
1615 |
||
1616 |
" |
|
1617 |
javaClass constantPool at: index. |
|
1618 |
" |
|
1619 |
||
1620 |
JavaInvalidRefError new |
|
1621 |
javaClass: javaClass; |
|
1622 |
index: index; |
|
1623 |
raiseRequest |
|
1624 |
||
1625 |
"Created: / 18-07-2011 / 23:33:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1626 |
! |
|
1627 |
||
1628 |
errorInvalidFieldRefAt: index |
|
1629 |
||
1630 |
"Sent by the VM when an invalid entry in contant pool |
|
1631 |
is encountered - for instance when the VM expects |
|
1632 |
a classref but the entry is not a classref" |
|
1633 |
||
1634 |
" |
|
1635 |
javaClass constantPool at: index. |
|
1636 |
" |
|
1637 |
||
1638 |
JavaInvalidRefError new |
|
1639 |
javaClass: javaClass; |
|
1640 |
index: index; |
|
1641 |
raiseRequest |
|
1642 |
||
1643 |
"Created: / 18-07-2011 / 23:33:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1644 |
! |
|
1645 |
||
1646 |
errorInvalidMethodRefAt: index |
|
1647 |
||
1648 |
"Sent by the VM when an invalid entry in contant pool |
|
1649 |
is encountered - for instance when the VM expects |
|
1650 |
a classref but the entry is not a classref" |
|
1651 |
||
1652 |
" |
|
1653 |
javaClass constantPool at: index. |
|
1654 |
" |
|
1655 |
||
1656 |
JavaInvalidRefError new |
|
1657 |
javaClass: javaClass; |
|
1658 |
index: index; |
|
1659 |
raiseRequest |
|
1660 |
||
1661 |
"Created: / 18-07-2011 / 19:59:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1662 |
! |
|
1663 |
||
277 | 1664 |
invalidByteCode |
1665 |
self isAbstract ifTrue:[ |
|
2151 | 1666 |
^ AbstractMethodInvokationSignal raise. |
277 | 1667 |
]. |
2151 | 1668 |
((self class numArgsFromSignature:descriptor) > self class maxNumberOfArguments) ifTrue:[ |
1669 |
^ self error:'method cannot be executed - too many args' |
|
309 | 1670 |
]. |
277 | 1671 |
^ super invalidByteCode |
1672 |
||
2151 | 1673 |
"Created: / 27-01-1998 / 21:48:01 / cg" |
1674 |
"Modified: / 14-08-2011 / 19:29:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
378 | 1675 |
! |
1676 |
||
1677 |
invalidMethodRef |
|
1678 |
self halt. |
|
1679 |
^ nil. |
|
1680 |
||
1681 |
"Modified: / 27.1.1998 / 21:50:19 / cg" |
|
1682 |
"Created: / 16.10.1998 / 11:27:21 / cg" |
|
594 | 1683 |
! |
1684 |
||
1685 |
nullClassPointer |
|
1686 |
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
|
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 |
|
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 |
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
|
1690 |
"{ 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
|
1691 |
|
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 |
"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
|
1693 |
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
|
1694 |
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
|
1695 |
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
|
1696 |
|
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 |
^ 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
|
1698 |
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
|
1699 |
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
|
1700 |
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
|
1701 |
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
|
1702 |
|
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 |
" |
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 |
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
|
1705 |
" |
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 |
|
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 |
"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
|
1708 |
"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
|
1709 |
! ! |
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 |
|
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 |
!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
|
1712 |
|
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 |
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
|
1714 |
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
|
1715 |
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
|
1716 |
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
|
1717 |
] |
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 |
]. |
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 |
^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
|
1720 |
|
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 |
"Created: / 31-10-2012 / 23:09:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
277 | 1722 |
! ! |
1723 |
||
2151 | 1724 |
!JavaMethod methodsFor:'initialization'! |
1725 |
||
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
|
1726 |
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
|
1727 |
"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
|
1728 |
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
|
1729 |
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
|
1730 |
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
|
1731 |
|
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 |
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
|
1733 |
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
|
1734 |
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
|
1735 |
"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
|
1736 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1737 |
[ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1738 |
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
|
1739 |
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
|
1740 |
^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
|
1741 |
] 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
|
1742 |
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
|
1743 |
^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
|
1744 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1745 |
|
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 |
"/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
|
1747 |
"/ 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
|
1748 |
"/ -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
|
1749 |
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
|
1750 |
^ 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
|
1751 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1752 |
"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
|
1753 |
"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
|
1754 |
"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
|
1755 |
"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
|
1756 |
! |
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 |
|
2151 | 1758 |
setAccessFlags:flags |
1759 |
accessFlags := flags. |
|
1760 |
||
1761 |
"Created: 16.4.1996 / 11:34:14 / cg" |
|
1762 |
! |
|
1763 |
||
1764 |
setCode:codeBytes maxStack:max_stack maxLocals:max_locals u1:unknown1 u2:unknown2 |
|
1765 |
"/ javaByteCode := codeBytes. |
|
1766 |
byteCode := codeBytes. |
|
1767 |
"/ numStack := max_stack. |
|
1768 |
"/ 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
|
1769 |
super numberOfVars:max_locals - self numArgs - (self isStatic ifTrue:[0] ifFalse:[1]). |
2151 | 1770 |
super stackSize:max_stack. |
1771 |
||
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
|
1772 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1773 |
|
2151 | 1774 |
"/ self displayString printNL. |
1775 |
"/ ' nStack: ' print. numStack print. |
|
1776 |
"/ ' nLocal: ' print. numLocals print. |
|
1777 |
"/ ' u1: ' print. unknown1 print. |
|
1778 |
"/ ' u2: ' print. unknown2 printNL. |
|
1779 |
||
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
|
1780 |
"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
|
1781 |
"Modified: / 12-10-2012 / 11:46:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2151 | 1782 |
! |
1783 |
||
1784 |
setDescriptor:aString |
|
1785 |
||
1786 |
descriptor := aString asSymbol. |
|
1787 |
||
1788 |
"Created: / 16-04-1996 / 11:34:29 / cg" |
|
1789 |
"Modified: / 16-10-1998 / 00:17:12 / cg" |
|
1790 |
"Modified: / 13-08-2011 / 01:21:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1791 |
"Created: / 14-08-2011 / 19:41:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1792 |
! |
|
1793 |
||
1794 |
setJavaClass:aJavaClass |
|
1795 |
javaClass := aJavaClass |
|
1796 |
||
1797 |
"Modified: 16.4.1996 / 12:36:27 / cg" |
|
1798 |
"Created: 16.4.1996 / 15:28:15 / cg" |
|
1799 |
! |
|
1800 |
||
1801 |
setLineNumberTable:anArrayOfPCtoLineAssociations |
|
1802 |
"since this uses up lots of memory, compress it" |
|
1803 |
||
1804 |
|allBytes allWords idx| |
|
1805 |
||
1806 |
allBytes := allWords := true. |
|
1807 |
||
1808 |
anArrayOfPCtoLineAssociations do:[:assoc | |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1809 |
assoc key > 255 ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1810 |
allBytes := false. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1811 |
assoc key > 16rFFFF ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1812 |
allWords := false. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1813 |
]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1814 |
]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1815 |
assoc value > 255 ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1816 |
allBytes := false. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1817 |
assoc value > 16rFFFF ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1818 |
allWords := false |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1819 |
]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1820 |
]. |
2151 | 1821 |
]. |
1822 |
allBytes ifTrue:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1823 |
lineNumberTable := ByteArray new:(anArrayOfPCtoLineAssociations size * 2). |
2151 | 1824 |
] ifFalse:[ |
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1825 |
allWords ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1826 |
lineNumberTable := WordArray new:(anArrayOfPCtoLineAssociations size * 2). |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1827 |
] ifFalse:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1828 |
lineNumberTable := Array new:(anArrayOfPCtoLineAssociations size * 2). |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1829 |
] |
2151 | 1830 |
]. |
1831 |
||
1832 |
idx := 1. |
|
1833 |
anArrayOfPCtoLineAssociations do:[:assoc | |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1834 |
lineNumberTable at:idx put:assoc key. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1835 |
lineNumberTable at:idx+1 put:assoc value. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1836 |
idx := idx + 2. |
2151 | 1837 |
]. |
1838 |
||
1839 |
"Created: 16.4.1996 / 12:34:04 / cg" |
|
1840 |
"Modified: 16.4.1996 / 12:49:06 / cg" |
|
1841 |
! |
|
1842 |
||
1843 |
setLocalVariableTable:anArray |
|
1844 |
localVariableTable := anArray. |
|
1845 |
! |
|
1846 |
||
1847 |
setName:nameString descriptor:aString |
|
1848 |
||
1849 |
||
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
|
1850 |
|numArgs numJArgs returnType| |
2151 | 1851 |
|
1852 |
selector := (nameString , aString) asSymbol. |
|
1853 |
self setDescriptor:aString. |
|
1854 |
||
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
|
1855 |
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
|
1856 |
(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
|
1857 |
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
|
1858 |
] 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
|
1859 |
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
|
1860 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
1861 |
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
|
1862 |
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
|
1863 |
returnType := self class typeFromSignature:aString in:nil. |
2151 | 1864 |
|
1865 |
"/ for the convenience of the VM, also mirror the return type in |
|
1866 |
"/ the flags ... |
|
1867 |
||
1868 |
returnType == #void ifTrue:[ |
|
1869 |
accessFlags := accessFlags bitOr:R_VOID |
|
1870 |
] ifFalse:[ |
|
1871 |
returnType == #long ifTrue:[ |
|
1872 |
accessFlags := accessFlags bitOr:R_LONG |
|
1873 |
] ifFalse:[ |
|
1874 |
returnType == #double ifTrue:[ |
|
1875 |
accessFlags := accessFlags bitOr:R_DOUBLE |
|
1876 |
] |
|
1877 |
] |
|
1878 |
]. |
|
1879 |
||
1880 |
"Created: / 14-08-2011 / 19:41:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1881 |
! |
|
1882 |
||
1883 |
setSignature:aString |
|
1884 |
||
1885 |
signature := aString asSymbol. |
|
1886 |
||
1887 |
"Created: / 16-04-1996 / 11:34:29 / cg" |
|
1888 |
"Modified: / 16-10-1998 / 00:17:12 / cg" |
|
1889 |
"Modified (format): / 14-08-2011 / 19:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1890 |
! ! |
|
1891 |
||
1892 |
!JavaMethod methodsFor:'inspecting'! |
|
1893 |
||
1894 |
inspectorExtraAttributes |
|
1895 |
"extra (pseudo instvar) entries to be shown in an inspector." |
|
1896 |
||
1897 |
^ Dictionary new |
|
1898 |
declareAllNewFrom:(super inspectorExtraAttributes ? #()); |
|
1899 |
"/add:'-code' -> [ String streamContents:[:s | JavaDecompiler decompile: self to: s] ]; |
|
1900 |
add:'-code' -> [ String streamContents:[:s | JavaByteCodeDisassembler diassemble: self to: s] ]; |
|
1901 |
"/add:'-source' -> [ self source ]; |
|
1902 |
yourself |
|
1903 |
||
1904 |
"Modified: / 22-03-2011 / 21:13:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1905 |
! ! |
|
1906 |
||
1907 |
!JavaMethod methodsFor:'interpretation'! |
|
1908 |
||
1909 |
interpretWithReceiver: receiver |
|
1910 |
||
1911 |
^self |
|
1912 |
interpretWithReceiver: receiver |
|
1913 |
arguments: #() |
|
1914 |
||
1915 |
"Created: / 24-02-2011 / 22:05:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1916 |
! |
|
1917 |
||
1918 |
interpretWithReceiver: receiver arg: a1 |
|
1919 |
||
1920 |
^self |
|
1921 |
interpretWithReceiver: receiver |
|
1922 |
arguments: (Array with: a1) |
|
1923 |
||
1924 |
"Created: / 24-02-2011 / 22:05:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1925 |
! |
|
1926 |
||
1927 |
interpretWithReceiver: receiver arg: a1 arg: a2 |
|
1928 |
||
1929 |
^self |
|
1930 |
interpretWithReceiver: receiver |
|
1931 |
arguments: (Array with: a1 with: a2) |
|
1932 |
||
1933 |
"Created: / 24-02-2011 / 22:05:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1934 |
! |
|
1935 |
||
1936 |
interpretWithReceiver: receiver arg: a1 arg: a2 arg: a3 |
|
1937 |
||
1938 |
^self |
|
1939 |
interpretWithReceiver: receiver |
|
1940 |
arguments: (Array with: a1 with: a2 with: a3) |
|
1941 |
||
1942 |
"Created: / 24-02-2011 / 22:06:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1943 |
! |
|
1944 |
||
1945 |
interpretWithReceiver: receiver arguments:args |
|
1946 |
||
1947 |
^ JavaByteCodeInterpreter |
|
1948 |
interpret:self |
|
1949 |
receiver:receiver |
|
1950 |
arguments:args |
|
1951 |
||
1952 |
"Modified: / 24-02-2011 / 23:00:42 / Marcel Hlopko <hlopik@gmail.com>" |
|
1953 |
"Created: / 24-02-2011 / 22:04:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1954 |
! ! |
|
1955 |
||
118 | 1956 |
!JavaMethod methodsFor:'methodref interchangability'! |
1957 |
||
673 | 1958 |
homeMethod |
1959 |
^ self |
|
1960 |
! |
|
1961 |
||
118 | 1962 |
method |
1963 |
^ self |
|
692 | 1964 |
! |
1965 |
||
1966 |
setPackage:newPackage |
|
1967 |
newPackage ~= javaClass package ifTrue:[ |
|
1968 |
self halt:'java method cannot be in a package different from its class'. |
|
1969 |
] |
|
118 | 1970 |
! ! |
1971 |
||
148 | 1972 |
!JavaMethod methodsFor:'misc'! |
1973 |
||
378 | 1974 |
fromMethod:aJavaMethod |
1975 |
"copy values from another javaMethod" |
|
149 | 1976 |
|
378 | 1977 |
flags := aJavaMethod flags. |
1978 |
byteCode := aJavaMethod byteCode. |
|
1979 |
accessFlags := aJavaMethod accessFlags. |
|
1980 |
selector := aJavaMethod selector. |
|
1981 |
javaClass := aJavaMethod javaClass. |
|
2151 | 1982 |
descriptor := aJavaMethod instVarNamed:#descriptor. |
1983 |
signature := aJavaMethod instVarNamed:#signature. |
|
378 | 1984 |
lineNumberTable := aJavaMethod lineNumberTable. |
1985 |
localVariableTable := aJavaMethod localVariableTable. |
|
2151 | 1986 |
annotations := aJavaMethod annotations. |
1987 |
||
1988 |
"Modified: / 16-10-1998 / 01:27:19 / cg" |
|
1989 |
"Modified: / 14-08-2011 / 19:30:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
255 | 1990 |
! |
252 | 1991 |
|
255 | 1992 |
updateClassRefsFrom:oldClass to:newClass |
1993 |
javaClass == oldClass ifTrue:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1994 |
"/ invalidate |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
1995 |
byteCode := nil. |
255 | 1996 |
] |
252 | 1997 |
|
255 | 1998 |
"Created: / 6.1.1998 / 18:19:48 / cg" |
252 | 1999 |
! ! |
2000 |
||
8 | 2001 |
!JavaMethod methodsFor:'printing & storing'! |
2002 |
||
29 | 2003 |
displayString |
168 | 2004 |
javaClass isNil ifTrue:[ |
611 | 2005 |
^ self class name , '(???)' |
168 | 2006 |
]. |
611 | 2007 |
^ self class name , '(' , javaClass displayString , '::' , self signatureName , ')' |
423 | 2008 |
|
611 | 2009 |
"Modified: / 25.9.1999 / 23:04:01 / cg" |
29 | 2010 |
! |
2011 |
||
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
|
2012 |
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
|
2013 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2014 |
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
|
2015 |
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
|
2016 |
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
|
2017 |
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
|
2018 |
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
|
2019 |
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
|
2020 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2021 |
"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
|
2022 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2023 |
|
670 | 2024 |
printStringForBrowserWithSelector:dummySelector inClass:dummyClass |
43 | 2025 |
"/ self isStatic ifTrue:[ |
2026 |
"/ ^ 'static ' , self signatureName |
|
2027 |
"/ ]. |
|
168 | 2028 |
"/ self isBreakpointed ifTrue:[ |
2029 |
"/ ^ (LabelAndIcon '!! ' , self signatureName |
|
2030 |
"/ ]. |
|
175 | 2031 |
|
252 | 2032 |
self name = #'<init>' ifTrue:[ |
2151 | 2033 |
^ self class specTextFromSignature:descriptor in:javaClass package withName:(javaClass lastName). |
166 | 2034 |
]. |
2151 | 2035 |
^ self class specTextFromSignature:descriptor in:javaClass package withName:(self name) |
10 | 2036 |
! |
2037 |
||
118 | 2038 |
shortDisplayString |
2039 |
^ javaClass name , '::' , self signatureNameWithoutReturnType |
|
2040 |
! |
|
2041 |
||
10 | 2042 |
signatureName |
2043 |
"return a string to be used when browsing" |
|
2044 |
||
2151 | 2045 |
^ self class specFromSignature:descriptor withName:(self name) in:nil |
255 | 2046 |
|
2047 |
"Modified: / 8.1.1998 / 19:15:33 / cg" |
|
113 | 2048 |
! |
2049 |
||
164 | 2050 |
signatureNameFor:name withArgsIn:aPackage |
2051 |
"return a string to be used when decompiling" |
|
2052 |
||
2151 | 2053 |
^ self class specWithArgsFromSignature:descriptor withName:name in:aPackage |
164 | 2054 |
|
2055 |
"Created: 25.3.1997 / 18:49:45 / cg" |
|
2056 |
! |
|
2057 |
||
142 | 2058 |
signatureNameIn:aPackage |
2059 |
"return a string to be used when browsing" |
|
2060 |
||
2151 | 2061 |
^ self class specFromSignature:descriptor withName:(self name) in:aPackage |
142 | 2062 |
|
2063 |
"Created: 18.3.1997 / 11:11:01 / cg" |
|
2064 |
! |
|
2065 |
||
175 | 2066 |
signatureNameText |
2067 |
"return a text to be used when browsing" |
|
2068 |
||
2151 | 2069 |
^ self class specTextFromSignature:descriptor withName:(self name) |
175 | 2070 |
|
2071 |
"Created: 30.7.1997 / 14:40:29 / cg" |
|
2072 |
! |
|
2073 |
||
189 | 2074 |
signatureNameTextFor:name withArgsIn:aPackage |
2075 |
"return a text to be used when decompiling" |
|
2076 |
||
2151 | 2077 |
^ self class specTextWithArgsFromSignature:descriptor withName:name in:aPackage |
189 | 2078 |
|
2079 |
"Created: 25.3.1997 / 18:49:45 / cg" |
|
2080 |
"Modified: 1.8.1997 / 10:44:28 / cg" |
|
2081 |
! |
|
2082 |
||
255 | 2083 |
signatureNameWithArgNames:argNames |
2084 |
"return a string to be used when browsing" |
|
2085 |
||
2086 |
|myName| |
|
2087 |
||
2088 |
myName := self name. |
|
2089 |
myName = '<init>' ifTrue:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2090 |
myName := javaClass name |
255 | 2091 |
]. |
2151 | 2092 |
^ self class specFromSignature:descriptor withName:myName argNames:argNames in:nil |
255 | 2093 |
|
2094 |
"Created: / 8.1.1998 / 21:04:03 / cg" |
|
2095 |
"Modified: / 8.1.1998 / 21:22:38 / cg" |
|
2096 |
! |
|
2097 |
||
2098 |
signatureNameWithArgNames:argNames in:package |
|
2099 |
"return a string to be used when browsing" |
|
2100 |
||
2101 |
|myName| |
|
2102 |
||
2103 |
myName := self name. |
|
2104 |
myName = '<init>' ifTrue:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2105 |
myName := javaClass name |
255 | 2106 |
]. |
2151 | 2107 |
^ self class specFromSignature:descriptor withName:myName argNames:argNames in:package |
255 | 2108 |
|
2109 |
"Modified: / 8.1.1998 / 21:05:52 / cg" |
|
2110 |
"Created: / 8.1.1998 / 21:23:03 / cg" |
|
2111 |
! |
|
2112 |
||
154 | 2113 |
signatureNameWithArgsIn:aPackage |
2114 |
"return a string to be used when browsing" |
|
2115 |
||
2151 | 2116 |
^ self class specWithArgsFromSignature:descriptor withName:(self name) in:aPackage |
2117 |
||
2118 |
"Created: / 20-03-1997 / 12:44:17 / cg" |
|
2119 |
"Modified: / 14-08-2011 / 19:29:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2120 |
! |
|
2121 |
||
2122 |
signatureNameWithModifiers |
|
2123 |
"return a string to be used when deassembling" |
|
2124 |
||
2125 |
| result | |
|
2126 |
||
2127 |
result := self signatureName. |
|
2128 |
self isFinal ifTrue: [ result := 'final ' , result ]. |
|
2129 |
self isStatic ifTrue: [ result := 'static ' , result ]. |
|
2130 |
self isSynchronized ifTrue: [ result := 'synchronized ' , result ]. |
|
2131 |
self isPrivate |
|
2132 |
ifTrue: [ result := 'private ' , result ] |
|
2133 |
ifFalse: |
|
2134 |
[ self isProtected |
|
2135 |
ifTrue: [ result := 'protected ' , result ] |
|
2136 |
ifFalse: [ self isPublic ifTrue: [ result := 'public ' , result ] ] ]. |
|
2137 |
self isAbstract ifTrue: [ result := 'abstract ' , result ]. |
|
2138 |
^ result. |
|
2139 |
||
2140 |
"Modified: / 08-01-1998 / 19:15:33 / cg" |
|
2141 |
"Created: / 22-03-2011 / 16:25:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
154 | 2142 |
! |
2143 |
||
113 | 2144 |
signatureNameWithoutReturnType |
2145 |
"return a string to be used when browsing" |
|
2146 |
||
2151 | 2147 |
^ self class argSpecFromSignature:descriptor withName:(self name) |
113 | 2148 |
|
8 | 2149 |
! ! |
2150 |
||
2151 |
!JavaMethod methodsFor:'queries'! |
|
2152 |
||
2527
c380a7c258fb
Makes JavaUnresolvedCompilationError proceedable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2514
diff
changeset
|
2153 |
canBeUpdatedFrom: anotherMethod |
c380a7c258fb
Makes JavaUnresolvedCompilationError proceedable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2514
diff
changeset
|
2154 |
"Return if receiver can be updated from given method, i.e., if it is safe |
c380a7c258fb
Makes JavaUnresolvedCompilationError proceedable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2514
diff
changeset
|
2155 |
to just to take anotherMethod's bytecode. Used to implement fix & restart |
c380a7c258fb
Makes JavaUnresolvedCompilationError proceedable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2514
diff
changeset
|
2156 |
workflow" |
c380a7c258fb
Makes JavaUnresolvedCompilationError proceedable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2514
diff
changeset
|
2157 |
|
2528
bc5ce044d5a1
Preserve method identity when updating class methods (when possible).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2527
diff
changeset
|
2158 |
"/ Allready jitted method cannot be updated - no way to restart existing context into |
bc5ce044d5a1
Preserve method identity when updating class methods (when possible).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2527
diff
changeset
|
2159 |
"/ new code |
bc5ce044d5a1
Preserve method identity when updating class methods (when possible).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2527
diff
changeset
|
2160 |
self code notNil ifTrue:[ ^ false ]. |
bc5ce044d5a1
Preserve method identity when updating class methods (when possible).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2527
diff
changeset
|
2161 |
|
bc5ce044d5a1
Preserve method identity when updating class methods (when possible).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2527
diff
changeset
|
2162 |
"/ Args and their types must match |
bc5ce044d5a1
Preserve method identity when updating class methods (when possible).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2527
diff
changeset
|
2163 |
selector ~~ anotherMethod selector ifTrue: [ ^ false ]. |
bc5ce044d5a1
Preserve method identity when updating class methods (when possible).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2527
diff
changeset
|
2164 |
|
bc5ce044d5a1
Preserve method identity when updating class methods (when possible).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2527
diff
changeset
|
2165 |
"/ max stack depth must be smaller or equal of the current |
bc5ce044d5a1
Preserve method identity when updating class methods (when possible).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2527
diff
changeset
|
2166 |
(self numVars + self stackSize) < (anotherMethod numVars + anotherMethod stackSize) ifTrue:[ ^ false ]. |
bc5ce044d5a1
Preserve method identity when updating class methods (when possible).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2527
diff
changeset
|
2167 |
|
bc5ce044d5a1
Preserve method identity when updating class methods (when possible).
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2527
diff
changeset
|
2168 |
^true |
2527
c380a7c258fb
Makes JavaUnresolvedCompilationError proceedable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2514
diff
changeset
|
2169 |
|
c380a7c258fb
Makes JavaUnresolvedCompilationError proceedable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2514
diff
changeset
|
2170 |
"Created: / 18-04-2013 / 23:43:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
c380a7c258fb
Makes JavaUnresolvedCompilationError proceedable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2514
diff
changeset
|
2171 |
! |
c380a7c258fb
Makes JavaUnresolvedCompilationError proceedable.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2514
diff
changeset
|
2172 |
|
111 | 2173 |
handlerFor:anException at:pc |
611 | 2174 |
"return an exceptionHandlers pc, for an exception of the given type, |
2175 |
occurring at pc. Returns nil, if there is none." |
|
2176 |
||
2177 |
|handlerTable| |
|
2178 |
||
2179 |
(handlerTable := self exceptionHandlerTable) isNil ifTrue:[^ nil]. |
|
2180 |
||
2181 |
handlerTable do:[:entry | |
|
2182 |
|hpc| |
|
2183 |
||
2184 |
hpc := entry handlerPCFor:anException at:pc in:self. |
|
2185 |
hpc notNil ifTrue:[^ hpc]. |
|
2186 |
]. |
|
2187 |
||
378 | 2188 |
^ nil |
48 | 2189 |
|
611 | 2190 |
"Created: / 16.10.1998 / 01:18:40 / cg" |
2191 |
"Modified: / 25.9.1999 / 23:07:01 / cg" |
|
31 | 2192 |
! |
2193 |
||
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
|
2194 |
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
|
2195 |
^ (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
|
2196 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2197 |
"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
|
2198 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2199 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2200 |
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
|
2201 |
"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
|
2202 |
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
|
2203 |
^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
|
2204 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2205 |
"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
|
2206 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2207 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2208 |
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
|
2209 |
^ (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
|
2210 |
|
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 |
"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
|
2212 |
! |
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 |
|
2151 | 2214 |
hasPrimitiveCode |
2215 |
||
2216 |
^false |
|
2217 |
||
2218 |
"Created: / 18-07-2011 / 20:45:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2219 |
! |
|
2220 |
||
127 | 2221 |
hasResource |
2222 |
^ false |
|
2223 |
! |
|
2224 |
||
19 | 2225 |
isAbstract |
252 | 2226 |
^ (accessFlags bitAnd:A_ABSTRACT) ~~ 0 |
19 | 2227 |
! |
2228 |
||
80 | 2229 |
isBreakpointed |
256 | 2230 |
^ (accessFlags bitAnd:A_BREAKPOINT) ~~ 0 |
2231 |
||
2232 |
"Modified: / 11.1.1998 / 13:28:43 / cg" |
|
80 | 2233 |
! |
2234 |
||
19 | 2235 |
isFinal |
252 | 2236 |
^ (accessFlags bitAnd:A_FINAL) ~~ 0 |
19 | 2237 |
! |
2238 |
||
175 | 2239 |
isIgnored |
2240 |
"not really a java attribute; |
|
2241 |
added to allow browsing" |
|
2242 |
||
2243 |
^ false. |
|
2244 |
||
2245 |
"Created: 30.7.1997 / 15:34:33 / cg" |
|
2246 |
! |
|
2247 |
||
625 | 2248 |
isJavaClassRef |
2249 |
^ false |
|
2250 |
||
2251 |
"Created: / 9.11.1999 / 17:16:20 / cg" |
|
2252 |
! |
|
2253 |
||
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
|
2254 |
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
|
2255 |
^((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
|
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 |
"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
|
2258 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2259 |
|
431 | 2260 |
isJavaMethod |
2261 |
^ true |
|
2262 |
||
2263 |
"Created: / 10.11.1998 / 18:24:51 / cg" |
|
2264 |
! |
|
2265 |
||
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
|
2266 |
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
|
2267 |
^((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
|
2268 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2269 |
"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
|
2270 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2271 |
|
19 | 2272 |
isNative |
252 | 2273 |
^ (accessFlags bitAnd:A_NATIVE) ~~ 0 |
19 | 2274 |
! |
2275 |
||
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
|
2276 |
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
|
2277 |
^ (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
|
2278 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2279 |
"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
|
2280 |
! |
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 |
|
19 | 2282 |
isPrivate |
252 | 2283 |
^ (accessFlags bitAnd:A_PRIVATE) ~~ 0 |
19 | 2284 |
! |
2285 |
||
2286 |
isProtected |
|
252 | 2287 |
^ (accessFlags bitAnd:A_PROTECTED) ~~ 0 |
19 | 2288 |
! |
2289 |
||
2290 |
isPublic |
|
252 | 2291 |
^ (accessFlags bitAnd:A_PUBLIC) ~~ 0 |
19 | 2292 |
! |
2293 |
||
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
|
2294 |
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
|
2295 |
"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
|
2296 |
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
|
2297 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2298 |
^ (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
|
2299 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2300 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2301 |
|
19 | 2302 |
isStatic |
252 | 2303 |
^ (accessFlags bitAnd:A_STATIC) ~~ 0 |
19 | 2304 |
! |
2305 |
||
2306 |
isSynchronized |
|
252 | 2307 |
^ (accessFlags bitAnd:A_SYNCHRONIZED) ~~ 0 |
18 | 2308 |
! |
2309 |
||
256 | 2310 |
isTraced |
2311 |
^ false |
|
2312 |
||
2313 |
"Modified: / 11.1.1998 / 13:28:43 / cg" |
|
2314 |
"Created: / 11.1.1998 / 13:38:11 / cg" |
|
2315 |
! |
|
2316 |
||
8 | 2317 |
isUnloaded |
2318 |
^ false |
|
18 | 2319 |
! |
2320 |
||
2151 | 2321 |
isUnresolved |
2322 |
"return true, if the receiver is unresolved;" |
|
2323 |
||
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
|
2324 |
^ self isResolved not |
2151 | 2325 |
|
2326 |
"Created: / 06-03-2011 / 22:57:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
2327 |
! |
|
2328 |
||
256 | 2329 |
isWrapped |
2330 |
^ self isBreakpointed |
|
2331 |
||
2332 |
"Modified: / 11.1.1998 / 13:28:43 / cg" |
|
2333 |
"Created: / 11.1.1998 / 13:38:04 / cg" |
|
2334 |
! |
|
2335 |
||
31 | 2336 |
lineNumberForPC:pc |
75 | 2337 |
|last num text classSource| |
31 | 2338 |
|
2339 |
num := nil. |
|
2340 |
||
207 | 2341 |
ForceByteCodeDisplay == true ifFalse:[ |
169 | 2342 |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2343 |
lineNumberTable notNil ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2344 |
classSource := javaClass source. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2345 |
classSource notNil ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2346 |
lineNumberTable pairWiseDo:[:lPc :lNr | |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2347 |
lPc >= pc ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2348 |
lPc == pc ifTrue:[^ lNr]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2349 |
last isNil ifTrue:[^ lNr]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2350 |
^ last. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2351 |
]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2352 |
last := lNr. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2353 |
]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2354 |
last notNil ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2355 |
^ last |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2356 |
]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2357 |
^ lineNumberTable at:2 |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2358 |
]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2359 |
]. |
46 | 2360 |
]. |
31 | 2361 |
|
46 | 2362 |
"/ decompile and look which line the pc falls into |
209 | 2363 |
|
2364 |
ForceByteCodeDisplay == true ifTrue:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2365 |
text := self decompiledBytecode asCollectionOfLines. |
209 | 2366 |
] ifFalse:[ |
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2367 |
text := self decompiledSource asCollectionOfLines. |
209 | 2368 |
]. |
31 | 2369 |
|
46 | 2370 |
text keysAndValuesDo:[:lineNr :line | |
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2371 |
|nr| |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2372 |
|
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2373 |
(line startsWith:' ') ifFalse:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2374 |
nr := Integer readFrom:line onError:0. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2375 |
nr >= pc ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2376 |
^ lineNr |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2377 |
] |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2378 |
] |
31 | 2379 |
]. |
2380 |
^ num |
|
141 | 2381 |
|
261 | 2382 |
"Modified: / 14.1.1998 / 13:30:54 / cg" |
31 | 2383 |
! |
2384 |
||
2087 | 2385 |
messagesSent |
2386 |
"return a collection of messages sent by this method" |
|
2387 |
||
2091 | 2388 |
|walker selectors| |
2087 | 2389 |
|
2390 |
"/ sigh - must extract all accessed literals ... |
|
2391 |
"/ must deparse the byteCode in order to do this. |
|
2392 |
||
2393 |
selectors := IdentitySet new. |
|
2394 |
walker := JavaByteCodeEnumerator new. |
|
2395 |
walker |
|
2396 |
literalAction: |
|
2397 |
[:pc :slotIndex :const | |
|
2398 |
|mSel| |
|
2399 |
||
2400 |
(const isNumber |
|
2401 |
or:[const isString |
|
2402 |
or:[const isNil]]) ifFalse:[ |
|
2403 |
const isJavaMethod ifTrue:[ |
|
2404 |
mSel := const selector. |
|
2405 |
] ifFalse:[ |
|
2406 |
const isJavaMethodRef ifTrue:[ |
|
2407 |
mSel := const selector "/ signature. |
|
2408 |
] |
|
2409 |
]. |
|
2410 |
]. |
|
2411 |
mSel notNil ifTrue:[ |
|
2412 |
"/ Transcript showCR:mSel. |
|
2413 |
selectors add:mSel |
|
2414 |
]. |
|
2415 |
]. |
|
2416 |
walker decompile:self to:nil. |
|
2417 |
^ selectors |
|
2418 |
! |
|
2419 |
||
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
|
2420 |
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
|
2421 |
"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
|
2422 |
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
|
2423 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2424 |
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
|
2425 |
"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
|
2426 |
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
|
2427 |
(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
|
2428 |
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
|
2429 |
^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
|
2430 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2431 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2432 |
"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
|
2433 |
(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
|
2434 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2435 |
" - 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
|
2436 |
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
|
2437 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2438 |
" - 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
|
2439 |
(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
|
2440 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2441 |
"- 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
|
2442 |
- 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
|
2443 |
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
|
2444 |
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
|
2445 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2446 |
(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
|
2447 |
(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
|
2448 |
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
|
2449 |
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
|
2450 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2451 |
^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
|
2452 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2453 |
"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
|
2454 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2455 |
|
156 | 2456 |
package |
685 | 2457 |
"in java, class extensions are not possible; |
2458 |
all methods MUST be in their classes package" |
|
156 | 2459 |
|
685 | 2460 |
^ javaClass package |
156 | 2461 |
! |
2462 |
||
428 | 2463 |
quickLineNumberForPC:pc |
2464 |
|last| |
|
2465 |
||
2466 |
lineNumberTable notNil ifTrue:[ |
|
2158
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2467 |
lineNumberTable pairWiseDo:[:lPc :lNr | |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2468 |
lPc >= pc ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2469 |
lPc == pc ifTrue:[^ lNr]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2470 |
last isNil ifTrue:[^ lNr]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2471 |
^ last. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2472 |
]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2473 |
last := lNr. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2474 |
]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2475 |
last notNil ifTrue:[ |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2476 |
^ last |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2477 |
]. |
cf16fc148fb8
added: #originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents:
2151
diff
changeset
|
2478 |
^ lineNumberTable at:2 |
428 | 2479 |
]. |
2480 |
^ nil |
|
2481 |
||
2482 |
"Modified: / 14.1.1998 / 13:30:54 / cg" |
|
2483 |
"Created: / 10.11.1998 / 14:18:22 / cg" |
|
2484 |
! |
|
2485 |
||
625 | 2486 |
referencesGlobal:aGlobalName |
2487 |
"return true, if this method refers to a global named aGlobalName" |
|
2488 |
||
2489 |
|walker any| |
|
2490 |
||
2491 |
"/ quick check, if constantPool includes a methodRef for this |
|
2492 |
"/ selector. |
|
2493 |
||
2494 |
any := false. |
|
2495 |
self javaClass constantPool do:[:const | |
|
2496 |
(const isNumber |
|
2497 |
or:[const isString |
|
2498 |
or:[const isNil]]) ifFalse:[ |
|
2499 |
const isJavaClass ifTrue:[ |
|
2500 |
any := any or:[const fullName = aGlobalName]. |
|
2501 |
] ifFalse:[ |
|
2502 |
const isJavaClassRef ifTrue:[ |
|
2503 |
any := any or:[const fullName = aGlobalName]. |
|
2504 |
] |
|
2505 |
]. |
|
2506 |
]. |
|
2507 |
]. |
|
2508 |
any ifFalse:[^ false]. |
|
2509 |
||
2510 |
"/ sigh - must extract all accessed literals ... |
|
2511 |
"/ must deparse the byteCode in order to do this. |
|
2512 |
||
2513 |
walker := JavaByteCodeEnumerator new. |
|
2514 |
walker |
|
2515 |
literalAction: |
|
2516 |
[:pc :slotIndex :const | |
|
2517 |
|mSel| |
|
2518 |
||
2519 |
(const isNumber |
|
2520 |
or:[const isString |
|
2521 |
or:[const isNil]]) ifFalse:[ |
|
2522 |
const isJavaClass ifTrue:[ |
|
2523 |
mSel := const fullName. |
|
2524 |
] ifFalse:[ |
|
2525 |
const isJavaClassRef ifTrue:[ |
|
2526 |
mSel := const fullName. |
|
2527 |
] |
|
2528 |
]. |
|
2529 |
]. |
|
2530 |
mSel notNil ifTrue:[ |
|
2531 |
"/ Transcript showCR:mSel. |
|
2532 |
mSel = aGlobalName ifTrue:[ |
|
2533 |
^ true |
|
2534 |
] |
|
2535 |
]. |
|
2536 |
]. |
|
2537 |
walker decompile:self to:nil. |
|
2538 |
||
2539 |
"Created: / 9.11.1999 / 17:15:46 / cg" |
|
2540 |
"Modified: / 9.11.1999 / 17:18:02 / cg" |
|
2541 |
! |
|
2542 |
||
618 | 2543 |
sends:aSelectorSymbol |
2544 |
"return true, if this method contains a message-send |
|
2545 |
with aSelectorSymbol as selector." |
|
2546 |
||
2547 |
|walker any| |
|
2548 |
||
2549 |
"/ quick check, if constantPool includes a methodRef for this |
|
2550 |
"/ selector. |
|
2551 |
||
2552 |
any := false. |
|
2553 |
self javaClass constantPool do:[:const | |
|
2554 |
(const isNumber |
|
2555 |
or:[const isString |
|
2556 |
or:[const isNil]]) ifFalse:[ |
|
2557 |
const isJavaMethod ifTrue:[ |
|
2558 |
any := any or:[const selector = aSelectorSymbol]. |
|
2559 |
] ifFalse:[ |
|
2560 |
const isJavaMethodRef ifTrue:[ |
|
2561 |
any := any or:[const signature = aSelectorSymbol]. |
|
2562 |
] |
|
2563 |
]. |
|
2564 |
]. |
|
2565 |
]. |
|
2566 |
any ifFalse:[^ false]. |
|
2567 |
||
625 | 2568 |
"/ sigh - must extract all accessed literals ... |
2569 |
"/ must deparse the byteCode in order to do this. |
|
2570 |
||
618 | 2571 |
walker := JavaByteCodeEnumerator new. |
2572 |
walker |
|
2573 |
literalAction: |
|
2574 |
[:pc :slotIndex :const | |
|
2575 |
|mSel| |
|
2576 |
||
2577 |
(const isNumber |
|
2578 |
or:[const isString |
|
2579 |
or:[const isNil]]) ifFalse:[ |
|
2580 |
const isJavaMethod ifTrue:[ |
|
2581 |
mSel := const selector. |
|
2582 |
] ifFalse:[ |
|
2583 |
const isJavaMethodRef ifTrue:[ |
|
2584 |
mSel := const signature. |
|
2585 |
] |
|
2586 |
]. |
|
2587 |
]. |
|
2588 |
mSel notNil ifTrue:[ |
|
2589 |
"/ Transcript showCR:mSel. |
|
2590 |
mSel = aSelectorSymbol ifTrue:[ |
|
2591 |
^ true |
|
2592 |
] |
|
2593 |
]. |
|
2594 |
]. |
|
2595 |
walker decompile:self to:nil. |
|
2596 |
||
2597 |
"Created: / 9.11.1999 / 15:38:14 / cg" |
|
625 | 2598 |
"Modified: / 9.11.1999 / 17:06:03 / cg" |
618 | 2599 |
! |
2600 |
||
2151 | 2601 |
shouldBeSkippedInDebuggersWalkBack |
2602 |
||
2603 |
^false |
|
2604 |
||
2605 |
"Created: / 30-11-2010 / 15:35:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2606 |
! |
|
2607 |
||
18 | 2608 |
who |
2609 |
"return the class and selector of where I am defined in." |
|
2610 |
||
64 | 2611 |
|sel| |
18 | 2612 |
|
252 | 2613 |
javaClass isNil ifTrue:[^ nil]. |
378 | 2614 |
sel := selector. |
2615 |
"/ sel := javaClass methodDictionary keyAtValue:self ifAbsent:nil. |
|
64 | 2616 |
sel isNil ifTrue:[^ nil]. |
129 | 2617 |
^ Method::MethodWhoInfo class:javaClass selector:sel. |
378 | 2618 |
|
2619 |
"Modified: / 16.10.1998 / 13:42:10 / cg" |
|
5 | 2620 |
! ! |
2621 |
||
154 | 2622 |
!JavaMethod methodsFor:'signature parsing'! |
2623 |
||
255 | 2624 |
XXXspecWithArgsFromSignature:aSignature withName:name in:aPackage |
154 | 2625 |
"given a signature, return a spec with args" |
2626 |
||
2627 |
|s argSpec retvalSpec| |
|
2628 |
||
2629 |
s := aSignature readStream. |
|
2630 |
s next ~~ $( ifTrue:[self halt. ^ name]. |
|
2631 |
||
2632 |
argSpec := self argSpecWithArgsFromStream:s in:aPackage. |
|
2633 |
||
2634 |
s next ~~ $) ifTrue:[self halt. ^ name]. |
|
2635 |
||
2636 |
retvalSpec := self retvalSpecFromStream:s in:aPackage. |
|
2637 |
||
2638 |
^ retvalSpec , ' ' , name , ' (' , argSpec , ')' |
|
2639 |
||
2640 |
" |
|
2641 |
JavaMethod specFromSignature:'(LObject;)V' withName:'foo' |
|
2642 |
JavaMethod specFromSignature:'(BB)S' withName:'foo' |
|
2643 |
" |
|
2644 |
||
255 | 2645 |
"Created: / 8.1.1998 / 19:17:58 / cg" |
154 | 2646 |
! ! |
2647 |
||
2151 | 2648 |
!JavaMethod methodsFor:'testing'! |
2649 |
||
2498
e6a3d5fa8bef
Added JavaMethod>>isMethodWithBreakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2476
diff
changeset
|
2650 |
isMethodWithBreakpoints |
e6a3d5fa8bef
Added JavaMethod>>isMethodWithBreakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2476
diff
changeset
|
2651 |
^self isBreakpointed |
e6a3d5fa8bef
Added JavaMethod>>isMethodWithBreakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2476
diff
changeset
|
2652 |
or:[(ConfigurableFeatures includesFeature: #VMBreakpointSupport) |
e6a3d5fa8bef
Added JavaMethod>>isMethodWithBreakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2476
diff
changeset
|
2653 |
and:[self breakpointTable notEmptyOrNil]] |
e6a3d5fa8bef
Added JavaMethod>>isMethodWithBreakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2476
diff
changeset
|
2654 |
|
e6a3d5fa8bef
Added JavaMethod>>isMethodWithBreakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2476
diff
changeset
|
2655 |
"Created: / 11-04-2013 / 14:50:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
e6a3d5fa8bef
Added JavaMethod>>isMethodWithBreakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2476
diff
changeset
|
2656 |
! |
e6a3d5fa8bef
Added JavaMethod>>isMethodWithBreakpoints.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2476
diff
changeset
|
2657 |
|
2151 | 2658 |
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
|
2659 |
^ (accessFlags bitAnd:A_SYNTHETIC) ~~ 0 |
2151 | 2660 |
|
2661 |
"Created: / 18-10-2010 / 19:09:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2662 |
! ! |
|
2663 |
||
129 | 2664 |
!JavaMethod class methodsFor:'documentation'! |
2 | 2665 |
|
2666 |
version |
|
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
2667 |
^ '$Header: /cvs/stx/stx/libjava/JavaMethod.st,v 1.112 2013-02-25 11:15:31 vrany Exp $' |
2145 | 2668 |
! |
2669 |
||
2670 |
version_CVS |
|
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
2671 |
^ '$Header: /cvs/stx/stx/libjava/JavaMethod.st,v 1.112 2013-02-25 11:15:31 vrany 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
|
2672 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2673 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2674 |
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
|
2675 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2204
diff
changeset
|
2676 |
^ '$Changeset: <not expanded> $' |
2151 | 2677 |
! |
2678 |
||
2679 |
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
|
2680 |
^ '§Id§' |
2 | 2681 |
! ! |
2107 | 2682 |
|
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
|
2683 |
|
2086 | 2684 |
JavaMethod initialize! |