author | Stefan Vogel <sv@exept.de> |
Thu, 11 Apr 2013 11:34:19 +0200 | |
changeset 2495 | 5f36daadd04a |
parent 2396 | fadc6d7a2f5b |
child 2429 | ebece4dcaab9 |
child 2678 | c865275e48a7 |
permissions | -rw-r--r-- |
749 | 1 |
" |
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
3 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
4 |
New code and modifications done at SWING Research Group [1]: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
5 |
|
749 | 6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
7 |
SWING Research Group, Czech Technical University in Prague |
|
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. |
|
15 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
16 |
[1] Code written at SWING Research Group contains a signature |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
17 |
of one of the above copright owners. For exact set of such code, |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
18 |
see the differences between this version and version stx:libjava |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
19 |
as of 1.9.2010 |
749 | 20 |
" |
21 |
"{ Package: 'stx:libjava' }" |
|
22 |
||
23 |
Object subclass:#JavaDescriptor |
|
24 |
instanceVariableNames:'' |
|
25 |
classVariableNames:'BaseTypes BaseTypesByTypeName ArrayTypes' |
|
26 |
poolDictionaries:'' |
|
27 |
category:'Languages-Java-Support' |
|
28 |
! |
|
29 |
||
30 |
!JavaDescriptor class methodsFor:'documentation'! |
|
31 |
||
32 |
copyright |
|
33 |
" |
|
34 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
35 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
36 |
New code and modifications done at SWING Research Group [1]: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
37 |
|
749 | 38 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
39 |
SWING Research Group, Czech Technical University in Prague |
|
40 |
||
41 |
This software is furnished under a license and may be used |
|
42 |
only in accordance with the terms of that license and with the |
|
43 |
inclusion of the above copyright notice. This software may not |
|
44 |
be provided or otherwise made available to, or used by, any |
|
45 |
other person. No title to or ownership of the software is |
|
46 |
hereby transferred. |
|
47 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
48 |
[1] Code written at SWING Research Group contains a signature |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
49 |
of one of the above copright owners. For exact set of such code, |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
50 |
see the differences between this version and version stx:libjava |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
51 |
as of 1.9.2010 |
749 | 52 |
|
53 |
" |
|
54 |
! ! |
|
55 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
56 |
|
749 | 57 |
!JavaDescriptor class methodsFor:'instance creation'! |
58 |
||
59 |
fromString: aString |
|
60 |
||
61 |
^self readFromString: aString |
|
62 |
||
63 |
"Created: / 25-11-2010 / 18:20:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
64 |
! |
|
65 |
||
66 |
readFrom: aStream |
|
67 |
||
68 |
^ self |
|
69 |
readFrom:aStream |
|
70 |
onError:[ self conversionErrorSignal |
|
71 |
raiseErrorString:'invalid java descriptor'] |
|
72 |
||
73 |
"Created: / 25-11-2010 / 18:04:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
74 |
! |
|
75 |
||
76 |
readFrom:stream onError:exceptionBlock |
|
77 |
||
78 |
(stream peek == $( or:[stream peek == $<]) |
|
79 |
ifTrue: [^self readMethodDescriptorFrom: stream onError: exceptionBlock] |
|
80 |
ifFalse:[^self readFieldDescriptorFrom: stream onError: exceptionBlock]. |
|
81 |
||
82 |
" |
|
83 |
JavaDescriptor fromString:'Ljava/lang/Object;' |
|
84 |
JavaDescriptor fromString:'[I' |
|
85 |
JavaDescriptor fromString:'[[I' |
|
86 |
JavaDescriptor fromString:'(ILjava/lang/Object;)V' |
|
87 |
JavaDescriptor fromString:'(ILjava/lang/Object;)Ljava/lang/Class;' |
|
88 |
JavaDescriptor fromString:'<T:Ljava/lang/Object;>(Ljava/util/Collection<TT;>;I)Ljava/util/Collection<TT;>;' |
|
89 |
||
90 |
" |
|
91 |
||
92 |
"Created: / 25-11-2010 / 17:50:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
93 |
"Modified: / 13-08-2011 / 01:37:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
94 |
! ! |
|
95 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
96 |
|
749 | 97 |
!JavaDescriptor class methodsFor:'accessing'! |
98 |
||
99 |
baseTypes |
|
100 |
||
101 |
^BaseTypes |
|
102 |
||
103 |
"Created: / 22-05-2011 / 17:45:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
104 |
! |
|
105 |
||
106 |
baseTypesByTypeName |
|
107 |
||
108 |
^BaseTypesByTypeName |
|
109 |
||
110 |
"Created: / 03-02-2011 / 21:08:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
111 |
! ! |
|
112 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
113 |
|
749 | 114 |
!JavaDescriptor class methodsFor:'class initialization'! |
115 |
||
116 |
initialize |
|
117 |
" |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
118 |
WindowGroup activeApplication spawnClassBrowserFor: BaseTypes values label:'Java primitive types' in:#buffer |
749 | 119 |
" |
120 |
"/WARNING: If you change something here, you MUST also |
|
121 |
"/ change JavaField class>>#initialize !!!!!! |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
122 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
123 |
BaseTypes := (IdentityDictionary new) |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
124 |
at: $B put: JavaByte; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
125 |
at: $C put: Character; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
126 |
at: $D put: Float; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
127 |
at: $F put: ShortFloat; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
128 |
at: $I put: Integer; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
129 |
at: $J put: LargeInteger; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
130 |
at: $S put: JavaShort; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
131 |
at: $Z put: Boolean; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
132 |
at: $V put: UndefinedObject; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
133 |
yourself. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
134 |
BaseTypesByTypeName := (Dictionary new) |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
135 |
at: 'byte' put: JavaByte; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
136 |
at: 'char' put: Character; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
137 |
at: 'double' put: Float; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
138 |
at: 'float' put: ShortFloat; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
139 |
at: 'int' put: Integer; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
140 |
at: 'long' put: LargeInteger; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
141 |
at: 'short' put: JavaShort; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
142 |
at: 'boolean' put: Boolean; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
143 |
at: 'void' put: UndefinedObject; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
144 |
yourself. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
145 |
" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
146 |
Tools::NewSystemBrowser basicNew spawnClassBrowserFor: ArrayTypes values label:'Java primitive array types' in:#newBrowser |
749 | 147 |
" |
148 |
"/WARNING: If you change something here, you MUST also |
|
149 |
"/ change JavaField class>>#initialize !!!!!! |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
150 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
151 |
ArrayTypes := (IdentityDictionary new) |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
152 |
at: $B put: ByteArray; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
153 |
at: $C put: Unicode16String; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
154 |
at: $D put: DoubleArray; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
155 |
at: $F put: FloatArray; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
156 |
at: $I put: SignedIntegerArray; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
157 |
at: $J put: SignedLongIntegerArray; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
158 |
at: $S put: WordArray; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
159 |
at: $Z put: BooleanArray; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
160 |
yourself |
749 | 161 |
|
162 |
"Created: / 25-11-2010 / 17:51:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
163 |
"Modified: / 10-08-2011 / 00:48:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
164 |
"Modified (comment): / 24-02-2012 / 19:40:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
165 |
! ! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
166 |
|
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
167 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
168 |
!JavaDescriptor class methodsFor:'queries'! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
169 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
170 |
isJavaPrimitiveArrayName: className |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
171 |
| justTypeSymbol | |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
172 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
173 |
(className startsWith: $[) ifTrue: [ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
174 |
justTypeSymbol := className copyFrom: ((className lastIndexOf: $[) + 1) |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
175 |
to: className size |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
176 |
] ifFalse: [ ^ false ]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
177 |
^( justTypeSymbol size = 1 ) |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
178 |
and: [BaseTypes includesKey: justTypeSymbol first]. |
749 | 179 |
! ! |
180 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
181 |
|
749 | 182 |
!JavaDescriptor class methodsFor:'reading-private'! |
183 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
184 |
readArrayTypeFrom: stream onError: exceptionBlock |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
185 |
| p c | |
749 | 186 |
|
187 |
stream next. "eat $[" |
|
188 |
p := stream peek. |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
189 |
"byte" "char" "double" "float" "int" "long" "short" "boolean" (#( $B |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
190 |
$C |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
191 |
$D |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
192 |
$F |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
193 |
$I |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
194 |
$J |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
195 |
$S |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
196 |
$Z ) includes: p) ifTrue: [ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
197 |
^ JavaFieldDescriptor javaClass: (ArrayTypes at: stream next) |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
198 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
199 |
"OK, not a primitive array..." |
749 | 200 |
c := self readFrom: stream onError: exceptionBlock. |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
201 |
c dimensions: c dimensions + 1. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
202 |
^c |
749 | 203 |
|
204 |
"Created: / 25-11-2010 / 18:12:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
205 |
"Modified: / 16-08-2012 / 13:31:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
749 | 206 |
! |
207 |
||
208 |
readBaseTypeFrom: stream onError: exceptionBlock |
|
209 |
||
210 |
^JavaFieldDescriptor javaClass: (BaseTypes at: (stream next) ifAbsent: exceptionBlock) |
|
211 |
||
212 |
"Created: / 25-11-2010 / 18:11:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
213 |
! |
|
214 |
||
215 |
readFieldDescriptorFrom: stream onError: exceptionBlock |
|
216 |
||
217 |
| p | |
|
218 |
p := stream peek. |
|
219 |
||
220 |
p == $L ifTrue:[^self readObjectTypeFrom: stream onError: exceptionBlock]. |
|
221 |
p == $[ ifTrue:[^self readArrayTypeFrom: stream onError: exceptionBlock]. |
|
222 |
(#( |
|
223 |
$B "byte" |
|
224 |
$C "char" |
|
225 |
$D "double" |
|
226 |
$F "float" |
|
227 |
$I "int" |
|
228 |
$J "long" |
|
229 |
$S "short" |
|
230 |
$Z "boolean" |
|
231 |
$V "void" |
|
232 |
) includes: p) ifTrue:[^self readBaseTypeFrom: stream onError: exceptionBlock]. |
|
233 |
||
234 |
exceptionBlock value |
|
235 |
||
236 |
"Created: / 25-11-2010 / 17:55:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
237 |
"Modified: / 21-12-2010 / 22:47:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
238 |
! |
|
239 |
||
240 |
readMethodDescriptorFrom: stream onError: exceptionBlock |
|
241 |
||
242 |
| parameterDescriptors returnDescriptor | |
|
243 |
||
244 |
stream peek == $< ifTrue:[ |
|
245 |
self readTypeVariableFrom: stream onError: exceptionBlock |
|
246 |
]. |
|
247 |
stream next. "eat $(" |
|
248 |
parameterDescriptors := OrderedCollection new. |
|
249 |
[ stream peek ~= $) ] whileTrue:[ |
|
250 |
parameterDescriptors add:( self readFieldDescriptorFrom: stream onError: exceptionBlock). |
|
251 |
]. |
|
252 |
stream next. "eat $)" |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
253 |
"/ stream peek == $V ifFalse:[ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
254 |
"/ returnDescriptor := self readFieldDescriptorFrom: stream onError: exceptionBlock. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
255 |
"/ ] ifTrue:[ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
256 |
"/ stream next. "eat $V" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
257 |
"/ ]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
258 |
returnDescriptor := self readFieldDescriptorFrom: stream onError: exceptionBlock. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
259 |
|
749 | 260 |
^JavaMethodDescriptor parameters: parameterDescriptors return: returnDescriptor |
261 |
||
262 |
" |
|
263 |
JavaDescriptor fromString:'(ILjava/lang/Object;)V' |
|
264 |
JavaDescriptor fromString:'(ILjava/lang/Object;)Ljava/lang/Class;' |
|
265 |
" |
|
266 |
||
267 |
"Created: / 25-11-2010 / 18:36:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
268 |
"Modified: / 13-08-2011 / 01:39:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
269 |
"Modified: / 12-12-2011 / 17:22:48 / kursjan <kursjan@fit.cvut.cz>" |
749 | 270 |
! |
271 |
||
272 |
readObjectTypeFrom: stream onError: exceptionBlock |
|
273 |
||
274 |
| clsName out | |
|
275 |
||
276 |
stream next. "/eat $L. |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
277 |
out := String new writeStream. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
278 |
[ stream peek ~~ $; and:[stream peek ~~ $< ]] whileTrue:[ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
279 |
| c | |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
280 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
281 |
c := stream next. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
282 |
c isNil ifTrue:[exceptionBlock value. ^nil]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
283 |
out nextPut: c. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
284 |
]. |
749 | 285 |
clsName := out contents. |
286 |
stream peek == $< ifTrue:[ |
|
287 |
self readTypeVariableFrom: stream onError: exceptionBlock |
|
288 |
]. |
|
289 |
||
290 |
"Just a check" |
|
291 |
stream next ~= $; ifTrue:[exceptionBlock value]. |
|
292 |
^JavaFieldDescriptor javaClassName: clsName. |
|
293 |
||
294 |
"Created: / 25-11-2010 / 18:08:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
295 |
! |
|
296 |
||
297 |
readTypeVariableFrom: stream onError: exceptionBlock |
|
298 |
||
299 |
| nangles | |
|
300 |
||
301 |
stream next. "/eat $<. |
|
302 |
nangles := 1. |
|
303 |
[ nangles ~~ 0 ] whileTrue:[ |
|
304 |
stream peek == $< ifTrue:[nangles := nangles + 1]. |
|
305 |
stream peek == $> ifTrue:[nangles := nangles - 1]. |
|
306 |
stream next. |
|
307 |
] |
|
308 |
||
309 |
"Created: / 13-08-2011 / 01:39:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
310 |
! ! |
|
311 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
312 |
|
749 | 313 |
!JavaDescriptor class methodsFor:'documentation'! |
314 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
315 |
version_CVS |
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
316 |
^ '$Header: /cvs/stx/stx/libjava/JavaDescriptor.st,v 1.4 2013-02-25 11:15:31 vrany Exp $' |
2308
5355d2734b8e
fixed: #version_SVN ($ to §)
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
317 |
! |
5355d2734b8e
fixed: #version_SVN ($ to §)
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
318 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
319 |
version_HG |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
320 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
321 |
^ '$Changeset: <not expanded> $' |
2308
5355d2734b8e
fixed: #version_SVN ($ to §)
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
322 |
! |
5355d2734b8e
fixed: #version_SVN ($ to §)
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
323 |
|
749 | 324 |
version_SVN |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
325 |
^ '§Id§' |
749 | 326 |
! ! |
327 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
328 |
|
2152 | 329 |
JavaDescriptor initialize! |