454
|
1 |
"
|
2151
|
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger
|
|
3 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
|
|
4 |
SWING Research Group, Czech Technical University in Prague
|
|
5 |
|
|
6 |
Parts of the code written by Claus Gittinger are under following
|
|
7 |
license:
|
454
|
8 |
|
|
9 |
This software is furnished under a license and may be used
|
|
10 |
only in accordance with the terms of that license and with the
|
|
11 |
inclusion of the above copyright notice. This software may not
|
|
12 |
be provided or otherwise made available to, or used by, any
|
|
13 |
other person. No title to or ownership of the software is
|
|
14 |
hereby transferred.
|
2151
|
15 |
|
|
16 |
Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
|
|
17 |
|
|
18 |
Permission is hereby granted, free of charge, to any person
|
|
19 |
obtaining a copy of this software and associated documentation
|
|
20 |
files (the 'Software'), to deal in the Software without
|
|
21 |
restriction, including without limitation the rights to use,
|
|
22 |
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
23 |
copies of the Software, and to permit persons to whom the
|
|
24 |
Software is furnished to do so, subject to the following
|
|
25 |
conditions:
|
|
26 |
|
|
27 |
The above copyright notice and this permission notice shall be
|
|
28 |
included in all copies or substantial portions of the Software.
|
|
29 |
|
|
30 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
31 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
32 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
33 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
34 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
35 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
36 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
37 |
OTHER DEALINGS IN THE SOFTWARE.
|
|
38 |
|
|
39 |
[1] Code written at SWING Research Group contain a signature
|
|
40 |
of one of the above copright owners.
|
2108
|
41 |
"
|
713
|
42 |
"{ Package: 'stx:libjava' }"
|
|
43 |
|
2151
|
44 |
Object subclass:#JavaField
|
|
45 |
instanceVariableNames:'accessFlags class name descriptor signature index constantValue
|
|
46 |
annotations constantPool'
|
354
|
47 |
classVariableNames:'A_FINAL A_PRIVATE A_PROTECTED A_PUBLIC A_STATIC A_TRANSIENT
|
2151
|
48 |
A_VOLATILE A_SMALLTALK A_SYBTHETIC A_ENUM FieldTypeClasses'
|
6
|
49 |
poolDictionaries:''
|
713
|
50 |
category:'Languages-Java-Reader-Support'
|
6
|
51 |
!
|
|
52 |
|
454
|
53 |
!JavaField class methodsFor:'documentation'!
|
|
54 |
|
|
55 |
copyright
|
|
56 |
"
|
2151
|
57 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger
|
|
58 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
|
|
59 |
SWING Research Group, Czech Technical University in Prague
|
|
60 |
|
|
61 |
Parts of the code written by Claus Gittinger are under following
|
|
62 |
license:
|
454
|
63 |
|
|
64 |
This software is furnished under a license and may be used
|
|
65 |
only in accordance with the terms of that license and with the
|
|
66 |
inclusion of the above copyright notice. This software may not
|
|
67 |
be provided or otherwise made available to, or used by, any
|
|
68 |
other person. No title to or ownership of the software is
|
|
69 |
hereby transferred.
|
2151
|
70 |
|
|
71 |
Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
|
|
72 |
|
|
73 |
Permission is hereby granted, free of charge, to any person
|
|
74 |
obtaining a copy of this software and associated documentation
|
|
75 |
files (the 'Software'), to deal in the Software without
|
|
76 |
restriction, including without limitation the rights to use,
|
|
77 |
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
78 |
copies of the Software, and to permit persons to whom the
|
|
79 |
Software is furnished to do so, subject to the following
|
|
80 |
conditions:
|
454
|
81 |
|
2151
|
82 |
The above copyright notice and this permission notice shall be
|
|
83 |
included in all copies or substantial portions of the Software.
|
454
|
84 |
|
2151
|
85 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
86 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
87 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
88 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
89 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
91 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
92 |
OTHER DEALINGS IN THE SOFTWARE.
|
|
93 |
|
|
94 |
[1] Code written at SWING Research Group contain a signature
|
|
95 |
of one of the above copright owners.
|
|
96 |
|
|
97 |
"
|
454
|
98 |
! !
|
6
|
99 |
|
354
|
100 |
!JavaField class methodsFor:'class initialization'!
|
|
101 |
|
|
102 |
initialize
|
|
103 |
A_PUBLIC := 16r0001. "/ JavaClass A_PUBLIC
|
|
104 |
A_PRIVATE := 16r0002.
|
|
105 |
A_PROTECTED := 16r0004.
|
|
106 |
A_STATIC := 16r0008.
|
|
107 |
A_FINAL := 16r0010. "/ JavaClass A_FINAL
|
|
108 |
A_VOLATILE := 16r0040.
|
|
109 |
A_TRANSIENT := 16r0080.
|
2147
|
110 |
A_SYBTHETIC := 16r1000.
|
|
111 |
A_ENUM := 16r4000.
|
749
|
112 |
|
2151
|
113 |
FieldTypeClasses := IdentityDictionary new
|
|
114 |
"Base types"
|
|
115 |
"/WARNING: If you change something here, you MUST also
|
|
116 |
"/ change JavaDescriptor class>>#initialize !!!!!!
|
|
117 |
|
|
118 |
at: #B put: Byte;
|
|
119 |
at: #C put: Character;
|
|
120 |
at: #D put: Float;
|
|
121 |
at: #F put: ShortFloat;
|
|
122 |
at: #I put: Integer; "Kludge: instances of java int are in fact SmallIntegers"
|
|
123 |
at: #J put: LargeInteger;
|
|
124 |
at: #S put: Short;
|
|
125 |
at: #Z put: Boolean;
|
|
126 |
|
|
127 |
"Array types"
|
|
128 |
"/WARNING: If you change something here, you MUST also
|
|
129 |
"/ change JavaDescriptor class>>#initialize !!!!!!
|
|
130 |
at: #'[B' put: ByteArray;
|
|
131 |
at: #'[C' put: Unicode16String;
|
|
132 |
at: #'[D' put: DoubleArray;
|
|
133 |
at: #'[F' put: FloatArray;
|
|
134 |
at: #'[I' put: SignedIntegerArray; "Kludge: instances of java int are in fact SmallIntegers"
|
|
135 |
at: #'[J' put: SignedLongIntegerArray;
|
|
136 |
at: #'[S' put: WordArray;
|
|
137 |
at: #'[Z' put: BooleanArray;
|
|
138 |
|
|
139 |
yourself
|
|
140 |
|
|
141 |
|
|
142 |
|
|
143 |
|
354
|
144 |
"
|
|
145 |
self initialize
|
|
146 |
"
|
|
147 |
|
2151
|
148 |
"Modified: / 13-05-1998 / 14:44:43 / cg"
|
|
149 |
"Modified: / 10-08-2011 / 00:48:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
354
|
150 |
! !
|
|
151 |
|
|
152 |
!JavaField class methodsFor:'constants'!
|
|
153 |
|
593
|
154 |
A_FINAL
|
|
155 |
^ A_FINAL
|
|
156 |
|
|
157 |
|
|
158 |
!
|
|
159 |
|
|
160 |
A_PRIVATE
|
|
161 |
^ A_PRIVATE
|
|
162 |
|
|
163 |
|
|
164 |
!
|
|
165 |
|
354
|
166 |
A_PROTECTED
|
|
167 |
^ A_PROTECTED
|
|
168 |
|
|
169 |
"Created: / 13.5.1998 / 13:03:51 / cg"
|
|
170 |
!
|
|
171 |
|
593
|
172 |
A_PUBLIC
|
|
173 |
^ A_PUBLIC
|
|
174 |
|
|
175 |
|
|
176 |
!
|
|
177 |
|
354
|
178 |
A_STATIC
|
|
179 |
^ A_STATIC
|
|
180 |
|
|
181 |
"Created: / 13.5.1998 / 13:03:55 / cg"
|
593
|
182 |
!
|
|
183 |
|
|
184 |
A_TRANSIENT
|
|
185 |
^ A_TRANSIENT
|
|
186 |
|
|
187 |
|
|
188 |
!
|
|
189 |
|
|
190 |
A_VOLATILE
|
|
191 |
^ A_VOLATILE
|
|
192 |
|
|
193 |
|
354
|
194 |
! !
|
|
195 |
|
27
|
196 |
!JavaField methodsFor:'accessing'!
|
|
197 |
|
2151
|
198 |
accessFlags
|
|
199 |
^ accessFlags
|
|
200 |
!
|
|
201 |
|
|
202 |
annotations
|
|
203 |
^ annotations
|
|
204 |
!
|
|
205 |
|
|
206 |
annotations:something
|
|
207 |
annotations := something.
|
|
208 |
!
|
|
209 |
|
|
210 |
constantPool
|
|
211 |
|
|
212 |
^ constantPool
|
|
213 |
|
|
214 |
"Created: / 17-12-2010 / 18:40:23 / Marcel Hlopko <hlopik@gmail.com>"
|
|
215 |
"Modified: / 27-07-2011 / 09:38:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
216 |
!
|
|
217 |
|
59
|
218 |
constantValue
|
|
219 |
^ constantValue
|
|
220 |
!
|
|
221 |
|
|
222 |
constantValue:aValue
|
|
223 |
constantValue := aValue
|
|
224 |
!
|
|
225 |
|
2151
|
226 |
ensureHasAnnotations
|
|
227 |
annotations ifNil: [ annotations := JavaAnnotationContainer for:self ].
|
|
228 |
^ annotations
|
|
229 |
|
|
230 |
"Created: / 25-02-2011 / 16:04:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
231 |
"Modified: / 16-03-2011 / 17:13:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
232 |
!
|
|
233 |
|
|
234 |
index
|
|
235 |
|
|
236 |
index ifNil:[
|
|
237 |
self isStatic ifTrue:[
|
|
238 |
index := class class instVarOffsetOf: name
|
|
239 |
] ifFalse:[
|
|
240 |
index := class instVarOffsetOf: name
|
|
241 |
].
|
|
242 |
].
|
|
243 |
^ index
|
|
244 |
|
|
245 |
"Modified: / 17-08-2011 / 09:26:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
246 |
!
|
|
247 |
|
|
248 |
javaClass
|
|
249 |
|
|
250 |
^ class
|
|
251 |
|
|
252 |
"Created: / 27-07-2011 / 09:17:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
253 |
!
|
|
254 |
|
27
|
255 |
name
|
|
256 |
^ name
|
376
|
257 |
!
|
|
258 |
|
|
259 |
signature
|
|
260 |
^ signature
|
|
261 |
|
|
262 |
"Created: / 15.10.1998 / 10:37:06 / cg"
|
27
|
263 |
! !
|
|
264 |
|
2151
|
265 |
!JavaField methodsFor:'initialization'!
|
6
|
266 |
|
|
267 |
setAccessFlags:flags
|
|
268 |
accessFlags := flags.
|
|
269 |
|
|
270 |
"Created: 16.4.1996 / 13:04:25 / cg"
|
|
271 |
!
|
|
272 |
|
2151
|
273 |
setClass: aClass
|
|
274 |
|
|
275 |
class := aClass
|
|
276 |
|
|
277 |
"Created: / 27-07-2011 / 09:27:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
278 |
!
|
|
279 |
|
|
280 |
setConstantPool:aJavaContantPool
|
|
281 |
|
|
282 |
constantPool := aJavaContantPool.
|
|
283 |
|
|
284 |
"Created: / 17-12-2010 / 18:41:59 / Marcel Hlopko <hlopik@gmail.com>"
|
|
285 |
"Created: / 27-07-2011 / 09:30:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
286 |
!
|
|
287 |
|
6
|
288 |
setConstantValue:something
|
|
289 |
constantValue := something.
|
|
290 |
|
|
291 |
"Created: 16.4.1996 / 13:04:58 / cg"
|
|
292 |
!
|
|
293 |
|
2151
|
294 |
setDescriptor:aString
|
|
295 |
|
|
296 |
descriptor := aString.
|
|
297 |
|
|
298 |
"Created: / 16-04-1996 / 13:04:43 / cg"
|
|
299 |
"Created: / 14-08-2011 / 19:40:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
300 |
!
|
|
301 |
|
|
302 |
setIndex:anInteger
|
|
303 |
index := anInteger.
|
|
304 |
|
|
305 |
"Created: / 22-11-2010 / 17:13:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
306 |
!
|
|
307 |
|
6
|
308 |
setName:aString
|
|
309 |
name := aString.
|
|
310 |
|
|
311 |
"Created: 16.4.1996 / 13:04:35 / cg"
|
|
312 |
!
|
|
313 |
|
|
314 |
setSignature:aString
|
|
315 |
signature := aString.
|
|
316 |
|
|
317 |
"Created: 16.4.1996 / 13:04:43 / cg"
|
|
318 |
! !
|
|
319 |
|
2151
|
320 |
!JavaField methodsFor:'printing & storing'!
|
|
321 |
|
|
322 |
printOn: aStream
|
|
323 |
|
|
324 |
super printOn: aStream.
|
|
325 |
aStream
|
|
326 |
nextPutAll:'(name: ';
|
|
327 |
nextPutAll: name;
|
|
328 |
nextPut:$,; space;
|
|
329 |
nextPutAll:'descriptor: ';
|
|
330 |
nextPutAll: signature;
|
|
331 |
nextPut:$)
|
|
332 |
|
|
333 |
"Created: / 22-05-2011 / 16:07:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
334 |
! !
|
|
335 |
|
35
|
336 |
!JavaField methodsFor:'queries'!
|
|
337 |
|
52
|
338 |
initialValue
|
2151
|
339 |
^ JavaClass initialValueFromSignature: descriptor
|
52
|
340 |
|
2151
|
341 |
"Modified: / 14-08-2011 / 19:59:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
52
|
342 |
!
|
|
343 |
|
35
|
344 |
isFinal
|
354
|
345 |
^ (accessFlags bitAnd:A_FINAL) ~~ 0
|
35
|
346 |
|
354
|
347 |
"Modified: / 13.5.1998 / 12:59:26 / cg"
|
35
|
348 |
!
|
|
349 |
|
|
350 |
isPrivate
|
354
|
351 |
^ (accessFlags bitAnd:A_PRIVATE) ~~ 0
|
35
|
352 |
|
354
|
353 |
"Modified: / 13.5.1998 / 12:59:30 / cg"
|
35
|
354 |
!
|
|
355 |
|
|
356 |
isProtected
|
354
|
357 |
^ (accessFlags bitAnd:A_PROTECTED) ~~ 0
|
35
|
358 |
|
354
|
359 |
"Modified: / 13.5.1998 / 12:59:35 / cg"
|
35
|
360 |
!
|
|
361 |
|
|
362 |
isPublic
|
354
|
363 |
^ (accessFlags bitAnd:A_PUBLIC) ~~ 0
|
35
|
364 |
|
354
|
365 |
"Modified: / 13.5.1998 / 12:59:40 / cg"
|
35
|
366 |
!
|
|
367 |
|
|
368 |
isStatic
|
354
|
369 |
^ (accessFlags bitAnd:A_STATIC) ~~ 0
|
35
|
370 |
|
354
|
371 |
"Modified: / 13.5.1998 / 12:59:43 / cg"
|
35
|
372 |
!
|
|
373 |
|
83
|
374 |
isTransient
|
354
|
375 |
^ (accessFlags bitAnd:A_TRANSIENT) ~~ 0
|
|
376 |
|
|
377 |
"Modified: / 13.5.1998 / 12:59:51 / cg"
|
83
|
378 |
!
|
|
379 |
|
|
380 |
isVolatile
|
354
|
381 |
^ (accessFlags bitAnd:A_VOLATILE) ~~ 0
|
|
382 |
|
|
383 |
"Modified: / 13.5.1998 / 12:59:56 / cg"
|
35
|
384 |
!
|
|
385 |
|
83
|
386 |
type
|
2151
|
387 |
^ JavaMethod typeFromSignature:descriptor in:nil
|
|
388 |
|
|
389 |
"Modified: / 08-01-1998 / 19:13:22 / cg"
|
|
390 |
"Modified: / 14-08-2011 / 19:43:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
391 |
!
|
255
|
392 |
|
2151
|
393 |
typeClass
|
|
394 |
|
|
395 |
^(JavaDescriptor fromString: descriptor) javaClass.
|
|
396 |
|
|
397 |
"Created: / 23-11-2010 / 17:02:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
398 |
"Modified: / 14-08-2011 / 19:59:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
35
|
399 |
! !
|
|
400 |
|
135
|
401 |
!JavaField class methodsFor:'documentation'!
|
6
|
402 |
|
|
403 |
version
|
2151
|
404 |
^ '$Header: /cvs/stx/stx/libjava/JavaField.st,v 1.18 2011-08-18 18:42:48 vrany Exp $'
|
2147
|
405 |
!
|
|
406 |
|
|
407 |
version_CVS
|
2151
|
408 |
^ '§Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaField.st,v 1.17 2009/10/09 14:04:34 cg Exp §'
|
|
409 |
!
|
|
410 |
|
|
411 |
version_SVN
|
|
412 |
^ '$Id: JavaField.st,v 1.18 2011-08-18 18:42:48 vrany Exp $'
|
6
|
413 |
! !
|
713
|
414 |
|
2108
|
415 |
JavaField initialize!
|