author | vranyj1 |
Wed, 07 Nov 2012 23:58:38 +0000 | |
branch | jk_new_structure |
changeset 1812 | 7b8fcf7d0562 |
parent 1796 | 467c3d06c67b |
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 |
JavaBehavior subclass:#JavaClass |
|
1368 | 24 |
instanceVariableNames:'classLoader fullName sourceFile sourceString binaryFilePath |
1793 | 25 |
fields staticFields annotations protectionDomain signatureJ' |
752 | 26 |
classVariableNames:'ArgumentConversionErrorSignal OrderOfClassInits' |
1523
f5ffdad83ab9
Access to ACC_* and ACX_* constants unified. The only definition is in JavaConstants
vranyj1
parents:
1511
diff
changeset
|
27 |
poolDictionaries:'JavaConstants' |
752 | 28 |
category:'Languages-Java-Classes' |
29 |
! |
|
30 |
||
31 |
!JavaClass class methodsFor:'documentation'! |
|
32 |
||
33 |
copyright |
|
34 |
" |
|
877 | 35 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
1152 | 36 |
|
1155 | 37 |
New code and modifications done at SWING Research Group [1]: |
1152 | 38 |
|
877 | 39 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
40 |
SWING Research Group, Czech Technical University in Prague |
|
41 |
||
752 | 42 |
This software is furnished under a license and may be used |
43 |
only in accordance with the terms of that license and with the |
|
44 |
inclusion of the above copyright notice. This software may not |
|
45 |
be provided or otherwise made available to, or used by, any |
|
46 |
other person. No title to or ownership of the software is |
|
47 |
hereby transferred. |
|
877 | 48 |
|
1155 | 49 |
[1] Code written at SWING Research Group contains a signature |
50 |
of one of the above copright owners. For exact set of such code, |
|
51 |
see the differences between this version and version stx:libjava |
|
1152 | 52 |
as of 1.9.2010 |
877 | 53 |
|
752 | 54 |
" |
55 |
! |
|
56 |
||
57 |
examples |
|
58 |
" |
|
59 |
(Java at:'java.util.Stack') new inspect |
|
60 |
(Java at:'java.util.Vector') new inspect |
|
61 |
" |
|
62 |
! ! |
|
63 |
||
64 |
!JavaClass class methodsFor:'instance creation'! |
|
65 |
||
66 |
fullName:aString |
|
67 |
self shouldNotImplement. |
|
68 |
^ self new flags:0; setFullName:aString |
|
69 |
||
70 |
! |
|
71 |
||
72 |
fullName:aString numStatic:nStatic |
|
1453 | 73 |
|meta cls classLoader | |
752 | 74 |
|
75 |
"/ check for a JAVA nameSpace to exist |
|
76 |
JAVA isNil ifTrue:[ |
|
1390
4a623c4ec05f
- improvements in JavaPackage (towards nicer interop)
vranyj1
parents:
1385
diff
changeset
|
77 |
JavaPackage name:'JAVA' |
752 | 78 |
]. |
79 |
||
1368 | 80 |
classLoader := JavaClassReader classLoaderQuerySignal query. |
81 |
||
752 | 82 |
"create the metaclass first" |
83 |
||
1453 | 84 |
meta := JavaMetaclass new. |
1372
dea574a1b6b3
Some initial class reloading support. Not yet finished, just sketched out.
vranyj1
parents:
1368
diff
changeset
|
85 |
meta setSuperclass:self. |
1368 | 86 |
meta instSize:(meta superclass instSize + nStatic). |
752 | 87 |
"/ meta setName:(aString , 'class') asSymbol. |
88 |
"/ meta setClassVariableString:''. |
|
89 |
meta flags:(meta flags bitOr:Behavior flagJavaClass). |
|
90 |
"/ meta setSuperclass:JavaObject class. |
|
91 |
||
92 |
"then let the new meta create the class" |
|
93 |
cls := meta new. |
|
94 |
cls setSuperclass:JavaObject. |
|
95 |
cls instSize:0. |
|
96 |
cls setName:('JAVA::' , aString). |
|
97 |
cls flags:0. |
|
98 |
||
99 |
cls setAccessFlags:0. |
|
100 |
"/ cls setClassVariableString:''. |
|
101 |
cls setInstanceVariableString:''. |
|
102 |
cls setCategory:#java. |
|
103 |
cls setFullName:aString. |
|
104 |
||
105 |
^ cls |
|
106 |
||
107 |
"Created: / 15-04-1996 / 15:52:55 / cg" |
|
108 |
"Modified: / 03-01-1998 / 22:32:25 / cg" |
|
1453 | 109 |
"Modified: / 04-04-2012 / 09:36:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 110 |
! |
111 |
||
112 |
name:aString |
|
113 |
self shouldNotImplement |
|
114 |
||
115 |
"Created: 15.4.1996 / 15:52:55 / cg" |
|
116 |
! ! |
|
117 |
||
1001 | 118 |
!JavaClass class methodsFor:'boxing-unboxing'! |
119 |
||
1006 | 120 |
box: stArgumentsCollection to: typesCollection |
121 |
" box smalltalk arguments collection to Java arguments " |
|
122 |
^ stArgumentsCollection with: typesCollection collect: [ :stObject :javaType | |
|
123 |
(JavaTypeBox typeBoxForJava: javaType) box: stObject. |
|
124 |
] |
|
125 |
||
126 |
"Created: / 25-09-2011 / 20:20:35 / Jan Kurs <kursjan@fit.cvut.cz>" |
|
127 |
! |
|
128 |
||
1001 | 129 |
unbox:jObj returnType: returnType |
130 |
||
131 |
"JV@2011-02-04" |
|
132 |
"Hack for primitive types" |
|
133 |
"/ JK: it is hack, but it is fast :) |
|
134 |
(JavaDescriptor baseTypesByTypeName keys includes: returnType) ifTrue:[^jObj]. |
|
135 |
||
1006 | 136 |
^ (JavaTypeBox typeBoxForJava: returnType) unbox: jObj. |
1001 | 137 |
|
138 |
"Created: / 30-08-2011 / 22:13:41 / Jan Kurs <kursjan@fit.cvut.cz>" |
|
139 |
! ! |
|
140 |
||
752 | 141 |
!JavaClass class methodsFor:'class initialization'! |
142 |
||
143 |
initialize |
|
144 |
||
145 |
ArgumentConversionErrorSignal := Signal new notifierString:'argument conversion error'. |
|
146 |
||
147 |
"Created: / 20-10-2010 / 11:11:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
148 |
! ! |
|
149 |
||
150 |
!JavaClass class methodsFor:'method lookup'! |
|
151 |
||
152 |
canConvertArgsToJava:argArray asSpecifiedIn:argSigSpecArray |
|
153 |
"given a smalltalk argument array, return true, if these can be converted to java objects as appropriate." |
|
154 |
||
155 |
argArray |
|
156 |
with:argSigSpecArray |
|
157 |
do:[:arg :type | |
|
158 |
self |
|
159 |
convertToJava:arg |
|
160 |
type:type |
|
161 |
ifFail:[:msg :default| ^ false]]. |
|
162 |
^ true |
|
163 |
||
164 |
"Created: / 5.11.1998 / 18:25:05 / cg" |
|
165 |
"Modified: / 6.11.1998 / 00:45:58 / cg" |
|
166 |
! |
|
167 |
||
168 |
convertArgsToJava:argArray asSpecifiedIn:argSigSpecArray numArgs:na |
|
169 |
"given a smalltalk argument array, convert to java objects as appropriate. |
|
170 |
Currently, only Strings and booleans are converted." |
|
171 |
||
172 |
|sigIndex newArgIndex newArgArray| |
|
173 |
||
174 |
sigIndex := newArgIndex := 1. |
|
175 |
||
176 |
newArgArray := Array new:na. |
|
177 |
argArray do:[:arg | |
|
178 |
|type newArg| |
|
179 |
||
180 |
type := argSigSpecArray at:sigIndex. |
|
181 |
sigIndex := sigIndex + 1. |
|
182 |
newArg := self convertToJava:arg type:type. |
|
183 |
newArgArray at:newArgIndex put:newArg. |
|
184 |
newArgIndex := newArgIndex + 1. |
|
185 |
(type == #long or:[type == #double]) ifTrue:[ |
|
186 |
newArgIndex > na ifTrue:[ |
|
187 |
self halt:'should not happen' |
|
188 |
]. |
|
189 |
newArgArray at:newArgIndex put:nil. |
|
190 |
newArgIndex := newArgIndex + 1. |
|
191 |
] |
|
192 |
]. |
|
193 |
||
194 |
^ newArgArray |
|
195 |
||
196 |
"Created: / 5.11.1998 / 18:30:57 / cg" |
|
197 |
"Modified: / 6.11.1998 / 00:45:00 / cg" |
|
198 |
! |
|
199 |
||
200 |
convertToJava:arg type:type |
|
201 |
"given a smalltalk argument, convert to a java object as appropriate." |
|
202 |
||
203 |
^ self |
|
204 |
convertToJava:arg |
|
205 |
type:type |
|
206 |
ifFail:[:msg :default | |
|
207 |
ArgumentConversionErrorSignal |
|
208 |
raiseWith:arg |
|
209 |
errorString:msg. |
|
210 |
default |
|
211 |
] |
|
212 |
||
213 |
"Created: / 06-11-1998 / 00:45:13 / cg" |
|
214 |
"Modified: / 20-10-2010 / 11:08:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
215 |
! |
|
216 |
||
1033 | 217 |
convertToJava: arg type: type ifFail: failBlock |
752 | 218 |
"given a smalltalk argument, convert to a java object as appropriate. |
219 |
Currently, only a few types are converted." |
|
1033 | 220 |
|
221 |
| expectedCls f failValue | |
|
222 |
||
223 |
type == #boolean ifTrue: [ |
|
224 |
arg == true ifTrue: [ ^ 1 ]. |
|
225 |
arg == false ifTrue: [ ^ 0 ]. |
|
226 |
^ failBlock value: ('cannot convert argument to ' , type) value: 0 |
|
227 |
]. |
|
228 |
type == #int ifTrue: [ |
|
229 |
arg isInteger ifTrue: [ |
|
230 |
(arg between: (16r8000000 * -1) and: 16r7FFFFFFF) ifTrue: [ ^ arg ]. |
|
231 |
^ failBlock value: ('integer range; cannot convert argument to ' , type) |
|
232 |
value: 0. |
|
752 | 233 |
]. |
1033 | 234 |
^ failBlock value: ('cannot convert argument to ' , type) value: 0 |
752 | 235 |
]. |
1033 | 236 |
type == #long ifTrue: [ |
237 |
arg isInteger ifTrue: [ |
|
238 |
(arg "(-1 * 16r800000000000000) -->" between: -576460752303423488 |
|
239 |
and: 16r7FFFFFFFFFFFFFFF) ifTrue: [ ^ arg ]. |
|
240 |
^ failBlock value: ('integer range; cannot convert argument to ' , type) |
|
241 |
value: 0 |
|
752 | 242 |
]. |
1033 | 243 |
^ failBlock value: ('cannot convert argument to ' , type) value: 0 |
244 |
]. |
|
245 |
(type == #float) ifTrue: [ |
|
246 |
arg isLimitedPrecisionReal ifTrue: [ ^ arg asShortFloat ]. |
|
247 |
^ failBlock value: ('cannot convert argument to ' , type) value: 0.0. |
|
752 | 248 |
]. |
1033 | 249 |
(type = 'java.lang.Float') ifTrue: [ |
250 |
arg isLimitedPrecisionReal ifTrue: [ |
|
251 |
f := (Java at: 'java.lang.Float') new. |
|
252 |
f perform: #'<init>(F)V' with: (arg asShortFloat). |
|
253 |
self halt. |
|
752 | 254 |
^ f. |
255 |
]. |
|
1033 | 256 |
^ failBlock value: ('cannot convert argument to ' , type) value: 0.0. |
752 | 257 |
]. |
1033 | 258 |
(type = 'java.lang.Double') ifTrue: [ |
259 |
arg isLimitedPrecisionReal ifTrue: [ |
|
260 |
f := (Java at: 'java.lang.Double') new. |
|
261 |
f perform: #'<init>(D)V' with: (arg asFloat). |
|
262 |
self halt. |
|
263 |
^ f. |
|
752 | 264 |
]. |
1033 | 265 |
^ failBlock value: ('cannot convert argument to ' , type) value: 0.0. |
266 |
]. |
|
267 |
(type == #double) ifTrue: [ |
|
268 |
arg isLimitedPrecisionReal ifTrue: [ ^ arg asFloat ]. |
|
269 |
^ failBlock value: ('cannot convert argument to ' , type) value: 0.0. |
|
752 | 270 |
]. |
1033 | 271 |
(type == #char) ifTrue: [ |
272 |
arg isCharacter ifTrue: [ ^ arg asciiValue ]. |
|
273 |
^ failBlock value: ('cannot convert argument to ' , type) value: 0 |
|
752 | 274 |
]. |
1033 | 275 |
(type = 'char[]') ifTrue: [ |
276 |
arg isString ifTrue: [ ^ arg ]. |
|
277 |
^ failBlock value: ('cannot convert argument to ' , type) value: '' |
|
278 |
]. |
|
279 |
(type = 'int[]') ifTrue: [ |
|
280 |
(arg isArray or: [ arg isMemberOf: SignedIntegerArray ]) ifTrue: [ ^ arg ]. |
|
281 |
^ failBlock value: ('cannot convert argument to ' , type) value: '' |
|
752 | 282 |
]. |
1033 | 283 |
(type = 'long[]') ifTrue: [ |
284 |
(arg isArray or: [ arg isMemberOf: SignedIntegerArray ]) ifTrue: [ ^ arg ]. |
|
285 |
^ failBlock value: ('cannot convert argument to ' , type) value: '' |
|
286 |
]. |
|
287 |
(type = 'float[]') ifTrue: [ |
|
288 |
(arg isArray or: [ arg isMemberOf: FloatArray ]) ifTrue: [ ^ arg ]. |
|
289 |
^ failBlock value: ('cannot convert argument to ' , type) value: '' |
|
752 | 290 |
]. |
1033 | 291 |
(type = 'double[]') ifTrue: [ |
292 |
(arg isArray or: [ arg isMemberOf: DoubleArray ]) ifTrue: [ ^ arg ]. |
|
293 |
^ failBlock value: ('cannot convert argument to ' , type) value: '' |
|
752 | 294 |
]. |
1033 | 295 |
(type endsWith: '[]') ifTrue: [ |
296 |
(arg isArray or: [ arg isNil ]) ifTrue: [ ^ arg ]. |
|
297 |
^ failBlock value: ('cannot convert argument to ' , type) value: '' |
|
298 |
]. |
|
299 |
expectedCls := JavaVM classForName: type. |
|
300 |
(arg isKindOf: expectedCls) ifTrue: [ |
|
752 | 301 |
"/ matches class and subclasses |
302 |
^ arg |
|
303 |
]. |
|
1033 | 304 |
(type = 'java.lang.Object') ifTrue: [ |
752 | 305 |
"/ matches any |
306 |
^ arg |
|
307 |
]. |
|
1033 | 308 |
(type = 'java.lang.String') ifTrue: [ |
309 |
arg isString ifTrue: [ ^ Java as_String: arg ]. |
|
752 | 310 |
failValue := '' |
311 |
]. |
|
1033 | 312 |
arg isNil ifTrue: [ |
752 | 313 |
"/ matches any |
314 |
^ arg |
|
315 |
]. |
|
1033 | 316 |
self halt. |
317 |
^ failBlock value: ('cannot convert argument to ' , type) value: failValue |
|
752 | 318 |
|
319 |
"Created: / 06-11-1998 / 00:46:19 / cg" |
|
320 |
"Modified: / 06-11-2001 / 13:28:29 / cg" |
|
321 |
"Modified: / 17-01-2011 / 10:08:04 / kursjan <kursjan@fit.cvut.cz>" |
|
322 |
"Modified: / 17-03-2011 / 14:09:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
323 |
! |
|
324 |
||
325 |
convertToSmalltalk:jObj type:type |
|
326 |
"given a java return value, convert to a smalltalk object as appropriate. |
|
327 |
Currently, only a few types are converted." |
|
328 |
||
329 |
"JV@2011-02-04" |
|
330 |
"Hack for primitive types" |
|
331 |
(JavaDescriptor baseTypesByTypeName keys includes: type) ifTrue:[^jObj]. |
|
332 |
"jObj is registered for the specified type?" |
|
333 |
||
756 | 334 |
" |
752 | 335 |
(JavaObjectDictionary new reflectionOf: jObj class name) = (Java classForName: type) ifTrue: [ |
336 |
^ jObj |
|
337 |
]. |
|
756 | 338 |
" |
752 | 339 |
|
340 |
type == #boolean ifTrue:[ |
|
341 |
jObj == 0 ifTrue:[ |
|
342 |
^ false |
|
343 |
]. |
|
344 |
^ true |
|
345 |
]. |
|
346 |
||
347 |
type == #void ifTrue:[ |
|
348 |
^ nil |
|
349 |
]. |
|
350 |
||
351 |
(type = 'java.lang.String') ifTrue:[ |
|
352 |
^ Java as_ST_String:jObj |
|
353 |
]. |
|
354 |
||
355 |
"/ (type = 'java.lang.Float') ifTrue:[ |
|
356 |
"/ ^ jObj instVarNamed:'value' |
|
357 |
"/ ]. |
|
358 |
"/ (type = 'java.lang.Double') ifTrue:[ |
|
359 |
"/ ^ jObj instVarNamed:'value' |
|
360 |
"/ ]. |
|
361 |
||
362 |
(type == #char) ifTrue:[ |
|
363 |
jObj isInteger ifTrue:[ |
|
364 |
^ Character value:jObj |
|
365 |
]. |
|
366 |
]. |
|
367 |
||
368 |
^ jObj |
|
369 |
||
370 |
"Created: / 06-11-1998 / 00:49:53 / cg" |
|
371 |
"Modified: / 11-11-1998 / 02:08:11 / cg" |
|
372 |
"Modified: / 17-01-2011 / 10:42:56 / kursjan <kursjan@fit.cvut.cz>" |
|
756 | 373 |
"Modified: / 08-04-2011 / 17:04:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 374 |
! |
375 |
||
376 |
lookupMethod:selector numArgs:nargs in:aClass static:staticMethod |
|
377 |
"lookup a method" |
|
378 |
||
379 |
|method cls sel| |
|
380 |
||
381 |
sel := selector. |
|
382 |
(sel includes:$:) ifTrue:[ |
|
383 |
sel := sel copyTo:(sel indexOf:$:)-1 |
|
384 |
]. |
|
385 |
||
386 |
sel := sel asSymbolIfInterned. |
|
387 |
sel notNil ifTrue:[ |
|
388 |
cls := aClass. |
|
389 |
||
390 |
[cls notNil |
|
391 |
and:[cls ~~ JavaObject |
|
392 |
and:[cls ~~ JavaClass]]] whileTrue:[ |
|
393 |
cls methodDictionary keysAndValuesDo:[:jSel :m | |
|
394 |
|aMethod| |
|
395 |
||
396 |
aMethod := m. |
|
397 |
aMethod isWrapped ifTrue:[ |
|
398 |
aMethod := aMethod originalMethod |
|
399 |
]. |
|
400 |
||
401 |
((jSel == sel) |
|
402 |
or:[aMethod name = sel |
|
403 |
or:[aMethod signatureNameWithoutReturnType = sel]]) |
|
404 |
ifTrue:[ |
|
405 |
aMethod numArgs == nargs ifTrue:[ |
|
406 |
staticMethod == (aMethod isStatic) ifTrue:[ |
|
407 |
^ m |
|
408 |
] |
|
409 |
] |
|
410 |
] |
|
411 |
]. |
|
412 |
||
413 |
cls := cls superclass. |
|
414 |
]. |
|
415 |
]. |
|
416 |
"/ self halt. |
|
417 |
^ nil |
|
418 |
||
419 |
"Created: / 17.8.1997 / 18:25:47 / cg" |
|
420 |
"Modified: / 16.11.1998 / 16:46:48 / cg" |
|
421 |
! |
|
422 |
||
423 |
lookupMethods:selector numArgs:nargs in:aClass static:staticMethod |
|
424 |
"lookup methods matching a selector. |
|
425 |
This is a special entry for doesNotUnderstand redirection |
|
426 |
(the caller must select the one method which fits the argument(s) best." |
|
427 |
||
428 |
|methods cls sel| |
|
429 |
||
430 |
sel := selector. |
|
431 |
(sel includes:$:) ifTrue:[ |
|
432 |
sel := sel copyTo:(sel indexOf:$:)-1 |
|
433 |
]. |
|
434 |
||
435 |
sel := sel asSymbolIfInterned. |
|
436 |
sel notNil ifTrue:[ |
|
437 |
cls := aClass. |
|
438 |
||
439 |
[cls notNil |
|
440 |
and:[cls ~~ JavaObject |
|
441 |
and:[cls ~~ JavaClass]]] whileTrue:[ |
|
442 |
cls methodDictionary keysAndValuesDo:[:jSel :aMethod | |
|
443 |
((jSel == sel) |
|
444 |
or:[aMethod name = sel |
|
445 |
or:[aMethod signatureNameWithoutReturnType = sel]]) |
|
446 |
ifTrue:[ |
|
447 |
(nargs isNil |
|
448 |
or:[aMethod numArgs == nargs]) ifTrue:[ |
|
449 |
staticMethod == (aMethod isStatic) ifTrue:[ |
|
450 |
methods isNil ifTrue:[ |
|
451 |
methods := OrderedCollection new |
|
452 |
]. |
|
453 |
methods add:aMethod |
|
454 |
] |
|
455 |
] |
|
456 |
] |
|
457 |
]. |
|
458 |
||
459 |
cls := cls superclass. |
|
460 |
]. |
|
461 |
]. |
|
462 |
^ methods ? #() |
|
463 |
||
464 |
"Created: / 4.11.1998 / 19:04:51 / cg" |
|
465 |
"Modified: / 4.11.1998 / 19:31:33 / cg" |
|
466 |
! ! |
|
467 |
||
468 |
!JavaClass class methodsFor:'signature parsing'! |
|
469 |
||
470 |
initialValueFromSignature:aSignature |
|
471 |
"given a signature, return an initializer value" |
|
472 |
||
473 |
|s| |
|
474 |
||
475 |
s := aSignature readStream. |
|
476 |
^ self initialValueFromStream:s. |
|
477 |
||
478 |
" |
|
479 |
JavaClass initialValueFromSignature:'LObject;' |
|
480 |
JavaClass initialValueFromSignature:'B' |
|
481 |
JavaClass initialValueFromSignature:'I' |
|
482 |
" |
|
483 |
||
484 |
||
485 |
! ! |
|
486 |
||
487 |
!JavaClass class methodsFor:'special'! |
|
488 |
||
489 |
deinitClasses |
|
490 |
||
491 |
Smalltalk allClassesDo: |
|
492 |
[:cls|cls isJavaClass ifTrue:[cls deinit]]. |
|
493 |
self flushClassesInitOrder. |
|
494 |
||
495 |
" |
|
496 |
JavaClass deinitClasses |
|
497 |
" |
|
498 |
||
499 |
"Created: / 25-10-2010 / 16:47:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
500 |
! |
|
501 |
||
502 |
flushClassesInitOrder |
|
503 |
OrderOfClassInits := nil |
|
504 |
||
505 |
"Created: / 6.11.2001 / 09:49:49 / cg" |
|
506 |
! |
|
507 |
||
508 |
orderOfClassInits |
|
509 |
^ OrderOfClassInits |
|
510 |
||
511 |
"Created: / 12.11.1998 / 15:35:57 / cg" |
|
512 |
! |
|
513 |
||
514 |
setInstanceVariableStringFromFields:f in:aClass |
|
515 |
|varNames| |
|
516 |
||
517 |
varNames := ''. |
|
518 |
f do:[:aField | |
|
519 |
varNames := varNames , aField name , ' ' |
|
520 |
]. |
|
521 |
aClass setInstanceVariableString:varNames. |
|
522 |
||
523 |
"Created: 15.4.1996 / 16:42:52 / cg" |
|
524 |
! |
|
525 |
||
526 |
startRememberingOrderOfClassInits |
|
527 |
OrderOfClassInits := OrderedCollection new. |
|
528 |
||
529 |
"Created: / 12.11.1998 / 15:26:32 / cg" |
|
530 |
"Modified: / 12.11.1998 / 15:29:10 / cg" |
|
531 |
! ! |
|
532 |
||
533 |
!JavaClass methodsFor:'accessing'! |
|
534 |
||
1453 | 535 |
allFields |
536 |
"Returns all fields, including those inherited from |
|
537 |
a superclass" |
|
538 |
| cls all | |
|
539 |
||
540 |
cls := self. |
|
541 |
all := OrderedCollection new. |
|
542 |
[ cls isJavaClass ] whileTrue:[ |
|
543 |
all addAll: cls fields. |
|
544 |
cls := cls superclass |
|
545 |
]. |
|
546 |
^all. |
|
547 |
||
548 |
"Created: / 04-04-2012 / 01:37:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
549 |
! |
|
550 |
||
752 | 551 |
allInterfaces |
552 |
||
553 |
| ifaces cls | |
|
554 |
||
555 |
ifaces := Set new. |
|
556 |
cls := self. |
|
557 |
[ cls isJavaClass ] whileTrue: |
|
558 |
[cls interfaces do:[:iface| ifaces add: iface; addAll: iface allInterfaces]. |
|
559 |
cls := cls superclass]. |
|
560 |
^ifaces. |
|
561 |
||
562 |
"Created: / 05-02-2011 / 23:51:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
563 |
! |
|
564 |
||
1453 | 565 |
allStaticFields |
566 |
"Returns all fields, including those inherited from |
|
567 |
a superclass" |
|
568 |
| cls all | |
|
569 |
||
570 |
cls := self. |
|
571 |
all := OrderedCollection new. |
|
572 |
[ cls isJavaClass ] whileTrue:[ |
|
573 |
all addAll: cls staticFields. |
|
574 |
cls := cls superclass |
|
575 |
]. |
|
576 |
^all. |
|
577 |
||
578 |
"Created: / 04-04-2012 / 01:37:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
579 |
! |
|
580 |
||
752 | 581 |
annotations |
582 |
^ annotations ifNil:[JavaClassAnnotationContainer empty]. |
|
583 |
||
584 |
"Modified: / 03-03-2011 / 22:52:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
585 |
! |
|
586 |
||
587 |
annotations:something |
|
588 |
annotations := something. |
|
589 |
! |
|
590 |
||
591 |
binaryFile |
|
592 |
^ binaryFilePath |
|
593 |
! |
|
594 |
||
595 |
classLoader |
|
596 |
^ classLoader |
|
597 |
! |
|
598 |
||
1368 | 599 |
classLoader:classLoaderOrNil |
600 |
classLoader := classLoaderOrNil. |
|
601 |
||
602 |
"Modified: / 18-02-2012 / 20:21:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 603 |
! |
604 |
||
605 |
compiledMethodAt:name |
|
606 |
"redefined to find the constructor" |
|
607 |
||
608 |
|m| |
|
609 |
||
610 |
m := super compiledMethodAt:name. |
|
611 |
m isNil ifTrue:[ |
|
612 |
name = self lastName ifTrue:[ |
|
613 |
^ super compiledMethodAt:#'<init>()V' |
|
614 |
]. |
|
615 |
]. |
|
616 |
^ m |
|
617 |
||
618 |
" |
|
619 |
JAVA::java::lang::Object compiledMethodAt:#Object |
|
620 |
" |
|
621 |
||
622 |
"Created: / 24.12.1999 / 02:02:50 / cg" |
|
623 |
"Modified: / 24.12.1999 / 02:04:46 / cg" |
|
624 |
! |
|
625 |
||
626 |
compiledMethodAt:name signature:sig |
|
627 |
"lookup the classes methodDictionary" |
|
628 |
||
629 |
methodDictionary keysAndValuesDo:[:mFullSelector :aMethod | |
|
630 |
aMethod name == name ifTrue:[ |
|
631 |
aMethod signature == sig ifTrue:[ |
|
632 |
^ aMethod |
|
633 |
] |
|
634 |
] |
|
635 |
]. |
|
636 |
^ nil |
|
637 |
||
638 |
"Created: 1.8.1997 / 00:01:58 / cg" |
|
639 |
! |
|
640 |
||
641 |
constantPool |
|
642 |
^ constantPool |
|
643 |
! |
|
644 |
||
645 |
ensureHasAnnotations |
|
646 |
annotations ifNil: [ annotations := JavaAnnotationContainer for: self ]. |
|
647 |
^ annotations |
|
648 |
||
649 |
"Created: / 25-02-2011 / 16:02:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
650 |
"Modified: / 16-03-2011 / 17:13:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
651 |
! |
|
652 |
||
653 |
fields |
|
654 |
^ fields |
|
655 |
! |
|
656 |
||
657 |
fullName |
|
658 |
^ fullName |
|
659 |
! |
|
660 |
||
661 |
interfaces |
|
662 |
interfaces notNil |
|
663 |
ifTrue: |
|
664 |
[ interfaces := interfaces collect: |
|
824 | 665 |
[:clsRef | clsRef javaClass ] ]. |
666 |
||
752 | 667 |
^ interfaces ? #() |
668 |
||
824 | 669 |
"Modified: / 31-05-2011 / 09:40:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 670 |
! |
671 |
||
672 |
javaClass |
|
808
6116e95d8d4b
- JavaBehavior>>#setConstantPool: set CP owner to class itself
vranyj1
parents:
796
diff
changeset
|
673 |
|
752 | 674 |
^ self |
808
6116e95d8d4b
- JavaBehavior>>#setConstantPool: set CP owner to class itself
vranyj1
parents:
796
diff
changeset
|
675 |
|
6116e95d8d4b
- JavaBehavior>>#setConstantPool: set CP owner to class itself
vranyj1
parents:
796
diff
changeset
|
676 |
"Modified: / 22-05-2011 / 13:32:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 677 |
! |
678 |
||
679 |
javaComponentClass |
|
822 | 680 |
^self. |
752 | 681 |
|
682 |
"Created: / 20-12-2010 / 22:02:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
822 | 683 |
"Modified: / 30-05-2011 / 23:26:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 684 |
! |
685 |
||
686 |
javaName |
|
687 |
"the javaname - as seen by a java programmer. |
|
688 |
(with '/'s replaced by dots) extract from the fullName" |
|
689 |
||
690 |
^ fullName copyReplaceAll:$/ with:$. |
|
691 |
||
692 |
" |
|
693 |
Java allClasses first fullName |
|
694 |
Java allClasses first name |
|
695 |
Java allClasses first javaName |
|
696 |
Java allClasses first javaPackage |
|
697 |
Java allClasses first package |
|
698 |
" |
|
699 |
! |
|
700 |
||
701 |
javaPackage |
|
702 |
"the javaPackage - as seen by a java programmer. |
|
703 |
(with '/'s replaced by dots) extract from the fullName" |
|
704 |
||
705 |
|components| |
|
706 |
||
707 |
components := fullName asCollectionOfSubstringsSeparatedBy:$/. |
|
708 |
components size > 1 ifTrue:[ |
|
709 |
^ (components copyWithoutLast:1) asStringWith:$. |
|
710 |
]. |
|
711 |
^ fullName |
|
712 |
||
713 |
" |
|
714 |
Java allClasses first fullName |
|
715 |
Java allClasses first javaPackage |
|
716 |
Java allClasses first package |
|
717 |
" |
|
718 |
! |
|
719 |
||
720 |
javaPackageAsDirname |
|
721 |
"the javaPackage - as directory in class path" |
|
722 |
||
723 |
|components| |
|
724 |
||
725 |
components := fullName asCollectionOfSubstringsSeparatedBy:$/. |
|
726 |
components size > 1 ifTrue:[ |
|
727 |
^ (components copyWithoutLast:1) asStringWith: Filename separator |
|
728 |
]. |
|
729 |
^ fullName |
|
730 |
||
731 |
" |
|
732 |
Java allClasses first fullName |
|
733 |
Java allClasses first javaPackage |
|
734 |
Java allClasses first package |
|
735 |
" |
|
736 |
||
737 |
"Created: / 30-11-2010 / 12:17:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
738 |
! |
|
739 |
||
1483 | 740 |
javaWrapperClass |
741 |
||
742 |
fullName == #'java/lang/String' ifTrue:[ ^ String ]. |
|
743 |
self error:'Should not happen' |
|
744 |
||
745 |
"Created: / 20-04-2012 / 20:03:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
746 |
! |
|
747 |
||
752 | 748 |
lastName |
749 |
^ fullName copyFrom:(fullName lastIndexOf:$/)+1 |
|
750 |
||
751 |
"Created: / 5.11.1998 / 19:16:00 / cg" |
|
752 |
! |
|
753 |
||
754 |
name |
|
755 |
^ name "/ fullName |
|
756 |
! |
|
757 |
||
758 |
nameSpace |
|
1468 | 759 |
^ NameSpace name:#JAVA |
760 |
||
761 |
"Created: / 20-01-1997 / 13:04:30 / cg" |
|
762 |
"Modified: / 11-04-2012 / 23:25:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 763 |
! |
764 |
||
765 |
nameWithoutNameSpacePrefix |
|
766 |
^ fullName |
|
767 |
||
768 |
"Created: 20.1.1997 / 13:05:30 / cg" |
|
769 |
! |
|
770 |
||
771 |
nameWithoutPrefix |
|
1483 | 772 |
^ self lastName |
773 |
||
774 |
"Created: / 20-01-1997 / 13:06:06 / cg" |
|
775 |
"Modified: / 20-04-2012 / 18:35:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 776 |
! |
777 |
||
778 |
package |
|
779 |
"the package (as seen by a smalltalk programmer) |
|
780 |
extract from the fullName, (with '/'s) and prepend 'java:'" |
|
781 |
||
782 |
|components p i| |
|
783 |
||
784 |
i := fullName lastIndexOf:$/. |
|
785 |
p := fullName copyTo:i - 1. |
|
786 |
p size == 0 ifTrue:[ |
|
787 |
^ 'java' |
|
788 |
]. |
|
789 |
"/ components := fullName asCollectionOfSubstringsSeparatedBy:$/. |
|
790 |
"/ components size > 1 ifTrue:[ |
|
791 |
"/ p := (components copyWithoutLast:1) asStringWith:$/ |
|
792 |
"/ ] ifFalse:[ |
|
793 |
"/ p := fullName |
|
794 |
"/ ]. |
|
795 |
||
796 |
^ 'java:' , p |
|
797 |
||
798 |
" |
|
799 |
Java allClasses first fullName |
|
800 |
Java allClasses first package |
|
801 |
Java allClasses first javaPackage |
|
802 |
" |
|
803 |
! |
|
804 |
||
903 | 805 |
protectionDomain |
806 |
^ protectionDomain |
|
807 |
! |
|
808 |
||
809 |
protectionDomain:something |
|
810 |
protectionDomain := something. |
|
811 |
! |
|
812 |
||
752 | 813 |
runtimeVisibleAnnotationsAsBytesOrNil |
814 |
annotations ifNil:[ ^ nil ]. |
|
815 |
annotations runtimeVisible ifNil:[ ^ nil ]. |
|
816 |
^ annotations runtimeVisible bytes |
|
817 |
||
818 |
"Created: / 25-02-2011 / 16:48:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
819 |
! |
|
820 |
||
912
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
821 |
setSignature: aSymbol |
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
822 |
|
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
823 |
signatureJ := aSymbol |
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
824 |
|
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
825 |
"Created: / 13-08-2011 / 00:30:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
826 |
! |
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
827 |
|
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
828 |
signatureJ |
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
829 |
|
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
830 |
"stupid naming, but superclass defines signature too" |
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
831 |
|
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
832 |
^signatureJ |
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
833 |
|
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
834 |
"Created: / 13-08-2011 / 00:30:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
835 |
! |
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
836 |
|
752 | 837 |
source |
1368 | 838 |
^ sourceString notNil |
839 |
ifTrue: [ sourceString ] |
|
840 |
ifFalse:[ Java classSourceOf:self ] |
|
752 | 841 |
|
842 |
" |
|
843 |
(Java at:'java.awt.Frame') source |
|
844 |
(Java at:'ArcTest') source |
|
845 |
(Java at:'ArcCanvas') source |
|
846 |
" |
|
847 |
||
1368 | 848 |
"Modified: / 30-07-1997 / 14:31:01 / cg" |
849 |
"Modified: / 18-02-2012 / 19:10:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 850 |
! |
851 |
||
852 |
sourceFile |
|
853 |
^ sourceFile |
|
854 |
! |
|
855 |
||
856 |
staticFields |
|
857 |
^ staticFields |
|
858 |
! |
|
859 |
||
860 |
superinterface |
|
861 |
||
862 |
| ifaces | |
|
863 |
||
864 |
self assert: self isInterface message: 'Type must be an interface'. |
|
865 |
(ifaces := self interfaces) size == 0 ifTrue:[^nil]. |
|
866 |
ifaces size = 1 ifTrue:[^ifaces first]. |
|
867 |
||
868 |
self error: 'Should not happen!!'. |
|
869 |
^nil |
|
870 |
||
871 |
"Created: / 04-02-2011 / 12:35:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
872 |
! |
|
873 |
||
874 |
typeOfField:aFieldName |
|
875 |
||
876 |
fields do:[:aField | |
|
877 |
aField name = aFieldName ifTrue:[ |
|
878 |
^ aField type |
|
879 |
] |
|
880 |
]. |
|
881 |
self error:'no such field' |
|
882 |
||
883 |
" |
|
884 |
(JAVA at:#'java/awt/image/ColorModel') typeOfField:'pixel_bits' |
|
885 |
" |
|
886 |
||
887 |
"Modified: 21.1.1997 / 22:48:28 / cg" |
|
888 |
! ! |
|
889 |
||
1581
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1527
diff
changeset
|
890 |
!JavaClass methodsFor:'accessing - java'! |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1527
diff
changeset
|
891 |
|
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1527
diff
changeset
|
892 |
javaMirror |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1527
diff
changeset
|
893 |
^self javaMirrorClass forClass: self. |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1527
diff
changeset
|
894 |
|
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1527
diff
changeset
|
895 |
"Created: / 01-08-2012 / 00:18:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1527
diff
changeset
|
896 |
! |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1527
diff
changeset
|
897 |
|
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1527
diff
changeset
|
898 |
javaMirrorClass |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1527
diff
changeset
|
899 |
^JavaMirror mirrorClassForJavaClass |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1527
diff
changeset
|
900 |
|
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1527
diff
changeset
|
901 |
"Created: / 31-07-2012 / 17:39:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1527
diff
changeset
|
902 |
! ! |
70fbc03d2d82
Java reflection support refactoring - moved to use JavaMirrors
vranyj1
parents:
1527
diff
changeset
|
903 |
|
752 | 904 |
!JavaClass methodsFor:'adding / removing'! |
905 |
||
906 |
removeFromSystem |
|
907 |
Java removeClass:self |
|
908 |
||
909 |
"Created: 12.8.1997 / 02:46:51 / cg" |
|
910 |
! ! |
|
911 |
||
915 | 912 |
!JavaClass methodsFor:'autoboxing'! |
913 |
||
914 |
javaBox:anObject |
|
915 |
^ anObject |
|
916 |
||
917 |
"Created: / 14-08-2011 / 22:58:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1263 | 918 |
! |
919 |
||
920 |
javaUnwrap: object |
|
921 |
||
922 |
| nm | |
|
923 |
nm := object class name. |
|
924 |
||
925 |
nm == #'java/lang/Byte' ifTrue:[ |
|
926 |
^object instVarNamed: #value. |
|
927 |
]. |
|
928 |
nm == #'java/lang/Short' ifTrue:[ |
|
929 |
^object instVarNamed: #value. |
|
930 |
]. |
|
931 |
nm == #'java/lang/Integer' ifTrue:[ |
|
932 |
^object instVarNamed: #value. |
|
933 |
]. |
|
934 |
nm == #'java/lang/Long' ifTrue:[ |
|
935 |
^object instVarNamed: #value. |
|
936 |
]. |
|
937 |
nm == #'java/lang/Character' ifTrue:[ |
|
938 |
^Character codePoint: (object instVarNamed: #value) |
|
939 |
]. |
|
940 |
nm == #'java/lang/Boolean' ifTrue:[ |
|
941 |
^(object instVarNamed: #value) == 1 |
|
942 |
]. |
|
1271 | 943 |
nm == #'java/lang/String' ifTrue:[ |
944 |
^ Java as_ST_String: object |
|
945 |
]. |
|
1639 | 946 |
nm == #'java/lang/Class' ifTrue:[ |
947 |
^ JavaVM classForJavaClassObject: object |
|
948 |
]. |
|
1263 | 949 |
|
950 |
^object |
|
951 |
||
952 |
"Created: / 10-12-2011 / 19:54:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1271 | 953 |
"Modified: / 12-12-2011 / 18:05:29 / kursjan <kursjan@fit.cvut.cz>" |
1639 | 954 |
"Modified: / 21-08-2012 / 13:16:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1385 | 955 |
! |
956 |
||
957 |
javaWrap: object |
|
958 |
||
1652 | 959 |
object isNil ifTrue:[ ^ nil ]. |
1385 | 960 |
|
961 |
object class isJavaPrimitiveType ifTrue:[ |
|
962 |
(self name == #'java/lang/Object' or:[self == object class javaWrapperClass]) ifTrue:[ |
|
963 |
^object class javaWrapperClass newCleared |
|
964 |
instVarNamed: #value put: object; |
|
965 |
yourself |
|
966 |
]. |
|
967 |
]. |
|
968 |
||
969 |
object isString ifTrue:[ |
|
970 |
(self name == #'java/lang/Object' or:[ |
|
971 |
self name == #'java/lang/String']) ifTrue:[ |
|
972 |
^ Java as_String: object |
|
973 |
]. |
|
974 |
]. |
|
975 |
||
976 |
^object |
|
977 |
||
978 |
"Modified: / 12-12-2011 / 18:05:29 / kursjan <kursjan@fit.cvut.cz>" |
|
979 |
"Created: / 24-02-2012 / 19:32:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
915 | 980 |
! ! |
981 |
||
752 | 982 |
!JavaClass methodsFor:'browser interface'! |
983 |
||
984 |
isVisualStartable |
|
985 |
"return true, if this is an application class, |
|
986 |
which can be started via #open" |
|
987 |
"/ if I have a main() method, I am |
|
1033 | 988 |
|
989 |
(self compiledMethodAt: #'main([Ljava/lang/String;)V') notNil ifTrue: [ |
|
1028
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1027
diff
changeset
|
990 |
^ true |
752 | 991 |
]. |
1033 | 992 |
(self isSubclassOf: (JavaVM at: 'java/applet/Applet')) ifTrue: [ |
1028
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1027
diff
changeset
|
993 |
^ true. |
752 | 994 |
]. |
995 |
^ false |
|
996 |
! |
|
997 |
||
998 |
open |
|
999 |
"start a thread for my main method" |
|
1000 |
||
1001 |
"/ if I have a main, call it ... |
|
1002 |
||
1003 |
(self compiledMethodAt:#'main([Ljava/lang/String;)V') notNil ifTrue:[ |
|
1004 |
^ self startMain |
|
1005 |
]. |
|
1006 |
||
1007 |
"/ otherwise, create a frame and wrap me; |
|
1008 |
"/ as in: |
|
1009 |
||
1010 |
"/ public static void main(String args[]) { |
|
1011 |
"/ Frame f = new Frame("myName"); |
|
1012 |
"/ mySelf me = new mySelf(); |
|
1013 |
"/ |
|
1014 |
"/ me.init(); |
|
1015 |
"/ me.start(); |
|
1016 |
"/ |
|
1017 |
"/ f.add("Center", me); |
|
1018 |
"/ f.setSize(300, 300); |
|
1019 |
"/ f.show(); |
|
1020 |
"/ } |
|
1021 |
||
1022 |
^ self startApplet |
|
1023 |
||
1024 |
"Created: / 15.1.1998 / 17:18:30 / cg" |
|
1025 |
"Modified: / 3.11.1998 / 22:51:47 / cg" |
|
1026 |
! ! |
|
1027 |
||
1028 |
!JavaClass methodsFor:'compiler interface'! |
|
1029 |
||
1030 |
browserClass |
|
1031 |
"return the browser to use for this class - |
|
1032 |
this can be redefined in special classes, to get different browsers" |
|
1033 |
||
1034 |
"/ ^ JavaBrowser |
|
1035 |
^ super browserClass. |
|
1036 |
||
1037 |
"Modified: / 14.10.1998 / 15:28:38 / cg" |
|
1365 | 1038 |
! |
1039 |
||
1040 |
syntaxHighlighterClass |
|
1041 |
"return the class to use for syntaxHighlighting (prettyPrinting) this class - |
|
1042 |
this can be redefined in special classes, to highlight classes with |
|
1043 |
Lisp, Prolog, ASN1, Basic :-) or whatever syntax." |
|
1044 |
||
1045 |
^ self class == JavaClass ifTrue:[ |
|
1046 |
super syntaxHighlighterClass |
|
1047 |
] ifFalse:[ |
|
1048 |
JavaLanguage instance syntaxHighlighterClass |
|
1049 |
] |
|
1050 |
||
1051 |
"Created: / 15-02-2012 / 01:43:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 1052 |
! ! |
1053 |
||
1054 |
!JavaClass methodsFor:'compiling'! |
|
1055 |
||
1056 |
recompileMethodsAccessingGlobal:aGlobalKey |
|
1057 |
"/ dummy for now |
|
1058 |
||
1059 |
"Created: / 9.11.1999 / 16:42:09 / cg" |
|
1060 |
! ! |
|
1061 |
||
1062 |
!JavaClass methodsFor:'documentation support'! |
|
1063 |
||
1064 |
htmlDocumentation |
|
1065 |
^ nil "/ replace by access to javadoc-generated documentation later |
|
1066 |
||
1067 |
"Modified: 22.3.1997 / 14:18:50 / cg" |
|
1068 |
! ! |
|
1069 |
||
1427
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1070 |
!JavaClass methodsFor:'exception handling support'! |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1071 |
|
1428
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1072 |
accepts: signal |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1073 |
"Return true, iff receicer is a throwable and |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1074 |
handles given signal (presumably another throwable class)" |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1075 |
|
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1076 |
| cls | |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1077 |
|
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1078 |
signal isJavaClass ifFalse:[ ^ false ]. |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1079 |
self == signal ifTrue:[ ^ true ]. |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1080 |
cls := signal. |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1081 |
[ cls ~~ JavaObject ] whileTrue:[ |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1082 |
self == cls ifTrue:[ ^ true ]. |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1083 |
cls := cls superclass. |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1084 |
]. |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1085 |
^false |
1427
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1086 |
|
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1087 |
"Created: / 18-03-2012 / 14:19:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1088 |
! |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1089 |
|
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1090 |
handles: anObject |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1091 |
|
1428
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1092 |
Transcript showCR:'>>>> JavaClass>>handles: ' , anObject printString. |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1093 |
Transcript showCR:' from: ', thisContext sender printString. |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1094 |
^false |
1427
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1095 |
|
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1096 |
"Created: / 18-03-2012 / 14:19:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1097 |
! |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1098 |
|
1626 | 1099 |
isControlInterrupt |
1100 |
^false |
|
1101 |
||
1102 |
"Created: / 20-08-2012 / 14:17:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1103 |
! |
|
1104 |
||
1428
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1105 |
isExceptionCreator |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1106 |
|
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1107 |
"/ ^false |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1108 |
^self isThrowable |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1109 |
|
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1110 |
"Created: / 18-03-2012 / 20:34:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1111 |
! |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1112 |
|
1427
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1113 |
isExceptionHandler |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1114 |
|
1428
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1115 |
"/ ^false |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1116 |
^self isThrowable |
1427
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1117 |
|
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1118 |
"Created: / 18-03-2012 / 14:18:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1119 |
! |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1120 |
|
1428
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1121 |
isQuerySignal |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1122 |
|
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1123 |
^false |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1124 |
|
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1125 |
"Created: / 18-03-2012 / 22:18:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1126 |
! |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1127 |
|
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1128 |
isThrowable |
1427
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1129 |
"Returns true, if the receiver is an instance |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1130 |
of java.lang.Throwable, false otherwise" |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1131 |
|
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1132 |
| cls | |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1133 |
cls := self. |
1481 | 1134 |
[ cls ~~ JavaObject ] whileTrue:[ |
1427
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1135 |
cls name == #'java/lang/Throwable' ifTrue:[ |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1136 |
^true |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1137 |
]. |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1138 |
cls := cls superclass. |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1139 |
]. |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1140 |
^false |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1141 |
|
1428
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1142 |
"Created: / 18-03-2012 / 20:35:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1143 |
! |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1144 |
|
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1145 |
mapyProceed |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1146 |
|
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1147 |
"Created: / 18-03-2012 / 20:35:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1148 |
! |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1149 |
|
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1150 |
parent |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1151 |
|
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1152 |
^nil |
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1153 |
|
902a1435f4ca
Initial support for handling Java exceptions in Smalltalk
vranyj1
parents:
1427
diff
changeset
|
1154 |
"Created: / 18-03-2012 / 22:19:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1507 | 1155 |
! |
1156 |
||
1157 |
signal |
|
1158 |
||
1159 |
^self class. |
|
1160 |
||
1161 |
"Created: / 05-07-2012 / 08:56:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1427
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1162 |
! ! |
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1163 |
|
752 | 1164 |
!JavaClass methodsFor:'executing programs'! |
1165 |
||
1166 |
startApplet |
|
1167 |
|f me stub top appFrame| |
|
1168 |
||
1169 |
top := StandardSystemView new. |
|
1170 |
appFrame := JavaEmbeddedFrameView new. |
|
1171 |
appFrame origin:0.0@0.0 corner:1.0@1.0. |
|
1172 |
top addSubView:appFrame. |
|
1173 |
||
1174 |
appFrame appletIsPreloaded:true. |
|
1175 |
appFrame codeURL:'file:/dummy'. |
|
1176 |
appFrame codeBaseURL:'file:/dummy'. |
|
1177 |
appFrame autoSetupApplet:true. |
|
1178 |
appFrame autoStartApplet:true. |
|
1179 |
appFrame autoDestroyApplet:true. |
|
1180 |
||
1181 |
||
1182 |
top open. |
|
1183 |
^ self. |
|
1184 |
||
1185 |
"/ TODO: setup embeddedAppletFrame correctly |
|
1186 |
"/ (for getParameter to work ...) |
|
1187 |
||
1188 |
"/ create a frame and wrap me; |
|
1189 |
"/ as in: |
|
1190 |
||
1191 |
"/ public static void main(String args[]) { |
|
1192 |
"/ Frame f = new Frame("myName"); |
|
1193 |
"/ mySelf me = new mySelf(); |
|
1194 |
"/ |
|
1195 |
"/ me.init(); |
|
1196 |
"/ me.start(); |
|
1197 |
"/ |
|
1198 |
"/ f.add("Center", me); |
|
1199 |
"/ f.setSize(300, 300); |
|
1200 |
"/ f.show(); |
|
1201 |
"/ } |
|
1202 |
f := (Java at:'java.awt.Frame') basicNew. |
|
1203 |
f perform:#'<init>(Ljava/lang/String;)V' with:(Java as_String:self name). |
|
1204 |
self halt. |
|
1205 |
me := self basicNew. |
|
1206 |
me perform:#'<init>()V'. |
|
1207 |
self halt. |
|
1208 |
||
1209 |
stub := (Java at:'netscape.applet.EmbeddedAppletFrame') new. |
|
1210 |
me instVarNamed:'stub' put:stub. |
|
1211 |
self halt. |
|
1212 |
||
1213 |
me perform:#'init()V'. |
|
1214 |
me perform:#'start()V'. |
|
1215 |
self halt. |
|
1216 |
||
1217 |
f perform:#'add(Ljava/lang/String;Ljava/awt/Component;)Ljava/awt/Component;' |
|
1218 |
with:(Java as_String:'Center') |
|
1219 |
with:me. |
|
1220 |
self halt. |
|
1221 |
f perform:#'setSize(II)V' with:300 with:300. |
|
1222 |
self halt. |
|
1223 |
f perform:#'show()V'. |
|
1224 |
self halt. |
|
1225 |
||
1226 |
"Modified: / 3.11.1998 / 23:04:41 / cg" |
|
1227 |
"/ TODO: setup embeddedAppletFrame correctly |
|
1228 |
"/ (for getParameter to work ...) |
|
1229 |
||
1230 |
"/ create a frame and wrap me; |
|
1231 |
"/ as in: |
|
1232 |
||
1233 |
"/ public static void main(String args[]) { |
|
1234 |
"/ Frame f = new Frame("myName"); |
|
1235 |
"/ mySelf me = new mySelf(); |
|
1236 |
"/ |
|
1237 |
"/ me.init(); |
|
1238 |
"/ me.start(); |
|
1239 |
"/ |
|
1240 |
"/ f.add("Center", me); |
|
1241 |
"/ f.setSize(300, 300); |
|
1242 |
"/ f.show(); |
|
1243 |
"/ } |
|
1244 |
f := (Java at:'java.awt.Frame') basicNew. |
|
1245 |
f perform:#'<init>(Ljava/lang/String;)V' with:(Java as_String:self name). |
|
1246 |
self halt. |
|
1247 |
me := self basicNew. |
|
1248 |
me perform:#'<init>()V'. |
|
1249 |
self halt. |
|
1250 |
||
1251 |
stub := (Java at:'netscape.applet.EmbeddedAppletFrame') new. |
|
1252 |
me instVarNamed:'stub' put:stub. |
|
1253 |
self halt. |
|
1254 |
||
1255 |
me perform:#'init()V'. |
|
1256 |
me perform:#'start()V'. |
|
1257 |
self halt. |
|
1258 |
||
1259 |
f perform:#'add(Ljava/lang/String;Ljava/awt/Component;)Ljava/awt/Component;' |
|
1260 |
with:(Java as_String:'Center') |
|
1261 |
with:me. |
|
1262 |
self halt. |
|
1263 |
f perform:#'setSize(II)V' with:300 with:300. |
|
1264 |
self halt. |
|
1265 |
f perform:#'show()V'. |
|
1266 |
self halt. |
|
1267 |
||
1268 |
"Modified: / 3.11.1998 / 23:04:41 / cg" |
|
1269 |
! |
|
1270 |
||
1271 |
startMain |
|
1272 |
"start a thread for my main() method" |
|
1273 |
||
1274 |
^ self startMainWithArgumentString:nil |
|
1275 |
||
1276 |
"Modified: / 30.12.1998 / 20:24:58 / cg" |
|
1277 |
! |
|
1278 |
||
1279 |
startMainWithArgumentString:aCommandLineString |
|
1280 |
"start a thread for my main() method, passing a string with arguments" |
|
1281 |
||
1282 |
|p| |
|
1283 |
||
1284 |
p := Java javaProcessForMainOf:self argumentString:aCommandLineString. |
|
1285 |
p notNil ifTrue:[ |
|
1286 |
p resume. |
|
1287 |
Object abortSignal handle:[:ex | |
|
1288 |
p == JavaVM javaScreenUpdaterThread ifTrue:[self halt]. |
|
1289 |
p == JavaVM javaEventQueueThread ifTrue:[self halt]. |
|
1290 |
p terminate. |
|
1291 |
ex reject. |
|
1292 |
] do:[ |
|
1293 |
p waitUntilTerminated |
|
1294 |
]. |
|
1295 |
] |
|
1296 |
||
1297 |
"Modified: / 24.12.1999 / 02:35:04 / cg" |
|
1298 |
! ! |
|
1299 |
||
1300 |
!JavaClass methodsFor:'fileOut'! |
|
1301 |
||
1302 |
basicFileOutDefinitionOn:aStream withNameSpace:nameSpaceBoolean |
|
1281 | 1303 |
|
1304 |
| source | |
|
1305 |
source := self theNonMetaclass source. |
|
1306 |
source notNil ifTrue:[ |
|
1307 |
aStream nextPutAll: source |
|
1308 |
] ifFalse:[ |
|
1309 |
JavaDecompiler definitionOf:self on:aStream |
|
1310 |
] |
|
1311 |
||
1312 |
"Modified: / 22-03-1997 / 14:30:28 / cg" |
|
1313 |
"Modified: / 14-12-2011 / 22:22:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 1314 |
! |
1315 |
||
1316 |
fileOut |
|
1317 |
self warn:'fileOut not yet supported' |
|
1318 |
||
1319 |
"Modified: 22.3.1997 / 14:30:28 / cg" |
|
1320 |
"Created: 22.3.1997 / 14:35:43 / cg" |
|
1697
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1321 |
! |
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1322 |
|
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1323 |
fileOutMethod:aMethod on:aStream |
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1324 |
"file out aMethod onto aStream. Used for example to write individual changeChunks" |
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1325 |
|
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1326 |
|cat source privacy| |
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1327 |
|
1812 | 1328 |
self assert: aMethod programmingLanguage isSmalltalk. |
1329 |
||
1697
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1330 |
aStream nextPutChunkSeparator. |
1812 | 1331 |
"/ aStream nextPutAll: 'JAVA'. |
1332 |
"/ (self name tokensBasedOn: $/) do:[:each| |
|
1333 |
"/ aStream space; nextPutAll: each. |
|
1334 |
"/ ]. |
|
1335 |
aStream nextPutAll:'(Java classForName:'''. |
|
1336 |
aStream nextPutAll:(self name copyReplaceAll:$/ with: $.). |
|
1337 |
aStream nextPutAll:''')'. |
|
1338 |
||
1697
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1339 |
(privacy := aMethod privacy) ~~ #public ifTrue:[ |
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1340 |
aStream space; nextPutAll:privacy; nextPutAll:'MethodsFor:'. |
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1341 |
] ifFalse:[ |
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1342 |
aStream nextPutAll:' methodsFor:'. |
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1343 |
]. |
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1344 |
|
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1345 |
cat := aMethod category ? ''. |
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1346 |
aStream nextPutAll:cat asString storeString. |
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1347 |
aStream nextPutChunkSeparator; cr; cr. |
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1348 |
|
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1349 |
source := aMethod source. |
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1350 |
source isNil ifTrue:[ |
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1351 |
FileOutErrorSignal |
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1352 |
raiseRequestWith:self |
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1353 |
errorString:(' - no source for method: ' , |
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1354 |
self name , '>>' , |
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1355 |
(self selectorAtMethod:aMethod)) |
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1356 |
] ifFalse:[ |
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1357 |
aStream nextChunkPut:source. |
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1358 |
]. |
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1359 |
aStream space. |
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1360 |
aStream nextPutChunkSeparator. |
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1361 |
aStream cr |
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1362 |
|
0a9d598a6408
- Initial support for fileouting Java extension methods
vranyj1
parents:
1691
diff
changeset
|
1363 |
"Created: / 05-09-2012 / 00:01:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1812 | 1364 |
"Modified: / 07-11-2012 / 23:43:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 1365 |
! ! |
1366 |
||
1468 | 1367 |
!JavaClass methodsFor:'interop support'! |
1368 |
||
1369 |
perform:aMessage onReceiver:receiver from:sender ifNotFound:aBlock |
|
1370 |
||
1371 |
| lo method selector class args| |
|
1372 |
selector := aMessage selector. |
|
1373 |
args := aMessage arguments. |
|
1374 |
||
1375 |
(selector includes: $() ifTrue:[ |
|
1376 |
"Java selector, search static methods" |
|
1495
e661836af8e6
Interop fixes for long and double arguments (take two slots in arg vector)
vranyj1
parents:
1483
diff
changeset
|
1377 |
method := methodDictionary at:selector ifAbsent:[nil]. |
1468 | 1378 |
method notNil ifTrue:[ |
1379 |
method isStatic ifTrue:[ |
|
1380 |
^ method |
|
1381 |
valueWithReceiver:self |
|
1382 |
arguments:args |
|
1383 |
]. |
|
1384 |
]. |
|
1385 |
]. |
|
1386 |
||
1387 |
class := self class. |
|
1388 |
||
1389 |
JavaLookup isNil ifTrue:[ |
|
1390 |
(Smalltalk loadPackage: 'stx:libjava/experiments') ifFalse:[ |
|
1391 |
self error: 'You should load package stx:libjava/experiments if you want some interop - still experimental' mayProceed: true. |
|
1392 |
^nil |
|
1393 |
] |
|
1394 |
]. |
|
1395 |
||
1396 |
||
1639 | 1397 |
lo := class getLookupObject isNil ifTrue: [ JavaLookup instance ] ifFalse: [ class lookupObject ]. |
1468 | 1398 |
|
1399 |
method := lo lookupMethodForSelector: selector |
|
1400 |
directedTo: class |
|
1401 |
for: receiver |
|
1402 |
withArguments: args |
|
1403 |
from: thisContext sender |
|
1404 |
ilc: nil. |
|
1405 |
||
1406 |
method isNil ifTrue:[ |
|
1407 |
^aBlock value. |
|
1408 |
] ifFalse:[ |
|
1409 |
^ method valueWithReceiver: receiver arguments: args |
|
1410 |
]. |
|
1411 |
||
1412 |
"Created: / 19-09-2011 / 23:33:06 / Jan Kurs <kursjan@fit.cvut.cz>" |
|
1413 |
"Modified: / 10-04-2012 / 16:47:31 / kursjan" |
|
1639 | 1414 |
"Modified: / 21-08-2012 / 13:32:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1468 | 1415 |
! ! |
1416 |
||
752 | 1417 |
!JavaClass methodsFor:'java initialization'! |
1418 |
||
1419 |
classInit |
|
1420 |
"call the classes JAVA clinit function" |
|
1246
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1241
diff
changeset
|
1421 |
|
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1241
diff
changeset
|
1422 |
| m | |
1523
f5ffdad83ab9
Access to ACC_* and ACX_* constants unified. The only definition is in JavaConstants
vranyj1
parents:
1511
diff
changeset
|
1423 |
(accessFlags bitAnd: ACX_INITIALIZED) ~~ 0 ifTrue: [ ^ self ]. |
1526 | 1424 |
(accessFlags bitAnd: ACX_INITIALIZING) ~~ 0 ifTrue: [ ^ self ]. |
1425 |
accessFlags := accessFlags bitOr: ACX_INITIALIZING. |
|
1246
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1241
diff
changeset
|
1426 |
superclass ~~ JavaObject ifTrue: [ superclass classInit ]. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1241
diff
changeset
|
1427 |
"JV@2011-12-03: Also call initializeStaticFields" |
1205 | 1428 |
self initializeStaticFields. |
1246
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1241
diff
changeset
|
1429 |
m := self compiledMethodAt: #'<clinit>()V'. |
1526 | 1430 |
m notNil ifTrue: [ |
1431 |
"/Logger log: ('calling <clinit>()V of %1' bindWith: self name) severity: #trace facility: 'JVM'. |
|
1246
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1241
diff
changeset
|
1432 |
OrderOfClassInits notNil ifTrue: [ OrderOfClassInits add: self. ]. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1241
diff
changeset
|
1433 |
m |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1241
diff
changeset
|
1434 |
valueWithReceiver: self |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1241
diff
changeset
|
1435 |
arguments: #() |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1241
diff
changeset
|
1436 |
selector: #'<clinit>()V' |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1241
diff
changeset
|
1437 |
search: self class |
1526 | 1438 |
sender: nil. |
1439 |
"/Logger log: ('calling <clinit>()V of %1 done' bindWith: self name) severity: #trace facility: 'JVM'. |
|
752 | 1440 |
]. |
1526 | 1441 |
accessFlags := accessFlags bitOr: ACX_INITIALIZED. |
1442 |
accessFlags := accessFlags bitAnd: ACX_INITIALIZING bitInvert32. |
|
1443 |
||
1246
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1241
diff
changeset
|
1444 |
(JavaVM booted and: [JavaVM eagerResolvingEnabled] )ifTrue: [ |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1241
diff
changeset
|
1445 |
JavaClassReader classLoaderQuerySignal answer: classLoader |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1241
diff
changeset
|
1446 |
do: [ self resolveAll. ] |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1241
diff
changeset
|
1447 |
]. |
752 | 1448 |
|
1449 |
" |
|
1450 |
JavaVM instructionTrace:true. |
|
1451 |
JavaVM callTrace:true. |
|
1452 |
||
1453 |
(Java classNamed:'java.lang.String') classInit |
|
1454 |
(Java classNamed:'java.lang.System') classInit |
|
1455 |
||
1456 |
(Java classNamed:'java/io/FileDescriptor') classInit |
|
1246
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1241
diff
changeset
|
1457 |
(Java classNamed:'java.util.Properties') classInit" |
752 | 1458 |
|
1459 |
"Modified: / 12-11-1998 / 15:41:11 / cg" |
|
920 | 1460 |
"Modified: / 18-08-2011 / 19:37:33 / jv" |
1205 | 1461 |
"Modified: / 03-12-2011 / 12:19:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1246
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1241
diff
changeset
|
1462 |
"Modified: / 08-12-2011 / 21:05:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 1463 |
! |
1464 |
||
1732 | 1465 |
classInitInternal |
1466 |
"Called by the JIT-compiled code when a class needs to be initialized" |
|
1467 |
||
1468 |
self classInit. |
|
1469 |
"Force recompilation" |
|
1470 |
thisContext sender method flushCode. |
|
1471 |
||
1472 |
! |
|
1473 |
||
1362 | 1474 |
classInitSpecial |
1527 | 1475 |
"Called by the VM when a class needs to be initialized" |
1476 |
||
1362 | 1477 |
self classInit. |
1478 |
||
1479 |
"Created: / 08-02-2012 / 23:43:57 / mh <hlopik@gmail.com>" |
|
1527 | 1480 |
"Modified: / 17-07-2012 / 20:54:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1362 | 1481 |
! |
1482 |
||
752 | 1483 |
initializeStaticFields |
1484 |
staticFields isNil ifTrue:[^ self]. |
|
1485 |
||
1486 |
staticFields do:[:f | |
|
1205 | 1487 |
|val type| |
1488 |
||
1489 |
(val := f constantValue) isNil ifTrue:[ |
|
1490 |
"/ careful: int/long etc. constants must be initialized |
|
1491 |
"/ with correct type. |
|
1492 |
type := f type. |
|
1493 |
type == #long ifTrue:[ |
|
1494 |
val := 0. |
|
1495 |
] ifFalse:[type == #int ifTrue:[ |
|
1496 |
val := 0. |
|
1497 |
] ifFalse:[type == #float ifTrue:[ |
|
1498 |
val := 0.0 asShortFloat |
|
1499 |
] ifFalse:[type == #double ifTrue:[ |
|
1500 |
val := 0.0 |
|
1501 |
] ifFalse:[type == #byte ifTrue:[ |
|
1502 |
val := 0. |
|
1503 |
] ifFalse:[type == #char ifTrue:[ |
|
1504 |
val := 0. |
|
1505 |
] ifFalse:[type == #'unsigned short' ifTrue:[ |
|
1506 |
val := 0. |
|
1507 |
] ifFalse:[type == #boolean ifTrue:[ |
|
1508 |
val := 0. |
|
1509 |
]]]]]]]]. |
|
1510 |
] ifFalse:[ |
|
1511 |
val class == JavaStringRef2 ifTrue:[ |
|
1512 |
val := val resolve |
|
1513 |
]. |
|
1514 |
]. |
|
1515 |
self instVarNamed:(f name) put:val. |
|
752 | 1516 |
]. |
1205 | 1517 |
|
1518 |
"Modified: / 03-12-2011 / 12:28:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1135
79bdd1501934
java.lang.ClassLoader>>resolveClass0 native method now resolves whole constant pool
hlopkmar
parents:
1109
diff
changeset
|
1519 |
! |
79bdd1501934
java.lang.ClassLoader>>resolveClass0 native method now resolves whole constant pool
hlopkmar
parents:
1109
diff
changeset
|
1520 |
|
79bdd1501934
java.lang.ClassLoader>>resolveClass0 native method now resolves whole constant pool
hlopkmar
parents:
1109
diff
changeset
|
1521 |
resolveAll |
79bdd1501934
java.lang.ClassLoader>>resolveClass0 native method now resolves whole constant pool
hlopkmar
parents:
1109
diff
changeset
|
1522 |
"resolve every ref in constantPool" |
1247
59574ba88702
making eager resolving less eager - not calling classInit on each class (because then it does not boot :P)
hlopkmar
parents:
1246
diff
changeset
|
1523 |
|
1149 | 1524 |
constantPool do: [ |
1525 |
:each | |
|
1378 | 1526 |
(each isJavaRef or: [ each isJavaNameAndType ]) ifTrue: [ |
1527 |
each resolve: false |
|
1528 |
] |
|
1149 | 1529 |
]. |
1135
79bdd1501934
java.lang.ClassLoader>>resolveClass0 native method now resolves whole constant pool
hlopkmar
parents:
1109
diff
changeset
|
1530 |
|
79bdd1501934
java.lang.ClassLoader>>resolveClass0 native method now resolves whole constant pool
hlopkmar
parents:
1109
diff
changeset
|
1531 |
"Created: / 18-11-2011 / 15:26:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1378 | 1532 |
"Modified: / 23-02-2012 / 17:14:09 / Marcel Hlopko <hlopik@gmail.com>" |
752 | 1533 |
! ! |
1534 |
||
1535 |
!JavaClass methodsFor:'java instance creation'! |
|
1536 |
||
1793 | 1537 |
basicNew |
1538 |
"Create a new cleared JAVA instance. Its instVars are cleared to the |
|
1539 |
corresponding typed values; however, constructor is not invoked." |
|
1796 | 1540 |
|
1541 |
"/ Reimplemeted for speed as a C function. That function is |
|
1542 |
"/ also called from JIT-compiled code, resulting in 40-50% speedup |
|
1543 |
"/ when running Java code |
|
1544 |
||
1545 |
%{ |
|
1546 |
extern OBJ ___new(); |
|
1547 |
RETURN ( ___new(self) ); |
|
1548 |
%}. |
|
1549 |
" |
|
1550 |
memory allocation failed. |
|
1551 |
When we arrive here, there was no memory, even after |
|
1552 |
a garbage collect. |
|
1553 |
This means, that the VM wanted to get some more memory from the |
|
1554 |
Operatingsystem, which was not kind enough to give it. |
|
1555 |
Bad luck - you should increase the swap space on your machine. |
|
1556 |
" |
|
1557 |
^ ObjectMemory allocationFailureSignal raise. |
|
1558 |
||
1559 |
||
1560 |
"/ Following code is original Smalltalk implementation" |
|
1561 |
||
1562 |
||
1563 |
"/| newJavaObject |
|
1564 |
"/ sz "{ Class: SmallInteger }" |
|
1565 |
"/ offs "{ Class: SmallInteger }" |
|
1566 |
"/| |
|
1567 |
" |
|
1793 | 1568 |
(accessFlags bitAnd: ACX_ABSTRACT_OR_INTERFACE) ~~ 0 ifTrue: [ |
1569 |
JavaVM throwInstantiationExceptionFor: self. |
|
1570 |
^ nil |
|
1571 |
]. |
|
1572 |
newJavaObject := super basicNew. |
|
1794 | 1573 |
offs := JavaObject instSize. |
1574 |
offs > 0 ifTrue:[ |
|
1575 |
"Assume first is lockword" |
|
1576 |
newJavaObject instVarAt: 1 put: 0. |
|
1793 | 1577 |
]. |
1794 | 1578 |
initValues notNil ifTrue: [ |
1579 |
sz := self instSize. |
|
1795 | 1580 |
offs + 1 to: sz do: [:i | newJavaObject instVarAt: i put: (initValues at: i - offs) ]. |
1793 | 1581 |
]. |
1794 | 1582 |
self hasFinalize ifTrue:[ |
1583 |
newJavaObject registerForFinalization |
|
1584 |
]. |
|
1585 |
||
1586 |
||
1793 | 1587 |
^ newJavaObject |
1796 | 1588 |
" |
1793 | 1589 |
|
1590 |
" |
|
1591 |
(Java classNamed:'java.lang.String') basicNew inspect |
|
1592 |
(Java classNamed:'java.lang.String') newCleared inspect |
|
1796 | 1593 |
(Java classNamed:'java.lang.String') new inspect |
1594 |
" |
|
1793 | 1595 |
|
1596 |
"Created: / 02-11-2012 / 21:02:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1597 |
! |
|
1598 |
||
752 | 1599 |
initValueFor:instVarName |
1600 |
|idx field| |
|
1601 |
||
1602 |
idx := fields findFirst:[:field | field name = instVarName]. |
|
1603 |
idx == 0 ifTrue:[ |
|
1691 | 1604 |
superclass ~~ JavaObject ifTrue:[ |
1605 |
^ superclass initValueFor:instVarName |
|
1606 |
]. |
|
1607 |
^0 "/lockWord" |
|
752 | 1608 |
] ifFalse:[ |
1691 | 1609 |
field := fields at:idx. |
1610 |
^ field initialValue |
|
752 | 1611 |
]. |
1691 | 1612 |
|
1613 |
"Modified: / 26-08-2012 / 20:08:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 1614 |
! |
1615 |
||
1616 |
newCleared |
|
1793 | 1617 |
<resource: #obsolete> |
1618 |
"Use #basicNew" |
|
1619 |
||
1620 |
^self basicNew |
|
752 | 1621 |
|
1622 |
"Modified: / 13-11-1998 / 14:10:45 / cg" |
|
1623 |
"Modified: / 10-03-2011 / 22:38:40 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1793 | 1624 |
"Modified: / 02-11-2012 / 21:08:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 1625 |
! |
1626 |
||
1627 |
newWith_String:argString |
|
1628 |
"create a new instance, preset its fields, |
|
1629 |
and call its JAVA init function passing a String arg" |
|
1630 |
||
1631 |
|newJavaObject| |
|
1632 |
||
1793 | 1633 |
newJavaObject := self basicNew. |
752 | 1634 |
newJavaObject |
1793 | 1635 |
perform:#'<init>(Ljava/lang/String;)V' |
1636 |
with:(Java as_String:argString). |
|
752 | 1637 |
^ newJavaObject |
1638 |
||
1639 |
" |
|
1640 |
((Java classNamed:'java.lang.ArrayStoreException') newWith_String:'foo') inspect |
|
1641 |
" |
|
1642 |
||
1793 | 1643 |
"Modified: / 04-11-1998 / 18:04:34 / cg" |
1644 |
"Created: / 13-11-1998 / 14:17:01 / cg" |
|
1645 |
"Modified: / 02-11-2012 / 21:11:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 1646 |
! |
1647 |
||
1648 |
newWith_int:arg |
|
1649 |
"create a new instance, preset its fields, |
|
1650 |
and call its JAVA init function passing an int arg" |
|
1651 |
||
1652 |
|newJavaObject| |
|
1653 |
||
1793 | 1654 |
newJavaObject := self basicNew. |
752 | 1655 |
newJavaObject perform:#'<init>(I)V' with:arg. |
1656 |
^ newJavaObject |
|
1657 |
||
1658 |
" |
|
1659 |
((Java classNamed:'java.lang.Integer') newWith_int:123) inspect |
|
1660 |
" |
|
1661 |
||
1793 | 1662 |
"Modified: / 04-11-1998 / 18:04:34 / cg" |
1663 |
"Created: / 13-11-1998 / 14:17:01 / cg" |
|
1664 |
"Modified: / 02-11-2012 / 21:11:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 1665 |
! ! |
1666 |
||
1425
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1667 |
!JavaClass methodsFor:'java instance creation-proxying'! |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1668 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1669 |
new |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1670 |
"create a new instance, preset its fields, |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1671 |
and call its JAVA init function" |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1672 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1673 |
|newJavaObject| |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1674 |
|
1793 | 1675 |
newJavaObject := self basicNew. |
1502
8caaac85827f
Initialization of Java Classes changed to be compatible with TO (I hope I did not broke anything!)
kursjan
parents:
1495
diff
changeset
|
1676 |
newJavaObject initialize. |
1425
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1677 |
^ newJavaObject |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1678 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1679 |
" |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1680 |
(Java classNamed:'java.lang.String') basicNew inspect |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1681 |
(Java classNamed:'java.lang.String') newCleared inspect |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1682 |
(Java classNamed:'java.lang.String') new inspect |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1683 |
" |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1684 |
|
1502
8caaac85827f
Initialization of Java Classes changed to be compatible with TO (I hope I did not broke anything!)
kursjan
parents:
1495
diff
changeset
|
1685 |
"Modified: / 04-11-1998 / 18:04:34 / cg" |
8caaac85827f
Initialization of Java Classes changed to be compatible with TO (I hope I did not broke anything!)
kursjan
parents:
1495
diff
changeset
|
1686 |
"Modified: / 09-06-2012 / 21:48:36 / Jan Kurs (kursjan@fit.cvut.cz)" |
1793 | 1687 |
"Modified: / 02-11-2012 / 21:10:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1425
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1688 |
! |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1689 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1690 |
new: arg1 |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1691 |
"create a new instance and call one-arg constructor" |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1692 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1693 |
|newJavaObject| |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1694 |
|
1793 | 1695 |
newJavaObject := self basicNew. |
1425
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1696 |
newJavaObject perform:#'<init>:' with: arg1. |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1697 |
^ newJavaObject |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1698 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1699 |
" |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1700 |
(Java classNamed:'java.lang.String') basicNew inspect |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1701 |
(Java classNamed:'java.lang.String') newCleared inspect |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1702 |
(Java classNamed:'java.lang.String') new inspect |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1703 |
" |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1704 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1705 |
"Modified: / 04-11-1998 / 18:04:34 / cg" |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1706 |
"Created: / 17-03-2012 / 15:09:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1793 | 1707 |
"Modified: / 02-11-2012 / 21:10:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1425
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1708 |
! |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1709 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1710 |
new: arg1 _: arg2 |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1711 |
^self new: arg1 with: arg2 |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1712 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1713 |
"Modified: / 04-11-1998 / 18:04:34 / cg" |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1714 |
"Created: / 17-03-2012 / 15:12:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1715 |
! |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1716 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1717 |
new: arg1 _: arg2 _: arg3 |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1718 |
^self new: arg1 with: arg2 with: arg3 |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1719 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1720 |
"Modified: / 04-11-1998 / 18:04:34 / cg" |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1721 |
"Created: / 17-03-2012 / 15:13:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1722 |
! |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1723 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1724 |
new: arg1 _: arg2 _: arg3 _: arg4 |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1725 |
^self new: arg1 with: arg2 with: arg3 with: arg4 |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1726 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1727 |
"Modified: / 04-11-1998 / 18:04:34 / cg" |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1728 |
"Created: / 17-03-2012 / 15:13:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1729 |
! |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1730 |
|
1449 | 1731 |
new: arg1 _: arg2 _: arg3 _: arg4 _: arg5 |
1732 |
^ self |
|
1733 |
new: arg1 |
|
1734 |
with: arg2 |
|
1735 |
with: arg3 |
|
1736 |
with: arg4 |
|
1737 |
with: arg5 |
|
1738 |
||
1739 |
"Modified: / 04-11-1998 / 18:04:34 / cg" |
|
1740 |
"Created: / 17-03-2012 / 15:13:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1741 |
"Created: / 03-04-2012 / 12:17:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1742 |
! |
|
1743 |
||
1425
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1744 |
new: arg1 with: arg2 |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1745 |
"create a new instance and call 2-arg constructor" |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1746 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1747 |
|newJavaObject| |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1748 |
|
1793 | 1749 |
newJavaObject := self basicNew. |
1425
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1750 |
newJavaObject perform:#'<init>:_:' with: arg1 with: arg2. |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1751 |
^ newJavaObject |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1752 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1753 |
" |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1754 |
(Java classNamed:'java.lang.String') basicNew inspect |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1755 |
(Java classNamed:'java.lang.String') newCleared inspect |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1756 |
(Java classNamed:'java.lang.String') new inspect |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1757 |
" |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1758 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1759 |
"Modified: / 04-11-1998 / 18:04:34 / cg" |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1760 |
"Created: / 17-03-2012 / 15:12:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1793 | 1761 |
"Modified: / 02-11-2012 / 21:10:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1425
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1762 |
! |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1763 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1764 |
new: arg1 with: arg2 with: arg3 |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1765 |
"create a new instance and call 3-arg constructor" |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1766 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1767 |
|newJavaObject| |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1768 |
|
1793 | 1769 |
newJavaObject := self basicNew. |
1425
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1770 |
newJavaObject perform:#'<init>:_:_:' with: arg1 with: arg2 with: arg3. |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1771 |
^ newJavaObject |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1772 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1773 |
" |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1774 |
(Java classNamed:'java.lang.String') basicNew inspect |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1775 |
(Java classNamed:'java.lang.String') newCleared inspect |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1776 |
(Java classNamed:'java.lang.String') new inspect |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1777 |
" |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1778 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1779 |
"Modified: / 04-11-1998 / 18:04:34 / cg" |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1780 |
"Created: / 17-03-2012 / 15:12:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1793 | 1781 |
"Modified: / 02-11-2012 / 21:10:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1425
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1782 |
! |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1783 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1784 |
new: arg1 with: arg2 with: arg3 with: arg4 |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1785 |
"create a new instance and call 4-arg constructor" |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1786 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1787 |
|newJavaObject| |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1788 |
|
1793 | 1789 |
newJavaObject := self basicNew. |
1425
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1790 |
newJavaObject perform:#'<init>:_:_:_:' with: arg1 with: arg2 with: arg3 with: arg4. |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1791 |
^ newJavaObject |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1792 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1793 |
" |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1794 |
(Java classNamed:'java.lang.String') basicNew inspect |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1795 |
(Java classNamed:'java.lang.String') newCleared inspect |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1796 |
(Java classNamed:'java.lang.String') new inspect |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1797 |
" |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1798 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1799 |
"Modified: / 04-11-1998 / 18:04:34 / cg" |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1800 |
"Created: / 17-03-2012 / 15:12:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1793 | 1801 |
"Modified: / 02-11-2012 / 21:10:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1447 | 1802 |
! |
1803 |
||
1804 |
new: arg1 with: arg2 with: arg3 with: arg4 with: arg5 |
|
1805 |
"create a new instance and call 4-arg constructor" |
|
1806 |
||
1807 |
| newJavaObject | |
|
1793 | 1808 |
newJavaObject := self basicNew. |
1447 | 1809 |
newJavaObject |
1810 |
perform: #'<init>:_:_:_:_:' |
|
1811 |
with: arg1 |
|
1812 |
with: arg2 |
|
1813 |
with: arg3 |
|
1814 |
with: arg4 |
|
1815 |
with: arg5. |
|
1816 |
^ newJavaObject |
|
1817 |
||
1818 |
" |
|
1819 |
(Java classNamed:'java.lang.String') basicNew inspect |
|
1820 |
(Java classNamed:'java.lang.String') newCleared inspect |
|
1821 |
(Java classNamed:'java.lang.String') new inspect" |
|
1822 |
||
1823 |
"Modified: / 04-11-1998 / 18:04:34 / cg" |
|
1824 |
"Created: / 17-03-2012 / 15:12:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1825 |
"Created: / 02-04-2012 / 10:52:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1793 | 1826 |
"Modified: / 02-11-2012 / 21:10:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1425
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1827 |
! ! |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1828 |
|
752 | 1829 |
!JavaClass methodsFor:'message sending'! |
1830 |
||
1831 |
doesNotUnderstand:aMessage |
|
1344 | 1832 |
| sender | |
1833 |
sender := thisContext sender. |
|
1834 |
^self |
|
1835 |
perform: aMessage |
|
1836 |
onReceiver: self |
|
1837 |
from: sender |
|
1838 |
ifNotFound: [ super doesNotUnderstand: aMessage ]. |
|
752 | 1839 |
|
1281 | 1840 |
"Modified: / 16-11-1998 / 16:50:56 / cg" |
1841 |
"Modified: / 19-09-2011 / 23:43:56 / Jan Kurs <kursjan@fit.cvut.cz>" |
|
1344 | 1842 |
"Modified (comment): / 01-01-2012 / 19:36:41 / kursjan <kursjan@fit.cvut.cz>" |
1843 |
"Modified: / 03-01-2012 / 21:02:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1425
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1844 |
! |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1845 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1846 |
lookupFieldFor:fname static: searchStatic onlyPublic: publicOnly |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1847 |
"Lookup a field with given name in class and all |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1848 |
its subclasses, return an instance of JavaField |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1849 |
or nil, if none is found. |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1850 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1851 |
If searchStatic is true, static fields are searched, |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1852 |
otherwise it searches inst and interface fields. |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1853 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1854 |
If publicOnly is true, only public field are searched" |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1855 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1856 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1857 |
| cls field | |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1858 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1859 |
cls := self. |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1860 |
[ cls ~~ JavaObject ] whileTrue:[ |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1861 |
searchStatic ifTrue:[ |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1862 |
field := cls findStaticFieldByName: fname. |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1863 |
field isNil ifTrue:[ |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1864 |
field := cls findInterfaceFieldByName: fname |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1865 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1866 |
] |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1867 |
] ifFalse:[ |
1452
69dcb9c33742
Some more support for finally block when a Smalltalk exception is thrown - not yet working correctly
vranyj1
parents:
1449
diff
changeset
|
1868 |
field := cls findInstFieldByName: fname |
1425
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1869 |
]. |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1870 |
field notNil ifTrue:[ |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1871 |
(publicOnly and:[field isPublic not]) ifTrue:[ |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1872 |
^ nil |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1873 |
] ifFalse:[ |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1874 |
^ field |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1875 |
] |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1876 |
]. |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1877 |
cls := cls superclass. |
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1878 |
]. |
1427
13f3765a9bba
Some experiments with Exceptions, not that easy :-)
vranyj1
parents:
1425
diff
changeset
|
1879 |
^nil. |
1425
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1880 |
|
820078605f73
- Improvements in interop - now can generate getters to public field.
vranyj1
parents:
1393
diff
changeset
|
1881 |
"Created: / 17-03-2012 / 16:41:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 1882 |
! ! |
1883 |
||
1884 |
||
1885 |
!JavaClass methodsFor:'printOut'! |
|
1886 |
||
1887 |
printNameInHierarchy |
|
1888 |
"return my name as printed in the hierarchy" |
|
1889 |
||
1890 |
^ self displayString |
|
1891 |
||
1892 |
"Modified: 22.3.1997 / 14:16:55 / cg" |
|
1893 |
! |
|
1894 |
||
1895 |
printOutOn:aStream |
|
1896 |
self warn:'printOut not yet supported' |
|
1897 |
||
1898 |
"Created: 22.3.1997 / 14:36:12 / cg" |
|
1899 |
! |
|
1900 |
||
1901 |
printOutProtocolOn:aStream |
|
1902 |
self warn:'printOut not yet supported' |
|
1903 |
||
1904 |
"Created: 22.3.1997 / 14:36:28 / cg" |
|
1905 |
! ! |
|
1906 |
||
1907 |
!JavaClass methodsFor:'printing & storing'! |
|
1908 |
||
1909 |
displayString |
|
1910 |
^ fullName copyReplaceAll:$/ with:$. |
|
1911 |
||
1912 |
"/ ^ 'JAVA-' , name . |
|
1913 |
"/ ^ name , '(Java)' "/ 'JavaClass(' , name , ')' |
|
1914 |
||
1915 |
"Created: / 15.4.1996 / 16:02:48 / cg" |
|
1916 |
"Modified: / 18.7.1998 / 22:56:30 / cg" |
|
1917 |
! ! |
|
1918 |
||
1919 |
!JavaClass methodsFor:'private accessing'! |
|
1920 |
||
1921 |
addMethod:m name:name signature:signature |
|
1922 |
|sel| |
|
1923 |
||
1924 |
sel := (name , signature) asSymbol. |
|
1453 | 1925 |
self primAddSelector:sel withMethod:m. |
752 | 1926 |
^ self. |
1927 |
||
1928 |
"/ selectorArray isNil ifTrue:[ |
|
1929 |
"/ selectorArray := #(). |
|
1930 |
"/ methodArray := #() |
|
1931 |
"/ ]. |
|
1932 |
"/ selectorArray := selectorArray copyWith:(name , signature) asSymbol. "/ name. |
|
1933 |
"/"/ selectorArray := selectorArray copyWith:name asSymbol. "/ name. |
|
1934 |
"/ methodArray := methodArray copyWith:m |
|
1935 |
||
1453 | 1936 |
"Created: / 15-04-1996 / 16:42:52 / cg" |
1937 |
"Modified: / 04-04-2012 / 01:18:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 1938 |
! |
1939 |
||
1940 |
addSelector:newSelector withMethod:newMethod |
|
1483 | 1941 |
|
1942 |
^super addSelector:newSelector withMethod:newMethod |
|
1943 |
||
1944 |
"/ "redefined to not flush smalltalk caches and send NO smalltalk-class |
|
1945 |
"/ change notification. Will eventually flush Java caches." |
|
1946 |
"/ |
|
1947 |
"/ |nargs oldMethod| |
|
1948 |
"/ |
|
1949 |
"/ oldMethod := self compiledMethodAt:newSelector. |
|
1950 |
"/ (self primAddSelector:newSelector withMethod:newMethod) ifFalse:[^ false]. |
|
1951 |
"/ |
|
1952 |
"/ ^ true |
|
1953 |
"/ |
|
1954 |
"/ |
|
1955 |
||
1956 |
"Created: / 20-01-1997 / 13:00:48 / cg" |
|
1957 |
"Modified: / 20-04-2012 / 20:27:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 1958 |
! |
1959 |
||
1960 |
setAccessFlags:flags |
|
1961 |
accessFlags := flags. |
|
1962 |
||
1963 |
"Created: 15.4.1996 / 16:42:52 / cg" |
|
1964 |
! |
|
1965 |
||
1966 |
setBinaryFilePath:aPathName |
|
1967 |
binaryFilePath := aPathName |
|
1968 |
! |
|
1969 |
||
1970 |
setFields:f |
|
1794 | 1971 |
| nignored nvals vals names | |
752 | 1972 |
|
1973 |
JavaClass setInstanceVariableStringFromFields:f in:self. |
|
1974 |
||
1975 |
instSize := superclass instSize + f size. |
|
1976 |
fields := f. |
|
1977 |
||
1978 |
f withIndexDo:[:field :index| |
|
1979 |
field setClass: self. |
|
1980 |
field setIndex: superclass instSize + index. |
|
1981 |
]. |
|
1982 |
||
1794 | 1983 |
"Now, collect initValues. Ignore the lockword, if any" |
1984 |
nignored := JavaObject instSize. "/except possible instvars in JavaObject (lockword) |
|
1985 |
nvals := self instSize - nignored. |
|
1986 |
nvals > 0 ifTrue:[ |
|
1987 |
vals := Array new: nvals. |
|
1988 |
names := self allInstVarNames. |
|
1989 |
JavaObject instSize + 1 to: names size do:[:i| |
|
1990 |
| val | |
|
1991 |
val := self initValueFor: (names at: i). |
|
1992 |
val notNil ifTrue:[ |
|
1993 |
vals at: i - nignored put: val. |
|
1994 |
initValues := vals. |
|
1995 |
] |
|
1996 |
]. |
|
752 | 1997 |
] |
1998 |
||
1999 |
"Created: / 15-04-1996 / 16:42:52 / cg" |
|
2000 |
"Modified: / 06-11-1998 / 01:53:01 / cg" |
|
1794 | 2001 |
"Modified: / 02-11-2012 / 21:49:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 2002 |
! |
2003 |
||
2004 |
setFullName:aString |
|
2005 |
|nameComponents| |
|
2006 |
||
2007 |
fullName := aString asSymbol. |
|
2008 |
"/ nameComponents := aString asCollectionOfSubstringsSeparatedBy:$/. |
|
2009 |
"/ name := nameComponents last asSymbol. |
|
2010 |
name := fullName. |
|
2011 |
||
2012 |
"Created: / 15.4.1996 / 16:42:52 / cg" |
|
2013 |
"Modified: / 5.11.1998 / 19:14:39 / cg" |
|
2014 |
! |
|
2015 |
||
1372
dea574a1b6b3
Some initial class reloading support. Not yet finished, just sketched out.
vranyj1
parents:
1368
diff
changeset
|
2016 |
setInterfaces: i |
dea574a1b6b3
Some initial class reloading support. Not yet finished, just sketched out.
vranyj1
parents:
1368
diff
changeset
|
2017 |
|
dea574a1b6b3
Some initial class reloading support. Not yet finished, just sketched out.
vranyj1
parents:
1368
diff
changeset
|
2018 |
super setInterfaces: i. |
752 | 2019 |
i size > 0 ifTrue:[ |
1372
dea574a1b6b3
Some initial class reloading support. Not yet finished, just sketched out.
vranyj1
parents:
1368
diff
changeset
|
2020 |
i do:[:iface| |
dea574a1b6b3
Some initial class reloading support. Not yet finished, just sketched out.
vranyj1
parents:
1368
diff
changeset
|
2021 |
iface name = 'groovy/lang/GroovyObject' ifTrue:[ |
1453 | 2022 |
self class changeClassTo: GroovyMetaclass. |
1372
dea574a1b6b3
Some initial class reloading support. Not yet finished, just sketched out.
vranyj1
parents:
1368
diff
changeset
|
2023 |
self class setSuperclass: GroovyClass. |
dea574a1b6b3
Some initial class reloading support. Not yet finished, just sketched out.
vranyj1
parents:
1368
diff
changeset
|
2024 |
] |
dea574a1b6b3
Some initial class reloading support. Not yet finished, just sketched out.
vranyj1
parents:
1368
diff
changeset
|
2025 |
] |
752 | 2026 |
] |
2027 |
||
1372
dea574a1b6b3
Some initial class reloading support. Not yet finished, just sketched out.
vranyj1
parents:
1368
diff
changeset
|
2028 |
"Created: / 20-02-2012 / 22:47:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 2029 |
! |
2030 |
||
1368 | 2031 |
setSource: aString |
2032 |
self assert: aString isString. |
|
2033 |
sourceString := aString |
|
2034 |
||
2035 |
"Created: / 15-04-1996 / 16:42:52 / cg" |
|
2036 |
"Created: / 18-02-2012 / 19:10:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2037 |
! |
|
2038 |
||
752 | 2039 |
setSourceFile:aFilename |
2040 |
sourceFile := aFilename. |
|
2041 |
||
2042 |
"Created: 15.4.1996 / 16:42:52 / cg" |
|
2043 |
! |
|
2044 |
||
2045 |
setStaticFields:f |
|
2046 |
JavaClass setInstanceVariableStringFromFields:f in:self class. |
|
2047 |
||
2048 |
staticFields := f. |
|
2049 |
||
918 | 2050 |
"Modified: / 17-08-2011 / 09:26:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 2051 |
! |
2052 |
||
2053 |
setSuperclass:aClass |
|
2054 |
|iVars numIvars| |
|
2055 |
||
2056 |
aClass isNil ifTrue:[ |
|
2057 |
super setSuperclass:JavaObject |
|
2058 |
] ifFalse:[ |
|
2059 |
(aClass isMemberOf:JavaUnresolvedClassConstant) ifTrue:[ |
|
2060 |
self halt. |
|
2061 |
]. |
|
2062 |
super setSuperclass:aClass. |
|
2063 |
]. |
|
2064 |
||
2065 |
iVars := self instVarNames. |
|
2066 |
((numIvars := iVars size) > 0) ifTrue:[ |
|
2067 |
(superclass notNil and:[(superclass isMemberOf:JavaUnresolvedClassConstant) not]) ifTrue:[ |
|
2068 |
instSize := superclass instSize + numIvars |
|
2069 |
] ifFalse:[ |
|
2070 |
instSize := numIvars |
|
2071 |
] |
|
2072 |
]. |
|
2073 |
||
2074 |
"Created: 15.4.1996 / 16:42:52 / cg" |
|
2075 |
"Modified: 22.8.1997 / 15:06:45 / cg" |
|
2076 |
! ! |
|
2077 |
||
2078 |
!JavaClass methodsFor:'private-changes management'! |
|
2079 |
||
2080 |
writingChangeWithTimeStamp:doStampIt do:aBlock |
|
2081 |
||
2082 |
"No changes for Java classes now" |
|
2083 |
||
2084 |
"Created: / 14-12-2010 / 18:07:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2085 |
! ! |
|
2086 |
||
2087 |
!JavaClass methodsFor:'queries'! |
|
2088 |
||
2089 |
canBeSubclassed |
|
2090 |
"return true, if its allowed to create subclasses of the receiver." |
|
2091 |
||
2092 |
self isFinal ifTrue:[^ false]. |
|
2093 |
self isInterface ifTrue:[^ false]. |
|
2094 |
^ true |
|
2095 |
||
2096 |
"Created: / 5.11.1998 / 23:04:50 / cg" |
|
2097 |
! |
|
2098 |
||
1478 | 2099 |
canHaveExtensions |
2100 |
^false |
|
2101 |
||
2102 |
"Created: / 13-04-2012 / 18:55:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2103 |
! |
|
2104 |
||
752 | 2105 |
containsMethodsAnnotatedWith:aJavaTypeName |
2106 |
| methods | |
|
2107 |
||
2108 |
methods := self selectMethodsAnnotatedWith:aJavaTypeName. |
|
2109 |
methods size > 0 ifTrue:[ ^ true ]. |
|
2110 |
(self name ~= #'java/lang/Object') |
|
2111 |
ifTrue:[ ^ superclass containsMethodsAnnotatedWith:aJavaTypeName. ]. |
|
2112 |
^ false. |
|
2113 |
||
2114 |
"Created: / 02-03-2011 / 23:01:14 / Marcel Hlopko <hlopik@gmail.com>" |
|
2115 |
! |
|
2116 |
||
1794 | 2117 |
hasFinalize |
2118 |
^ (accessFlags bitAnd:ACX_HASFINALIZE) ~~ 0 |
|
2119 |
||
2120 |
"Created: / 02-11-2012 / 18:50:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2121 |
! |
|
2122 |
||
752 | 2123 |
hasInterface:aJavaInterface |
2124 |
"return true, if I respond to all methods as |
|
2125 |
required by the argument, an aJavaInterface" |
|
2126 |
||
2127 |
interfaces size > 0 ifTrue:[ |
|
2128 |
self interfaces do:[:if | |
|
2129 |
aJavaInterface == if ifTrue:[ |
|
2130 |
^ true |
|
2131 |
]. |
|
2132 |
] |
|
2133 |
]. |
|
2134 |
superclass isJavaClass ifTrue:[ |
|
2135 |
^ superclass hasInterface:aJavaInterface |
|
2136 |
]. |
|
2137 |
^ false. |
|
2138 |
||
2139 |
"/ aJavaInterface methodDictionary keysAndValuesDo:[:sel :mthd | |
|
2140 |
"/ (self canUnderstand:sel) ifFalse:[ |
|
2141 |
"/ ^ false. |
|
2142 |
"/ ] |
|
2143 |
"/ ]. |
|
2144 |
^ true |
|
2145 |
||
2146 |
"Modified: / 28.1.1998 / 01:46:16 / cg" |
|
2147 |
||
2148 |
! |
|
2149 |
||
884 | 2150 |
isAnonymous |
2151 |
||
2152 |
| i | |
|
2153 |
i := name lastIndexOf: $$. |
|
2154 |
i ~~ 0 ifTrue:[ |
|
2155 |
i + 1 to: name size do:[:i| |
|
2156 |
(name at:i) isDigit ifFalse:[^false]. |
|
2157 |
]. |
|
2158 |
^true |
|
2159 |
]. |
|
2160 |
^false |
|
2161 |
||
2162 |
" |
|
2163 |
(Java at:'java.io.Console') isAnonymous |
|
2164 |
(Java at:'java.io.Console$1') isAnonymous |
|
2165 |
(Java at:'java.io.Console$1$1') isAnonymous |
|
2166 |
(Java at:'sun.misc.Launcher$ExtClassLoader') isAnonymous |
|
2167 |
||
2168 |
" |
|
2169 |
||
2170 |
"Created: / 18-03-1997 / 17:48:01 / cg" |
|
2171 |
"Created: / 07-08-2011 / 15:50:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2172 |
! |
|
2173 |
||
1246
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1241
diff
changeset
|
2174 |
isFullyResolved |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1241
diff
changeset
|
2175 |
constantPool do: [:each | (each isJavaRef and: [each isResolved not]) ifTrue: [^false]]. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1241
diff
changeset
|
2176 |
^ true. |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1241
diff
changeset
|
2177 |
|
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1241
diff
changeset
|
2178 |
"Created: / 08-12-2011 / 20:44:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1241
diff
changeset
|
2179 |
! |
2e7d85df01f8
resolveClass native resolves whole CP, for even more eager resolving, run JavaVM enableEagerResolving :)
hlopkmar
parents:
1241
diff
changeset
|
2180 |
|
752 | 2181 |
isJavaArrayClass |
2182 |
||
2183 |
^false |
|
2184 |
||
2185 |
"Created: / 05-02-2011 / 22:20:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2186 |
! |
|
2187 |
||
2188 |
isJavaClass |
|
2189 |
^ self ~~ JavaClass |
|
2190 |
||
2191 |
"Created: 18.3.1997 / 17:48:01 / cg" |
|
2192 |
! |
|
2193 |
||
2194 |
isJavaClassType |
|
2195 |
||
2196 |
^self isInterface not |
|
2197 |
||
2198 |
" |
|
2199 |
(Java classForName:'java.lang.Class') isJavaClassType |
|
2200 |
" |
|
2201 |
||
2202 |
"Created: / 11-02-2011 / 08:09:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2203 |
! |
|
2204 |
||
2205 |
isJavaInterfaceType |
|
2206 |
||
2207 |
^self isInterface |
|
2208 |
||
2209 |
" |
|
2210 |
(Java classForName:'java.lang.Class') isJavaInterfaceType |
|
2211 |
" |
|
2212 |
||
2213 |
"Created: / 11-02-2011 / 08:09:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2214 |
! |
|
2215 |
||
2216 |
isJavaMethodRef |
|
2217 |
^ false |
|
2218 |
||
2219 |
"Created: / 9.11.1999 / 15:42:10 / cg" |
|
2220 |
! |
|
2221 |
||
2222 |
isJavaPrimitiveType |
|
2223 |
||
2224 |
^false |
|
2225 |
||
2226 |
" |
|
2227 |
(Java classForName:'java.lang.Class') isJavaPrimitiveType |
|
2228 |
ByteArray isJavaPrimitiveType |
|
2229 |
" |
|
2230 |
||
2231 |
"Created: / 21-12-2010 / 23:03:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2232 |
! |
|
2233 |
||
2234 |
isJavaReferenceType |
|
2235 |
||
2236 |
^true |
|
2237 |
||
2238 |
" |
|
2239 |
(Java classForName:'java.lang.Class') isJavaReferenceType |
|
2240 |
" |
|
2241 |
||
2242 |
"Created: / 20-12-2010 / 21:54:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2243 |
! |
|
2244 |
||
2245 |
isJavaType |
|
2246 |
||
2247 |
^true |
|
2248 |
||
2249 |
" |
|
2250 |
(Java classForName:'java.lang.Class') isJavaType |
|
2251 |
" |
|
2252 |
||
2253 |
"Created: / 20-12-2010 / 21:53:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2254 |
! |
|
2255 |
||
1332 | 2256 |
isJavaWrapperClass |
2257 |
"Returns true, iff receiver is one of the Java wrapper classes or String" |
|
2258 |
||
2259 |
name == #'java/lang/Byte' ifTrue:[^true]. |
|
2260 |
name == #'java/lang/Short' ifTrue:[^true]. |
|
2261 |
name == #'java/lang/Integer' ifTrue:[^true]. |
|
2262 |
name == #'java/lang/Long' ifTrue:[^true]. |
|
2263 |
name == #'java/lang/Character' ifTrue:[^true]. |
|
2264 |
name == #'java/lang/Boolean' ifTrue:[^true]. |
|
2265 |
name == #'java/lang/String' ifTrue:[^true]."/Not really a wrapper, but..." |
|
2266 |
||
2267 |
^false. |
|
2268 |
||
2269 |
"Created: / 26-12-2011 / 22:03:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2270 |
! |
|
2271 |
||
752 | 2272 |
isUnresolved |
2273 |
"return true, if the receiver is unresolved; |
|
2274 |
javaClasses are never; JavaUnresolvedClasses are always" |
|
2275 |
||
2276 |
^ false |
|
2277 |
||
2278 |
"Modified: / 07-05-1998 / 12:23:14 / cg" |
|
2279 |
"Created: / 06-03-2011 / 22:57:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
2280 |
! |
|
2281 |
||
2282 |
nameInBrowser |
|
2283 |
"return a nameString as shown in browsers" |
|
2284 |
||
2285 |
^ self name copyReplaceAll:$/ with:$. |
|
2286 |
! |
|
2287 |
||
2288 |
nameSpacePath |
|
2289 |
|parts s| |
|
2290 |
||
2291 |
parts := self fullName asCollectionOfSubstringsSeparatedBy:$/. |
|
2292 |
s := '' writeStream. |
|
2293 |
s nextPutAll:'JAVA'. |
|
2294 |
parts from:1 to:(parts size - 1) do:[:aPart | |
|
2295 |
s nextPutAll:'::'. |
|
2296 |
s nextPutAll:aPart |
|
2297 |
]. |
|
2298 |
^ s contents |
|
2299 |
||
2300 |
" |
|
2301 |
JAVA::java::lang::Object fullName |
|
2302 |
JAVA::java::lang::Object nameSpacePath |
|
2303 |
JAVA::java::lang::Object name |
|
2304 |
" |
|
2305 |
||
2306 |
"Modified: / 19.10.1998 / 20:07:24 / cg" |
|
2307 |
! |
|
2308 |
||
2309 |
selectMethodsAnnotatedWith:aJavaTypeName |
|
2310 |
^ self methodDictionary values select: |
|
2311 |
[:method | |
|
1281 | 2312 |
(method isJavaMethod |
2313 |
and:[method annotations notNil |
|
2314 |
and:[(method annotations runtimeVisible at:aJavaTypeName ifAbsent:nil) notNil]])]. |
|
752 | 2315 |
|
2316 |
"Created: / 02-03-2011 / 23:06:42 / Marcel Hlopko <hlopik@gmail.com>" |
|
1281 | 2317 |
"Modified: / 14-12-2011 / 22:35:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 2318 |
! |
2319 |
||
2320 |
supportsMethodCategories |
|
2321 |
^ self isJavaClass not |
|
2322 |
||
2323 |
"Created: / 30.7.1997 / 14:58:58 / cg" |
|
2324 |
"Modified: / 7.5.1998 / 12:25:54 / cg" |
|
2325 |
! |
|
2326 |
||
2327 |
typeName |
|
2328 |
^ 'L' , self fullName , ';'. |
|
2329 |
||
2330 |
" |
|
2331 |
(Java at:'java.util.Stack') typeName" |
|
2332 |
||
2333 |
"Modified: / 10-02-1998 / 17:13:26 / cg" |
|
2334 |
"Modified: / 02-03-2011 / 22:48:40 / Marcel Hlopko <hlopik@gmail.com>" |
|
2335 |
! ! |
|
2336 |
||
2337 |
!JavaClass methodsFor:'queries-protocol'! |
|
2338 |
||
821
560f60ad3a2a
fixed (hopefully:) bug in permissions (new resolving)
hlopkmar
parents:
820
diff
changeset
|
2339 |
equalsOrIsSubclassOf: aJavaClass |
560f60ad3a2a
fixed (hopefully:) bug in permissions (new resolving)
hlopkmar
parents:
820
diff
changeset
|
2340 |
self = aJavaClass ifTrue: [^true]. |
560f60ad3a2a
fixed (hopefully:) bug in permissions (new resolving)
hlopkmar
parents:
820
diff
changeset
|
2341 |
^ self isSubclassOf:aJavaClass. |
560f60ad3a2a
fixed (hopefully:) bug in permissions (new resolving)
hlopkmar
parents:
820
diff
changeset
|
2342 |
|
560f60ad3a2a
fixed (hopefully:) bug in permissions (new resolving)
hlopkmar
parents:
820
diff
changeset
|
2343 |
"Created: / 30-05-2011 / 23:07:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
560f60ad3a2a
fixed (hopefully:) bug in permissions (new resolving)
hlopkmar
parents:
820
diff
changeset
|
2344 |
! |
560f60ad3a2a
fixed (hopefully:) bug in permissions (new resolving)
hlopkmar
parents:
820
diff
changeset
|
2345 |
|
1033 | 2346 |
includesBehavior: aClass |
2347 |
^ (aClass isJavaClass not or: [ aClass isInterface not ]) |
|
2348 |
ifTrue: [ self name == aClass name or:[ super includesBehavior: aClass ]] |
|
2349 |
ifFalse: [ |
|
2350 |
self name == aClass name or: [ self allInterfaces includes: aClass ] |
|
2351 |
]. |
|
752 | 2352 |
|
2353 |
"Created: / 05-02-2011 / 23:44:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1033 | 2354 |
"Modified: / 11-02-2011 / 09:12:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
761 | 2355 |
! |
2356 |
||
1031 | 2357 |
isSubclassOf: aClass |
2358 |
||
2359 |
| cls | |
|
2360 |
aClass isNil ifTrue:[^false]. |
|
2361 |
cls := self. |
|
2362 |
[ cls notNil ] whileTrue:[ |
|
2363 |
"JV-2011-10-20: Q: is one subclass of another if its |
|
2364 |
are subclass but loaded using different classloader?" |
|
2365 |
cls == aClass ifTrue:[ |
|
2366 |
^true |
|
2367 |
]. |
|
2368 |
cls := cls superclass. |
|
2369 |
]. |
|
2370 |
^false |
|
2371 |
||
2372 |
"Created: / 20-10-2011 / 16:15:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
761 | 2373 |
! ! |
2374 |
||
2375 |
!JavaClass methodsFor:'reflection'! |
|
2376 |
||
1240 | 2377 |
findInstFieldByName: fieldName |
2378 |
"tries to find a field in current class (not superclasses)" |
|
2379 |
||
2380 |
| result | |
|
2381 |
result := self fields |
|
2382 |
detect: [:each | each name = fieldName ] |
|
2383 |
ifNone: [ nil ]. |
|
2384 |
^ result. |
|
1236 | 2385 |
|
1241 | 2386 |
"Created: / 07-12-2011 / 23:05:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1236 | 2387 |
! |
2388 |
||
1240 | 2389 |
findInterfaceFieldByName: fieldName |
1241 | 2390 |
| result seenIfaces ifaces | |
2391 |
ifaces := OrderedCollection withAll: self interfaces. |
|
2392 |
seenIfaces := Set new. |
|
2393 |
[ ifaces notEmpty ] whileTrue: [ |
|
2394 |
| iface | |
|
2395 |
iface := ifaces removeFirst. |
|
2396 |
result := iface staticFields |
|
2397 |
detect: [:each | each name = fieldName ] |
|
2398 |
ifNone: [ nil ]. |
|
2399 |
result notNil ifTrue: [ ^ result ]. |
|
2400 |
seenIfaces add: iface. |
|
2401 |
iface interfaces do: [ |
|
2402 |
:each | |
|
2403 |
(seenIfaces includes: each) not ifTrue: [ ifaces add: each ] |
|
2404 |
] |
|
2405 |
]. |
|
1239 | 2406 |
^ nil. |
1236 | 2407 |
|
1241 | 2408 |
"Created: / 07-12-2011 / 23:05:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1236 | 2409 |
! |
2410 |
||
1240 | 2411 |
findStaticFieldByName: fieldName |
2412 |
"tries to find a field in current class (not superclasses)" |
|
2413 |
||
2414 |
| result | |
|
2415 |
result := self staticFields |
|
2416 |
detect: [:each | each name = fieldName ] |
|
2417 |
ifNone: [ nil ]. |
|
2418 |
^ result. |
|
1236 | 2419 |
|
1241 | 2420 |
"Created: / 07-12-2011 / 23:05:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1236 | 2421 |
! |
2422 |
||
2423 |
lookupFieldByNameAndType: aJavaNameAndType |
|
1240 | 2424 |
| field cls | |
2425 |
cls := self. |
|
2426 |
[ cls ~~ JavaObject ] whileTrue: [ |
|
1241 | 2427 |
field := cls findInstFieldByName: aJavaNameAndType name. |
1240 | 2428 |
field notNil ifTrue: [ ^ field ]. |
1241 | 2429 |
field := cls findStaticFieldByName: aJavaNameAndType name. |
1240 | 2430 |
field notNil ifTrue: [ ^ field ]. |
1241 | 2431 |
field := cls findInterfaceFieldByName: aJavaNameAndType name. |
1240 | 2432 |
field notNil ifTrue: [ ^ field ]. |
2433 |
cls := cls superclass. |
|
2434 |
]. |
|
2435 |
self breakPoint: #mh. |
|
2436 |
^ nil. |
|
761 | 2437 |
|
2438 |
"Created: / 11-04-2011 / 21:27:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
912
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
905
diff
changeset
|
2439 |
"Modified: / 13-08-2011 / 00:46:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1241 | 2440 |
"Modified: / 07-12-2011 / 23:05:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
761 | 2441 |
! |
2442 |
||
2443 |
lookupMethodByNameAndType: aJavaNameAndType |
|
2444 |
^ self lookupMethodFor: aJavaNameAndType selector. |
|
2445 |
||
2446 |
"Created: / 11-04-2011 / 21:28:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
2447 |
! |
|
2448 |
||
2449 |
lookupStaticFieldByNameAndType: aJavaNameAndType |
|
1240 | 2450 |
| field cls | |
2451 |
cls := self. |
|
2452 |
[ cls ~= JavaObject ] whileTrue: [ |
|
1241 | 2453 |
field := cls findStaticFieldByName: aJavaNameAndType name. |
1240 | 2454 |
field notNil ifTrue: [ ^ field ]. |
1241 | 2455 |
field := cls findInterfaceFieldByName: aJavaNameAndType name. |
1240 | 2456 |
field notNil ifTrue: [ ^ field ]. |
2457 |
cls := cls superclass. |
|
2458 |
]. |
|
2459 |
self breakPoint: #mh. |
|
2460 |
^ nil. |
|
818 | 2461 |
|
2462 |
"Created: / 11-04-2011 / 21:27:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
927 | 2463 |
"Modified: / 26-08-2011 / 18:27:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1241 | 2464 |
"Modified: / 07-12-2011 / 23:06:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 2465 |
! ! |
2466 |
||
2467 |
!JavaClass methodsFor:'special'! |
|
2468 |
||
2469 |
asClassPointerRef |
|
2470 |
"/ self halt. |
|
2471 |
^ self |
|
2472 |
||
2473 |
"Created: / 10.11.1998 / 02:07:01 / cg" |
|
2474 |
"Modified: / 8.1.1999 / 14:11:26 / cg" |
|
2475 |
! |
|
2476 |
||
2477 |
deinit |
|
2478 |
||
1523
f5ffdad83ab9
Access to ACC_* and ACX_* constants unified. The only definition is in JavaConstants
vranyj1
parents:
1511
diff
changeset
|
2479 |
accessFlags := accessFlags bitClear: ACX_INITIALIZED. |
752 | 2480 |
|
2481 |
"Created: / 25-10-2010 / 12:28:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2482 |
! |
|
2483 |
||
2484 |
deref |
|
2485 |
^ self |
|
2486 |
||
2487 |
"Created: / 10.11.1998 / 02:08:06 / cg" |
|
2488 |
! |
|
2489 |
||
851 | 2490 |
javaArrayClass |
2491 |
"/ self halt. |
|
2492 |
"/ ^ Array |
|
2493 |
||
1511 | 2494 |
^ JavaArray javaArrayClassFor:self |
851 | 2495 |
|
2496 |
"Created: / 10-11-1998 / 02:07:32 / cg" |
|
2497 |
"Modified: / 08-01-1999 / 14:11:34 / cg" |
|
1511 | 2498 |
"Modified: / 05-07-2012 / 23:24:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
851 | 2499 |
! |
2500 |
||
752 | 2501 |
updateClassRefsFrom:oldClass to:newClass |
2502 |
self == oldClass ifTrue:[ |
|
2503 |
self makeObsolete. |
|
2504 |
^ self |
|
2505 |
]. |
|
2506 |
||
2507 |
constantPool updateClassRefsFrom:oldClass to:newClass. |
|
2508 |
interfaces notNil ifTrue:[ |
|
2509 |
interfaces := interfaces collect:[:anInterface | |
|
2510 |
anInterface == oldClass ifTrue:[ |
|
2511 |
newClass isNil ifTrue:[ |
|
2512 |
nil "/ replace by an unresolvedInterface |
|
2513 |
] ifFalse:[ |
|
2514 |
newClass |
|
2515 |
] |
|
2516 |
] ifFalse:[ |
|
2517 |
anInterface |
|
2518 |
] |
|
2519 |
] |
|
2520 |
] |
|
2521 |
||
2522 |
"Modified: / 4.2.1998 / 22:08:19 / cg" |
|
2523 |
! ! |
|
2524 |
||
2525 |
!JavaClass methodsFor:'support - refactorings'! |
|
2526 |
||
2527 |
directlyDefinesMethod: aSelector |
|
2528 |
||
2529 |
^self methodDictionary includes: aSelector. |
|
2530 |
||
2531 |
"Created: / 16-03-2011 / 14:21:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2532 |
! |
|
2533 |
||
2534 |
metaclass |
|
2535 |
||
2536 |
^self class |
|
2537 |
||
2538 |
"Created: / 16-03-2011 / 14:22:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2539 |
! ! |
|
2540 |
||
2541 |
!JavaClass methodsFor:'support - sUnit'! |
|
2542 |
||
2543 |
asTestCase |
|
761 | 2544 |
self isTestletLike |
763 | 2545 |
ifTrue: [^ TestletTestCaseProxy for: self ]. |
761 | 2546 |
^ JUnitTestCaseProxy for: self. |
752 | 2547 |
|
2548 |
"Created: / 04-03-2011 / 08:20:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
761 | 2549 |
"Modified: / 29-04-2011 / 17:52:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
763 | 2550 |
"Modified: / 07-05-2011 / 18:59:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
761 | 2551 |
! |
2552 |
||
2553 |
asTestlet |
|
2554 |
^ TestletTestCaseProxy for: self |
|
2555 |
||
2556 |
"Created: / 29-04-2011 / 16:53:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
752 | 2557 |
! |
2558 |
||
820
beb45cce2856
Mauve test integration works.. and that's the bad news, there are sooo many failures.. so back to the beginning, let's fix natives..
hlopkmar
parents:
818
diff
changeset
|
2559 |
buildSuite |
beb45cce2856
Mauve test integration works.. and that's the bad news, there are sooo many failures.. so back to the beginning, let's fix natives..
hlopkmar
parents:
818
diff
changeset
|
2560 |
self isTestletLike ifTrue: [ ^(TestletTestCaseProxy for: self) buildSuite ]. |
beb45cce2856
Mauve test integration works.. and that's the bad news, there are sooo many failures.. so back to the beginning, let's fix natives..
hlopkmar
parents:
818
diff
changeset
|
2561 |
^ (JUnitTestCaseProxy for: self) buildSuite |
beb45cce2856
Mauve test integration works.. and that's the bad news, there are sooo many failures.. so back to the beginning, let's fix natives..
hlopkmar
parents:
818
diff
changeset
|
2562 |
|
beb45cce2856
Mauve test integration works.. and that's the bad news, there are sooo many failures.. so back to the beginning, let's fix natives..
hlopkmar
parents:
818
diff
changeset
|
2563 |
"Created: / 29-05-2011 / 22:45:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
beb45cce2856
Mauve test integration works.. and that's the bad news, there are sooo many failures.. so back to the beginning, let's fix natives..
hlopkmar
parents:
818
diff
changeset
|
2564 |
! |
beb45cce2856
Mauve test integration works.. and that's the bad news, there are sooo many failures.. so back to the beginning, let's fix natives..
hlopkmar
parents:
818
diff
changeset
|
2565 |
|
1041 | 2566 |
isJUnitTestCaseLike |
761 | 2567 |
| junit_framework_TestCase org_junit_Test | |
752 | 2568 |
|
2569 |
"try JUnit 4.x" |
|
1052 | 2570 |
org_junit_Test := JavaVM classForName: 'org.junit.Test'. |
1041 | 2571 |
(org_junit_Test notNil and: [ self containsMethodsAnnotatedWith: org_junit_Test typeName ]) ifTrue: [ |
2572 |
^ true |
|
2573 |
]. |
|
2574 |
||
2575 |
"Try jUnit 3.x" |
|
1052 | 2576 |
junit_framework_TestCase := JavaVM classForName: 'junit.framework.TestCase'. |
1041 | 2577 |
junit_framework_TestCase ifNotNil: [ |
2578 |
self == junit_framework_TestCase ifTrue: [ ^ false ]. |
|
2579 |
(self includesBehavior: junit_framework_TestCase) ifTrue: [ ^ true ] |
|
2580 |
]. |
|
2581 |
||
2582 |
^false |
|
2583 |
" |
|
2584 |
JAVA::java::lang::Object isTestCaseLike |
|
2585 |
JAVA::stx::libjava::tests::junit::JUnit3Tests isTestCaseLike |
|
2586 |
" |
|
2587 |
||
2588 |
"Created: / 23-10-2011 / 22:04:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2589 |
! |
|
2590 |
||
2591 |
isTestCaseLike |
|
2592 |
||
1204 | 2593 |
JavaVM booted ifFalse:[ ^ false ]. |
2594 |
||
1041 | 2595 |
^self isJUnitTestCaseLike or:[ self isTestletLike ] |
761 | 2596 |
|
752 | 2597 |
" |
2598 |
JAVA::java::lang::Object isTestCaseLike |
|
2599 |
JAVA::stx::libjava::tests::junit::JUnit3Tests isTestCaseLike" |
|
2600 |
||
2601 |
"Created: / 28-02-2011 / 21:31:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2602 |
"Modified: / 02-03-2011 / 23:08:02 / Marcel Hlopko <hlopik@gmail.com>" |
|
820
beb45cce2856
Mauve test integration works.. and that's the bad news, there are sooo many failures.. so back to the beginning, let's fix natives..
hlopkmar
parents:
818
diff
changeset
|
2603 |
"Modified: / 29-05-2011 / 22:48:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1204 | 2604 |
"Modified: / 02-12-2011 / 23:09:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 2605 |
! |
2606 |
||
2607 |
isTestSelector: selector |
|
2608 |
||
2609 |
"Hack, you're right, blame on me" |
|
2610 |
||
2611 |
| junit_framework_TestCase m | |
|
899 | 2612 |
|
2613 |
((selector == #'test(Lgnu/testlet/TestHarness;)V') |
|
2614 |
and:[self ~~ (Java at:'gnu.testlet.Testlet')]) |
|
2615 |
ifTrue:[^true]. |
|
2616 |
||
2617 |
||
752 | 2618 |
junit_framework_TestCase := Java at:'junit.framework.TestCase'. |
2619 |
(junit_framework_TestCase notNil and: |
|
2620 |
[self includesBehavior:junit_framework_TestCase]) |
|
2621 |
ifTrue:[^selector startsWith: 'test']. |
|
2622 |
||
2623 |
m := self lookupSelector: selector. |
|
2624 |
"Sorry fo that, but I need this method to be fast" |
|
1090 | 2625 |
^m notNil and:[m annotations runtimeVisible includesKey: 'Lorg/junit/Test;']. |
752 | 2626 |
|
2627 |
"Modified: / 02-03-2011 / 23:08:02 / Marcel Hlopko <hlopik@gmail.com>" |
|
2628 |
"Created: / 04-03-2011 / 07:07:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
761 | 2629 |
! |
2630 |
||
2631 |
isTestletLike |
|
1039 | 2632 |
|
761 | 2633 |
| testlet | |
1263 | 2634 |
[ |
2635 |
testlet := JavaVM classForName: 'gnu.testlet.Testlet'. |
|
2636 |
] on: Error do:[ |
|
2637 |
^false. |
|
2638 |
]. |
|
761 | 2639 |
testlet ifNil:[^ false]. |
2640 |
self == testlet ifTrue: [ ^ false ]. |
|
2641 |
(self includesBehavior: testlet) ifTrue: [ ^ true ]. |
|
2642 |
^ false. |
|
2643 |
||
2644 |
"Modified: / 02-03-2011 / 23:08:02 / Marcel Hlopko <hlopik@gmail.com>" |
|
2645 |
"Created: / 29-04-2011 / 17:02:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1263 | 2646 |
"Modified: / 10-12-2011 / 20:15:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 2647 |
! ! |
2648 |
||
1098 | 2649 |
!JavaClass methodsFor:'unwind'! |
2650 |
||
2651 |
unwindHandlerInContext: aContext |
|
2652 |
"given a context which has been marked for unwind, |
|
2653 |
retrieve the handler block. This method is called when ST |
|
2654 |
exception raises and stack is unwinding. JavaClass instance |
|
2655 |
has an opportunity to clean up monitors" |
|
2656 |
||
2657 |
^ JavaVM unwindHandlerForJavaContext: aContext. |
|
2658 |
||
2659 |
"Created: / 08-11-2011 / 12:25:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
2660 |
! ! |
|
2661 |
||
752 | 2662 |
!JavaClass class methodsFor:'documentation'! |
2663 |
||
2664 |
version |
|
1022 | 2665 |
^ '$Id$' |
752 | 2666 |
! |
2667 |
||
2668 |
version_SVN |
|
1022 | 2669 |
^ '$Id$' |
752 | 2670 |
! ! |
2671 |
||
926 | 2672 |
JavaClass initialize! |