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