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