454
|
1 |
"
|
2151
|
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger
|
|
3 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
|
2210
|
4 |
SWING Research Group, Czech Technical University in Prague (*)
|
454
|
5 |
|
|
6 |
This software is furnished under a license and may be used
|
|
7 |
only in accordance with the terms of that license and with the
|
|
8 |
inclusion of the above copyright notice. This software may not
|
|
9 |
be provided or otherwise made available to, or used by, any
|
|
10 |
other person. No title to or ownership of the software is
|
|
11 |
hereby transferred.
|
2151
|
12 |
|
2210
|
13 |
(*) extensions, changes and fixes for java1.1 compatibility.
|
|
14 |
For a list of changes, see a list of diffs against the last stable version before 2011-08.
|
2108
|
15 |
"
|
713
|
16 |
"{ Package: 'stx:libjava' }"
|
|
17 |
|
2151
|
18 |
Object subclass:#JavaField
|
|
19 |
instanceVariableNames:'accessFlags class name descriptor signature index constantValue
|
|
20 |
annotations constantPool'
|
354
|
21 |
classVariableNames:'A_FINAL A_PRIVATE A_PROTECTED A_PUBLIC A_STATIC A_TRANSIENT
|
2151
|
22 |
A_VOLATILE A_SMALLTALK A_SYBTHETIC A_ENUM FieldTypeClasses'
|
6
|
23 |
poolDictionaries:''
|
713
|
24 |
category:'Languages-Java-Reader-Support'
|
6
|
25 |
!
|
|
26 |
|
454
|
27 |
!JavaField class methodsFor:'documentation'!
|
|
28 |
|
|
29 |
copyright
|
|
30 |
"
|
2151
|
31 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger
|
|
32 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
|
2210
|
33 |
SWING Research Group, Czech Technical University in Prague (*)
|
454
|
34 |
|
|
35 |
This software is furnished under a license and may be used
|
|
36 |
only in accordance with the terms of that license and with the
|
|
37 |
inclusion of the above copyright notice. This software may not
|
|
38 |
be provided or otherwise made available to, or used by, any
|
|
39 |
other person. No title to or ownership of the software is
|
|
40 |
hereby transferred.
|
2151
|
41 |
|
2210
|
42 |
(*) extensions, changes and fixes for java1.1 compatibility.
|
|
43 |
For a list of changes, see a list of diffs against the last stable version before 2011-08.
|
2151
|
44 |
|
|
45 |
"
|
454
|
46 |
! !
|
6
|
47 |
|
354
|
48 |
!JavaField class methodsFor:'class initialization'!
|
|
49 |
|
|
50 |
initialize
|
|
51 |
A_PUBLIC := 16r0001. "/ JavaClass A_PUBLIC
|
|
52 |
A_PRIVATE := 16r0002.
|
|
53 |
A_PROTECTED := 16r0004.
|
|
54 |
A_STATIC := 16r0008.
|
|
55 |
A_FINAL := 16r0010. "/ JavaClass A_FINAL
|
|
56 |
A_VOLATILE := 16r0040.
|
|
57 |
A_TRANSIENT := 16r0080.
|
2147
|
58 |
A_SYBTHETIC := 16r1000.
|
|
59 |
A_ENUM := 16r4000.
|
749
|
60 |
|
2151
|
61 |
FieldTypeClasses := IdentityDictionary new
|
|
62 |
"Base types"
|
|
63 |
"/WARNING: If you change something here, you MUST also
|
|
64 |
"/ change JavaDescriptor class>>#initialize !!!!!!
|
|
65 |
|
|
66 |
at: #B put: Byte;
|
|
67 |
at: #C put: Character;
|
|
68 |
at: #D put: Float;
|
|
69 |
at: #F put: ShortFloat;
|
|
70 |
at: #I put: Integer; "Kludge: instances of java int are in fact SmallIntegers"
|
|
71 |
at: #J put: LargeInteger;
|
|
72 |
at: #S put: Short;
|
|
73 |
at: #Z put: Boolean;
|
|
74 |
|
|
75 |
"Array types"
|
|
76 |
"/WARNING: If you change something here, you MUST also
|
|
77 |
"/ change JavaDescriptor class>>#initialize !!!!!!
|
|
78 |
at: #'[B' put: ByteArray;
|
|
79 |
at: #'[C' put: Unicode16String;
|
|
80 |
at: #'[D' put: DoubleArray;
|
|
81 |
at: #'[F' put: FloatArray;
|
|
82 |
at: #'[I' put: SignedIntegerArray; "Kludge: instances of java int are in fact SmallIntegers"
|
|
83 |
at: #'[J' put: SignedLongIntegerArray;
|
|
84 |
at: #'[S' put: WordArray;
|
|
85 |
at: #'[Z' put: BooleanArray;
|
|
86 |
|
|
87 |
yourself
|
|
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
354
|
92 |
"
|
|
93 |
self initialize
|
|
94 |
"
|
|
95 |
|
2151
|
96 |
"Modified: / 13-05-1998 / 14:44:43 / cg"
|
|
97 |
"Modified: / 10-08-2011 / 00:48:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
354
|
98 |
! !
|
|
99 |
|
|
100 |
!JavaField class methodsFor:'constants'!
|
|
101 |
|
593
|
102 |
A_FINAL
|
|
103 |
^ A_FINAL
|
|
104 |
|
|
105 |
|
|
106 |
!
|
|
107 |
|
|
108 |
A_PRIVATE
|
|
109 |
^ A_PRIVATE
|
|
110 |
|
|
111 |
|
|
112 |
!
|
|
113 |
|
354
|
114 |
A_PROTECTED
|
|
115 |
^ A_PROTECTED
|
|
116 |
|
|
117 |
"Created: / 13.5.1998 / 13:03:51 / cg"
|
|
118 |
!
|
|
119 |
|
593
|
120 |
A_PUBLIC
|
|
121 |
^ A_PUBLIC
|
|
122 |
|
|
123 |
|
|
124 |
!
|
|
125 |
|
354
|
126 |
A_STATIC
|
|
127 |
^ A_STATIC
|
|
128 |
|
|
129 |
"Created: / 13.5.1998 / 13:03:55 / cg"
|
593
|
130 |
!
|
|
131 |
|
|
132 |
A_TRANSIENT
|
|
133 |
^ A_TRANSIENT
|
|
134 |
|
|
135 |
|
|
136 |
!
|
|
137 |
|
|
138 |
A_VOLATILE
|
|
139 |
^ A_VOLATILE
|
|
140 |
|
|
141 |
|
354
|
142 |
! !
|
|
143 |
|
27
|
144 |
!JavaField methodsFor:'accessing'!
|
|
145 |
|
2151
|
146 |
accessFlags
|
|
147 |
^ accessFlags
|
|
148 |
!
|
|
149 |
|
|
150 |
annotations
|
|
151 |
^ annotations
|
|
152 |
!
|
|
153 |
|
|
154 |
annotations:something
|
|
155 |
annotations := something.
|
|
156 |
!
|
|
157 |
|
|
158 |
constantPool
|
|
159 |
|
|
160 |
^ constantPool
|
|
161 |
|
|
162 |
"Created: / 17-12-2010 / 18:40:23 / Marcel Hlopko <hlopik@gmail.com>"
|
|
163 |
"Modified: / 27-07-2011 / 09:38:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
164 |
!
|
|
165 |
|
59
|
166 |
constantValue
|
|
167 |
^ constantValue
|
|
168 |
!
|
|
169 |
|
|
170 |
constantValue:aValue
|
|
171 |
constantValue := aValue
|
|
172 |
!
|
|
173 |
|
2151
|
174 |
ensureHasAnnotations
|
|
175 |
annotations ifNil: [ annotations := JavaAnnotationContainer for:self ].
|
|
176 |
^ annotations
|
|
177 |
|
|
178 |
"Created: / 25-02-2011 / 16:04:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
179 |
"Modified: / 16-03-2011 / 17:13:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
|
|
180 |
!
|
|
181 |
|
|
182 |
index
|
|
183 |
|
|
184 |
index ifNil:[
|
|
185 |
self isStatic ifTrue:[
|
|
186 |
index := class class instVarOffsetOf: name
|
|
187 |
] ifFalse:[
|
|
188 |
index := class instVarOffsetOf: name
|
|
189 |
].
|
|
190 |
].
|
|
191 |
^ index
|
|
192 |
|
|
193 |
"Modified: / 17-08-2011 / 09:26:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
194 |
!
|
|
195 |
|
|
196 |
javaClass
|
|
197 |
|
|
198 |
^ class
|
|
199 |
|
|
200 |
"Created: / 27-07-2011 / 09:17:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
201 |
!
|
|
202 |
|
27
|
203 |
name
|
|
204 |
^ name
|
376
|
205 |
!
|
|
206 |
|
|
207 |
signature
|
|
208 |
^ signature
|
|
209 |
|
|
210 |
"Created: / 15.10.1998 / 10:37:06 / cg"
|
27
|
211 |
! !
|
|
212 |
|
2151
|
213 |
!JavaField methodsFor:'initialization'!
|
6
|
214 |
|
|
215 |
setAccessFlags:flags
|
|
216 |
accessFlags := flags.
|
|
217 |
|
|
218 |
"Created: 16.4.1996 / 13:04:25 / cg"
|
|
219 |
!
|
|
220 |
|
2151
|
221 |
setClass: aClass
|
|
222 |
|
|
223 |
class := aClass
|
|
224 |
|
|
225 |
"Created: / 27-07-2011 / 09:27:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
226 |
!
|
|
227 |
|
|
228 |
setConstantPool:aJavaContantPool
|
|
229 |
|
|
230 |
constantPool := aJavaContantPool.
|
|
231 |
|
|
232 |
"Created: / 17-12-2010 / 18:41:59 / Marcel Hlopko <hlopik@gmail.com>"
|
|
233 |
"Created: / 27-07-2011 / 09:30:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
234 |
!
|
|
235 |
|
6
|
236 |
setConstantValue:something
|
|
237 |
constantValue := something.
|
|
238 |
|
|
239 |
"Created: 16.4.1996 / 13:04:58 / cg"
|
|
240 |
!
|
|
241 |
|
2151
|
242 |
setDescriptor:aString
|
|
243 |
|
|
244 |
descriptor := aString.
|
|
245 |
|
|
246 |
"Created: / 16-04-1996 / 13:04:43 / cg"
|
|
247 |
"Created: / 14-08-2011 / 19:40:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
248 |
!
|
|
249 |
|
|
250 |
setIndex:anInteger
|
|
251 |
index := anInteger.
|
|
252 |
|
|
253 |
"Created: / 22-11-2010 / 17:13:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
254 |
!
|
|
255 |
|
6
|
256 |
setName:aString
|
|
257 |
name := aString.
|
|
258 |
|
|
259 |
"Created: 16.4.1996 / 13:04:35 / cg"
|
|
260 |
!
|
|
261 |
|
|
262 |
setSignature:aString
|
|
263 |
signature := aString.
|
|
264 |
|
|
265 |
"Created: 16.4.1996 / 13:04:43 / cg"
|
|
266 |
! !
|
|
267 |
|
2151
|
268 |
!JavaField methodsFor:'printing & storing'!
|
|
269 |
|
|
270 |
printOn: aStream
|
|
271 |
|
|
272 |
super printOn: aStream.
|
|
273 |
aStream
|
|
274 |
nextPutAll:'(name: ';
|
|
275 |
nextPutAll: name;
|
|
276 |
nextPut:$,; space;
|
|
277 |
nextPutAll:'descriptor: ';
|
|
278 |
nextPutAll: signature;
|
|
279 |
nextPut:$)
|
|
280 |
|
|
281 |
"Created: / 22-05-2011 / 16:07:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
282 |
! !
|
|
283 |
|
35
|
284 |
!JavaField methodsFor:'queries'!
|
|
285 |
|
52
|
286 |
initialValue
|
2151
|
287 |
^ JavaClass initialValueFromSignature: descriptor
|
52
|
288 |
|
2151
|
289 |
"Modified: / 14-08-2011 / 19:59:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
52
|
290 |
!
|
|
291 |
|
35
|
292 |
isFinal
|
354
|
293 |
^ (accessFlags bitAnd:A_FINAL) ~~ 0
|
35
|
294 |
|
354
|
295 |
"Modified: / 13.5.1998 / 12:59:26 / cg"
|
35
|
296 |
!
|
|
297 |
|
|
298 |
isPrivate
|
354
|
299 |
^ (accessFlags bitAnd:A_PRIVATE) ~~ 0
|
35
|
300 |
|
354
|
301 |
"Modified: / 13.5.1998 / 12:59:30 / cg"
|
35
|
302 |
!
|
|
303 |
|
|
304 |
isProtected
|
354
|
305 |
^ (accessFlags bitAnd:A_PROTECTED) ~~ 0
|
35
|
306 |
|
354
|
307 |
"Modified: / 13.5.1998 / 12:59:35 / cg"
|
35
|
308 |
!
|
|
309 |
|
|
310 |
isPublic
|
354
|
311 |
^ (accessFlags bitAnd:A_PUBLIC) ~~ 0
|
35
|
312 |
|
354
|
313 |
"Modified: / 13.5.1998 / 12:59:40 / cg"
|
35
|
314 |
!
|
|
315 |
|
|
316 |
isStatic
|
354
|
317 |
^ (accessFlags bitAnd:A_STATIC) ~~ 0
|
35
|
318 |
|
354
|
319 |
"Modified: / 13.5.1998 / 12:59:43 / cg"
|
35
|
320 |
!
|
|
321 |
|
83
|
322 |
isTransient
|
354
|
323 |
^ (accessFlags bitAnd:A_TRANSIENT) ~~ 0
|
|
324 |
|
|
325 |
"Modified: / 13.5.1998 / 12:59:51 / cg"
|
83
|
326 |
!
|
|
327 |
|
|
328 |
isVolatile
|
354
|
329 |
^ (accessFlags bitAnd:A_VOLATILE) ~~ 0
|
|
330 |
|
|
331 |
"Modified: / 13.5.1998 / 12:59:56 / cg"
|
35
|
332 |
!
|
|
333 |
|
83
|
334 |
type
|
2151
|
335 |
^ JavaMethod typeFromSignature:descriptor in:nil
|
|
336 |
|
|
337 |
"Modified: / 08-01-1998 / 19:13:22 / cg"
|
|
338 |
"Modified: / 14-08-2011 / 19:43:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
339 |
!
|
255
|
340 |
|
2151
|
341 |
typeClass
|
|
342 |
|
|
343 |
^(JavaDescriptor fromString: descriptor) javaClass.
|
|
344 |
|
|
345 |
"Created: / 23-11-2010 / 17:02:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
|
346 |
"Modified: / 14-08-2011 / 19:59:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
|
35
|
347 |
! !
|
|
348 |
|
135
|
349 |
!JavaField class methodsFor:'documentation'!
|
6
|
350 |
|
|
351 |
version
|
2210
|
352 |
^ '$Header: /cvs/stx/stx/libjava/JavaField.st,v 1.19 2011-11-24 11:19:52 cg Exp $'
|
2147
|
353 |
!
|
|
354 |
|
|
355 |
version_CVS
|
2210
|
356 |
^ '$Header: /cvs/stx/stx/libjava/JavaField.st,v 1.19 2011-11-24 11:19:52 cg Exp $'
|
2151
|
357 |
!
|
|
358 |
|
|
359 |
version_SVN
|
2210
|
360 |
^ '§Id: JavaField.st,v 1.18 2011/08/18 18:42:48 vrany Exp §'
|
6
|
361 |
! !
|
713
|
362 |
|
2108
|
363 |
JavaField initialize!
|