author | Claus Gittinger <cg@exept.de> |
Wed, 26 Jun 2019 22:06:15 +0200 | |
branch | cvs_MAIN |
changeset 3917 | 94088b7097d5 |
parent 3582 | b592fb3845d4 |
child 3961 | 72bd0e4ba4d0 |
permissions | -rw-r--r-- |
749 | 1 |
" |
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2993
diff
changeset
|
2 |
COPYRIGHT (c) 1996-2015 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 |
|
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2993
diff
changeset
|
6 |
COPYRIGHT (c) 2010-2015 by Jan Vrany, Jan Kurs and Marcel Hlopko |
749 | 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 |
||
3582 | 23 |
"{ NameSpace: Smalltalk }" |
24 |
||
749 | 25 |
Object subclass:#JavaDescriptor |
26 |
instanceVariableNames:'' |
|
27 |
classVariableNames:'BaseTypes BaseTypesByTypeName ArrayTypes' |
|
28 |
poolDictionaries:'' |
|
29 |
category:'Languages-Java-Support' |
|
30 |
! |
|
31 |
||
32 |
!JavaDescriptor class methodsFor:'documentation'! |
|
33 |
||
34 |
copyright |
|
35 |
" |
|
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2993
diff
changeset
|
36 |
COPYRIGHT (c) 1996-2015 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
|
37 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
38 |
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
|
39 |
|
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2993
diff
changeset
|
40 |
COPYRIGHT (c) 2010-2015 by Jan Vrany, Jan Kurs and Marcel Hlopko |
749 | 41 |
SWING Research Group, Czech Technical University in Prague |
42 |
||
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. |
|
49 |
||
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
|
50 |
[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
|
51 |
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
|
52 |
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
|
53 |
as of 1.9.2010 |
749 | 54 |
|
55 |
" |
|
56 |
! ! |
|
57 |
||
58 |
!JavaDescriptor class methodsFor:'instance creation'! |
|
59 |
||
60 |
fromString: aString |
|
61 |
||
62 |
^self readFromString: aString |
|
63 |
||
64 |
"Created: / 25-11-2010 / 18:20:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
65 |
! |
|
66 |
||
67 |
readFrom: aStream |
|
68 |
^ self |
|
69 |
readFrom:aStream |
|
70 |
onError:[ self conversionErrorSignal |
|
3582 | 71 |
raiseWith:aStream errorString:' - invalid java descriptor'] |
749 | 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 |
||
96 |
!JavaDescriptor class methodsFor:'accessing'! |
|
97 |
||
98 |
baseTypes |
|
99 |
||
100 |
^BaseTypes |
|
101 |
||
102 |
"Created: / 22-05-2011 / 17:45:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
103 |
! |
|
104 |
||
105 |
baseTypesByTypeName |
|
106 |
||
107 |
^BaseTypesByTypeName |
|
108 |
||
109 |
"Created: / 03-02-2011 / 21:08:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
110 |
! ! |
|
111 |
||
112 |
!JavaDescriptor class methodsFor:'class initialization'! |
|
113 |
||
114 |
initialize |
|
115 |
" |
|
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
|
116 |
WindowGroup activeApplication spawnClassBrowserFor: BaseTypes values label:'Java primitive types' in:#buffer |
749 | 117 |
" |
118 |
"/WARNING: If you change something here, you MUST also |
|
119 |
"/ 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
|
120 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
121 |
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
|
122 |
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
|
123 |
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
|
124 |
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
|
125 |
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
|
126 |
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
|
127 |
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
|
128 |
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
|
129 |
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
|
130 |
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
|
131 |
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
|
132 |
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
|
133 |
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
|
134 |
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
|
135 |
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
|
136 |
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
|
137 |
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
|
138 |
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
|
139 |
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
|
140 |
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
|
141 |
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
|
142 |
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
|
143 |
" |
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 |
Tools::NewSystemBrowser basicNew spawnClassBrowserFor: ArrayTypes values label:'Java primitive array types' in:#newBrowser |
749 | 145 |
" |
146 |
"/WARNING: If you change something here, you MUST also |
|
147 |
"/ 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
|
148 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
149 |
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
|
150 |
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
|
151 |
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
|
152 |
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
|
153 |
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
|
154 |
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
|
155 |
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
|
156 |
at: $S put: WordArray; |
2993
ed8cd8e5a16d
Added JavaBooleanArray to represent boolean[].
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2731
diff
changeset
|
157 |
at: $Z put: JavaBooleanArray; |
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
|
158 |
yourself |
749 | 159 |
|
160 |
"Created: / 25-11-2010 / 17:51:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2993
ed8cd8e5a16d
Added JavaBooleanArray to represent boolean[].
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2731
diff
changeset
|
161 |
"Modified: / 31-01-2014 / 12:31:23 / 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
|
162 |
! ! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
163 |
|
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 |
!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
|
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 |
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
|
167 |
| 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
|
168 |
|
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 |
(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
|
170 |
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
|
171 |
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
|
172 |
] 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
|
173 |
^( 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
|
174 |
and: [BaseTypes includesKey: justTypeSymbol first]. |
749 | 175 |
! ! |
176 |
||
177 |
!JavaDescriptor class methodsFor:'reading-private'! |
|
178 |
||
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
|
179 |
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
|
180 |
| p c | |
749 | 181 |
|
182 |
stream next. "eat $[" |
|
183 |
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
|
184 |
"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
|
185 |
$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
|
186 |
$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
|
187 |
$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
|
188 |
$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
|
189 |
$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
|
190 |
$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
|
191 |
$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
|
192 |
^ 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
|
193 |
]. |
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 |
"OK, not a primitive array..." |
749 | 195 |
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
|
196 |
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
|
197 |
^c |
749 | 198 |
|
199 |
"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
|
200 |
"Modified: / 16-08-2012 / 13:31:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
749 | 201 |
! |
202 |
||
203 |
readBaseTypeFrom: stream onError: exceptionBlock |
|
204 |
||
205 |
^JavaFieldDescriptor javaClass: (BaseTypes at: (stream next) ifAbsent: exceptionBlock) |
|
206 |
||
207 |
"Created: / 25-11-2010 / 18:11:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
208 |
! |
|
209 |
||
210 |
readFieldDescriptorFrom: stream onError: exceptionBlock |
|
211 |
||
212 |
| p | |
|
213 |
p := stream peek. |
|
214 |
||
215 |
p == $L ifTrue:[^self readObjectTypeFrom: stream onError: exceptionBlock]. |
|
216 |
p == $[ ifTrue:[^self readArrayTypeFrom: stream onError: exceptionBlock]. |
|
217 |
(#( |
|
218 |
$B "byte" |
|
219 |
$C "char" |
|
220 |
$D "double" |
|
221 |
$F "float" |
|
222 |
$I "int" |
|
223 |
$J "long" |
|
224 |
$S "short" |
|
225 |
$Z "boolean" |
|
226 |
$V "void" |
|
227 |
) includes: p) ifTrue:[^self readBaseTypeFrom: stream onError: exceptionBlock]. |
|
228 |
||
229 |
exceptionBlock value |
|
230 |
||
231 |
"Created: / 25-11-2010 / 17:55:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
232 |
"Modified: / 21-12-2010 / 22:47:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
233 |
! |
|
234 |
||
235 |
readMethodDescriptorFrom: stream onError: exceptionBlock |
|
236 |
||
237 |
| parameterDescriptors returnDescriptor | |
|
238 |
||
239 |
stream peek == $< ifTrue:[ |
|
240 |
self readTypeVariableFrom: stream onError: exceptionBlock |
|
241 |
]. |
|
242 |
stream next. "eat $(" |
|
243 |
parameterDescriptors := OrderedCollection new. |
|
244 |
[ stream peek ~= $) ] whileTrue:[ |
|
245 |
parameterDescriptors add:( self readFieldDescriptorFrom: stream onError: exceptionBlock). |
|
246 |
]. |
|
247 |
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
|
248 |
"/ 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
|
249 |
"/ 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
|
250 |
"/ ] 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
|
251 |
"/ 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
|
252 |
"/ ]. |
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 |
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
|
254 |
|
749 | 255 |
^JavaMethodDescriptor parameters: parameterDescriptors return: returnDescriptor |
256 |
||
257 |
" |
|
258 |
JavaDescriptor fromString:'(ILjava/lang/Object;)V' |
|
259 |
JavaDescriptor fromString:'(ILjava/lang/Object;)Ljava/lang/Class;' |
|
260 |
" |
|
261 |
||
262 |
"Created: / 25-11-2010 / 18:36:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
263 |
"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
|
264 |
"Modified: / 12-12-2011 / 17:22:48 / kursjan <kursjan@fit.cvut.cz>" |
749 | 265 |
! |
266 |
||
267 |
readObjectTypeFrom: stream onError: exceptionBlock |
|
268 |
||
269 |
| clsName out | |
|
270 |
||
271 |
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
|
272 |
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
|
273 |
[ 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
|
274 |
| 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
|
275 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2308
diff
changeset
|
276 |
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
|
277 |
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
|
278 |
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
|
279 |
]. |
749 | 280 |
clsName := out contents. |
281 |
stream peek == $< ifTrue:[ |
|
282 |
self readTypeVariableFrom: stream onError: exceptionBlock |
|
283 |
]. |
|
284 |
||
285 |
"Just a check" |
|
286 |
stream next ~= $; ifTrue:[exceptionBlock value]. |
|
287 |
^JavaFieldDescriptor javaClassName: clsName. |
|
288 |
||
289 |
"Created: / 25-11-2010 / 18:08:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
290 |
! |
|
291 |
||
292 |
readTypeVariableFrom: stream onError: exceptionBlock |
|
293 |
||
294 |
| nangles | |
|
295 |
||
296 |
stream next. "/eat $<. |
|
297 |
nangles := 1. |
|
298 |
[ nangles ~~ 0 ] whileTrue:[ |
|
299 |
stream peek == $< ifTrue:[nangles := nangles + 1]. |
|
300 |
stream peek == $> ifTrue:[nangles := nangles - 1]. |
|
301 |
stream next. |
|
302 |
] |
|
303 |
||
304 |
"Created: / 13-08-2011 / 01:39:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
305 |
! ! |
|
306 |
||
307 |
!JavaDescriptor class methodsFor:'documentation'! |
|
308 |
||
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
|
309 |
version_CVS |
3582 | 310 |
^ '$Header$' |
2308
5355d2734b8e
fixed: #version_SVN ($ to §)
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
311 |
! |
5355d2734b8e
fixed: #version_SVN ($ to §)
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
312 |
|
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
|
313 |
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
|
314 |
|
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 |
^ '$Changeset: <not expanded> $' |
2308
5355d2734b8e
fixed: #version_SVN ($ to §)
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
316 |
! |
5355d2734b8e
fixed: #version_SVN ($ to §)
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
317 |
|
749 | 318 |
version_SVN |
3582 | 319 |
^ '$Id$' |
749 | 320 |
! ! |
321 |
||
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
|
322 |
|
2152 | 323 |
JavaDescriptor initialize! |