2
|
1 |
CompiledCode subclass:#JavaMethod
|
72
|
2 |
instanceVariableNames:'javaByteCode numArgs numLocals returnType accessFlags name
|
83
|
3 |
signature exceptionHandlerTable exceptionTable lineNumberTable
|
|
4 |
localVariableTable javaClass numStack'
|
8
|
5 |
classVariableNames:'SignatureTypeCodes'
|
2
|
6 |
poolDictionaries:''
|
|
7 |
category:'Java-Classes'
|
|
8 |
!
|
|
9 |
|
|
10 |
|
64
|
11 |
!JavaMethod class methodsFor:'initialization'!
|
8
|
12 |
|
|
13 |
initialize
|
|
14 |
SignatureTypeCodes := IdentityDictionary new.
|
|
15 |
SignatureTypeCodes at:$B put:#byte.
|
|
16 |
SignatureTypeCodes at:$C put:#char.
|
|
17 |
SignatureTypeCodes at:$D put:#double.
|
|
18 |
SignatureTypeCodes at:$F put:#float.
|
|
19 |
SignatureTypeCodes at:$I put:#int.
|
|
20 |
SignatureTypeCodes at:$J put:#long.
|
|
21 |
SignatureTypeCodes at:$S put:#'unsigned short'.
|
|
22 |
SignatureTypeCodes at:$Z put:#boolean.
|
|
23 |
SignatureTypeCodes at:$L put:#object.
|
|
24 |
SignatureTypeCodes at:$[ put:#array.
|
|
25 |
|
|
26 |
"
|
|
27 |
JavaMethod initialize
|
|
28 |
"
|
|
29 |
! !
|
|
30 |
|
64
|
31 |
!JavaMethod class methodsFor:'signature parsing'!
|
5
|
32 |
|
29
|
33 |
argSigArrayFromSignature:aSignature
|
|
34 |
"given a signature, return a specArray for the arguments"
|
|
35 |
|
|
36 |
|s argSpec retvalSpec|
|
|
37 |
|
|
38 |
s := aSignature readStream.
|
|
39 |
s next ~~ $( ifTrue:[self halt. ^ name].
|
|
40 |
|
|
41 |
^ self argSigArrayFromStream:s.
|
|
42 |
|
|
43 |
"
|
|
44 |
JavaMethod argSigArrayFromSignature:'(LObject;)V'
|
|
45 |
JavaMethod argSigArrayFromSignature:'(BB)S'
|
|
46 |
JavaMethod argSigArrayFromSignature:'(LObject;LObject;II)V'
|
|
47 |
"
|
|
48 |
!
|
|
49 |
|
|
50 |
argSigArrayFromStream:s
|
|
51 |
"parse an argSpec, return an array of specs - see java doc"
|
|
52 |
|
|
53 |
|argSpec spec|
|
|
54 |
|
|
55 |
spec := #().
|
|
56 |
[s atEnd or:[s peek == $)]] whileFalse:[
|
|
57 |
"/ s peek == Character space ifTrue:[
|
|
58 |
"/ s next
|
|
59 |
"/ ] ifFalse:[
|
|
60 |
argSpec := self fieldTypeFromStream:s.
|
|
61 |
spec := spec copyWith:argSpec.
|
|
62 |
"/ ]
|
|
63 |
].
|
|
64 |
^ spec
|
|
65 |
|
|
66 |
|
|
67 |
!
|
|
68 |
|
8
|
69 |
argSpecFromStream:s
|
|
70 |
"parse an argSpec - see java doc"
|
|
71 |
|
|
72 |
|argSpec spec|
|
|
73 |
|
|
74 |
spec := ''.
|
|
75 |
[s atEnd or:[s peek == $)]] whileFalse:[
|
27
|
76 |
"/ s peek == Character space ifTrue:[
|
|
77 |
"/ s next
|
|
78 |
"/ ] ifFalse:[
|
|
79 |
argSpec := self fieldTypeFromStream:s.
|
|
80 |
spec size ~~ 0 ifTrue:[
|
|
81 |
spec := spec , ' '
|
|
82 |
].
|
|
83 |
spec := spec , argSpec.
|
|
84 |
"/ ]
|
8
|
85 |
].
|
|
86 |
^ spec
|
|
87 |
|
5
|
88 |
|
|
89 |
!
|
|
90 |
|
8
|
91 |
fieldTypeFromStream:s
|
|
92 |
"parse a fieldTypeSpec - see java doc"
|
|
93 |
|
10
|
94 |
|typeChar typeSym spec elType size className|
|
8
|
95 |
|
|
96 |
typeChar := s next.
|
|
97 |
|
|
98 |
typeSym := SignatureTypeCodes at:typeChar ifAbsent:#unknown.
|
|
99 |
|
|
100 |
typeSym == #unknown ifTrue:[
|
|
101 |
^ typeSym
|
|
102 |
].
|
|
103 |
typeSym == #object ifTrue:[
|
10
|
104 |
className := s upTo:$;.
|
|
105 |
"/ strip off default
|
|
106 |
(className startsWith:'java/lang/') ifTrue:[
|
|
107 |
^ className copyFrom:11
|
|
108 |
].
|
|
109 |
^ className
|
8
|
110 |
].
|
|
111 |
typeSym == #array ifTrue:[
|
|
112 |
s peek isDigit ifTrue:[
|
|
113 |
size := Integer readFrom:s.
|
|
114 |
elType := self fieldTypeFromStream:s.
|
|
115 |
^ elType , '[' , size printString , ']'
|
|
116 |
].
|
|
117 |
elType := self fieldTypeFromStream:s.
|
|
118 |
^ elType , '[]'
|
|
119 |
].
|
|
120 |
^ typeSym
|
|
121 |
!
|
|
122 |
|
27
|
123 |
numArgsFromSignature:aSignature
|
|
124 |
"given a signature, return the number of args"
|
|
125 |
|
|
126 |
|s argSpec|
|
|
127 |
|
|
128 |
s := aSignature readStream.
|
|
129 |
s next ~~ $( ifTrue:[self halt. ^ name].
|
|
130 |
|
|
131 |
^ self numArgsFromStream:s.
|
|
132 |
|
|
133 |
"
|
|
134 |
JavaMethod numArgsFromSignature:'(LObject;)V'
|
|
135 |
JavaMethod numArgsFromSignature:'(BB)S'
|
|
136 |
JavaMethod numArgsFromSignature:'()V'
|
|
137 |
"
|
|
138 |
!
|
|
139 |
|
|
140 |
numArgsFromStream:s
|
|
141 |
"parse an argSpec - see java doc"
|
|
142 |
|
55
|
143 |
|argSpec n t|
|
27
|
144 |
|
|
145 |
n := 0.
|
|
146 |
[s atEnd or:[s peek == $)]] whileFalse:[
|
55
|
147 |
t := self fieldTypeFromStream:s.
|
|
148 |
"/
|
|
149 |
"/ some args count as 2
|
|
150 |
"/
|
|
151 |
t == #long ifTrue:[
|
|
152 |
n := n + 2.
|
|
153 |
] ifFalse:[
|
|
154 |
t == #double ifTrue:[
|
|
155 |
n := n + 2
|
|
156 |
] ifFalse:[
|
|
157 |
n := n + 1.
|
|
158 |
]
|
|
159 |
]
|
27
|
160 |
].
|
|
161 |
^ n
|
|
162 |
!
|
|
163 |
|
29
|
164 |
retValSpecFromSignature:aSignature
|
|
165 |
"given a signature, return a spec"
|
|
166 |
|
|
167 |
|s argSpec retvalSpec|
|
|
168 |
|
|
169 |
s := aSignature readStream.
|
|
170 |
s next ~~ $( ifTrue:[self halt. ^ name].
|
|
171 |
|
|
172 |
argSpec := self argSpecFromStream:s.
|
|
173 |
|
|
174 |
s next ~~ $) ifTrue:[self halt. ^ name].
|
|
175 |
|
|
176 |
retvalSpec := self retvalSpecFromStream:s.
|
|
177 |
|
|
178 |
^ retvalSpec
|
|
179 |
|
|
180 |
"
|
|
181 |
JavaMethod retValSpecFromSignature:'(LObject;)V'
|
|
182 |
JavaMethod retValSpecFromSignature:'(BB)S'
|
|
183 |
"
|
|
184 |
!
|
|
185 |
|
72
|
186 |
returnTypeFromSignature:aSignature
|
|
187 |
"given a signature, return its type as a string"
|
27
|
188 |
|
80
|
189 |
|s c argSpec retvalSpec|
|
27
|
190 |
|
|
191 |
s := aSignature readStream.
|
80
|
192 |
(c := s peek) ~~ $( ifTrue:[
|
|
193 |
c == $' ifTrue:[
|
|
194 |
[s peek ~= $'] whileTrue:[s next].
|
|
195 |
s next.
|
|
196 |
^ (self retvalSpecFromStream:s)
|
|
197 |
].
|
|
198 |
^ (self retvalSpecFromStream:s)
|
|
199 |
].
|
27
|
200 |
|
80
|
201 |
s next.
|
27
|
202 |
self argSpecFromStream:s.
|
80
|
203 |
s next ~~ $) ifTrue:[self halt. ^ nil].
|
27
|
204 |
|
72
|
205 |
^ (self retvalSpecFromStream:s)
|
|
206 |
|
|
207 |
"
|
|
208 |
JavaMethod returnTypeFromSignature:'(LObject;)V'
|
|
209 |
JavaMethod returnTypeFromSignature:'(BB)S'
|
|
210 |
JavaMethod returnTypeFromSignature:'()J'
|
80
|
211 |
JavaMethod returnTypeFromSignature:'''first''J'
|
72
|
212 |
"
|
|
213 |
!
|
|
214 |
|
|
215 |
returnsVoidFromSignature:aSignature
|
|
216 |
"given a signature, return true if it returns void, false if not"
|
|
217 |
|
83
|
218 |
^ (self typeFromSignature:aSignature) = 'void'
|
27
|
219 |
|
|
220 |
"
|
|
221 |
JavaMethod returnsVoidFromSignature:'(LObject;)V'
|
|
222 |
JavaMethod returnsVoidFromSignature:'(BB)S'
|
|
223 |
"
|
|
224 |
!
|
|
225 |
|
8
|
226 |
retvalSpecFromStream:s
|
|
227 |
"parse a retvalSpec - see java doc"
|
|
228 |
|
|
229 |
|argSpec spec|
|
|
230 |
|
72
|
231 |
s atEnd ifTrue:[self halt. ^ #void].
|
|
232 |
s peek == $V ifTrue:[^ #void].
|
8
|
233 |
^ self fieldTypeFromStream:s
|
10
|
234 |
|
|
235 |
!
|
|
236 |
|
|
237 |
specFromSignature:aSignature withName:name
|
|
238 |
"given a signature, return a spec"
|
|
239 |
|
|
240 |
|s argSpec retvalSpec|
|
|
241 |
|
|
242 |
s := aSignature readStream.
|
|
243 |
s next ~~ $( ifTrue:[self halt. ^ name].
|
|
244 |
|
|
245 |
argSpec := self argSpecFromStream:s.
|
|
246 |
|
|
247 |
s next ~~ $) ifTrue:[self halt. ^ name].
|
|
248 |
|
|
249 |
retvalSpec := self retvalSpecFromStream:s.
|
|
250 |
|
|
251 |
^ retvalSpec , ' ' , name , ' (' , argSpec , ')'
|
|
252 |
|
|
253 |
"
|
|
254 |
JavaMethod specFromSignature:'(LObject;)V' withName:'foo'
|
27
|
255 |
JavaMethod specFromSignature:'(BB)S' withName:'foo'
|
10
|
256 |
"
|
83
|
257 |
!
|
|
258 |
|
|
259 |
typeFromSignature:aSignature
|
|
260 |
"given a signature, return its type as a string"
|
|
261 |
|
|
262 |
|s c argSpec retvalSpec|
|
|
263 |
|
|
264 |
s := aSignature readStream.
|
|
265 |
(c := s peek) ~~ $( ifTrue:[
|
|
266 |
c == $' ifTrue:[
|
|
267 |
s next.
|
|
268 |
[s peek ~= $'] whileTrue:[s next].
|
|
269 |
s next.
|
|
270 |
^ (self retvalSpecFromStream:s)
|
|
271 |
].
|
|
272 |
^ (self retvalSpecFromStream:s)
|
|
273 |
].
|
|
274 |
|
|
275 |
s next.
|
|
276 |
self argSpecFromStream:s.
|
|
277 |
s next ~~ $) ifTrue:[self halt. ^ nil].
|
|
278 |
|
|
279 |
^ (self retvalSpecFromStream:s)
|
|
280 |
|
|
281 |
"
|
|
282 |
JavaMethod typeFromSignature:'(LObject;)V'
|
|
283 |
JavaMethod typeFromSignature:'(BB)S'
|
|
284 |
JavaMethod typeFromSignature:'()J'
|
|
285 |
JavaMethod typeFromSignature:'J'
|
|
286 |
JavaMethod typeFromSignature:'''first''J'
|
|
287 |
"
|
10
|
288 |
! !
|
|
289 |
|
|
290 |
!JavaMethod methodsFor:'accessing'!
|
|
291 |
|
29
|
292 |
argSignature
|
|
293 |
^ self class argSigArrayFromSignature:signature
|
|
294 |
!
|
|
295 |
|
10
|
296 |
constantPool
|
|
297 |
^ javaClass constantPool
|
|
298 |
|
|
299 |
"Modified: 16.4.1996 / 12:36:27 / cg"
|
|
300 |
"Created: 16.4.1996 / 15:28:50 / cg"
|
|
301 |
!
|
|
302 |
|
75
|
303 |
decompiledSource
|
|
304 |
|s|
|
|
305 |
|
|
306 |
s := '' writeStream.
|
|
307 |
self decompileTo:s.
|
|
308 |
^ s contents
|
|
309 |
!
|
|
310 |
|
83
|
311 |
exceptionTable
|
|
312 |
^ exceptionTable
|
|
313 |
|
|
314 |
"Created: 16.4.1996 / 12:34:04 / cg"
|
|
315 |
"Modified: 16.4.1996 / 12:49:06 / cg"
|
|
316 |
!
|
|
317 |
|
10
|
318 |
javaByteCode
|
|
319 |
^ javaByteCode
|
|
320 |
|
|
321 |
"Modified: 16.4.1996 / 12:36:27 / cg"
|
|
322 |
"Created: 16.4.1996 / 14:55:44 / cg"
|
8
|
323 |
!
|
|
324 |
|
27
|
325 |
javaClass
|
|
326 |
^ javaClass
|
|
327 |
|
|
328 |
"Modified: 16.4.1996 / 12:36:27 / cg"
|
|
329 |
"Created: 16.4.1996 / 14:55:44 / cg"
|
|
330 |
!
|
|
331 |
|
50
|
332 |
lineNumberTable
|
|
333 |
^ lineNumberTable
|
|
334 |
|
|
335 |
"Created: 16.4.1996 / 12:34:04 / cg"
|
|
336 |
"Modified: 16.4.1996 / 12:49:06 / cg"
|
|
337 |
!
|
|
338 |
|
85
|
339 |
localVariableTable
|
|
340 |
^ localVariableTable
|
|
341 |
|
|
342 |
"
|
|
343 |
JavaMethod allInstancesDo:[:m| m localVariableTable notNil ifTrue:[self halt]]
|
|
344 |
"
|
|
345 |
!
|
|
346 |
|
31
|
347 |
methodArgAndVarNames
|
|
348 |
^ ((1 to:self numArgs) collect:[:i | 'arg' , i printString])
|
|
349 |
,
|
|
350 |
((1 to:self numVars) collect:[:i | 'local' , i printString])
|
|
351 |
|
|
352 |
!
|
|
353 |
|
|
354 |
methodArgNames
|
|
355 |
^ (1 to:self numArgs) collect:[:i | 'arg' , i printString]
|
|
356 |
!
|
|
357 |
|
29
|
358 |
name
|
|
359 |
^ name
|
|
360 |
|
|
361 |
"Created: 16.4.1996 / 11:34:22 / cg"
|
|
362 |
!
|
|
363 |
|
27
|
364 |
numArgs
|
29
|
365 |
numArgs isNil ifTrue:[^ 0].
|
27
|
366 |
^ numArgs
|
|
367 |
!
|
|
368 |
|
29
|
369 |
numVars
|
|
370 |
numLocals isNil ifTrue:[^ 0].
|
|
371 |
^ numLocals
|
|
372 |
!
|
|
373 |
|
27
|
374 |
numberOfMethodArgs:n
|
|
375 |
numArgs := n
|
|
376 |
!
|
|
377 |
|
29
|
378 |
retValSignature
|
|
379 |
^ self class retValSpecFromSignature:signature
|
|
380 |
|
|
381 |
!
|
|
382 |
|
72
|
383 |
returnsLong
|
|
384 |
^ returnType == #long
|
|
385 |
!
|
|
386 |
|
27
|
387 |
returnsVoid
|
72
|
388 |
^ returnType == #void
|
27
|
389 |
!
|
|
390 |
|
5
|
391 |
setAccessFlags:flags
|
|
392 |
accessFlags := flags.
|
|
393 |
|
|
394 |
"Created: 16.4.1996 / 11:34:14 / cg"
|
|
395 |
!
|
|
396 |
|
29
|
397 |
setCode:codeBytes maxStack:max_stack maxLocals:max_locals u1:unknown1 u2:unknown2
|
|
398 |
javaByteCode := codeBytes.
|
|
399 |
numStack := max_stack.
|
|
400 |
numLocals := max_locals.
|
5
|
401 |
|
43
|
402 |
"/ self displayString printNL.
|
|
403 |
"/ ' nStack: ' print. numStack print.
|
|
404 |
"/ ' nLocal: ' print. numLocals print.
|
|
405 |
"/ ' u1: ' print. unknown1 print.
|
|
406 |
"/ ' u2: ' print. unknown2 printNL.
|
29
|
407 |
|
5
|
408 |
!
|
|
409 |
|
83
|
410 |
setExceptionHandlerTable:anArray
|
|
411 |
exceptionHandlerTable := anArray.
|
|
412 |
|
|
413 |
"Created: 16.4.1996 / 12:34:04 / cg"
|
|
414 |
!
|
|
415 |
|
5
|
416 |
setExceptionTable:anArray
|
|
417 |
exceptionTable := anArray.
|
|
418 |
|
|
419 |
"Created: 16.4.1996 / 12:34:04 / cg"
|
|
420 |
!
|
|
421 |
|
|
422 |
setJavaClass:aJavaClass
|
|
423 |
javaClass := aJavaClass
|
|
424 |
|
|
425 |
"Modified: 16.4.1996 / 12:36:27 / cg"
|
|
426 |
"Created: 16.4.1996 / 15:28:15 / cg"
|
|
427 |
!
|
|
428 |
|
|
429 |
setLineNumberTable:anArray
|
|
430 |
lineNumberTable := anArray.
|
|
431 |
|
|
432 |
"Created: 16.4.1996 / 12:34:04 / cg"
|
|
433 |
"Modified: 16.4.1996 / 12:49:06 / cg"
|
|
434 |
!
|
|
435 |
|
50
|
436 |
setLocalVariableTable:anArray
|
83
|
437 |
localVariableTable := anArray.
|
50
|
438 |
!
|
|
439 |
|
5
|
440 |
setName:aString
|
29
|
441 |
name := aString asSymbol.
|
5
|
442 |
|
|
443 |
"Created: 16.4.1996 / 11:34:22 / cg"
|
|
444 |
!
|
|
445 |
|
|
446 |
setSignature:aString
|
29
|
447 |
signature := aString asSymbol.
|
|
448 |
|
27
|
449 |
self numberOfMethodArgs:(self class numArgsFromSignature:aString).
|
83
|
450 |
returnType := self class typeFromSignature:aString.
|
27
|
451 |
|
|
452 |
"Created: 16.4.1996 / 11:34:29 / cg"
|
|
453 |
!
|
|
454 |
|
|
455 |
signature
|
|
456 |
^ signature
|
5
|
457 |
|
|
458 |
"Created: 16.4.1996 / 11:34:29 / cg"
|
31
|
459 |
!
|
|
460 |
|
|
461 |
source
|
75
|
462 |
|classSource|
|
31
|
463 |
|
75
|
464 |
lineNumberTable notNil ifTrue:[
|
|
465 |
classSource := javaClass source.
|
|
466 |
classSource notNil ifTrue:[^ classSource].
|
|
467 |
].
|
|
468 |
|
|
469 |
^ self decompiledSource
|
31
|
470 |
!
|
|
471 |
|
|
472 |
sourceFilename
|
|
473 |
^ javaClass sourceFile
|
8
|
474 |
! !
|
|
475 |
|
18
|
476 |
!JavaMethod methodsFor:'decompiling'!
|
|
477 |
|
|
478 |
decompileTo:aStream
|
|
479 |
JavaDecompiler decompile:self to:aStream.
|
|
480 |
^ true
|
|
481 |
|
|
482 |
|
|
483 |
! !
|
|
484 |
|
8
|
485 |
!JavaMethod methodsFor:'printing & storing'!
|
|
486 |
|
29
|
487 |
displayString
|
|
488 |
^ 'JavaMethod(' , javaClass name , '::' , self signatureName , ')'
|
|
489 |
!
|
|
490 |
|
8
|
491 |
printStringForBrowserWithSelector:selector
|
43
|
492 |
"/ self isStatic ifTrue:[
|
|
493 |
"/ ^ 'static ' , self signatureName
|
|
494 |
"/ ].
|
80
|
495 |
self isBreakpointed ifTrue:[
|
|
496 |
^ '!! ' , self signatureName
|
|
497 |
].
|
8
|
498 |
^ self signatureName
|
10
|
499 |
!
|
|
500 |
|
|
501 |
signatureName
|
|
502 |
"return a string to be used when browsing"
|
|
503 |
|
|
504 |
^ self class specFromSignature:signature withName:name
|
8
|
505 |
! !
|
|
506 |
|
|
507 |
!JavaMethod methodsFor:'queries'!
|
|
508 |
|
48
|
509 |
hasHandlerFor:anException at:pc
|
83
|
510 |
exceptionHandlerTable isNil ifTrue:[^ false].
|
|
511 |
exceptionHandlerTable do:[:entry |
|
48
|
512 |
|hpc|
|
|
513 |
|
|
514 |
hpc := entry handlerPCFor:anException at:pc in:self.
|
|
515 |
hpc notNil ifTrue:[
|
|
516 |
self halt
|
|
517 |
].
|
|
518 |
].
|
|
519 |
|
31
|
520 |
^ false
|
|
521 |
!
|
|
522 |
|
19
|
523 |
isAbstract
|
|
524 |
^ (accessFlags bitAnd:16r0400) ~~ 0
|
|
525 |
!
|
|
526 |
|
80
|
527 |
isBreakpointed
|
|
528 |
^ false
|
|
529 |
!
|
|
530 |
|
19
|
531 |
isFinal
|
|
532 |
^ (accessFlags bitAnd:16r0010) ~~ 0
|
|
533 |
!
|
|
534 |
|
|
535 |
isNative
|
|
536 |
^ (accessFlags bitAnd:16r0100) ~~ 0
|
|
537 |
!
|
|
538 |
|
|
539 |
isPrivate
|
|
540 |
^ (accessFlags bitAnd:16r0002) ~~ 0
|
|
541 |
|
|
542 |
!
|
|
543 |
|
|
544 |
isProtected
|
|
545 |
^ (accessFlags bitAnd:16r0004) ~~ 0
|
|
546 |
!
|
|
547 |
|
|
548 |
isPublic
|
|
549 |
^ (accessFlags bitAnd:16r0001) ~~ 0
|
|
550 |
|
|
551 |
!
|
|
552 |
|
|
553 |
isStatic
|
|
554 |
^ (accessFlags bitAnd:16r0008) ~~ 0
|
|
555 |
!
|
|
556 |
|
|
557 |
isSynchronized
|
|
558 |
^ (accessFlags bitAnd:16r0020) ~~ 0
|
18
|
559 |
!
|
|
560 |
|
8
|
561 |
isUnloaded
|
|
562 |
^ false
|
18
|
563 |
!
|
|
564 |
|
31
|
565 |
lineNumberForPC:pc
|
75
|
566 |
|last num text classSource|
|
31
|
567 |
|
|
568 |
num := nil.
|
|
569 |
|
46
|
570 |
lineNumberTable notNil ifTrue:[
|
75
|
571 |
classSource := javaClass source.
|
|
572 |
classSource notNil ifTrue:[
|
|
573 |
lineNumberTable do:[:assoc |
|
|
574 |
assoc key >= pc ifTrue:[
|
|
575 |
assoc key == pc ifTrue:[^ assoc value].
|
|
576 |
last isNil ifTrue:[^ assoc value].
|
|
577 |
^ last value.
|
|
578 |
].
|
|
579 |
last := assoc.
|
|
580 |
].
|
|
581 |
^ lineNumberTable first value
|
|
582 |
].
|
46
|
583 |
].
|
31
|
584 |
|
46
|
585 |
"/ decompile and look which line the pc falls into
|
75
|
586 |
text := self decompiledSource asCollectionOfLines.
|
31
|
587 |
|
46
|
588 |
text keysAndValuesDo:[:lineNr :line |
|
|
589 |
|nr|
|
|
590 |
|
83
|
591 |
(line startsWith:' ') ifFalse:[
|
|
592 |
nr := Integer readFrom:line onError:0.
|
|
593 |
nr >= pc ifTrue:[
|
|
594 |
^ lineNr
|
|
595 |
]
|
46
|
596 |
]
|
31
|
597 |
].
|
|
598 |
^ num
|
|
599 |
!
|
|
600 |
|
18
|
601 |
who
|
|
602 |
"return the class and selector of where I am defined in."
|
|
603 |
|
64
|
604 |
|sel|
|
18
|
605 |
|
64
|
606 |
sel := javaClass methodDictionary keyAtValue:self ifAbsent:nil.
|
|
607 |
sel isNil ifTrue:[^ nil].
|
|
608 |
^ Array with:javaClass with:sel.
|
5
|
609 |
! !
|
|
610 |
|
64
|
611 |
!JavaMethod class methodsFor:'documentation'!
|
2
|
612 |
|
|
613 |
version
|
85
|
614 |
^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaMethod.st,v 1.20 1996/06/27 16:30:06 cg Exp $'
|
2
|
615 |
! !
|
8
|
616 |
JavaMethod initialize!
|