author | vranyj1 |
Thu, 27 Oct 2011 12:38:22 +0000 | |
branch | jk_new_structure |
changeset 1052 | 4f6434d914fd |
parent 1050 | df4edfc9b41f |
child 1055 | d89af7610ed3 |
permissions | -rw-r--r-- |
752 | 1 |
" |
877 | 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: |
|
752 | 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. |
|
877 | 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. |
|
752 | 41 |
" |
42 |
"{ Package: 'stx:libjava' }" |
|
43 |
||
44 |
Object subclass:#JavaClassReader |
|
45 |
instanceVariableNames:'inStream msb constants majorVsn minorVsn constNeeds2Slots |
|
775 | 46 |
constSlot classBeingLoaded' |
752 | 47 |
classVariableNames:'Verbose AnnotationsVerbose Silent AbsolutelySilent |
48 |
LazyClassLoading InvalidClassFormatSignal ClassLoaderQuerySignal |
|
877 | 49 |
JavaArchiveCache' |
752 | 50 |
poolDictionaries:'' |
51 |
category:'Languages-Java-Support' |
|
52 |
! |
|
53 |
||
54 |
!JavaClassReader class methodsFor:'documentation'! |
|
55 |
||
56 |
copyright |
|
57 |
" |
|
877 | 58 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
59 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
|
60 |
SWING Research Group, Czech Technical University in Prague |
|
61 |
||
62 |
Parts of the code written by Claus Gittinger are under following |
|
63 |
license: |
|
752 | 64 |
|
65 |
This software is furnished under a license and may be used |
|
66 |
only in accordance with the terms of that license and with the |
|
67 |
inclusion of the above copyright notice. This software may not |
|
68 |
be provided or otherwise made available to, or used by, any |
|
69 |
other person. No title to or ownership of the software is |
|
70 |
hereby transferred. |
|
877 | 71 |
|
72 |
Parts of the code written at SWING Reasearch Group [1] are MIT licensed: |
|
73 |
||
74 |
Permission is hereby granted, free of charge, to any person |
|
75 |
obtaining a copy of this software and associated documentation |
|
76 |
files (the 'Software'), to deal in the Software without |
|
77 |
restriction, including without limitation the rights to use, |
|
78 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
79 |
copies of the Software, and to permit persons to whom the |
|
80 |
Software is furnished to do so, subject to the following |
|
81 |
conditions: |
|
82 |
||
83 |
The above copyright notice and this permission notice shall be |
|
84 |
included in all copies or substantial portions of the Software. |
|
85 |
||
86 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
|
87 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
|
88 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
|
89 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
|
90 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
91 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
92 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
|
93 |
OTHER DEALINGS IN THE SOFTWARE. |
|
94 |
||
95 |
[1] Code written at SWING Research Group contain a signature |
|
96 |
of one of the above copright owners. |
|
97 |
||
752 | 98 |
" |
99 |
! ! |
|
100 |
||
101 |
!JavaClassReader class methodsFor:'initialization'! |
|
102 |
||
103 |
initialize |
|
104 |
InvalidClassFormatSignal := Signal new mayProceed: true. |
|
105 |
InvalidClassFormatSignal notifierString: 'class load failure'. |
|
106 |
InvalidClassFormatSignal nameClass: self message: #invalidClassFormatSignal. |
|
107 |
Verbose := false. |
|
108 |
Silent := true. |
|
109 |
AbsolutelySilent := false. |
|
110 |
||
111 |
"/LazyClassLoading := false. |
|
112 |
||
113 |
LazyClassLoading := true. |
|
114 |
ClassLoaderQuerySignal := QuerySignal new. |
|
115 |
JavaArchiveCache := CacheDictionary new: 32. |
|
116 |
AnnotationsVerbose := false. |
|
771 | 117 |
|
752 | 118 |
" |
119 |
JavaClassReader initialize" |
|
120 |
||
121 |
"Modified: / 27-01-1998 / 17:54:23 / cg" |
|
122 |
"Modified: / 17-12-2010 / 17:37:45 / Marcel Hlopko <hlopik@gmail.com>" |
|
772
0f92c23b80ee
testing new project structure + fixing tiny litle bug which caused java not to work at all :)
hlopkmar
parents:
771
diff
changeset
|
123 |
"Modified: / 10-05-2011 / 23:59:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
877 | 124 |
"Modified: / 26-07-2011 / 17:21:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 125 |
! ! |
126 |
||
127 |
!JavaClassReader class methodsFor:'Signal constants'! |
|
128 |
||
129 |
classLoaderQuerySignal |
|
130 |
^ ClassLoaderQuerySignal |
|
131 |
||
132 |
"Created: 14.8.1997 / 19:56:03 / cg" |
|
133 |
! |
|
134 |
||
135 |
invalidClassFormatSignal |
|
136 |
^ InvalidClassFormatSignal |
|
137 |
||
138 |
"Created: 3.8.1997 / 18:17:21 / cg" |
|
139 |
! ! |
|
140 |
||
141 |
!JavaClassReader class methodsFor:'constants'! |
|
142 |
||
143 |
fileMajorVersions |
|
831 | 144 |
^#( |
145 |
46 "Java 1.2" |
|
920 | 146 |
47 "???" |
147 |
48 "???" |
|
831 | 148 |
49 "Java 5" |
149 |
50 "Java 6" |
|
150 |
). |
|
151 |
||
152 |
" |
|
153 |
JSR 202: |
|
154 |
The Java virtual machine implementation of Sun's JDK release 1.0.2 supports |
|
155 |
class file format versions 45.0 through 45.3 inclusive. Sun's JDK releases |
|
156 |
1.1.X can support class file formats of versions in the range 45.0 through |
|
157 |
45.65535 inclusive. For k > 1 implementations of version 1.k of the Java 2 |
|
158 |
platform can support class file formats of versions in the range 45.0 through |
|
159 |
44+k.0 inclusive. |
|
160 |
" |
|
752 | 161 |
|
162 |
"Created: / 19-10-2010 / 21:40:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
830
235c482b462f
- JavaClassReader: do not want about .class file version 50.0
vranyj1
parents:
828
diff
changeset
|
163 |
"Modified: / 01-06-2011 / 21:44:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
831 | 164 |
"Modified: / 02-06-2011 / 22:50:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
920 | 165 |
"Modified: / 18-08-2011 / 19:32:37 / jv" |
752 | 166 |
! |
167 |
||
168 |
fileMinorVersions |
|
169 |
^ #( |
|
170 |
3 "Java 1.2" |
|
171 |
0 "Java 6" |
|
172 |
) |
|
173 |
||
174 |
"Created: / 19-10-2010 / 21:41:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
175 |
! |
|
176 |
||
177 |
magic_LSB |
|
178 |
^ 16rBEBAFECA |
|
179 |
||
180 |
"Modified: / 7.5.1998 / 13:14:27 / cg" |
|
181 |
"Created: / 7.5.1998 / 13:15:05 / cg" |
|
182 |
! |
|
183 |
||
184 |
magic_MSB |
|
185 |
^ 16rCAFEBABE |
|
186 |
||
187 |
"Modified: / 7.5.1998 / 13:14:27 / cg" |
|
188 |
! ! |
|
189 |
||
190 |
!JavaClassReader class methodsFor:'debugging'! |
|
191 |
||
192 |
annotationsVerbose:aBoolean |
|
193 |
AnnotationsVerbose := aBoolean |
|
194 |
||
195 |
" |
|
196 |
Java flushClasses. |
|
197 |
JavaClassReader verbose:true |
|
198 |
JavaClassReader verbose:false" |
|
199 |
||
200 |
"Created: / 25-02-2011 / 12:25:23 / Marcel Hlopko <hlopik@gmail.com>" |
|
201 |
! |
|
202 |
||
203 |
verbose:aBoolean |
|
204 |
Verbose := aBoolean |
|
205 |
||
206 |
" |
|
207 |
Java flushClasses. |
|
208 |
JavaClassReader verbose:true |
|
209 |
JavaClassReader verbose:false |
|
210 |
" |
|
211 |
! ! |
|
212 |
||
213 |
!JavaClassReader class methodsFor:'file reading'! |
|
214 |
||
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
215 |
readClass: aClassName |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
216 |
"reads a class, and returns it. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
217 |
<clinit> is called, class is not installed" |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
218 |
|
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
219 |
^ self readClass: aClassName ignoring: Set new. |
752 | 220 |
|
960 | 221 |
"Created: / 15-04-1996 / 14:58:53 / cg" |
222 |
"Modified: / 20-10-1998 / 17:24:54 / cg" |
|
992 | 223 |
"Modified: / 08-09-2011 / 08:10:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 224 |
! |
225 |
||
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
226 |
readClass: className ignoring: classesBeingLoadedOrNil |
1041 | 227 |
|
228 |
"This method is bit hacky, as it tries to supply 'correct' |
|
229 |
classloader. |
|
230 |
||
231 |
If the class is loaded from Java release classPath (containing |
|
232 |
base java classes shipped with JDK/JRE), then set the classloader |
|
233 |
to null. Otherwise set class's loader to system class loader |
|
234 |
(as returned by ClassLoader#getSystemClassLoader()) |
|
235 |
||
236 |
This is required to run groovy and other SW that uses resources |
|
237 |
or other classloader dependent stuff. When changing, make sure |
|
238 |
Groovy is running afterwards!!!!!! |
|
239 |
" |
|
240 |
||
241 |
| class java_lang_ClassLoader scl | |
|
242 |
class := self |
|
243 |
readClass: className ignoring: classesBeingLoadedOrNil |
|
244 |
classPath: Java release classPath. |
|
245 |
class notNil ifTrue:[ ^ class ]. |
|
246 |
||
247 |
class := self |
|
248 |
readClass: className ignoring: classesBeingLoadedOrNil |
|
249 |
classPath: Java classPath. |
|
250 |
class notNil ifTrue:[ |
|
251 |
JavaVM booted ifFalse:[ |
|
252 |
self breakPoint:#jv info: 'Should not happen!!'. |
|
253 |
]. |
|
254 |
java_lang_ClassLoader := JavaVM classForName: 'java.lang.ClassLoader'. |
|
255 |
(scl := java_lang_ClassLoader instVarNamed:#scl) isNil ifTrue:[ |
|
256 |
scl := java_lang_ClassLoader perform: #'getSystemClassLoader()Ljava/lang/ClassLoader;' |
|
257 |
]. |
|
258 |
class classLoader: scl. |
|
259 |
]. |
|
260 |
||
261 |
^class |
|
262 |
||
263 |
"Created: / 15-04-1996 / 14:58:53 / cg" |
|
264 |
"Modified: / 20-10-1998 / 17:24:54 / cg" |
|
265 |
"Modified: / 21-10-2011 / 13:39:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
266 |
"Modified: / 23-10-2011 / 22:07:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
267 |
! |
|
268 |
||
269 |
readClass: className ignoring: classesBeingLoadedOrNil classPath: classPath |
|
1036 | 270 |
"searches classspath for a class, loads it and returns. |
271 |
<clinit> is not called, class is not installed as global" |
|
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
272 |
|
1036 | 273 |
| rslt clsName classesBeingLoaded | |
274 |
clsName := className asInternalJavaClassName. |
|
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
275 |
classesBeingLoadedOrNil isNil ifTrue: [ |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
276 |
classesBeingLoaded := Set with: clsName |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
277 |
] ifFalse: [ |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
278 |
classesBeingLoaded := classesBeingLoadedOrNil |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
279 |
add: clsName; |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
280 |
yourself. |
1021
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
281 |
]. |
1041 | 282 |
classPath do: [:path | |
1021
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
283 |
| nm p zar entry zipFile read | |
1041 | 284 |
|
1021
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
285 |
p := path. |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
286 |
p asFilename isDirectory ifTrue: [ |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
287 |
(p endsWith: Filename separator) ifFalse: [ |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
288 |
p := p , (Filename separator asString) |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
289 |
]. |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
290 |
(Array |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
291 |
with: clsName |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
292 |
with: clsName asLowercase |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
293 |
with: clsName asUppercase) |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
294 |
do: [ |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
295 |
:tryName | |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
296 |
nm := p , tryName , '.class'. |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
297 |
nm asFilename exists ifTrue: [ |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
298 |
(Java isExcludedFromClassPath: nm) ifFalse: [ |
1032 | 299 |
self breakPoint: #mh. |
300 |
"means we are successfully going to read something :)" |
|
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
301 |
rslt := self readFile: nm ignoring: classesBeingLoaded. |
1032 | 302 |
rslt notNil ifTrue: [ ^ rslt. ]. |
1021
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
303 |
] |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
304 |
]. |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
305 |
] |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
306 |
] ifFalse: [ |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
307 |
((zipFile := p asFilename withSuffix: 'jar') exists |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
308 |
or: [ (zipFile := p asFilename withSuffix: 'zip') exists ]) |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
309 |
ifTrue: [ |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
310 |
zar := JavaArchiveCache at: zipFile |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
311 |
ifAbsentPut: [ ZipArchive oldFileNamed: zipFile ]. |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
312 |
read := [ |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
313 |
nm := clsName , '.class'. |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
314 |
entry := zar extract: nm. |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
315 |
entry notNil ifTrue: [ |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
316 |
(Java isExcludedFromClassPath: nm) ifFalse: [ |
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
317 |
rslt := self readStream: (entry readStream) ignoring: classesBeingLoaded. |
1021
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
318 |
rslt notNil ifTrue: [ ^ rslt ]. |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
319 |
] |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
320 |
] |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
321 |
]. |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
322 |
JavaClassReader invalidClassFormatSignal |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
323 |
handle: [ |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
324 |
"Kludge, sometimes zar gets corrupted" |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
325 |
zar := JavaArchiveCache at: zipFile put: (ZipArchive oldFileNamed: zipFile). |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
326 |
read value |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
327 |
] |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
328 |
do: [ read value ]. |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
329 |
] |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
330 |
] |
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1000
diff
changeset
|
331 |
]. |
1037 | 332 |
^nil |
752 | 333 |
|
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
334 |
"Created: / 15-04-1996 / 14:58:53 / cg" |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
335 |
"Modified: / 20-10-1998 / 17:24:54 / cg" |
1036 | 336 |
"Modified: / 21-10-2011 / 13:39:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1037 | 337 |
"Modified: / 23-10-2011 / 12:03:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1041 | 338 |
"Created: / 23-10-2011 / 21:48:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 339 |
! |
340 |
||
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
341 |
readFile: aFilename ignoring: classesBeingLoaded |
752 | 342 |
"reads a class from aFilename and returns it. |
343 |
The JavaClass is NOT installed as global and unresolved |
|
344 |
refs are NOT patched." |
|
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
345 |
|
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
346 |
| inStream javaClass | |
752 | 347 |
|
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
348 |
[ inStream := aFilename asFilename readStream. ] on: StreamError |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
349 |
do: [ |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
350 |
:ex | |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
351 |
Logger |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
352 |
log: ('no file: ' , aFilename asString) |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
353 |
severity: #error |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
354 |
facility: 'JVM'. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
355 |
self halt. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
356 |
^ nil |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
357 |
]. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
358 |
javaClass := self readStream: inStream ignoring: classesBeingLoaded. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
359 |
(javaClass notNil and: [ javaClass isJavaClass ]) ifTrue: [ |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
360 |
javaClass setBinaryFilePath: (inStream pathName). |
752 | 361 |
]. |
362 |
inStream close. |
|
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
363 |
AbsolutelySilent ifFalse: [ |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
364 |
Logger |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
365 |
log: 'loaded class ' , javaClass displayString |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
366 |
severity: #info |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
367 |
facility: 'JVM'. |
752 | 368 |
]. |
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
369 |
^ javaClass. |
752 | 370 |
|
898 | 371 |
"Created: / 15-04-1996 / 14:58:53 / cg" |
372 |
"Modified: / 09-05-1998 / 01:44:24 / cg" |
|
1000 | 373 |
"Modified: / 14-09-2011 / 22:20:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 374 |
! |
375 |
||
1041 | 376 |
readStream: aStream |
377 |
"reads a class from aStream and returns it. |
|
378 |
The JavaClass is not installed as global" |
|
379 |
||
380 |
^self readStream: aStream ignoring: Set new. |
|
381 |
||
382 |
"Created: / 24-10-2011 / 00:12:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
383 |
! |
|
384 |
||
771 | 385 |
readStream: aStream ignoring: classesBeingLoaded |
752 | 386 |
"reads a class from aStream and returns it. |
387 |
The JavaClass is not installed as global" |
|
771 | 388 |
|
389 |
| javaClass | |
|
390 |
||
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
391 |
javaClass := JavaClassReader new readStream: aStream |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
392 |
ignoring: classesBeingLoaded. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
393 |
Logger |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
394 |
log: 'loaded class ' , javaClass displayString |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
395 |
severity: #info |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
396 |
facility: 'JVM'. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
397 |
^ javaClass. |
752 | 398 |
|
771 | 399 |
"Modified: / 30-03-1998 / 18:14:40 / cg" |
400 |
"Modified: / 09-05-2011 / 23:15:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1000 | 401 |
"Modified: / 14-09-2011 / 22:21:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 402 |
! ! |
403 |
||
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
404 |
!JavaClassReader class methodsFor:'obsolete'! |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
405 |
|
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
406 |
resolveClass: aJavaClass |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
407 |
"Resolve a particular classes' constants. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
408 |
Perform all class initialization functions |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
409 |
(of those which are not yet initialized)." |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
410 |
|
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
411 |
| loader classToLoad | |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
412 |
|
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
413 |
self breakPoint: #mh. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
414 |
"new resolving does not need this - shouldn't be called at all" |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
415 |
LazyClassLoading ifFalse: [ |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
416 |
loader := (aJavaClass classLoader). |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
417 |
[ |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
418 |
classToLoad := nil. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
419 |
aJavaClass constantPool do: [ |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
420 |
:item | |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
421 |
| itemClass | |
771 | 422 |
|
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
423 |
itemClass := item class. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
424 |
itemClass == JavaUnresolvedClassConstant ifTrue: [ |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
425 |
classToLoad := item className. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
426 |
|
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
427 |
"/ ] ifFalse:[ |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
428 |
"/ itemClass == JavaUnresolvedMethodrefConstant ifTrue:[ |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
429 |
"/self halt. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
430 |
"/ ] ifFalse:[ |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
431 |
"/ itemClass == JavaUnresolvedInterfaceMethodrefConstant ifTrue:[ |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
432 |
"/self halt. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
433 |
"/ ] |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
434 |
"/ ] |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
435 |
]. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
436 |
]. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
437 |
classToLoad notNil ifTrue: [ |
1033 | 438 |
loader isNil ifTrue: [ JavaVM classForName: classToLoad. ] ifFalse: [ |
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
439 |
"/ |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
440 |
"/ the aquired loader is a javaClassLoader |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
441 |
"/ which expects an URL as arg. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
442 |
"/ |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
443 |
"/ classURL := Java as_URL:('file:' , nextUnresolved asString , '.class'). |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
444 |
"/ loader loadClass:classURL |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
445 |
loader perform: #'loadClass(Ljava/lang/String;)Ljava/lang/Class;' |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
446 |
with: (Java as_String: (classToLoad asString)). |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
447 |
] |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
448 |
]. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
449 |
classToLoad notNil. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
450 |
] whileTrue. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
451 |
aJavaClass isInitialized ifFalse: [ |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
452 |
Silent ifFalse: [ |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
453 |
'performing class initialization of ' print. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
454 |
aJavaClass fullName printCR. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
455 |
]. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
456 |
aJavaClass classInit |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
457 |
]. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
458 |
] |
771 | 459 |
|
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
460 |
"Created: / 20.10.1998 / 17:53:22 / cg" |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
461 |
"Modified: / 20.10.1998 / 17:59:09 / cg" |
771 | 462 |
! ! |
463 |
||
464 |
!JavaClassReader methodsFor:'accessing'! |
|
465 |
||
466 |
constants |
|
467 |
^ constants. |
|
468 |
||
469 |
"Created: / 10-05-2011 / 13:48:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
470 |
! |
|
471 |
||
472 |
constants: aJavaConstantPool |
|
473 |
constants := aJavaConstantPool. |
|
474 |
||
475 |
"Created: / 10-05-2011 / 13:48:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
476 |
! |
|
477 |
||
478 |
stream |
|
479 |
^ inStream. |
|
480 |
||
481 |
"Created: / 09-05-2011 / 23:22:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
482 |
! |
|
483 |
||
484 |
stream:aReadStream |
|
485 |
inStream := aReadStream. |
|
486 |
||
487 |
"Created: / 09-05-2011 / 23:23:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
488 |
! ! |
|
489 |
||
752 | 490 |
!JavaClassReader methodsFor:'file reading'! |
491 |
||
771 | 492 |
readClassFileIgnoring: classesbeingLoaded |
752 | 493 |
"reads a class from inStream and returns it. |
494 |
The JavaClass is not installed as global and its constants |
|
495 |
(especially strings) may not be fully resolved." |
|
496 |
||
798
b534e73eaf7e
JavaClassReader2 now uses correct superclass loading
hlopkmar
parents:
797
diff
changeset
|
497 |
| magic access_flags this_class_index super_class super_class_index this_class_ref existingSuperClass fields interfaces staticFields nStatic superClassName thisClassName existing_class thisMetaClass | |
752 | 498 |
|
499 |
"/ |
|
500 |
"/ read magic, determine byte order |
|
501 |
"/ |
|
502 |
msb := true. |
|
771 | 503 |
magic := inStream nextUnsignedLongMSB: true. |
1028
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
504 |
magic = (self class magic_MSB) ifFalse: [ |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
505 |
magic = (self class magic_LSB) ifFalse: [ |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
506 |
InvalidClassFormatSignal raiseErrorString: 'not a java class file'. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
507 |
^ nil |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
508 |
]. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
509 |
msb := false. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
510 |
Verbose ifTrue: [ Transcript showCR: 'file is lsb' ]. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
511 |
] ifTrue: [ Verbose ifTrue: [ Transcript showCR: 'file is msb' ]. ]. |
752 | 512 |
|
513 |
"/ |
|
514 |
"/ get version |
|
515 |
"/ |
|
516 |
||
771 | 517 |
minorVsn := inStream nextUnsignedShortMSB: msb. |
518 |
majorVsn := inStream nextUnsignedShortMSB: msb. |
|
519 |
((self class fileMajorVersions includes: majorVsn) not |
|
520 |
or: [ (self class fileMinorVersions includes: minorVsn) not ]) |
|
1028
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
521 |
ifTrue: [ |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
522 |
Transcript |
771 | 523 |
show: 'warning this file has version '; |
524 |
show: majorVsn; |
|
525 |
show: '.'; |
|
1028
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
526 |
showCR: minorVsn. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
527 |
]. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
528 |
Verbose ifTrue: [ |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
529 |
Transcript |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
530 |
show: 'version = '; |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
531 |
show: (majorVsn printString); |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
532 |
show: '.'; |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
533 |
showCR: (minorVsn printString). |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
534 |
]. |
752 | 535 |
|
536 |
"/ |
|
537 |
"/ get constant pool |
|
538 |
"/ |
|
539 |
||
540 |
self readConstantPool. |
|
541 |
||
542 |
"/ |
|
543 |
"/ access flags |
|
544 |
"/ |
|
545 |
||
771 | 546 |
access_flags := inStream nextUnsignedShortMSB: msb. |
547 |
this_class_index := inStream nextUnsignedShortMSB: msb. |
|
548 |
super_class_index := inStream nextUnsignedShortMSB: msb. |
|
1028
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
549 |
super_class_index == 0 ifTrue: [ super_class := nil ] ifFalse: [ |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
550 |
super_class := constants at: super_class_index. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
551 |
superClassName := super_class fullName. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
552 |
|
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
553 |
"/ special for ST-classes |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
554 |
|
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
555 |
(superClassName startsWith: 'smalltalk.') ifTrue: [ |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
556 |
"/ a Smalltalk class |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
557 |
superClassName := superClassName copyFrom: 11. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
558 |
existingSuperClass := Smalltalk at: superClassName asSymbol. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
559 |
existingSuperClass notNil ifTrue: [ super_class := existingSuperClass ] ifFalse: [ |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
560 |
"/ self halt - must load superclass ... |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
561 |
] |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
562 |
] ifFalse: [ |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
563 |
"/ a JAVA class |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
564 |
super_class := Java classNamed: superClassName. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
565 |
super_class |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
566 |
ifNil: [ |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
567 |
super_class := self |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
568 |
loadSuperclassIdentifiedBy: (constants at: super_class_index) |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
569 |
ignoring: classesbeingLoaded |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
570 |
]. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
571 |
super_class ifNil: [ self halt: 'Cannot find super class?!!' ]. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
572 |
]. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
573 |
]. |
752 | 574 |
|
575 |
"/ |
|
576 |
"/ get interfaces |
|
577 |
"/ |
|
578 |
||
579 |
interfaces := self readInterfaces. |
|
580 |
||
581 |
"/ |
|
582 |
"/ get fields |
|
583 |
"/ |
|
584 |
||
585 |
fields := self readFieldInfofields. |
|
586 |
||
587 |
"/ |
|
588 |
"/ create the fields as instVars |
|
589 |
"/ static fields are created as class-InstVars |
|
590 |
"/ |
|
798
b534e73eaf7e
JavaClassReader2 now uses correct superclass loading
hlopkmar
parents:
797
diff
changeset
|
591 |
|
771 | 592 |
staticFields := fields select: [:f | f isStatic ]. |
752 | 593 |
nStatic := staticFields size. |
771 | 594 |
this_class_ref := constants at: this_class_index. |
752 | 595 |
thisClassName := this_class_ref fullName. |
596 |
||
597 |
"/ care for smalltalk classes ... |
|
598 |
||
1028
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
599 |
(thisClassName startsWith: 'smalltalk.') ifTrue: [ |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
600 |
thisClassName := thisClassName copyFrom: 11. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
601 |
existing_class := Smalltalk at: thisClassName asSymbol. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
602 |
existing_class notNil ifTrue: [ |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
603 |
self halt: ('overloading existing class: ' , thisClassName). |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
604 |
thisClassName := (thisClassName , '_new') asSymbol. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
605 |
]. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
606 |
thisMetaClass := Metaclass new. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
607 |
thisMetaClass setSuperclass: super_class class. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
608 |
thisMetaClass instSize: (super_class class instSize + nStatic). |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
609 |
classBeingLoaded := thisMetaClass new. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
610 |
classBeingLoaded setSuperclass: super_class. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
611 |
classBeingLoaded setName: thisClassName asSymbol. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
612 |
] ifFalse: [ |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
613 |
"/ a java class |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
614 |
classBeingLoaded := JavaClass fullName: thisClassName numStatic: nStatic. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
615 |
fields := fields select: [:f | f isStatic not ]. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
616 |
JavaClass setInstanceVariableStringFromFields: staticFields |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
617 |
in: classBeingLoaded class. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
618 |
classBeingLoaded setStaticFields: staticFields. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
619 |
classBeingLoaded initializeStaticFields. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
620 |
classBeingLoaded setAccessFlags: access_flags. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
621 |
classBeingLoaded setSuperclass: super_class. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
622 |
classBeingLoaded setConstantPool: constants. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
623 |
classBeingLoaded setFields: fields. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
624 |
classBeingLoaded setInterfaces: interfaces. |
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
625 |
]. |
752 | 626 |
|
627 |
"/ |
|
628 |
"/ get methods |
|
629 |
"/ |
|
630 |
||
775 | 631 |
self readMethodsFor: classBeingLoaded. |
632 |
self readAttributesFor: classBeingLoaded. |
|
1028
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
633 |
|
809 | 634 |
"/ classBeingLoaded constantPool |
635 |
"/ do: [:each | self updateOwnerInCPItem: each ]. |
|
1028
d30cabc12354
fixed problem with classInit cycle.. still not booting :)
hlopkmar
parents:
1026
diff
changeset
|
636 |
|
796
9b3e00dd3196
Small fix, so JavaFields have their javaClass always set.
hlopkmar
parents:
784
diff
changeset
|
637 |
classBeingLoaded fields do: [:each | self updateOwnerInField: each ]. |
1033 | 638 |
classBeingLoaded staticFields do: [:each | self updateOwnerInField: each ]. |
1037 | 639 |
JavaVM classRegistry registerClass: classBeingLoaded. |
1038 | 640 |
classesbeingLoaded remove: classBeingLoaded name ifAbsent:[]. |
775 | 641 |
^ classBeingLoaded. |
752 | 642 |
|
643 |
" |
|
644 |
JavaClassReader loadFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
645 |
JavaClassReader loadFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class' |
|
646 |
JavaClassReader loadFile:'foo.cls' |
|
647 |
||
648 |
JavaClassReader verbose:true. |
|
649 |
JavaClassReader loadFile:'/phys/ibm3/hotjava/classes/java/lang/ArithmeticException.class' |
|
650 |
JavaClassReader loadFile:'/phys/ibm3/java/lib/java/lang/ArithmeticException.class'" |
|
1035 | 651 |
|
752 | 652 |
"Created: / 15-04-1996 / 15:02:47 / cg" |
653 |
"Modified: / 12-11-1998 / 21:14:45 / cg" |
|
654 |
"Modified: / 15-10-2010 / 17:37:38 / Jan Kurs <kurs.jan@post.cz>" |
|
655 |
"Modified: / 28-01-2011 / 15:09:48 / Marcel Hlopko <hlopik@gmail.com>" |
|
800
11f2222f816d
forgotten return and fixed broken class reading (static field were not set up correctly)..
hlopkmar
parents:
799
diff
changeset
|
656 |
"Modified: / 18-05-2011 / 15:30:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1038 | 657 |
"Modified: / 23-10-2011 / 15:23:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 658 |
! |
659 |
||
660 |
readStream:aStream ignoring:classesBeingLoaded |
|
661 |
"reads a class from aStream and returns it. |
|
662 |
The JavaClass is not installed as global" |
|
663 |
||
664 |
inStream := aStream. |
|
665 |
inStream binary. |
|
666 |
||
667 |
^ self readClassFileIgnoring:classesBeingLoaded |
|
668 |
||
669 |
" |
|
670 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
671 |
" |
|
672 |
||
673 |
"Created: 15.4.1996 / 15:00:55 / cg" |
|
674 |
"Modified: 15.4.1996 / 15:06:18 / cg" |
|
675 |
! ! |
|
676 |
||
677 |
!JavaClassReader methodsFor:'file reading - attributes'! |
|
678 |
||
679 |
readAnnotationDefaultAttributeFor:something |
|
680 |
"/ ('JAVA [info]: unhandled attribute: AnnotationDefault') infoPrintCR. |
|
681 |
||
682 |
|len startPos endPos annotationDefault| |
|
683 |
||
684 |
self assert:something isJavaMethod |
|
685 |
description:'AnnotationDefault may only occure for methods!!'. |
|
686 |
len := inStream nextUnsignedLongMSB:msb. |
|
687 |
startPos := inStream position. |
|
688 |
annotationDefault := (something ensureHasAnnotations) |
|
689 |
default:(JavaAnnotationDefault new |
|
690 |
value:(self readAnnotationValueFor:something)); |
|
691 |
default. |
|
692 |
endPos := inStream position. |
|
693 |
inStream position:startPos. |
|
694 |
annotationDefault bytes:(inStream next:len). |
|
695 |
self assert:inStream position = endPos |
|
696 |
description:'self readAnnotationValueFor: something is reading what it shouldn'. |
|
697 |
||
698 |
"Modified: / 28-02-2011 / 17:08:28 / Marcel Hlopko <hlopik@gmail.com>" |
|
699 |
"Modified: / 03-03-2011 / 23:06:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
700 |
! |
|
701 |
||
702 |
readAnnotationFor:something |
|
703 |
| typeIndex type result attrsCount | |
|
704 |
||
705 |
typeIndex := inStream nextUnsignedShortMSB:msb. |
|
879 | 706 |
type := constants at:typeIndex. |
752 | 707 |
attrsCount := inStream nextUnsignedShortMSB:msb. |
708 |
result := JavaAnnotation for:something. |
|
709 |
result name:type. |
|
710 |
attrsCount timesRepeat: |
|
711 |
[ | nameIndex name valueIndex attr | |
|
712 |
||
713 |
nameIndex := inStream nextUnsignedShortMSB:msb. |
|
879 | 714 |
name := constants at:nameIndex. |
752 | 715 |
attr := self readAnnotationValueFor:something. |
716 |
attr name:name. |
|
717 |
result values at:attr name put:attr. |
|
718 |
AnnotationsVerbose |
|
719 |
ifTrue:[ ('JAVA [INFO]: Reading annotation attribute: ' , name) infoPrintCR. ]. ]. |
|
720 |
^ result. |
|
721 |
||
722 |
"Created: / 17-12-2010 / 16:21:28 / Marcel Hlopko <hlopik@gmail.com>" |
|
723 |
"Modified: / 25-02-2011 / 12:25:36 / Marcel Hlopko <hlopik@gmail.com>" |
|
879 | 724 |
"Modified: / 27-07-2011 / 09:37:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 725 |
! |
726 |
||
727 |
readAnnotationValueFor:something |
|
728 |
| tag result | |
|
729 |
||
730 |
tag := (inStream nextByte) asCharacter. |
|
731 |
tag = $e |
|
732 |
ifTrue: |
|
733 |
[ result := JavaAnnotationEnumValue for:something. |
|
734 |
result nameIndex:(inStream nextUnsignedShortMSB:msb). |
|
735 |
result valueIndex:(inStream nextUnsignedShortMSB:msb). |
|
736 |
AnnotationsVerbose |
|
737 |
ifTrue: |
|
738 |
[ ('JAVA [INFO]: Reading annotation enum value: ' , result name printString, ' -> ' |
|
739 |
, result value printString) infoPrintCR ]. |
|
740 |
^ result ]. |
|
741 |
tag = $c |
|
742 |
ifTrue: |
|
743 |
[ result := JavaAnnotationClassValue for:something. |
|
744 |
result classIndex:(inStream nextUnsignedShortMSB:msb). |
|
745 |
AnnotationsVerbose |
|
746 |
ifTrue: |
|
747 |
[ ('JAVA [INFO]: Reading annotation class value: ' , result name printString, ' -> ' |
|
748 |
, result value printString) infoPrintCR ]. |
|
749 |
^ result ]. |
|
750 |
tag = $@ |
|
751 |
ifTrue: |
|
752 |
[ result := JavaAnnotationNestedAnnotationValue for:something. |
|
753 |
result classIndex:(inStream nextUnsignedShortMSB:msb). |
|
754 |
AnnotationsVerbose |
|
755 |
ifTrue: |
|
756 |
[ ('JAVA [INFO]: Reading annotation nested annotation value: ' , result name printString |
|
757 |
, ' -> ' , result value printString) |
|
758 |
infoPrintCR ]. |
|
759 |
^ result ]. |
|
760 |
tag = $[ |
|
761 |
ifTrue: |
|
762 |
[ result := JavaAnnotationArrayValue for:something. |
|
763 |
result count:(inStream nextUnsignedShortMSB:msb). |
|
764 |
AnnotationsVerbose |
|
765 |
ifTrue:[ ('JAVA [INFO]: Reading annotation array value') infoPrintCR ]. |
|
766 |
1 to:result count |
|
767 |
do:[:index | result values at:index put:(self readAnnotationValueFor:something) ]. |
|
768 |
AnnotationsVerbose |
|
769 |
ifTrue: |
|
770 |
[ ('JAVA [INFO]: Finished reading annotation array value: ' |
|
771 |
, result value printString) infoPrintCR ]. |
|
772 |
^ result ]. |
|
773 |
result := JavaAnnotationPrimitiveValue for:something. |
|
774 |
result valueIndex:(inStream nextUnsignedShortMSB:msb). |
|
775 |
AnnotationsVerbose |
|
776 |
ifTrue: |
|
777 |
[ ('JAVA [INFO]: Finished reading annotation primitive value: ' |
|
778 |
, result name printString , ' -> ' , result value printString) infoPrintCR ]. |
|
779 |
^ result. |
|
780 |
||
781 |
"Created: / 17-12-2010 / 16:44:14 / Marcel Hlopko <hlopik@gmail.com>" |
|
782 |
"Modified: / 28-02-2011 / 16:12:09 / Marcel Hlopko <hlopik@gmail.com>" |
|
783 |
! |
|
784 |
||
785 |
readAttribute:attributeName for:something |
|
786 |
"/ implemented JAVA attributes |
|
787 |
||
788 |
(attributeName = 'ConstantValue') |
|
789 |
ifTrue: |
|
790 |
[ self readConstantValueAttributeFor:something. |
|
791 |
^ self. ]. |
|
792 |
(attributeName = 'Code') |
|
793 |
ifTrue: |
|
794 |
[ self readCodeAttributeFor:something. |
|
795 |
^ self. ]. |
|
796 |
(attributeName = 'Exceptions') |
|
797 |
ifTrue: |
|
798 |
[ self readExceptionsAttributeFor:something. |
|
799 |
^ self. ]. |
|
800 |
(attributeName = 'InnerClasses') |
|
801 |
ifTrue: |
|
802 |
[ self readInnerClassesAttributeFor:something. |
|
803 |
^ self. ]. |
|
804 |
(attributeName = 'EnclosingMethod') |
|
805 |
ifTrue: |
|
806 |
[ self readEnclosingMethodAttributeFor:something. |
|
807 |
^ self. ]. |
|
808 |
(attributeName = 'LineNumberTable') |
|
809 |
ifTrue: |
|
810 |
[ self readLineNumberTableAttributeFor:something. |
|
811 |
^ self. ]. |
|
812 |
(attributeName = 'LocalVariableTable') |
|
813 |
ifTrue: |
|
814 |
[ self readLocalVariableTableAttributeFor:something. |
|
815 |
^ self. ]. |
|
816 |
(attributeName = 'LocalVariableTypeTable') |
|
817 |
ifTrue: |
|
818 |
[ self readLocalVariableTypeTableAttributeFor:something. |
|
819 |
^ self. ]. |
|
820 |
(attributeName = 'SourceFile') |
|
821 |
ifTrue: |
|
822 |
[ self readSourceFileAttributeFor:something. |
|
823 |
^ self. ]. |
|
824 |
(attributeName = 'SourceDebugExtension') |
|
825 |
ifTrue: |
|
826 |
[ self readSourceDebugExtensionAttributeFor:something. |
|
827 |
^ self. ]. |
|
828 |
(attributeName = 'Synthetic') |
|
829 |
ifTrue: |
|
830 |
[ self readSyntheticAttributeFor:something. |
|
831 |
^ self. ]. |
|
832 |
(attributeName = 'Signature') |
|
833 |
ifTrue: |
|
834 |
[ self readSignatureAttributeFor:something. |
|
835 |
^ self. ]. |
|
836 |
(attributeName = 'Deprecated') |
|
837 |
ifTrue: |
|
838 |
[ self readDeprecatedAttributeFor:something. |
|
839 |
^ self. ]. |
|
840 |
(attributeName = 'RuntimeVisibleAnnotations') |
|
841 |
ifTrue: |
|
842 |
[ self readRuntimeAnnotationsAttributeFor:something visible:true. |
|
843 |
^ self. ]. |
|
844 |
(attributeName = 'RuntimeInvisibleAnnotations') |
|
845 |
ifTrue: |
|
846 |
[ self readRuntimeAnnotationsAttributeFor:something visible:false. |
|
847 |
^ self. ]. |
|
848 |
(attributeName = 'RuntimeVisibleParameterAnnotations') |
|
849 |
ifTrue: |
|
850 |
[ self readRuntimeParameterAnnotationsAttributeFor:something visible:true. |
|
851 |
^ self. ]. |
|
852 |
(attributeName = 'RuntimeInvisibleParameterAnnotations') |
|
853 |
ifTrue: |
|
854 |
[ self readRuntimeParameterAnnotationsAttributeFor:something visible:false. |
|
855 |
^ self. ]. |
|
856 |
(attributeName = 'AnnotationDefault') |
|
857 |
ifTrue: |
|
858 |
[ self readAnnotationDefaultAttributeFor:something. |
|
859 |
^ self. ]. |
|
860 |
||
861 |
"/ ignored JAVA attributes |
|
862 |
||
863 |
(attributeName = 'FastJavac1.0') |
|
864 |
ifTrue: |
|
865 |
[ "/ ('JAVA [info]: unhandled attribute: ' , attributeName) infoPrintCR. |
|
866 |
self skipAttribute:attributeName. |
|
867 |
^ self. ]. |
|
868 |
(attributeName = 'AbsoluteSourcePath') |
|
869 |
ifTrue: |
|
870 |
[ ('JAVA [info]: unhandled attribute: ' , attributeName) infoPrintCR. |
|
871 |
self skipAttribute:attributeName. |
|
872 |
^ self. ]. |
|
873 |
(attributeName startsWith:((Character value:13) asString , 'WARNING:')) |
|
874 |
ifTrue: |
|
875 |
[ "/ ('JAVA [info]: unhandled attribute: ' , attributeName) infoPrintCR. |
|
876 |
self skipAttribute:attributeName. |
|
877 |
^ self. ]. |
|
878 |
(attributeName = 'StackMapTable') |
|
879 |
ifTrue: |
|
880 |
[ "/ ('JAVA [info]: unhandled attribute: ' , attributeName) infoPrintCR. |
|
881 |
self readStackMapTableAttributeFor:something. |
|
882 |
^ self. ]. |
|
883 |
||
884 |
"/ implemented ST attributes |
|
885 |
||
886 |
(attributeName = 'STLiterals') |
|
887 |
ifTrue: |
|
888 |
[ self readSTLiteralsAttributeFor:something. |
|
889 |
^ self. ]. |
|
890 |
(attributeName = 'ClassRevision') |
|
891 |
ifTrue: |
|
892 |
[ self readSTClassRevisionAttributeFor:something. |
|
893 |
^ self. ]. |
|
894 |
(attributeName = 'ClassPackage') |
|
895 |
ifTrue: |
|
896 |
[ self readSTClassPackageAttributeFor:something. |
|
897 |
^ self. ]. |
|
898 |
(attributeName = 'ClassCategory') |
|
899 |
ifTrue: |
|
900 |
[ self readSTClassCategoryAttributeFor:something. |
|
901 |
^ self. ]. |
|
902 |
(attributeName = 'ClassVarNames') |
|
903 |
ifTrue: |
|
904 |
[ self readSTClassVarNamesAttributeFor:something. |
|
905 |
^ self. ]. |
|
906 |
(attributeName = 'ClassInstVarNames') |
|
907 |
ifTrue: |
|
908 |
[ self readSTClassInstVarNamesAttributeFor:something. |
|
909 |
^ self. ]. |
|
910 |
(attributeName = 'InstVarNames') |
|
911 |
ifTrue: |
|
912 |
[ self readSTInstVarNamesAttributeFor:something. |
|
913 |
^ self. ]. |
|
914 |
(attributeName = 'STCode') |
|
915 |
ifTrue: |
|
916 |
[ self readSTCodeAttributeFor:something. |
|
917 |
^ self. ]. |
|
918 |
(attributeName = 'MethodCategory') |
|
919 |
ifTrue: |
|
920 |
[ self readSTMethodCategoryAttributeFor:something. |
|
921 |
^ self. ]. |
|
922 |
||
923 |
"/ unknown attributes |
|
924 |
||
925 |
('JAVA [warning]: unrecognized attribute: ' , attributeName) infoPrintCR. |
|
926 |
self skipAttribute:attributeName. |
|
927 |
||
928 |
"Modified: / 03-12-1998 / 13:13:42 / cg" |
|
929 |
"Modified: / 25-02-2011 / 18:09:21 / Marcel Hlopko <hlopik@gmail.com>" |
|
930 |
! |
|
931 |
||
932 |
readAttributeFor:something |
|
933 |
|attribute_name_index attribute_name attribute_length attribute_info| |
|
934 |
||
935 |
Verbose ifTrue:[Transcript show:'attrib at pos: '; showCR:inStream position]. |
|
936 |
||
937 |
attribute_name_index := inStream nextUnsignedShortMSB:msb. |
|
938 |
attribute_name_index == 0 ifTrue:[ |
|
939 |
self halt. |
|
940 |
"/self skipAttribute:'unnamed'. |
|
941 |
^ self. |
|
942 |
]. |
|
943 |
||
944 |
"/ |
|
945 |
"/ UNDOC feature ? |
|
946 |
"/ |
|
947 |
attribute_name_index > constants size ifTrue:[ |
|
948 |
attribute_name_index == 16rb700 ifTrue:[ |
|
949 |
self halt. |
|
950 |
] |
|
951 |
]. |
|
952 |
||
953 |
attribute_name := constants at:attribute_name_index. |
|
954 |
||
955 |
Verbose ifTrue:[Transcript show:'attrib name: '; showCR:attribute_name]. |
|
956 |
||
957 |
self readAttribute:attribute_name for:something. |
|
958 |
||
959 |
" |
|
960 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
961 |
" |
|
962 |
||
963 |
"Created: / 15-04-1996 / 15:40:17 / cg" |
|
964 |
"Modified: / 09-04-1998 / 18:13:34 / cg" |
|
965 |
"Modified: / 19-10-2010 / 21:43:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
966 |
! |
|
967 |
||
968 |
readAttributesFor:something |
|
969 |
|attributes_count| |
|
970 |
||
971 |
attributes_count := inStream nextUnsignedShortMSB:msb. |
|
972 |
||
973 |
1 to:attributes_count do:[:i | |
|
974 |
self readAttributeFor:something. |
|
975 |
]. |
|
976 |
||
977 |
"Modified: 15.4.1996 / 15:33:28 / cg" |
|
978 |
"Created: 15.4.1996 / 15:40:17 / cg" |
|
979 |
! |
|
980 |
||
981 |
readDeprecatedAttributeFor:aJavaMethodWithHandler |
|
982 |
||
983 |
self skipAttribute:'Deprecated'. |
|
984 |
^self |
|
985 |
||
986 |
"Created: / 18-10-2010 / 22:26:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
987 |
! |
|
988 |
||
989 |
readEnclosingMethodAttributeFor:something |
|
990 |
"/ ('JAVA [info]: unhandled attribute: EnclosingMethod') infoPrintCR. |
|
991 |
self skipAttribute:'EnclosingMethod'. |
|
992 |
! |
|
993 |
||
994 |
readInnerClassesAttributeFor:something |
|
995 |
"/ ('JAVA [info]: unhandled attribute: InnerClasses') infoPrintCR. |
|
996 |
self skipAttribute:'InnerClasses'. |
|
997 |
! |
|
998 |
||
999 |
readLocalVariableTypeTableAttributeFor:something |
|
1000 |
"/ ('JAVA [info]: unhandled attribute: LocalVariableTypeTable') infoPrintCR. |
|
1001 |
self skipAttribute:'LocalVariableTypeTable'. |
|
1002 |
! |
|
1003 |
||
1004 |
readRuntimeAnnotationsAttributeFor: something visible: visible |
|
1005 |
| length annotationsCount annotations rawAnnotations startPos endPos | |
|
1006 |
||
1007 |
self assert: inStream isPositionable |
|
1008 |
message: '.class file stream must be positionable'. |
|
1009 |
length := inStream nextUnsignedLongMSB: msb. |
|
1010 |
startPos := inStream position. |
|
1011 |
annotationsCount := inStream nextUnsignedShortMSB: msb. |
|
1012 |
annotationsCount = 0 ifTrue: [ ^ nil ]. |
|
1013 |
annotations := visible ifTrue: [something ensureHasAnnotations ensureRuntimeVisible] ifFalse: [something ensureHasAnnotations ensureRuntimeInvisible]. |
|
1014 |
annotationsCount timesRepeat: |
|
1015 |
[ | currentAnnotation | |
|
1016 |
||
1017 |
currentAnnotation := self readAnnotationFor: something. |
|
1018 |
annotations at: currentAnnotation name put: currentAnnotation. ]. |
|
1019 |
"Cut raw annotations as required by getRawAnnotations()" |
|
1020 |
endPos := inStream position. |
|
1021 |
inStream position: startPos. |
|
1022 |
rawAnnotations := inStream next: length. |
|
1023 |
inStream position ~= endPos |
|
1024 |
ifTrue: [ self halt: 'annotations are probably reading what they shouldnt' ]. |
|
1025 |
annotations rawAnnotations: rawAnnotations. |
|
1026 |
||
1027 |
"Modified: / 07-01-2011 / 22:00:07 / Jan Kurs <kurs.jan@post.cz>" |
|
1028 |
"Modified: / 25-02-2011 / 18:45:58 / Marcel Hlopko <hlopik@gmail.com>" |
|
1029 |
"Modified: / 03-03-2011 / 23:01:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1030 |
"Modified: / 16-03-2011 / 16:57:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1031 |
! |
|
1032 |
||
1033 |
readRuntimeParameterAnnotationsAttributeFor: javaMethod visible: visible |
|
1034 |
| length paramsCount annotationsCount rawAnnotations startPos endPos | |
|
1035 |
||
1036 |
self assert: inStream isPositionable |
|
1037 |
message: '.class file stream must be positionable'. |
|
1038 |
length := inStream nextUnsignedLongMSB: msb. |
|
1039 |
startPos := inStream position. |
|
1040 |
paramsCount := inStream nextByte. |
|
1041 |
paramsCount = 0 ifTrue: [ ^ nil ]. |
|
1042 |
1 to: paramsCount |
|
1043 |
do: |
|
1044 |
[:paramIndex | |
|
1045 |
annotationsCount := inStream nextUnsignedShortMSB: msb. |
|
1046 |
annotationsCount > 0 |
|
1047 |
ifTrue: |
|
1048 |
[ | annotations | |
|
1049 |
annotations := visible |
|
1050 |
ifTrue: |
|
1051 |
[ javaMethod ensureHasAnnotations ensureVisibleParameterAnnotationsAt: paramIndex ] |
|
1052 |
ifFalse: |
|
1053 |
[javaMethod ensureHasAnnotations ensureInvisibleParameterAnnotationsAt: paramIndex ]. |
|
1054 |
annotationsCount timesRepeat: |
|
1055 |
[ | annotation | |
|
1056 |
||
1057 |
annotation := self readAnnotationFor: javaMethod. |
|
1058 |
annotations at: (annotation name) put: annotation. ] ]]. |
|
1059 |
endPos := inStream position. |
|
1060 |
rawAnnotations := inStream position: startPos. |
|
1061 |
rawAnnotations := inStream next: length. |
|
1062 |
inStream position ~= endPos |
|
1063 |
ifTrue: [ self halt: 'annotations are probably reading what they shouldnt' ]. |
|
1064 |
javaMethod annotations rawAnnotations: rawAnnotations. |
|
1065 |
||
1066 |
"Modified: / 28-02-2011 / 17:05:47 / Marcel Hlopko <hlopik@gmail.com>" |
|
1067 |
"Modified: / 16-03-2011 / 17:26:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1068 |
! |
|
1069 |
||
1070 |
readSignatureAttributeFor:something |
|
912
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
908
diff
changeset
|
1071 |
|
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
908
diff
changeset
|
1072 |
|attribute_length signature_index signature| |
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
908
diff
changeset
|
1073 |
|
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
908
diff
changeset
|
1074 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
908
diff
changeset
|
1075 |
|
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
908
diff
changeset
|
1076 |
signature_index := inStream nextUnsignedShortMSB:msb. |
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
908
diff
changeset
|
1077 |
signature := constants at:signature_index. |
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
908
diff
changeset
|
1078 |
|
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
908
diff
changeset
|
1079 |
something setSignature: signature. |
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
908
diff
changeset
|
1080 |
|
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
908
diff
changeset
|
1081 |
"Modified: / 13-08-2011 / 00:28:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 1082 |
! |
1083 |
||
1084 |
readSourceDebugExtensionAttributeFor:something |
|
1085 |
"/ ('JAVA [info]: unhandled attribute: SourceDebugExtension') infoPrintCR. |
|
1086 |
self skipAttribute:'SourceDebugExtension'. |
|
1087 |
! |
|
1088 |
||
1089 |
readSourceFileAttributeFor:aClass |
|
1090 |
|attribute_length sourceFile_index sourceFile| |
|
1091 |
||
1092 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
1093 |
||
1094 |
sourceFile_index := inStream nextUnsignedShortMSB:msb. |
|
1095 |
sourceFile := constants at:sourceFile_index. |
|
1096 |
||
1097 |
aClass isJavaClass ifTrue:[ |
|
1098 |
aClass setSourceFile:sourceFile. |
|
1099 |
] ifFalse:[ |
|
1100 |
aClass setClassFilename:sourceFile |
|
1101 |
]. |
|
1102 |
||
1103 |
Verbose ifTrue:[Transcript show:'sourceFile: '; showCR:sourceFile]. |
|
1104 |
^ true |
|
1105 |
||
1106 |
" |
|
1107 |
JavaClassReader loadFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1108 |
JavaClassReader loadFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class' |
|
1109 |
JavaClassReader loadFile:'foo.cls' |
|
1110 |
" |
|
1111 |
||
1112 |
"Created: / 15.4.1996 / 15:40:17 / cg" |
|
1113 |
"Modified: / 12.5.1998 / 22:01:07 / cg" |
|
1114 |
! |
|
1115 |
||
1116 |
readStackMapTableAttributeFor:something |
|
1117 |
"/ ('JAVA [info]: unhandled attribute: StackMapTable') infoPrintCR. |
|
1118 |
self skipAttribute:'StackMapTable'. |
|
1119 |
||
1120 |
"Created: / 09-02-2011 / 01:19:20 / Marcel Hlopko <hlopik@gmail.com>" |
|
1121 |
! |
|
1122 |
||
1123 |
readSyntheticAttributeFor:something |
|
1124 |
"/ ('JAVA [info]: unhandled attribute: Synthetic') infoPrintCR. |
|
1125 |
self skipAttribute:'Synthetic'. |
|
1126 |
! |
|
1127 |
||
1128 |
skipAttribute:attributeName |
|
1129 |
"dont know about this attribute - skip it here" |
|
1130 |
||
1131 |
|attribute_length attribute_info| |
|
1132 |
||
1133 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
1134 |
attribute_info := ByteArray new:(attribute_length). |
|
1135 |
inStream nextBytes:attribute_length into:attribute_info startingAt:1. |
|
1136 |
||
1137 |
Verbose ifTrue:[Transcript show:'skipped '; show:attributeName; showCR:'-attribute']. |
|
1138 |
||
1139 |
"Created: / 9.4.1998 / 18:12:46 / cg" |
|
1140 |
"Modified: / 9.4.1998 / 18:13:20 / cg" |
|
1141 |
! ! |
|
1142 |
||
1143 |
!JavaClassReader methodsFor:'file reading - attributes-ST'! |
|
1144 |
||
1145 |
readSTClassCategoryAttributeFor:aClass |
|
1146 |
|attribute_length categoryString_index categoryString| |
|
1147 |
||
1148 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
1149 |
||
1150 |
categoryString_index := inStream nextUnsignedShortMSB:msb. |
|
1151 |
categoryString := constants at:categoryString_index. |
|
1152 |
||
1153 |
aClass category:categoryString. |
|
1154 |
||
1155 |
Verbose ifTrue:[Transcript show:'categoryString: '; showCR:categoryString]. |
|
1156 |
^ true |
|
1157 |
||
1158 |
" |
|
1159 |
JavaClassReader loadFile:'foo.cls' |
|
1160 |
" |
|
1161 |
||
1162 |
"Created: / 9.5.1998 / 02:33:13 / cg" |
|
1163 |
"Modified: / 9.5.1998 / 02:36:55 / cg" |
|
1164 |
! |
|
1165 |
||
1166 |
readSTClassInstVarNamesAttributeFor:aClass |
|
1167 |
|attribute_length nameString_index nameString| |
|
1168 |
||
1169 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
1170 |
||
1171 |
nameString_index := inStream nextUnsignedShortMSB:msb. |
|
1172 |
nameString := constants at:nameString_index. |
|
1173 |
||
1174 |
aClass class instanceVariableString:nameString. |
|
1175 |
||
1176 |
Verbose ifTrue:[Transcript show:'nameString: '; showCR:nameString]. |
|
1177 |
^ true |
|
1178 |
||
1179 |
" |
|
1180 |
JavaClassReader loadFile:'foo.cls' |
|
1181 |
" |
|
1182 |
||
1183 |
"Modified: / 12.5.1998 / 22:18:03 / cg" |
|
1184 |
"Created: / 12.5.1998 / 22:18:24 / cg" |
|
1185 |
! |
|
1186 |
||
1187 |
readSTClassPackageAttributeFor:aClass |
|
1188 |
|attribute_length packageString_index packageString| |
|
1189 |
||
1190 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
1191 |
||
1192 |
packageString_index := inStream nextUnsignedShortMSB:msb. |
|
1193 |
packageString := constants at:packageString_index. |
|
1194 |
||
1195 |
aClass package:packageString asSymbol. |
|
1196 |
||
1197 |
Verbose ifTrue:[Transcript show:'packageString: '; showCR:packageString]. |
|
1198 |
^ true |
|
1199 |
||
1200 |
" |
|
1201 |
JavaClassReader loadFile:'foo.cls' |
|
1202 |
" |
|
1203 |
||
1204 |
"Modified: / 9.5.1998 / 02:32:38 / cg" |
|
1205 |
"Created: / 9.5.1998 / 02:33:44 / cg" |
|
1206 |
! |
|
1207 |
||
1208 |
readSTClassRevisionAttributeFor:aClass |
|
1209 |
|attribute_length revisionString_index revisionString| |
|
1210 |
||
1211 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
1212 |
||
1213 |
revisionString_index := inStream nextUnsignedShortMSB:msb. |
|
1214 |
revisionString := constants at:revisionString_index. |
|
1215 |
||
1216 |
aClass setBinaryRevision:revisionString. |
|
1217 |
||
1218 |
Verbose ifTrue:[Transcript show:'revisionString: '; showCR:revisionString]. |
|
1219 |
^ true |
|
1220 |
||
1221 |
" |
|
1222 |
JavaClassReader loadFile:'foo.cls' |
|
1223 |
" |
|
1224 |
||
1225 |
"Created: / 9.5.1998 / 02:33:13 / cg" |
|
1226 |
"Modified: / 9.5.1998 / 02:35:01 / cg" |
|
1227 |
! |
|
1228 |
||
1229 |
readSTClassVarNamesAttributeFor:aClass |
|
1230 |
|attribute_length nameString_index nameString| |
|
1231 |
||
1232 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
1233 |
||
1234 |
nameString_index := inStream nextUnsignedShortMSB:msb. |
|
1235 |
nameString := constants at:nameString_index. |
|
1236 |
||
1237 |
aClass classVariableString:nameString. |
|
1238 |
||
1239 |
Verbose ifTrue:[Transcript show:'nameString: '; showCR:nameString]. |
|
1240 |
^ true |
|
1241 |
||
1242 |
" |
|
1243 |
JavaClassReader loadFile:'foo.cls' |
|
1244 |
" |
|
1245 |
||
1246 |
"Created: / 9.5.1998 / 02:33:13 / cg" |
|
1247 |
"Modified: / 12.5.1998 / 22:18:03 / cg" |
|
1248 |
! |
|
1249 |
||
1250 |
readSTInstVarNamesAttributeFor:aClass |
|
1251 |
|attribute_length nameString_index nameString| |
|
1252 |
||
1253 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
1254 |
||
1255 |
nameString_index := inStream nextUnsignedShortMSB:msb. |
|
1256 |
nameString := constants at:nameString_index. |
|
1257 |
||
1258 |
aClass setInstanceVariableString:nameString. |
|
1259 |
||
1260 |
Verbose ifTrue:[Transcript show:'nameString: '; showCR:nameString]. |
|
1261 |
^ true |
|
1262 |
||
1263 |
" |
|
1264 |
JavaClassReader loadFile:'foo.cls' |
|
1265 |
" |
|
1266 |
||
1267 |
"Created: / 12.5.1998 / 22:18:14 / cg" |
|
1268 |
"Modified: / 12.5.1998 / 22:21:10 / cg" |
|
1269 |
! ! |
|
1270 |
||
1271 |
!JavaClassReader methodsFor:'file reading - constants'! |
|
1272 |
||
1273 |
readConstant |
|
1274 |
|tag constReader const| |
|
1275 |
||
1276 |
||
1277 |
constNeeds2Slots := false. |
|
1278 |
||
1279 |
"/ |
|
1280 |
"/ get tag |
|
1281 |
"/ |
|
1282 |
tag := inStream nextByte. |
|
1283 |
Verbose ifTrue:[Transcript show:'tag = '; showCR:tag]. |
|
1284 |
||
1285 |
tag >= 250 ifTrue:[ |
|
1286 |
constReader := #( |
|
1287 |
"/ ST types |
|
1288 |
readConstant_ST_Large "/ 249 |
|
1289 |
readConstant_ST_Special "/ 250 |
|
1290 |
readConstant_ST_Character "/ 251 |
|
1291 |
readConstant_ST_ByteArray "/ 252 |
|
1292 |
readConstant_ST_Array "/ 253 |
|
1293 |
readConstant_ST_Symbol "/ 254 |
|
1294 |
readConstant_ST_Reserved "/ 255 |
|
1295 |
) at:tag-249+1. |
|
1296 |
] ifFalse:[ |
|
1297 |
constReader := #( |
|
1298 |
"/ JAVA types |
|
1299 |
readConstant_Utf8 "/ 1 - now called Utf8 |
|
1300 |
readConstant_Unicode "/ 2 |
|
1301 |
readConstant_Integer "/ 3 |
|
1302 |
readConstant_Float "/ 4 |
|
1303 |
readConstant_Long "/ 5 |
|
1304 |
readConstant_Double "/ 6 |
|
1305 |
readConstant_Class "/ 7 |
|
1306 |
readConstant_String "/ 8 |
|
1307 |
readConstant_Fieldref "/ 9 |
|
1308 |
readConstant_Methodref "/ 10 |
|
1309 |
readConstant_InterfaceMethodref "/ 11 |
|
1310 |
readConstant_NameAndType "/ 12 |
|
1311 |
) at:tag ifAbsent:[#readConstant_Undef]. |
|
1312 |
]. |
|
1313 |
^ self perform:constReader. |
|
1314 |
||
1315 |
" |
|
1316 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1317 |
" |
|
1318 |
||
1319 |
"Created: / 15.4.1996 / 15:46:32 / cg" |
|
1320 |
"Modified: / 9.5.1998 / 01:26:05 / cg" |
|
1321 |
! |
|
1322 |
||
1323 |
readConstantPool |
|
877 | 1324 |
| constantPoolSize const | |
752 | 1325 |
|
1326 |
"/ |
|
1327 |
"/ get constant pool |
|
1328 |
"/ |
|
877 | 1329 |
constantPoolSize := inStream nextUnsignedShortMSB: msb. |
1330 |
self info: 'constantPoolSize = ' , constantPoolSize printString. |
|
1331 |
constants := JavaConstantPool new: constantPoolSize - 1. |
|
752 | 1332 |
constSlot := 1. |
877 | 1333 |
[ constSlot < constantPoolSize ] whileTrue: [ |
1334 |
self info: 'const slot: ' , constSlot printString. |
|
1335 |
const := self readConstant. |
|
1336 |
constants at: constSlot put: const. |
|
1337 |
||
1338 |
"/ long & double consts take 2 slots |
|
1339 |
"/ (only first is used) |
|
1340 |
||
1341 |
constNeeds2Slots |
|
1342 |
ifTrue: [ constSlot := constSlot + 2. ] |
|
1343 |
ifFalse: [ constSlot := constSlot + 1. ]]. |
|
752 | 1344 |
constSlot := -1. |
877 | 1345 |
|
1346 |
1 to: constantPoolSize - 1 |
|
1347 |
do: |
|
1348 |
[:i | |
|
1349 |
| const value | |
|
1350 |
||
1351 |
const := constants at: i. |
|
1352 |
const ifNotNil: |
|
1353 |
[ "/ kludge for 2-slot constants (which only take 1 slot in ST/X) |
|
1354 |
(const isKindOf: JavaUnresolvedConstant) |
|
1355 |
ifTrue: |
|
1356 |
[ value := const preResolve. |
|
1357 |
value ~~ const ifTrue: [ constants at: i put: value. ] ] ] ]. |
|
752 | 1358 |
|
1359 |
" |
|
1360 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
877 | 1361 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'" |
1362 |
||
1363 |
"Modified: / 07-05-1998 / 11:44:06 / cg" |
|
1364 |
"Created: / 13-05-2011 / 16:52:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
752 | 1365 |
! |
1366 |
||
1367 |
readConstant_Asciz |
|
781
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1368 |
| len string | |
782 | 1369 |
|
1370 |
||
781
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1371 |
len := inStream nextUnsignedShortMSB: msb. |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1372 |
string := String new: len. |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1373 |
inStream |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1374 |
nextBytes: len |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1375 |
into: string |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1376 |
startingAt: 1. |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1377 |
Verbose |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1378 |
ifTrue: |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1379 |
[ Transcript |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1380 |
show: 'asciz; string= '; |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1381 |
showCR: string ]. |
752 | 1382 |
^ string |
1383 |
||
1384 |
" |
|
1385 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
781
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1386 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'" |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1387 |
|
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1388 |
"Created: / 15-04-1996 / 15:15:35 / cg" |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1389 |
"Modified: / 15-04-1996 / 16:33:45 / cg" |
782 | 1390 |
"Modified: / 13-05-2011 / 17:31:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 1391 |
! |
1392 |
||
1393 |
readConstant_Class |
|
877 | 1394 |
| nameIndex | |
1395 |
||
1396 |
nameIndex := inStream nextUnsignedShortMSB: msb. |
|
1397 |
((constants at: nameIndex) isNil) |
|
1398 |
ifTrue: |
|
1399 |
[ self info: ('reading class; index=' , nameIndex printString , ' name=' |
|
1400 |
, (constants at: nameIndex) printString) ] |
|
1401 |
ifFalse: [ self info: ('reading class; index= ' , nameIndex printString) ]. |
|
1402 |
^ JavaClassRef2 in: constants withNameAt: nameIndex. |
|
1403 |
||
1404 |
"Modified: / 18-05-2011 / 18:21:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
752 | 1405 |
! |
1406 |
||
1407 |
readConstant_Double |
|
1408 |
|high low aFloat bytes| |
|
1409 |
||
1410 |
"/ new code - to be tested |
|
1411 |
"/ bytes := ByteArray new:8. |
|
1412 |
"/ |
|
1413 |
"/ inStream nextBytes:8 into:bytes startingAt:1. |
|
1414 |
"/ msb ~~ UninterpretedBytes isBigEndian ifTrue:[ |
|
1415 |
"/ bytes reverse |
|
1416 |
"/ ]. |
|
1417 |
"/ aFloat := bytes doubleAt:1. |
|
1418 |
||
1419 |
"/ old code |
|
1420 |
||
1421 |
high := inStream nextUnsignedLongMSB:msb. |
|
1422 |
low := inStream nextUnsignedLongMSB:msb. |
|
1423 |
||
1424 |
aFloat := Float new. |
|
1425 |
UninterpretedBytes isBigEndian ifTrue:[ |
|
1426 |
aFloat basicAt:1 put:((high bitShift:-24) bitAnd:16rFF). |
|
1427 |
aFloat basicAt:2 put:((high bitShift:-16) bitAnd:16rFF). |
|
1428 |
aFloat basicAt:3 put:((high bitShift:-8) bitAnd:16rFF). |
|
1429 |
aFloat basicAt:4 put:(high bitAnd:16rFF). |
|
1430 |
aFloat basicAt:5 put:((low bitShift:-24) bitAnd:16rFF). |
|
1431 |
aFloat basicAt:6 put:((low bitShift:-16) bitAnd:16rFF). |
|
1432 |
aFloat basicAt:7 put:((low bitShift:-8) bitAnd:16rFF). |
|
1433 |
aFloat basicAt:8 put:(low bitAnd:16rFF). |
|
1434 |
] ifFalse:[ |
|
1435 |
aFloat basicAt:1 put:(low bitAnd:16rFF). |
|
1436 |
aFloat basicAt:2 put:((low bitShift:-8) bitAnd:16rFF). |
|
1437 |
aFloat basicAt:3 put:((low bitShift:-16) bitAnd:16rFF). |
|
1438 |
aFloat basicAt:4 put:((low bitShift:-24) bitAnd:16rFF). |
|
1439 |
aFloat basicAt:5 put:(high bitAnd:16rFF). |
|
1440 |
aFloat basicAt:6 put:((high bitShift:-8) bitAnd:16rFF). |
|
1441 |
aFloat basicAt:7 put:((high bitShift:-16) bitAnd:16rFF). |
|
1442 |
aFloat basicAt:8 put:((high bitShift:-24) bitAnd:16rFF). |
|
1443 |
]. |
|
1444 |
||
1445 |
constNeeds2Slots := true. |
|
1446 |
||
1447 |
Verbose ifTrue:[Transcript show:'double; value= '; showCR:aFloat]. |
|
1448 |
^ aFloat |
|
1449 |
||
1450 |
" |
|
1451 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1452 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class' |
|
1453 |
" |
|
1454 |
||
1455 |
"Created: / 15.4.1996 / 16:34:42 / cg" |
|
1456 |
"Modified: / 8.5.1998 / 22:06:07 / cg" |
|
1457 |
! |
|
1458 |
||
877 | 1459 |
readConstant_Fieldref |
1460 |
"incrementally changing resolving logic, fields will come later" |
|
1461 |
||
1462 |
| classIndex nameAndTypeIndex | |
|
1463 |
||
1464 |
classIndex := inStream nextUnsignedShortMSB: msb. |
|
1465 |
nameAndTypeIndex := inStream nextUnsignedShortMSB: msb. |
|
1466 |
self |
|
1467 |
info: 'reading fieldref; classindex=' , classIndex printString |
|
1468 |
, ' nameAndTypeIndex=' , nameAndTypeIndex printString. |
|
1469 |
^ JavaFieldRef2 |
|
1470 |
in: constants |
|
1471 |
withNameAndTypeAt: nameAndTypeIndex |
|
1472 |
andClassAt: classIndex. |
|
1473 |
||
1474 |
"Modified: / 15-05-2011 / 14:20:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
752 | 1475 |
! |
1476 |
||
1477 |
readConstant_Float |
|
1478 |
|b1 b2 b3 b4 aFloat bytes| |
|
1479 |
||
1480 |
"/ new code - to be tested ... |
|
1481 |
"/ |
|
1482 |
"/ bytes := ByteArray new:4. |
|
1483 |
"/ inStream nextBytes:4 into:bytes startingAt:1. |
|
1484 |
"/ msb ~~ UninterpretedBytes isBigEndian ifTrue:[ |
|
1485 |
"/ bytes reverse |
|
1486 |
"/ ]. |
|
1487 |
"/ aFloat := bytes floatAt:1. |
|
1488 |
"/ Verbose ifTrue:[Transcript show:'float; value= '; showCR:aFloat]. |
|
1489 |
"/ ^ aFloat. |
|
1490 |
||
1491 |
"/ old code |
|
1492 |
||
1493 |
aFloat := ShortFloat basicNew. |
|
1494 |
||
1495 |
b1 := inStream nextByte. |
|
1496 |
b2 := inStream nextByte. |
|
1497 |
b3 := inStream nextByte. |
|
1498 |
b4 := inStream nextByte. |
|
1499 |
||
1500 |
UninterpretedBytes isBigEndian ifTrue:[ |
|
1501 |
aFloat basicAt:1 put:b1. |
|
1502 |
aFloat basicAt:2 put:b2. |
|
1503 |
aFloat basicAt:3 put:b3. |
|
1504 |
aFloat basicAt:4 put:b4. |
|
1505 |
] ifFalse:[ |
|
1506 |
aFloat basicAt:4 put:b1. |
|
1507 |
aFloat basicAt:3 put:b2. |
|
1508 |
aFloat basicAt:2 put:b3. |
|
1509 |
aFloat basicAt:1 put:b4. |
|
1510 |
]. |
|
1511 |
Verbose ifTrue:[Transcript show:'float; value= '; showCR:aFloat]. |
|
1512 |
^ aFloat |
|
1513 |
||
1514 |
" |
|
1515 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1516 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class' |
|
1517 |
" |
|
1518 |
||
1519 |
"Created: / 15.4.1996 / 16:34:42 / cg" |
|
1520 |
"Modified: / 10.11.1998 / 22:04:59 / cg" |
|
1521 |
! |
|
1522 |
||
1523 |
readConstant_Integer |
|
1524 |
|value| |
|
1525 |
||
1526 |
value := inStream nextLongMSB:msb. |
|
1527 |
||
1528 |
Verbose ifTrue:[Transcript show:'integer; value= '; showCR:value]. |
|
1529 |
||
1530 |
^ value |
|
1531 |
||
1532 |
" |
|
1533 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1534 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class' |
|
1535 |
" |
|
1536 |
||
1537 |
"Modified: 15.4.1996 / 15:42:16 / cg" |
|
1538 |
"Created: 15.4.1996 / 16:34:42 / cg" |
|
1539 |
! |
|
1540 |
||
1541 |
readConstant_InterfaceMethodref |
|
877 | 1542 |
| classIndex nameAndTypeIndex | |
1543 |
||
1544 |
classIndex := inStream nextUnsignedShortMSB: msb. |
|
1545 |
nameAndTypeIndex := inStream nextUnsignedShortMSB: msb. |
|
1546 |
self |
|
1547 |
info: 'reading interface methodref; classindex=' , classIndex printString |
|
1548 |
, ' nameAndTypeIndex=' , nameAndTypeIndex printString. |
|
1549 |
^ JavaInterfaceMethodRef2 |
|
1550 |
in: constants |
|
1551 |
withNameAndTypeAt: nameAndTypeIndex |
|
1552 |
andClassAt: classIndex. |
|
1553 |
||
1554 |
"Modified: / 12-05-2011 / 18:57:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
752 | 1555 |
! |
1556 |
||
1557 |
readConstant_Long |
|
1558 |
|high low value| |
|
1559 |
||
1560 |
high := inStream nextUnsignedLongMSB:msb. |
|
1561 |
low := inStream nextUnsignedLongMSB:msb. |
|
1562 |
||
1563 |
value := (high bitShift:32) bitOr:low. |
|
1564 |
(high bitTest:16r80000000) ifTrue:[ |
|
1565 |
value := value - 16r10000000000000000. |
|
1566 |
]. |
|
1567 |
constNeeds2Slots := true. |
|
1568 |
||
1569 |
Verbose ifTrue:[Transcript show:'long; value= '; showCR:value]. |
|
1570 |
^ value |
|
1571 |
||
1572 |
" |
|
1573 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1574 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class' |
|
1575 |
" |
|
1576 |
||
1577 |
"Modified: 15.4.1996 / 15:42:16 / cg" |
|
1578 |
"Created: 15.4.1996 / 16:34:42 / cg" |
|
1579 |
! |
|
1580 |
||
1581 |
readConstant_Methodref |
|
877 | 1582 |
| classIndex nameAndTypeIndex | |
1583 |
||
1584 |
classIndex := inStream nextUnsignedShortMSB: msb. |
|
1585 |
nameAndTypeIndex := inStream nextUnsignedShortMSB: msb. |
|
1586 |
self |
|
1587 |
info: 'reading methodref; classindex=' , classIndex printString , ' nameAndTypeIndex=' |
|
1588 |
, nameAndTypeIndex printString. |
|
1589 |
^ JavaMethodRef2 |
|
1590 |
in: constants |
|
1591 |
withNameAndTypeAt: nameAndTypeIndex |
|
1592 |
andClassAt: classIndex. |
|
1593 |
||
1594 |
"Modified: / 15-05-2011 / 14:20:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
752 | 1595 |
! |
1596 |
||
1597 |
readConstant_NameAndType |
|
877 | 1598 |
| nameIndex descriptorIndex | |
1599 |
||
1600 |
nameIndex := inStream nextUnsignedShortMSB: msb. |
|
1601 |
descriptorIndex := inStream nextUnsignedShortMSB: msb. |
|
1602 |
self |
|
1603 |
info: 'reading nameAndType; nameindex=' , nameIndex printString |
|
1604 |
, ' descriptorIndex= ' , descriptorIndex printString. |
|
1605 |
^JavaNameAndType2 |
|
1606 |
in: constants |
|
1607 |
withNameAt: nameIndex |
|
1608 |
andDescriptorAt: descriptorIndex. |
|
1609 |
||
1610 |
"Modified: / 10-05-2011 / 17:09:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
752 | 1611 |
! |
1612 |
||
1613 |
readConstant_String |
|
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
1614 |
| string_index | |
782 | 1615 |
|
781
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1616 |
string_index := inStream nextUnsignedShortMSB: msb. |
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
1617 |
^ JavaStringRef2 in: constants withValueAt: string_index. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
1618 |
|
781
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1619 |
|
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
1620 |
|
781
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1621 |
"Created: / 15-04-1996 / 15:20:33 / cg" |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1622 |
"Modified: / 07-05-1998 / 11:42:45 / cg" |
782 | 1623 |
"Modified: / 13-05-2011 / 17:31:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
906
fea23aa2b228
Few more fixes and workarounds for Saxon 6.5.5: the Othello example works fine...
vranyj1
parents:
898
diff
changeset
|
1624 |
"Modified: / 10-08-2011 / 23:25:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 1625 |
! |
1626 |
||
1627 |
readConstant_Unicode |
|
781
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1628 |
| len string ascii | |
782 | 1629 |
|
781
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1630 |
len := inStream nextUnsignedShortMSB: msb. |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1631 |
string := TwoByteString new: len. |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1632 |
1 to: len |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1633 |
do: |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1634 |
[:idx | |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1635 |
ascii := inStream nextUnsignedShortMSB: msb. |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1636 |
string at: idx put: (Character value: ascii). ]. |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1637 |
Verbose |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1638 |
ifTrue: |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1639 |
[ Transcript |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1640 |
show: 'asciz; unicodeString= '; |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1641 |
showCR: string ]. |
752 | 1642 |
^ string |
781
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1643 |
|
782 | 1644 |
"Modified: / 13-05-2011 / 17:31:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 1645 |
! |
1646 |
||
1647 |
readConstant_Utf8 |
|
781
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1648 |
| len bytes string | |
782 | 1649 |
|
781
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1650 |
len := inStream nextUnsignedShortMSB: msb. |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1651 |
bytes := ByteArray new: len. |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1652 |
inStream |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1653 |
nextBytes: len |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1654 |
into: bytes |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1655 |
startingAt: 1. |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1656 |
string := CharacterArray fromJavaUTF8Bytes: bytes. |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1657 |
Verbose |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1658 |
ifTrue: |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1659 |
[ Transcript |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1660 |
show: 'asciz; string= '; |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1661 |
showCR: string ]. |
752 | 1662 |
^ string |
1663 |
||
1664 |
"Modified: / 19-10-2010 / 12:38:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
782 | 1665 |
"Modified: / 13-05-2011 / 17:31:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 1666 |
! ! |
1667 |
||
1668 |
!JavaClassReader methodsFor:'file reading - constants-ST'! |
|
1669 |
||
1670 |
readConstant_ST_Array |
|
1671 |
|aSize arr| |
|
1672 |
||
1673 |
aSize := inStream nextUnsignedShortMSB:msb. |
|
1674 |
arr := Array new:aSize. |
|
1675 |
||
1676 |
1 to:aSize do:[:i | |
|
1677 |
|element_index element| |
|
1678 |
||
1679 |
element_index := inStream nextUnsignedShortMSB:msb. |
|
1680 |
arr at:i put:element_index. |
|
1681 |
]. |
|
1682 |
Verbose ifTrue:[Transcript show:'array; size= '; showCR:aSize]. |
|
1683 |
||
1684 |
^ JavaUnresolvedSTArrayConstant |
|
1685 |
pool:constants |
|
1686 |
poolIndex:constSlot |
|
1687 |
array:arr |
|
1688 |
||
1689 |
"Created: / 7.5.1998 / 11:47:01 / cg" |
|
1690 |
"Modified: / 9.5.1998 / 00:25:34 / cg" |
|
1691 |
! |
|
1692 |
||
1693 |
readConstant_ST_ByteArray |
|
1694 |
|aSize arr| |
|
1695 |
||
1696 |
aSize := inStream nextUnsignedShortMSB:msb. |
|
1697 |
arr := ByteArray new:aSize. |
|
1698 |
||
1699 |
1 to:aSize do:[:i | |
|
1700 |
|element_index| |
|
1701 |
||
1702 |
arr at:i put:(inStream nextByte). |
|
1703 |
]. |
|
1704 |
Verbose ifTrue:[Transcript show:'byteArray; size= '; showCR:aSize]. |
|
1705 |
||
1706 |
^ arr |
|
1707 |
||
1708 |
"Created: / 7.5.1998 / 11:47:12 / cg" |
|
1709 |
! |
|
1710 |
||
1711 |
readConstant_ST_Character |
|
1712 |
|ascii| |
|
1713 |
||
1714 |
ascii := inStream nextUnsignedShortMSB:msb. |
|
1715 |
||
1716 |
Verbose ifTrue:[Transcript show:'char; ascii= '; showCR:ascii]. |
|
1717 |
^ Character value:ascii |
|
1718 |
||
1719 |
"Created: / 7.5.1998 / 11:48:12 / cg" |
|
1720 |
! |
|
1721 |
||
1722 |
readConstant_ST_Special |
|
1723 |
|type| |
|
1724 |
||
1725 |
type := inStream nextUnsignedShortMSB:msb. |
|
1726 |
^ #( |
|
1727 |
nil |
|
1728 |
true |
|
1729 |
false |
|
1730 |
) at:(type + 1) |
|
1731 |
||
1732 |
"Created: / 8.5.1998 / 23:06:56 / cg" |
|
1733 |
"Modified: / 9.5.1998 / 00:40:14 / cg" |
|
1734 |
! |
|
1735 |
||
1736 |
readConstant_ST_String |
|
781
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1737 |
| tag string_index chars | |
782 | 1738 |
|
1739 |
||
781
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1740 |
string_index := inStream nextUnsignedShortMSB: msb. |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1741 |
Verbose |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1742 |
ifTrue: |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1743 |
[ Transcript |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1744 |
show: 'string; index= '; |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1745 |
showCR: string_index ]. |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1746 |
|
752 | 1747 |
"/ resolve here if possible |
781
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1748 |
|
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1749 |
string_index < constSlot |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1750 |
ifTrue: |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1751 |
[ chars := (constants at: string_index). |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1752 |
^ chars ]. |
752 | 1753 |
^ JavaUnresolvedSTStringConstant |
781
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1754 |
pool: constants |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1755 |
poolIndex: constSlot |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1756 |
stringIndex: string_index |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1757 |
|
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1758 |
"Created: / 07-05-1998 / 11:49:55 / cg" |
782 | 1759 |
"Modified: / 13-05-2011 / 17:32:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 1760 |
! |
1761 |
||
1762 |
readConstant_ST_Symbol |
|
781
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1763 |
| tag string_index chars | |
782 | 1764 |
|
1765 |
||
781
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1766 |
string_index := inStream nextUnsignedShortMSB: msb. |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1767 |
Verbose |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1768 |
ifTrue: |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1769 |
[ Transcript |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1770 |
show: 'symbol; index= '; |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1771 |
showCR: string_index ]. |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1772 |
|
752 | 1773 |
"/ resolve here if possible |
781
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1774 |
|
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1775 |
string_index < constSlot |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1776 |
ifTrue: |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1777 |
[ chars := (constants at: string_index). |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1778 |
chars isString ifFalse: [ self halt: 'should not happen' ]. |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1779 |
^ chars asSymbol ]. |
752 | 1780 |
^ JavaUnresolvedSTSymbolConstant |
781
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1781 |
pool: constants |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1782 |
poolIndex: constSlot |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1783 |
stringIndex: string_index |
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1784 |
|
d27c59bcf38a
added preResolve compatibility method + JavaStringRef - will be used soon
hlopkmar
parents:
775
diff
changeset
|
1785 |
"Modified: / 07-05-1998 / 11:48:28 / cg" |
782 | 1786 |
"Modified: / 13-05-2011 / 17:32:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 1787 |
! ! |
1788 |
||
1789 |
!JavaClassReader methodsFor:'file reading - fields'! |
|
1790 |
||
1791 |
readConstantValueAttributeFor:aField |
|
1792 |
|attribute_length constantvalue_index constantValue| |
|
1793 |
||
1794 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
1795 |
||
1796 |
constantvalue_index := inStream nextUnsignedShortMSB:msb. |
|
1797 |
constantValue := constants at:constantvalue_index. |
|
1798 |
||
1799 |
aField constantValue:constantValue. |
|
1800 |
||
1801 |
Verbose ifTrue:[Transcript show:'constantValue: '; showCR:constantValue]. |
|
1802 |
^ true |
|
1803 |
||
1804 |
" |
|
1805 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1806 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class' |
|
1807 |
" |
|
1808 |
||
1809 |
"Modified: 15.4.1996 / 15:33:28 / cg" |
|
1810 |
"Created: 15.4.1996 / 15:40:17 / cg" |
|
1811 |
! |
|
1812 |
||
1813 |
readFieldInfofield |
|
913 | 1814 |
| access_flags name_index descriptor_index attributes_count field | |
797
8d4e7c17eadd
fixed JavaClassReader so it always sets staticFields
hlopkmar
parents:
796
diff
changeset
|
1815 |
|
752 | 1816 |
access_flags := inStream nextUnsignedShortMSB: msb. |
1817 |
name_index := inStream nextUnsignedShortMSB: msb. |
|
913 | 1818 |
descriptor_index := inStream nextUnsignedShortMSB: msb. |
752 | 1819 |
field := JavaField new. |
1820 |
field setAccessFlags: access_flags. |
|
1821 |
field setName: (constants at: name_index) asSymbol. |
|
913 | 1822 |
field setDescriptor: (constants at: descriptor_index) asSymbol. |
879 | 1823 |
field setConstantPool: constants. |
752 | 1824 |
attributes_count := inStream nextUnsignedShortMSB: msb. |
1825 |
Verbose |
|
1826 |
ifTrue: |
|
1827 |
[ Transcript |
|
1828 |
show: ' field name: '; |
|
1829 |
show: (constants at: name_index); |
|
1830 |
show: ' access: '; |
|
1831 |
show: access_flags; |
|
1832 |
show: ' attrib_cnt: '; |
|
1833 |
showCR: attributes_count ]. |
|
1834 |
1 to: attributes_count do: [:i | self readAttributeFor: field. ]. |
|
1835 |
^ field. |
|
1836 |
||
1837 |
" |
|
1838 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'" |
|
1839 |
||
1840 |
"Created: / 15-04-1996 / 15:38:43 / cg" |
|
1841 |
"Modified: / 15-10-1998 / 10:38:01 / cg" |
|
1842 |
"Modified: / 17-12-2010 / 18:44:30 / Marcel Hlopko <hlopik@gmail.com>" |
|
797
8d4e7c17eadd
fixed JavaClassReader so it always sets staticFields
hlopkmar
parents:
796
diff
changeset
|
1843 |
"Modified: / 18-05-2011 / 14:11:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
913 | 1844 |
"Modified: / 14-08-2011 / 19:40:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 1845 |
! |
1846 |
||
1847 |
readFieldInfofields |
|
1848 |
|nFields fields| |
|
1849 |
||
1850 |
"/ |
|
1851 |
"/ get fieldInfos |
|
1852 |
"/ |
|
1853 |
nFields := inStream nextUnsignedShortMSB:msb. |
|
1854 |
Verbose ifTrue:[Transcript show:'fieldsCount = '; showCR:nFields]. |
|
1855 |
||
1856 |
fields := Array new:nFields. |
|
1857 |
||
1858 |
1 to:nFields do:[:i | |
|
1859 |
Verbose ifTrue:[Transcript show:'field: '; showCR:i]. |
|
1860 |
fields at:i put:(self readFieldInfofield) |
|
1861 |
]. |
|
1862 |
^ fields |
|
1863 |
||
1864 |
" |
|
1865 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1866 |
" |
|
1867 |
||
1868 |
"Created: 15.4.1996 / 15:34:41 / cg" |
|
1869 |
"Modified: 15.4.1996 / 15:35:28 / cg" |
|
1870 |
! ! |
|
1871 |
||
1872 |
!JavaClassReader methodsFor:'file reading - interfaces'! |
|
1873 |
||
1874 |
readInterfaces |
|
1875 |
|interfacesCount interface_index interface interfaces| |
|
1876 |
||
1877 |
"/ |
|
1878 |
"/ get interfaces |
|
1879 |
"/ |
|
1880 |
interfacesCount := inStream nextUnsignedShortMSB:msb. |
|
1881 |
Verbose ifTrue:[Transcript show:'interfacesCount = '; showCR:interfacesCount]. |
|
1882 |
||
1883 |
interfaces := Array new:interfacesCount. |
|
1884 |
||
1885 |
1 to:interfacesCount do:[:i | |
|
1886 |
Verbose ifTrue:[Transcript show:'interface: '; showCR:i]. |
|
1887 |
interface_index := inStream nextUnsignedShortMSB:msb. |
|
1888 |
interface := constants at:interface_index. |
|
1889 |
||
1890 |
interfaces at:i put:interface. |
|
1891 |
]. |
|
1892 |
^ interfaces |
|
1893 |
||
1894 |
" |
|
1895 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1896 |
" |
|
1897 |
||
1898 |
"Created: 15.4.1996 / 15:31:59 / cg" |
|
1899 |
"Modified: 15.4.1996 / 15:33:28 / cg" |
|
1900 |
! ! |
|
1901 |
||
1902 |
!JavaClassReader methodsFor:'file reading - methods'! |
|
1903 |
||
1904 |
readCodeAttributeFor:aJavaMethod |
|
1905 |
|attribute_length max_stack max_locals code_length code |
|
1906 |
exception_table_length exception_table unknown1 unknown2| |
|
1907 |
||
1908 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
1909 |
||
1910 |
Verbose ifTrue:[Transcript show:'code_attribute_length: 0x'; showCR:(attribute_length printStringRadix:16)]. |
|
1911 |
||
1912 |
((minorVsn > 2) or:[majorVsn > 45]) ifTrue:[ |
|
1913 |
"/ should be: |
|
1914 |
max_stack := inStream nextUnsignedShortMSB:msb. |
|
1915 |
max_locals := inStream nextUnsignedShortMSB:msb. |
|
1916 |
code_length := inStream nextUnsignedLongMSB:msb. |
|
1917 |
||
1918 |
"/ unknown1 := inStream nextByte. |
|
1919 |
"/ max_stack := inStream nextByte. |
|
1920 |
"/ max_locals := inStream nextUnsignedShortMSB:msb. |
|
1921 |
"/ unknown2 := inStream nextUnsignedShortMSB:msb. |
|
1922 |
"/ code_length := inStream nextUnsignedShortMSB:msb. |
|
1923 |
"/ Verbose ifTrue:[Transcript show:'?1: '; showCR:unknown1]. |
|
1924 |
"/ Verbose ifTrue:[Transcript show:'?2: '; showCR:unknown2]. |
|
1925 |
] ifFalse:[ |
|
1926 |
max_stack := inStream nextByte. |
|
1927 |
max_locals := inStream nextByte. |
|
1928 |
code_length := inStream nextUnsignedShortMSB:msb. |
|
1929 |
]. |
|
1930 |
||
1931 |
Verbose ifTrue:[ |
|
1932 |
Transcript show:'code_length: '; showCR:(code_length printStringRadix:16). |
|
1933 |
Transcript show:'code at pos: '; showCR:inStream position |
|
1934 |
]. |
|
1935 |
||
1936 |
code_length ~~ 0 ifTrue:[ |
|
1937 |
code := ByteArray new:code_length. |
|
1938 |
inStream nextBytes:code_length into:code startingAt:1. |
|
1939 |
]. |
|
1940 |
Verbose ifTrue:[Transcript show:'method code: '; showCR:code.]. |
|
1941 |
||
1942 |
exception_table_length := inStream nextUnsignedShortMSB:msb. |
|
1943 |
Verbose ifTrue:[Transcript show:'exception_table_length: '; showCR:(exception_table_length printStringRadix:16)]. |
|
1944 |
exception_table_length ~~ 0 ifTrue:[ |
|
1945 |
Verbose ifTrue:[Transcript show:'exceptionTable length:'; showCR:exception_table_length.]. |
|
1946 |
||
1947 |
exception_table := Array new:exception_table_length. |
|
1948 |
1 to:exception_table_length do:[:i | |
|
1949 |
|start_pc end_pc handler_pc catch_type| |
|
1950 |
||
1951 |
start_pc := inStream nextUnsignedShortMSB:msb. |
|
1952 |
end_pc := inStream nextUnsignedShortMSB:msb. |
|
1953 |
handler_pc := inStream nextUnsignedShortMSB:msb. |
|
1954 |
catch_type := inStream nextUnsignedShortMSB:msb. |
|
1955 |
catch_type ~= 0 ifTrue:[ |
|
1956 |
catch_type := constants at:catch_type. |
|
1957 |
]. |
|
1958 |
exception_table at:i put:(JavaExceptionTableEntry |
|
1959 |
startPC:start_pc |
|
1960 |
endPC:end_pc |
|
1961 |
handlerPC:handler_pc |
|
1962 |
catchType:catch_type). |
|
1963 |
]. |
|
1964 |
aJavaMethod setExceptionHandlerTable:exception_table. |
|
1965 |
]. |
|
1966 |
||
1967 |
aJavaMethod |
|
1968 |
setCode:code |
|
1969 |
maxStack:max_stack |
|
1970 |
maxLocals:max_locals |
|
1971 |
u1:unknown1 |
|
1972 |
u2:unknown2. |
|
1973 |
||
1974 |
self readAttributesFor:aJavaMethod. |
|
1975 |
^ true |
|
1976 |
||
1977 |
" |
|
1978 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1979 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class' |
|
1980 |
" |
|
1981 |
||
1982 |
"Created: / 15-04-1996 / 15:40:17 / cg" |
|
1983 |
"Modified: / 16-05-1998 / 01:39:42 / cg" |
|
1984 |
"Modified: / 17-12-2010 / 00:24:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1985 |
! |
|
1986 |
||
1987 |
readExceptionsAttributeFor:aJavaMethod |
|
1988 |
|attribute_length exception_table_length exception_table| |
|
1989 |
||
1990 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
1991 |
||
1992 |
exception_table_length := inStream nextUnsignedShortMSB:msb. |
|
1993 |
exception_table_length ~~ 0 ifTrue:[ |
|
1994 |
exception_table := Array new:exception_table_length. |
|
1995 |
1 to:exception_table_length do:[:i | |
|
1996 |
|idx ex| |
|
1997 |
||
1998 |
idx := inStream nextUnsignedShortMSB:msb. |
|
1999 |
ex := constants at:idx. |
|
2000 |
exception_table at:i put:ex. |
|
2001 |
]. |
|
2002 |
]. |
|
2003 |
||
2004 |
Verbose ifTrue:[Transcript showCR:'method has an exceptionTable']. |
|
2005 |
||
2006 |
aJavaMethod setExceptionTable:exception_table. |
|
2007 |
^ true |
|
2008 |
||
2009 |
"Modified: 15.4.1996 / 15:33:28 / cg" |
|
2010 |
"Created: 15.4.1996 / 15:40:17 / cg" |
|
2011 |
! |
|
2012 |
||
2013 |
readLineNumberTableAttributeFor:aJavaMethod |
|
2014 |
|attribute_length line_number_table_length line_number_table| |
|
2015 |
||
2016 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
2017 |
||
2018 |
line_number_table_length := inStream nextUnsignedShortMSB:msb. |
|
2019 |
line_number_table_length ~~ 0 ifTrue:[ |
|
2020 |
line_number_table := Array new:line_number_table_length. |
|
2021 |
1 to:line_number_table_length do:[:i | |
|
2022 |
|start_pc line_number| |
|
2023 |
||
2024 |
start_pc := inStream nextUnsignedShortMSB:msb. |
|
2025 |
line_number := inStream nextUnsignedShortMSB:msb. |
|
2026 |
line_number_table at:i put:(start_pc -> line_number). |
|
2027 |
]. |
|
2028 |
Verbose ifTrue:[Transcript showCR:'method has a lineNumberTable']. |
|
2029 |
||
2030 |
aJavaMethod setLineNumberTable:line_number_table. |
|
2031 |
]. |
|
2032 |
||
2033 |
^ true |
|
2034 |
||
2035 |
" |
|
2036 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
2037 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/java/lang/Boolean.class' |
|
2038 |
" |
|
2039 |
||
2040 |
"Created: / 15.4.1996 / 15:40:17 / cg" |
|
2041 |
"Modified: / 7.4.1998 / 19:08:42 / cg" |
|
2042 |
! |
|
2043 |
||
2044 |
readLocalVariableTableAttributeFor:aJavaMethod |
|
2045 |
|attribute_length local_variable_table_length local_variable_table| |
|
2046 |
||
2047 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
2048 |
||
2049 |
local_variable_table_length := inStream nextUnsignedShortMSB:msb. |
|
2050 |
local_variable_table_length ~~ 0 ifTrue:[ |
|
2051 |
local_variable_table := JavaLocalVariableTable new:local_variable_table_length. |
|
2052 |
1 to:local_variable_table_length do:[:i | |
|
2053 |
|start_pc length name_index sig_index slot name signature| |
|
2054 |
||
2055 |
start_pc := inStream nextUnsignedShortMSB:msb. |
|
2056 |
length := inStream nextUnsignedShortMSB:msb. |
|
2057 |
name_index := inStream nextUnsignedShortMSB:msb. |
|
2058 |
name := constants at:name_index. |
|
2059 |
sig_index := inStream nextUnsignedShortMSB:msb. |
|
2060 |
signature := constants at:sig_index. |
|
2061 |
slot := inStream nextUnsignedShortMSB:msb. |
|
2062 |
||
2063 |
local_variable_table at:i put:(JavaLocalVariableTableEntry new |
|
2064 |
startPC:start_pc |
|
2065 |
length:length |
|
2066 |
name:name |
|
2067 |
signature:signature |
|
2068 |
slot:slot) |
|
2069 |
]. |
|
2070 |
]. |
|
2071 |
||
2072 |
Verbose ifTrue:[Transcript showCR:'method has a localvariableTable']. |
|
2073 |
||
2074 |
aJavaMethod setLocalVariableTable:local_variable_table. |
|
2075 |
^ true |
|
2076 |
||
2077 |
" |
|
2078 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
2079 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/java/lang/Boolean.class' |
|
2080 |
" |
|
2081 |
||
2082 |
"Modified: 15.4.1996 / 15:33:28 / cg" |
|
2083 |
"Created: 15.4.1996 / 15:40:17 / cg" |
|
2084 |
! |
|
2085 |
||
2086 |
readMethodFor:aClass |
|
913 | 2087 |
|m access_flags name_index name descriptor_index descriptor |
752 | 2088 |
tooManyArgs| |
2089 |
||
2090 |
"/ |
|
2091 |
"/ get a method |
|
2092 |
"/ |
|
2093 |
access_flags := inStream nextUnsignedShortMSB:msb. |
|
2094 |
name_index := inStream nextUnsignedShortMSB:msb. |
|
913 | 2095 |
descriptor_index := inStream nextUnsignedShortMSB:msb. |
752 | 2096 |
|
2097 |
name := constants at:name_index. |
|
913 | 2098 |
descriptor := constants at:descriptor_index. |
752 | 2099 |
|
2100 |
Verbose ifTrue:[ |
|
2101 |
Transcript show:'method name:'; showCR:name. |
|
913 | 2102 |
Transcript show:'descriptor:'; showCR:descriptor. |
752 | 2103 |
]. |
2104 |
||
2105 |
aClass isJavaClass ifTrue:[ |
|
2106 |
(access_flags bitAnd:JavaMethod A_NATIVE) ~~ 0 ifTrue:[ |
|
2107 |
m := JavaNativeMethod new. |
|
2108 |
] ifFalse:[ |
|
2109 |
m := JavaMethodWithHandler new. |
|
2110 |
]. |
|
2111 |
m setAccessFlags:access_flags. |
|
2112 |
tooManyArgs := false. |
|
2113 |
ArgumentError handle:[:ex | |
|
1000 | 2114 |
Logger log: 'java method has too many arguments - will fail to execute' severity: #warn facility: 'JVM'. |
752 | 2115 |
tooManyArgs := true. |
2116 |
ex proceed. |
|
2117 |
] do:[ |
|
913 | 2118 |
m setName:name descriptor:descriptor. |
752 | 2119 |
]. |
2120 |
m setJavaClass:aClass. |
|
2121 |
||
2122 |
self readAttributesFor:m. |
|
2123 |
||
2124 |
tooManyArgs ifTrue:[ |
|
2125 |
m code:nil. |
|
2126 |
m byteCode:nil. |
|
2127 |
]. |
|
1050 | 2128 |
|
752 | 2129 |
(m exceptionHandlerTable isNil) ifTrue:[ |
2130 |
m isNative ifFalse:[ |
|
2131 |
m getExceptionTable isNil ifTrue:[ |
|
2132 |
m := JavaMethod fromMethod:m |
|
2133 |
] ifFalse:[ |
|
2134 |
m := JavaMethodWithException fromMethod:m |
|
2135 |
] |
|
2136 |
] |
|
2137 |
] ifFalse:[ |
|
2138 |
m setAccessFlags:(m accessFlags bitOr:JavaMethod A_HASHANDLER) |
|
2139 |
]. |
|
913 | 2140 |
aClass addMethod:m name:name signature:descriptor. |
752 | 2141 |
] ifFalse:[ |
2142 |
m := Method new. |
|
2143 |
self readAttributesFor:m. |
|
2144 |
(access_flags bitTest:JavaMethod A_STATIC) ifTrue:[ |
|
2145 |
aClass class primAddSelector:name asSymbol withMethod:m. |
|
2146 |
] ifFalse:[ |
|
2147 |
aClass primAddSelector:name asSymbol withMethod:m. |
|
2148 |
] |
|
2149 |
]. |
|
2150 |
||
2151 |
" |
|
2152 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
2153 |
" |
|
2154 |
||
2155 |
"Created: / 15-04-1996 / 16:48:49 / cg" |
|
2156 |
"Modified: / 25-09-1999 / 23:16:25 / cg" |
|
1050 | 2157 |
"Modified: / 25-10-2011 / 17:41:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 2158 |
! |
2159 |
||
2160 |
readMethodsFor:aJavaClass |
|
2161 |
|methodsCount method| |
|
2162 |
||
2163 |
"/ |
|
2164 |
"/ get methods |
|
2165 |
"/ |
|
2166 |
methodsCount := inStream nextUnsignedShortMSB:msb. |
|
2167 |
Verbose ifTrue:[Transcript show:'methodsCount = '; showCR:methodsCount]. |
|
2168 |
||
2169 |
1 to:methodsCount do:[:i | |
|
2170 |
Verbose ifTrue:[Transcript show:'method: '; showCR:i]. |
|
2171 |
method := self readMethodFor:aJavaClass |
|
2172 |
]. |
|
2173 |
||
2174 |
" |
|
2175 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
2176 |
" |
|
2177 |
||
2178 |
"Created: / 15.4.1996 / 16:46:30 / cg" |
|
2179 |
"Modified: / 8.5.1998 / 21:20:59 / cg" |
|
2180 |
! ! |
|
2181 |
||
2182 |
!JavaClassReader methodsFor:'file reading - methods-ST'! |
|
2183 |
||
2184 |
readSTCodeAttributeFor:aSmalltalkMethod |
|
2185 |
|attribute_length max_stack max_locals code_length code |
|
2186 |
exception_table_length unknown1 unknown2| |
|
2187 |
||
2188 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
2189 |
||
2190 |
Verbose ifTrue:[Transcript show:'attribute_length: 0x'; showCR:(attribute_length printStringRadix:16)]. |
|
2191 |
||
2192 |
max_stack := inStream nextUnsignedShortMSB:msb. |
|
2193 |
max_locals := inStream nextUnsignedShortMSB:msb. |
|
2194 |
||
2195 |
code_length := inStream nextUnsignedLongMSB:msb. |
|
2196 |
Verbose ifTrue:[Transcript show:'code_length: '; showCR:(code_length printStringRadix:16)]. |
|
2197 |
Verbose ifTrue:[Transcript show:'code at pos: '; showCR:inStream position]. |
|
2198 |
||
2199 |
code_length ~~ 0 ifTrue:[ |
|
2200 |
code := ByteArray new:code_length. |
|
2201 |
inStream nextBytes:code_length into:code startingAt:1. |
|
2202 |
]. |
|
2203 |
Verbose ifTrue:[Transcript show:'method code: '; showCR:code.]. |
|
2204 |
||
2205 |
exception_table_length := inStream nextUnsignedShortMSB:msb. |
|
2206 |
Verbose ifTrue:[Transcript show:'exception_table_length: '; showCR:(exception_table_length printStringRadix:16)]. |
|
2207 |
exception_table_length ~~ 0 ifTrue:[ |
|
2208 |
self error:'unexpected exceptionTable length'. |
|
2209 |
"/ skip it. |
|
2210 |
1 to:exception_table_length do:[:i | |
|
2211 |
"start_pc :=" inStream nextUnsignedShortMSB:msb. |
|
2212 |
"end_pc :=" inStream nextUnsignedShortMSB:msb. |
|
2213 |
"handler_pc :=" inStream nextUnsignedShortMSB:msb. |
|
2214 |
"catch_type :=" inStream nextUnsignedShortMSB:msb. |
|
2215 |
]. |
|
2216 |
]. |
|
2217 |
||
2218 |
aSmalltalkMethod byteCode:code. |
|
2219 |
aSmalltalkMethod stackSize:max_stack . |
|
2220 |
aSmalltalkMethod numberOfVars:max_locals. |
|
2221 |
||
2222 |
self readAttributesFor:aSmalltalkMethod. |
|
2223 |
^ true |
|
2224 |
||
2225 |
"Modified: / 16.5.1998 / 01:39:30 / cg" |
|
2226 |
! |
|
2227 |
||
2228 |
readSTLiteralsAttributeFor:aSmalltalkMethod |
|
2229 |
|attribute_length literal_table_length literal_table litIndex literal| |
|
2230 |
||
2231 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
2232 |
||
2233 |
literal_table_length := inStream nextUnsignedShortMSB:msb. |
|
2234 |
literal_table_length ~~ 0 ifTrue:[ |
|
2235 |
literal_table := Array new:literal_table_length. |
|
2236 |
1 to:literal_table_length do:[:i | |
|
2237 |
litIndex := inStream nextUnsignedShortMSB:msb. |
|
2238 |
literal := (constants at:litIndex). |
|
2239 |
literal_table at:i put:literal. |
|
2240 |
]. |
|
2241 |
]. |
|
2242 |
Verbose ifTrue:[Transcript show:'literals: '; showCR:literal_table storeString.]. |
|
2243 |
||
2244 |
"Created: / 7.5.1998 / 11:52:28 / cg" |
|
2245 |
"Modified: / 16.5.1998 / 01:52:27 / cg" |
|
2246 |
! |
|
2247 |
||
2248 |
readSTMethodCategoryAttributeFor:aSmalltalkMethod |
|
2249 |
|attribute_length name_index name| |
|
2250 |
||
2251 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
2252 |
||
2253 |
name_index := inStream nextUnsignedShortMSB:msb. |
|
2254 |
name := (constants at:name_index). |
|
2255 |
||
2256 |
aSmalltalkMethod category:name. |
|
2257 |
||
2258 |
"Modified: / 8.5.1998 / 20:39:59 / cg" |
|
2259 |
"Created: / 16.5.1998 / 01:04:19 / cg" |
|
2260 |
! ! |
|
2261 |
||
775 | 2262 |
!JavaClassReader methodsFor:'helpers'! |
2263 |
||
798
b534e73eaf7e
JavaClassReader2 now uses correct superclass loading
hlopkmar
parents:
797
diff
changeset
|
2264 |
loadSuperclassIdentifiedBy: something ignoring: classesBeingLoaded |
877 | 2265 |
"overriding method, here we expect something to be new JavaClassRef2" |
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
2266 |
|
877 | 2267 |
self assert: something isJavaRef |
2268 |
message: 'class identifier is not a java reference'. |
|
2269 |
self assert: something isJavaClassRef |
|
1033 | 2270 |
message: 'class identifier is not a java class reference'. |
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
2271 |
(classesBeingLoaded includes: something name) ifTrue: [ |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
2272 |
self |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
2273 |
error: 'class we want to load is being loaded and that means something went wrong. tell mh' |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
2274 |
]. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1025
diff
changeset
|
2275 |
"hint in case of bug - is parent of something set? surely jv will know more :)" "find out which classloader is used" |
1033 | 2276 |
^ JavaVM classForName: something name. |
877 | 2277 |
|
2278 |
"Created: / 18-05-2011 / 14:55:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
960 | 2279 |
"Modified: / 31-08-2011 / 21:25:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
798
b534e73eaf7e
JavaClassReader2 now uses correct superclass loading
hlopkmar
parents:
797
diff
changeset
|
2280 |
! |
b534e73eaf7e
JavaClassReader2 now uses correct superclass loading
hlopkmar
parents:
797
diff
changeset
|
2281 |
|
775 | 2282 |
updateOwnerInCPItem: each |
2283 |
((each isJavaRef and: [ each isNewJavaRef ]) |
|
2284 |
or: [ each isJavaNameAndType and: [ each isNewJavaNameAndType ] ]) |
|
2285 |
ifTrue: [ each owner: classBeingLoaded ]. |
|
2286 |
||
2287 |
"Created: / 12-05-2011 / 17:40:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
796
9b3e00dd3196
Small fix, so JavaFields have their javaClass always set.
hlopkmar
parents:
784
diff
changeset
|
2288 |
! |
9b3e00dd3196
Small fix, so JavaFields have their javaClass always set.
hlopkmar
parents:
784
diff
changeset
|
2289 |
|
9b3e00dd3196
Small fix, so JavaFields have their javaClass always set.
hlopkmar
parents:
784
diff
changeset
|
2290 |
updateOwnerInField: each |
9b3e00dd3196
Small fix, so JavaFields have their javaClass always set.
hlopkmar
parents:
784
diff
changeset
|
2291 |
|
9b3e00dd3196
Small fix, so JavaFields have their javaClass always set.
hlopkmar
parents:
784
diff
changeset
|
2292 |
each setClass: classBeingLoaded. |
9b3e00dd3196
Small fix, so JavaFields have their javaClass always set.
hlopkmar
parents:
784
diff
changeset
|
2293 |
|
9b3e00dd3196
Small fix, so JavaFields have their javaClass always set.
hlopkmar
parents:
784
diff
changeset
|
2294 |
"Created: / 18-05-2011 / 13:57:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
775 | 2295 |
! ! |
2296 |
||
799 | 2297 |
!JavaClassReader methodsFor:'logging'! |
2298 |
||
2299 |
info: message |
|
1000 | 2300 |
Verbose ifTrue: [ Logger log: message severity: #info facility: 'JVM' ]. |
799 | 2301 |
|
2302 |
"Created: / 18-05-2011 / 15:06:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1000 | 2303 |
"Modified (format): / 14-09-2011 / 21:39:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
799 | 2304 |
! ! |
2305 |
||
752 | 2306 |
!JavaClassReader class methodsFor:'documentation'! |
2307 |
||
2308 |
version |
|
1022 | 2309 |
^ '$Id$' |
752 | 2310 |
! |
2311 |
||
2312 |
version_CVS |
|
2313 |
^ '§Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaClassReader.st,v 1.92 2009/10/09 14:21:53 cg Exp §' |
|
2314 |
! |
|
2315 |
||
2316 |
version_SVN |
|
1022 | 2317 |
^ '$Id$' |
752 | 2318 |
! ! |
2319 |
||
959 | 2320 |
JavaClassReader initialize! |