author | Claus Gittinger <cg@exept.de> |
Thu, 24 Nov 2011 13:02:05 +0100 | |
changeset 2330 | b189800c0d92 |
parent 2151 | c0b6570c6f9b |
child 2353 | fa7400d022a0 |
permissions | -rw-r--r-- |
454 | 1 |
" |
2151 | 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: |
|
454 | 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. |
|
2151 | 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. |
|
454 | 41 |
" |
695 | 42 |
"{ Package: 'stx:libjava' }" |
43 |
||
1 | 44 |
Object subclass:#JavaClassReader |
91 | 45 |
instanceVariableNames:'inStream msb constants majorVsn minorVsn constNeeds2Slots |
2151 | 46 |
constSlot classBeingLoaded' |
47 |
classVariableNames:'Verbose AnnotationsVerbose Silent AbsolutelySilent |
|
48 |
LazyClassLoading InvalidClassFormatSignal ClassLoaderQuerySignal |
|
49 |
JavaArchiveCache' |
|
1 | 50 |
poolDictionaries:'' |
2108 | 51 |
category:'Languages-Java-Support' |
1 | 52 |
! |
53 |
||
454 | 54 |
!JavaClassReader class methodsFor:'documentation'! |
55 |
||
56 |
copyright |
|
57 |
" |
|
2151 | 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: |
|
454 | 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. |
|
2151 | 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 |
||
454 | 98 |
" |
99 |
! ! |
|
1 | 100 |
|
135 | 101 |
!JavaClassReader class methodsFor:'initialization'! |
1 | 102 |
|
103 |
initialize |
|
2151 | 104 |
InvalidClassFormatSignal := Signal new mayProceed: true. |
105 |
InvalidClassFormatSignal notifierString: 'class load failure'. |
|
106 |
InvalidClassFormatSignal nameClass: self message: #invalidClassFormatSignal. |
|
107 |
Verbose := false. |
|
91 | 108 |
Silent := true. |
109 |
AbsolutelySilent := false. |
|
2151 | 110 |
|
111 |
"/LazyClassLoading := false. |
|
112 |
||
113 |
LazyClassLoading := true. |
|
114 |
ClassLoaderQuerySignal := QuerySignal new. |
|
115 |
JavaArchiveCache := CacheDictionary new: 32. |
|
116 |
AnnotationsVerbose := false. |
|
29 | 117 |
|
118 |
" |
|
2151 | 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>" |
|
123 |
"Modified: / 10-05-2011 / 23:59:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
124 |
"Modified: / 26-07-2011 / 17:21:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
198 | 125 |
! ! |
126 |
||
127 |
!JavaClassReader class methodsFor:'Signal constants'! |
|
128 |
||
223 | 129 |
classLoaderQuerySignal |
130 |
^ ClassLoaderQuerySignal |
|
131 |
||
132 |
"Created: 14.8.1997 / 19:56:03 / cg" |
|
133 |
! |
|
134 |
||
198 | 135 |
invalidClassFormatSignal |
136 |
^ InvalidClassFormatSignal |
|
137 |
||
138 |
"Created: 3.8.1997 / 18:17:21 / cg" |
|
1 | 139 |
! ! |
140 |
||
344 | 141 |
!JavaClassReader class methodsFor:'constants'! |
142 |
||
2151 | 143 |
fileMajorVersions |
144 |
^#( |
|
145 |
46 "Java 1.2" |
|
146 |
47 "???" |
|
147 |
48 "???" |
|
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 |
" |
|
161 |
||
162 |
"Created: / 19-10-2010 / 21:40:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
163 |
"Modified: / 01-06-2011 / 21:44:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
164 |
"Modified: / 02-06-2011 / 22:50:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
165 |
"Modified: / 18-08-2011 / 19:32:37 / jv" |
|
344 | 166 |
! |
167 |
||
2151 | 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>" |
|
344 | 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 |
||
135 | 190 |
!JavaClassReader class methodsFor:'debugging'! |
1 | 191 |
|
2151 | 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 |
||
1 | 203 |
verbose:aBoolean |
204 |
Verbose := aBoolean |
|
205 |
||
206 |
" |
|
67 | 207 |
Java flushClasses. |
1 | 208 |
JavaClassReader verbose:true |
209 |
JavaClassReader verbose:false |
|
210 |
" |
|
211 |
! ! |
|
212 |
||
135 | 213 |
!JavaClassReader class methodsFor:'file reading'! |
1 | 214 |
|
21 | 215 |
loadClass:aClassName |
43 | 216 |
"reads a class, installs and returns it. |
217 |
The classes string constants are resolved & <clinit> is called, |
|
218 |
if it implements it." |
|
21 | 219 |
|
223 | 220 |
|rslt loader| |
21 | 221 |
|
548 | 222 |
loader := ClassLoaderQuerySignal query. |
223 | 223 |
loader isNil ifTrue:[ |
399 | 224 |
^ self loadSystemClass:aClassName |
223 | 225 |
]. |
226 |
||
227 |
^ loader loadClass:aClassName |
|
21 | 228 |
|
229 |
" |
|
230 |
JavaClassReader loadClass:'awt/Component' |
|
231 |
JavaClassReader loadClass:'awt/Button' |
|
232 |
JavaClassReader loadClass:'browser/AddButton' |
|
233 |
||
234 |
JavaClassReader loadClass:'java/lang/Object' |
|
235 |
JavaClassReader loadClass:'java/lang/AbstractMethodError' |
|
236 |
JavaClassReader loadClass:'java/lang/Thread' |
|
237 |
" |
|
238 |
||
252 | 239 |
"Created: / 15.4.1996 / 14:58:53 / cg" |
399 | 240 |
"Modified: / 20.10.1998 / 17:24:54 / cg" |
21 | 241 |
! |
242 |
||
2151 | 243 |
loadClassLazy: internalJavaClassName |
244 |
^ self loadClassLazy: internalJavaClassName ignoring: Set new. |
|
245 |
||
246 |
"Created: / 08-04-2011 / 18:00:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
247 |
"Modified: / 11-04-2011 / 19:31:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
248 |
! |
|
249 |
||
250 |
loadClassLazy: className classpath: classpath ignoring: classesBeingLoaded |
|
38 | 251 |
"private helper: |
252 |
reads a class, installs and returns it. |
|
253 |
The class is searched along the ClassPath. |
|
43 | 254 |
|
255 |
This is a partial load (to load other classes): |
|
2151 | 256 |
- The classes stringConstants are not fixed to be JavaStrings |
43 | 257 |
(i.e they are still ST-Strings). |
252 | 258 |
- The class is NOT initialized." |
2151 | 259 |
|
260 |
| rslt clsName cls loadedClass | |
|
261 |
||
262 |
clsName := className utf8Encoded. |
|
263 |
(clsName endsWith: ';') |
|
264 |
ifTrue: |
|
265 |
[ (clsName startsWith: '[L') |
|
266 |
ifTrue: [ clsName := clsName copyFrom: 3 to: clsName size - 1. ] |
|
267 |
ifFalse: |
|
268 |
[ ('oops - loading of ' , clsName , ' attempted') printNL. |
|
269 |
self halt: 'should not happen'. |
|
270 |
^ nil. ] ]. |
|
271 |
(clsName endsWith: '[]') |
|
272 |
ifTrue: |
|
273 |
[ ('oops - loading of ' , clsName , ' attempted') printNL. |
|
274 |
self halt: 'should not happen'. |
|
275 |
^ nil ]. |
|
276 |
(clsName includes: $.) |
|
277 |
ifTrue: [ clsName := clsName asString copyReplaceAll: $. with: $/ ]. |
|
278 |
(classesBeingLoaded notNil and: [ classesBeingLoaded includes: clsName ]) |
|
279 |
ifTrue: |
|
280 |
[ ('oops - recursive load of ' , clsName , ' attempted') printNL. |
|
281 |
self halt: 'should not happen'. |
|
282 |
^ JavaUnresolvedClassConstant fullName: clsName ]. |
|
283 |
(cls := Java at: clsName) notNil |
|
284 |
ifTrue: |
|
285 |
[ ('oops - ' , clsName , ' is already loaded') printNL. |
|
286 |
||
287 |
"/self halt:clsName , ' is already loaded - should not happen'. |
|
288 |
||
289 |
^ cls ]. |
|
290 |
classesBeingLoaded isNil |
|
291 |
ifTrue: [ loadedClass := Set with: clsName ] |
|
292 |
ifFalse: |
|
293 |
[ loadedClass := Set withAll: classesBeingLoaded. |
|
294 |
loadedClass add: clsName. ]. |
|
295 |
classpath do: |
|
296 |
[:path | |
|
297 |
| nm p zar entry zipFile read | |
|
298 |
||
299 |
Verbose == true |
|
300 |
ifTrue: [ Transcript showCR: 'trying ' , path asFilename pathName , ' ...'. ]. |
|
301 |
p := path. |
|
302 |
p asFilename isDirectory |
|
303 |
ifTrue: |
|
304 |
[ (p endsWith: Filename separator) |
|
305 |
ifFalse: [ p := p , (Filename separator asString) ]. |
|
306 |
(Array |
|
307 |
with: clsName |
|
308 |
with: clsName asLowercase |
|
309 |
with: clsName asUppercase) do: |
|
310 |
[:tryName | |
|
311 |
nm := p , tryName , '.class'. |
|
312 |
Verbose == true ifTrue: [ Transcript showCR: 'trying ' , nm , ' ...'. ]. |
|
313 |
nm asFilename exists |
|
314 |
ifTrue: |
|
315 |
[ (Java isExcludedFromClassPath: nm) |
|
316 |
ifFalse: |
|
317 |
[ rslt := self loadFileLazy: nm ignoring: loadedClass. |
|
318 |
rslt notNil ifTrue: [ ^ rslt ]. ] ]. ] ] |
|
319 |
ifFalse: |
|
320 |
[ Verbose == true |
|
321 |
ifTrue: |
|
322 |
[ Transcript |
|
323 |
showCR: 'trying ' , (p asFilename withSuffix: 'jar') pathName , ' ...'. |
|
324 |
Transcript |
|
325 |
showCR: 'and ' , (p asFilename withSuffix: 'zip') pathName , ' ...'. ]. |
|
326 |
((zipFile := p asFilename withSuffix: 'jar') exists |
|
327 |
or: [ (zipFile := p asFilename withSuffix: 'zip') exists ]) |
|
328 |
ifTrue: |
|
329 |
[ |
|
330 |
zar := JavaArchiveCache at: zipFile |
|
331 |
ifAbsentPut: [ ZipArchive oldFileNamed: zipFile ]. |
|
332 |
read := |
|
333 |
[ nm := clsName , '.class'. |
|
334 |
entry := zar extract: nm. |
|
335 |
entry notNil |
|
336 |
ifTrue: |
|
337 |
[ (Java isExcludedFromClassPath: nm) |
|
338 |
ifFalse: |
|
339 |
[ rslt := self loadStreamLazy: (entry readStream) ignoring: loadedClass. |
|
340 |
rslt notNil ifTrue: [ ^ rslt ]. ] ] ]. |
|
341 |
JavaClassReader invalidClassFormatSignal handle: |
|
342 |
[ "Kludge, sometimes zar gets corrupted" |
|
343 |
||
344 |
zar := JavaArchiveCache at: zipFile put: (ZipArchive oldFileNamed: zipFile). |
|
345 |
read value ] |
|
346 |
do: [ read value ]. ] ] ]. |
|
347 |
^nil. |
|
348 |
||
349 |
"Modified: / 14-08-1997 / 11:38:42 / stefan" |
|
350 |
"Modified: / 17-09-1998 / 20:51:25 / cg" |
|
351 |
"Modified: / 21-03-2011 / 12:42:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
352 |
"Created: / 12-08-2011 / 08:48:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
353 |
! |
|
354 |
||
355 |
loadClassLazy: aClassName ignoring: classesBeingLoaded |
|
356 |
||
357 |
| class loader | |
|
358 |
class := self loadClassLazy: aClassName classpath: Java release classPath ignoring: classesBeingLoaded. |
|
359 |
class notNil ifTrue:[^class]. |
|
360 |
class := self loadClassLazy: aClassName classpath: Java classPath ignoring: classesBeingLoaded. |
|
361 |
class isNil ifTrue:[^nil]. |
|
362 |
loader := (Java classForName:'java.lang.ClassLoader') instVarNamed: #scl. |
|
363 |
loader ifNil:[ |
|
364 |
loader := (Java classForName:'java.lang.ClassLoader') perform: #'getSystemClassLoader()Ljava/lang/ClassLoader;'. |
|
91 | 365 |
]. |
2151 | 366 |
class classLoader: loader. |
367 |
^ class |
|
368 |
||
369 |
"Modified: / 14-08-1997 / 11:38:42 / stefan" |
|
370 |
"Modified: / 17-09-1998 / 20:51:25 / cg" |
|
371 |
"Modified: / 21-03-2011 / 12:42:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
372 |
"Modified: / 12-08-2011 / 09:06:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
373 |
! |
|
374 |
||
375 |
loadClassesIn: directory |
|
376 |
"load all classes (.class files, strictly speaking) found in given directory. |
|
377 |
The argument is string containing the name of the directory. |
|
378 |
||
379 |
Returns a set of loaded classes." |
|
380 |
||
381 |
^self loadClassesIn: directory matching: '*' |
|
382 |
||
383 |
"Modified: / 11-06-2011 / 13:35:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
384 |
! |
|
385 |
||
386 |
loadClassesIn: directory matching: pattern |
|
387 |
"load all classes (.class files, strictly speaking) found in given directory. |
|
388 |
The arguments are a string containing the name of the directory |
|
389 |
and a class name pattern. Only classes matching the pattern are loaded. |
|
390 |
class names are matched using String>>matches:. |
|
391 |
||
392 |
Returns a set of loaded classes." |
|
393 |
||
394 |
| dir dirString className loadedClasses | |
|
395 |
||
396 |
dir := directory asFilename asAbsoluteFilename. |
|
397 |
loadedClasses := Set new. |
|
398 |
Java addToClassPath: dir pathName. |
|
399 |
dir recursiveDirectoryContentsAsFilenamesDo: |
|
400 |
[:filename | |
|
401 |
(filename isRegularFile and: [ filename suffix = #class ]) |
|
402 |
ifTrue: |
|
403 |
[ dirString := dir pathName. |
|
404 |
className := filename withoutSuffix pathName. |
|
405 |
className := className subString: dirString size + 2 to: className size. |
|
406 |
className := className copyReplaceAll: (Filename separator) with: $.. |
|
407 |
(className matches: pattern) ifTrue: |
|
408 |
[loadedClasses add: (self loadClass: className)]]]. |
|
409 |
||
410 |
^ loadedClasses. |
|
411 |
||
412 |
"Modified: / 29-04-2011 / 17:43:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
413 |
"Created: / 11-06-2011 / 13:34:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
414 |
"Modified: / 11-06-2011 / 16:19:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
38 | 415 |
! |
416 |
||
7 | 417 |
loadFile:aFilename |
43 | 418 |
"reads a class from aFilename, installs and returns it. |
419 |
The classes strings are fixed and its class-init function is called." |
|
420 |
||
54 | 421 |
self loadFileLazy:aFilename ignoring:(Set new). |
43 | 422 |
self postLoadActions |
423 |
! |
|
424 |
||
54 | 425 |
loadFileLazy:aFilename ignoring:classesBeingLoaded |
43 | 426 |
"reads a class from aFilename, installs and returns it. |
91 | 427 |
Strings are fixed and classrefs are fixed, |
428 |
but NO no class-init functions are called." |
|
7 | 429 |
|
353 | 430 |
|aClass pool| |
7 | 431 |
|
353 | 432 |
aClass := self readFile:aFilename ignoring:classesBeingLoaded. |
433 |
aClass notNil ifTrue:[ |
|
434 |
aClass isJavaClass ifTrue:[ |
|
350 | 435 |
"/ a java class |
353 | 436 |
Java at:(aClass fullName asSymbol) put:aClass. |
350 | 437 |
|
353 | 438 |
classesBeingLoaded remove:aClass fullName ifAbsent:nil. |
21 | 439 |
|
353 | 440 |
JavaUnresolvedConstant resolveFor:aClass. |
350 | 441 |
] ifFalse:[ |
442 |
"/ a smalltalk class |
|
353 | 443 |
"/ self halt. |
444 |
aClass inspect. |
|
350 | 445 |
] |
7 | 446 |
]. |
353 | 447 |
^ aClass |
7 | 448 |
|
449 |
" |
|
450 |
JavaClassReader loadFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
9 | 451 |
|
452 |
'/phys/ibm3/java/lib/java/lang' asFilename |
|
350 | 453 |
directoryContents do:[:nm | |
454 |
(nm endsWith:'.class') ifTrue:[ |
|
455 |
('/phys/ibm3/java/lib/java/lang/' , nm) printNL. |
|
456 |
JavaClassReader loadFile:'/phys/ibm3/java/lib/java/lang/' , nm |
|
457 |
] |
|
458 |
]. |
|
9 | 459 |
|
14
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
460 |
'/phys/ibm3/java/lib/java/io' asFilename |
350 | 461 |
directoryContents do:[:nm | |
462 |
(nm endsWith:'.class') ifTrue:[ |
|
463 |
('/phys/ibm3/java/lib/java/io/' , nm) printNL. |
|
464 |
JavaClassReader loadFile:'/phys/ibm3/java/lib/java/io/' , nm |
|
465 |
] |
|
466 |
]. |
|
14
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
467 |
|
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
468 |
'/phys/ibm3/java/lib/java/net' asFilename |
350 | 469 |
directoryContents do:[:nm | |
470 |
(nm endsWith:'.class') ifTrue:[ |
|
471 |
('/phys/ibm3/java/lib/java/net/' , nm) printNL. |
|
472 |
JavaClassReader loadFile:'/phys/ibm3/java/lib/java/net/' , nm |
|
473 |
] |
|
474 |
]. |
|
14
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
475 |
|
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
476 |
'/phys/ibm3/java/lib/java/util' asFilename |
350 | 477 |
directoryContents do:[:nm | |
478 |
(nm endsWith:'.class') ifTrue:[ |
|
479 |
('/phys/ibm3/java/lib/java/util/' , nm) printNL. |
|
480 |
JavaClassReader loadFile:'/phys/ibm3/java/lib/java/util/' , nm |
|
481 |
] |
|
482 |
]. |
|
14
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
483 |
|
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
484 |
'/phys/ibm3/java/lib/java/awt' asFilename |
350 | 485 |
directoryContents do:[:nm | |
486 |
(nm endsWith:'.class') ifTrue:[ |
|
487 |
('/phys/ibm3/java/lib/java/awt/' , nm) printNL. |
|
488 |
JavaClassReader loadFile:'/phys/ibm3/java/lib/java/awt/' , nm |
|
489 |
] |
|
490 |
]. |
|
14
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
491 |
|
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
492 |
'/phys/ibm3/java/lib/java/applet' asFilename |
350 | 493 |
directoryContents do:[:nm | |
494 |
(nm endsWith:'.class') ifTrue:[ |
|
495 |
('/phys/ibm3/java/lib/java/applet/' , nm) printNL. |
|
496 |
JavaClassReader loadFile:'/phys/ibm3/java/lib/java/applet/' , nm |
|
497 |
] |
|
498 |
]. |
|
14
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
499 |
|
9 | 500 |
JavaClassReader loadFile:'/phys/ibm3/java/lib/java/lang/AbstractMethodError.class' |
14
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
501 |
JavaClassReader loadFile:'/phys/ibm3/java/lib/java/lang/Thread.class' |
7 | 502 |
" |
503 |
||
350 | 504 |
"Created: / 15.4.1996 / 14:58:53 / cg" |
353 | 505 |
"Modified: / 12.5.1998 / 22:06:52 / cg" |
7 | 506 |
! |
507 |
||
327 | 508 |
loadStreamLazy:aStream ignoring:classesBeingLoaded |
509 |
"reads a class from aStream, installs and returns it. |
|
510 |
Strings are fixed and classrefs are fixed, |
|
511 |
but NO no class-init functions are called." |
|
512 |
||
513 |
|javaClass pool| |
|
514 |
||
515 |
javaClass := self readStream:aStream ignoring:classesBeingLoaded. |
|
516 |
javaClass notNil ifTrue:[ |
|
517 |
Java at:(javaClass fullName asSymbol) put:javaClass. |
|
518 |
||
519 |
classesBeingLoaded remove:javaClass fullName ifAbsent:nil. |
|
520 |
||
521 |
JavaUnresolvedConstant resolveFor:javaClass. |
|
522 |
]. |
|
523 |
^ javaClass |
|
524 |
||
525 |
"Created: / 30.3.1998 / 17:59:02 / cg" |
|
526 |
! |
|
527 |
||
2151 | 528 |
loadSystemClass: aClassName |
399 | 529 |
"reads a class, installs and returns it. |
530 |
The classes string constants are resolved & <clinit> is called, |
|
531 |
if it implements it. |
|
532 |
This only loads local classes (i.e. any Java classReader is not used)" |
|
2151 | 533 |
|
534 |
| class classLoaderClass | |
|
535 |
||
536 |
class := JavaClassReader loadClassLazy: aClassName ignoring: (Set new). |
|
537 |
class isNil ifTrue: [ ^nil]. |
|
538 |
self assert: class constantPool owner == class. |
|
539 |
JavaClassReader postLoadActions. |
|
540 |
"/ "Set the classloader iff the VM is booted" |
|
541 |
"/ "Rubbish, do not do that" |
|
542 |
"/ JavaVM booted ifTrue:[ |
|
543 |
"/ classLoaderClass := Java at:'java.lang.ClassLoader'. |
|
544 |
"/ classLoaderClass notNil ifTrue:[ |
|
545 |
"/ class classLoader: (classLoaderClass instVarNamed:#scl). |
|
546 |
"/ ]. |
|
547 |
"/ ]. |
|
548 |
^ class |
|
399 | 549 |
|
550 |
" |
|
551 |
JavaClassReader loadSystemClass:'awt/Component' |
|
552 |
JavaClassReader loadSystemClass:'awt/Button' |
|
553 |
JavaClassReader loadSystemClass:'browser/AddButton' |
|
554 |
||
555 |
JavaClassReader loadSystemClass:'java/lang/Object' |
|
556 |
JavaClassReader loadSystemClass:'java/lang/AbstractMethodError' |
|
2151 | 557 |
JavaClassReader loadSystemClass:'java/lang/Thread'" |
558 |
||
559 |
"Created: / 20-10-1998 / 17:24:40 / cg" |
|
560 |
"Modified: / 13-05-2011 / 17:50:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
561 |
"Modified: / 08-08-2011 / 17:13:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
562 |
! |
|
563 |
||
564 |
loadSystemClass: aClassName classpath: classpath |
|
565 |
"reads a class, installs and returns it. |
|
566 |
The classes string constants are resolved & <clinit> is called, |
|
567 |
if it implements it. |
|
568 |
This only loads local classes (i.e. any Java classReader is not used)" |
|
569 |
||
570 |
| class loader | |
|
571 |
||
572 |
class := JavaClassReader loadClassLazy: aClassName classpath: classpath ignoring: (Set new). |
|
573 |
class isNil ifTrue: [ ^nil]. |
|
574 |
classpath = Java release classPath ifFalse:[ |
|
575 |
loader := (Java classForName:'java.lang.ClassLoader') instVarNamed: #scl. |
|
576 |
loader ifNil:[ |
|
577 |
loader := (Java classForName:'java.lang.ClassLoader') perform: #'getSystemClassLoader()Ljava/lang/ClassLoader;'. |
|
578 |
]. |
|
579 |
class classLoader: loader. |
|
580 |
]. |
|
581 |
self assert: class constantPool owner == class. |
|
582 |
JavaClassReader postLoadActions. |
|
583 |
"/ "Set the classloader iff the VM is booted" |
|
584 |
"/ "Rubbish, do not do that" |
|
585 |
"/ JavaVM booted ifTrue:[ |
|
586 |
"/ classLoaderClass := Java at:'java.lang.ClassLoader'. |
|
587 |
"/ classLoaderClass notNil ifTrue:[ |
|
588 |
"/ class classLoader: (classLoaderClass instVarNamed:#scl). |
|
589 |
"/ ]. |
|
590 |
"/ ]. |
|
591 |
^ class |
|
592 |
||
399 | 593 |
" |
2151 | 594 |
JavaClassReader loadSystemClass:'awt/Component' |
595 |
JavaClassReader loadSystemClass:'awt/Button' |
|
596 |
JavaClassReader loadSystemClass:'browser/AddButton' |
|
597 |
||
598 |
JavaClassReader loadSystemClass:'java/lang/Object' |
|
599 |
JavaClassReader loadSystemClass:'java/lang/AbstractMethodError' |
|
600 |
JavaClassReader loadSystemClass:'java/lang/Thread'" |
|
601 |
||
602 |
"Created: / 20-10-1998 / 17:24:40 / cg" |
|
603 |
"Modified: / 13-05-2011 / 17:50:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
604 |
"Created: / 12-08-2011 / 09:05:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
399 | 605 |
! |
606 |
||
43 | 607 |
postLoadActions |
608 |
"Resolve all classes' string constants. |
|
609 |
Perform all class initialization functions (of those which are not |
|
610 |
yet initialized)." |
|
611 |
||
225 | 612 |
^ self postLoadActions:true |
613 |
||
614 |
"Modified: 15.8.1997 / 01:02:17 / cg" |
|
615 |
! |
|
616 |
||
617 |
postLoadActions:loadUnresolved |
|
618 |
"Resolve all classes' string constants. |
|
252 | 619 |
Perform all class initialization functions |
620 |
(of those which are not yet initialized)." |
|
225 | 621 |
|
223 | 622 |
|classes prevUnresolved newUnresolved loader| |
43 | 623 |
|
91 | 624 |
"/ need at least java.lang.String, for valid constants |
167 | 625 |
Java java_lang_String isNil ifTrue:[ |
255 | 626 |
self loadClassLazy:'java.lang.String' ignoring:(Set new). |
54 | 627 |
]. |
628 |
||
91 | 629 |
LazyClassLoading ifFalse:[ |
547 | 630 |
loader := ClassLoaderQuerySignal query. |
255 | 631 |
|
632 |
prevUnresolved := nil. |
|
633 |
newUnresolved := JavaUnresolvedConstant unresolvedClassNames asArray. |
|
634 |
loadUnresolved ifTrue:[ |
|
635 |
[prevUnresolved ~= newUnresolved] whileTrue:[ |
|
636 |
newUnresolved do:[:nextUnresolved | |
|
637 |
|classURL| |
|
223 | 638 |
|
255 | 639 |
(Java at:nextUnresolved) isNil ifTrue:[ "/ could have been loaded in the meantime |
640 |
Silent ifFalse:[ |
|
641 |
'loading unresolved: ' print. nextUnresolved printCR. |
|
642 |
]. |
|
643 |
loader isNil ifTrue:[ |
|
644 |
self |
|
645 |
loadClassLazy:nextUnresolved |
|
646 |
ignoring:(Set new). |
|
647 |
] ifFalse:[ |
|
648 |
"/ |
|
649 |
"/ the aquired loader is a javaClassLoader |
|
650 |
"/ which expects an URL as arg. |
|
651 |
"/ |
|
652 |
"/ classURL := Java as_URL:('file:' , nextUnresolved asString , '.class'). |
|
653 |
"/ loader loadClass:classURL |
|
654 |
loader |
|
655 |
perform:#'loadClass(Ljava/lang/String;)Ljava/lang/Class;' |
|
656 |
with:(Java as_String:(nextUnresolved asString)). |
|
657 |
] |
|
658 |
] |
|
659 |
]. |
|
660 |
prevUnresolved := newUnresolved. |
|
661 |
newUnresolved := JavaUnresolvedConstant unresolvedClassNames asArray. |
|
662 |
]. |
|
663 |
]. |
|
407 | 664 |
false ifTrue:[ |
255 | 665 |
newUnresolved size == 0 ifTrue:[ |
666 |
"/ nothing unresolved |
|
91 | 667 |
|
255 | 668 |
(classes := Java allClasses) notNil ifTrue:[ |
669 |
"/ init all new classes |
|
670 |
"/ fetch again - there could be new ones ... |
|
91 | 671 |
|
255 | 672 |
classes := Java allClasses. |
673 |
classes do:[:aJavaClass | |
|
674 |
aJavaClass isInitialized ifFalse:[ |
|
675 |
Silent ifFalse:[ |
|
676 |
'performing class initialization of ' print. aJavaClass fullName printCR. |
|
677 |
]. |
|
678 |
aJavaClass classInit |
|
679 |
] |
|
680 |
] |
|
681 |
] |
|
682 |
]. |
|
407 | 683 |
]. |
43 | 684 |
] |
167 | 685 |
|
252 | 686 |
"Created: / 15.8.1997 / 01:01:44 / cg" |
407 | 687 |
"Modified: / 21.10.1998 / 01:18:35 / cg" |
43 | 688 |
! |
689 |
||
54 | 690 |
readFile:aFilename ignoring:classesBeingLoaded |
7 | 691 |
"reads a class from aFilename and returns it. |
91 | 692 |
The JavaClass is NOT installed as global and unresolved |
693 |
refs are NOT patched." |
|
7 | 694 |
|
73 | 695 |
|inStream javaClass| |
1 | 696 |
|
2151 | 697 |
"Silent"false ifFalse:[ |
2115 | 698 |
'reading ' print. aFilename print. ' ...' printCR. |
43 | 699 |
]. |
21 | 700 |
|
2115 | 701 |
[ |
702 |
inStream := aFilename asFilename readStream. |
|
703 |
] on:StreamError do:[:ex| |
|
704 |
('JAVA [info]: no file: ' , aFilename asString) printCR. |
|
318 | 705 |
self halt. |
706 |
^ nil |
|
91 | 707 |
]. |
708 |
||
709 |
javaClass := self new readStream:inStream ignoring:classesBeingLoaded. |
|
350 | 710 |
(javaClass notNil and:[javaClass isJavaClass]) ifTrue:[ |
318 | 711 |
javaClass setBinaryFilePath:(inStream pathName). |
73 | 712 |
]. |
1 | 713 |
inStream close. |
27 | 714 |
|
91 | 715 |
AbsolutelySilent ifFalse:[ |
318 | 716 |
' ... loaded ' print. javaClass displayString printNL. |
43 | 717 |
]. |
27 | 718 |
|
2151 | 719 |
|
73 | 720 |
^ javaClass |
1 | 721 |
|
2151 | 722 |
"Created: / 15-04-1996 / 14:58:53 / cg" |
723 |
"Modified: / 09-05-1998 / 01:44:24 / cg" |
|
724 |
"Modified: / 09-08-2011 / 15:18:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1 | 725 |
! |
726 |
||
198 | 727 |
readStream:aStream |
728 |
"reads a class from aStream and returns it. |
|
223 | 729 |
The JavaClass is installed as global. |
730 |
If new classes are required to be loaded, a new standard loader |
|
731 |
is created." |
|
198 | 732 |
|
223 | 733 |
^ self readStream:aStream loader:nil |
198 | 734 |
|
223 | 735 |
"Modified: 14.8.1997 / 19:51:50 / cg" |
198 | 736 |
! |
737 |
||
2151 | 738 |
readStream: aStream ignoring: classesBeingLoaded |
7 | 739 |
"reads a class from aStream and returns it. |
740 |
The JavaClass is not installed as global" |
|
2151 | 741 |
|
742 |
| javaClass | |
|
743 |
||
744 |
javaClass := JavaClassReader new readStream: aStream ignoring: classesBeingLoaded. |
|
745 |
AbsolutelySilent |
|
746 |
ifFalse: |
|
747 |
[ ' ... loaded ' print. |
|
748 |
javaClass displayString printNL. ]. |
|
327 | 749 |
^ javaClass |
750 |
||
2151 | 751 |
"Modified: / 30-03-1998 / 18:14:40 / cg" |
752 |
"Modified: / 09-05-2011 / 23:15:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
753 |
"Modified: / 26-07-2011 / 17:21:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
223 | 754 |
! |
755 |
||
756 |
readStream:aStream loader:aClassLoader |
|
757 |
"reads a class from aStream and returns it. |
|
758 |
The JavaClass is installed as global. |
|
759 |
If new classes are required to be loaded, aClassLoader is |
|
760 |
asked to do it. If aClassLoader is nil, a new standard loader |
|
761 |
is created." |
|
762 |
||
225 | 763 |
^ self |
252 | 764 |
readStream:aStream |
765 |
loader:aClassLoader |
|
766 |
loadUnresolved:true |
|
225 | 767 |
|
768 |
"Modified: 15.8.1997 / 01:00:35 / cg" |
|
769 |
! |
|
770 |
||
2151 | 771 |
readStream: aStream loader: aClassLoader loadUnresolved: loadUnresolved |
225 | 772 |
"reads a class from aStream and returns it. |
773 |
The JavaClass is installed as global. |
|
774 |
If new classes are required to be loaded, aClassLoader is |
|
775 |
asked to do it. If aClassLoader is nil, a new standard loader |
|
776 |
is created." |
|
2151 | 777 |
|
778 |
| javaClass | |
|
779 |
||
780 |
ClassLoaderQuerySignal answer: aClassLoader |
|
781 |
do: |
|
782 |
[ javaClass := self readStream: aStream ignoring: (Set new). |
|
783 |
javaClass notNil |
|
784 |
ifTrue: |
|
785 |
[ JavaClassReader postLoadActions: loadUnresolved. |
|
786 |
Java at: (javaClass fullName asSymbol) put: javaClass. |
|
787 |
JavaUnresolvedConstant resolveFor: javaClass. ]. ]. |
|
223 | 788 |
^ javaClass |
789 |
||
2151 | 790 |
"Created: / 15-08-1997 / 00:59:24 / cg" |
791 |
"Modified: / 23-01-1998 / 17:14:09 / cg" |
|
792 |
"Modified: / 09-05-2011 / 23:15:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
793 |
"Modified: / 26-07-2011 / 17:21:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
399 | 794 |
! |
795 |
||
796 |
resolveClass:aJavaClass |
|
797 |
"Resolve a particular classes' constants. |
|
798 |
Perform all class initialization functions |
|
799 |
(of those which are not yet initialized)." |
|
800 |
||
801 |
|loader classToLoad| |
|
802 |
||
803 |
LazyClassLoading ifFalse:[ |
|
804 |
loader := (aJavaClass classLoader). "/ ? (ClassLoaderQuerySignal raise). |
|
805 |
||
806 |
[ |
|
807 |
classToLoad := nil. |
|
808 |
aJavaClass constantPool do:[:item | |
|
809 |
|itemClass | |
|
810 |
||
811 |
itemClass := item class. |
|
812 |
itemClass == JavaUnresolvedClassConstant ifTrue:[ |
|
813 |
classToLoad := item className. |
|
814 |
"/ ] ifFalse:[ |
|
815 |
"/ itemClass == JavaUnresolvedMethodrefConstant ifTrue:[ |
|
816 |
"/self halt. |
|
817 |
"/ ] ifFalse:[ |
|
818 |
"/ itemClass == JavaUnresolvedInterfaceMethodrefConstant ifTrue:[ |
|
819 |
"/self halt. |
|
820 |
"/ ] |
|
821 |
"/ ] |
|
822 |
]. |
|
823 |
]. |
|
824 |
||
825 |
classToLoad notNil ifTrue:[ |
|
826 |
loader isNil ifTrue:[ |
|
827 |
self |
|
828 |
loadClassLazy:classToLoad |
|
829 |
ignoring:(Set new). |
|
830 |
] ifFalse:[ |
|
831 |
"/ |
|
832 |
"/ the aquired loader is a javaClassLoader |
|
833 |
"/ which expects an URL as arg. |
|
834 |
"/ |
|
835 |
"/ classURL := Java as_URL:('file:' , nextUnresolved asString , '.class'). |
|
836 |
"/ loader loadClass:classURL |
|
837 |
loader |
|
838 |
perform:#'loadClass(Ljava/lang/String;)Ljava/lang/Class;' |
|
839 |
with:(Java as_String:(classToLoad asString)). |
|
840 |
] |
|
841 |
]. |
|
842 |
classToLoad notNil. |
|
843 |
] whileTrue. |
|
844 |
||
845 |
aJavaClass isInitialized ifFalse:[ |
|
846 |
Silent ifFalse:[ |
|
847 |
'performing class initialization of ' print. aJavaClass fullName printCR. |
|
848 |
]. |
|
849 |
aJavaClass classInit |
|
850 |
]. |
|
851 |
] |
|
852 |
||
853 |
"Created: / 20.10.1998 / 17:53:22 / cg" |
|
854 |
"Modified: / 20.10.1998 / 17:59:09 / cg" |
|
1 | 855 |
! ! |
856 |
||
2151 | 857 |
!JavaClassReader class methodsFor:'mode setting'! |
858 |
||
859 |
useOldClassReader |
|
860 |
self error: 'Old class reader should not be used anymore!!'. |
|
861 |
UsedJavaClassReaderClass := JavaClassReader. |
|
862 |
||
863 |
"Created: / 09-05-2011 / 23:11:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
864 |
! ! |
|
865 |
||
866 |
!JavaClassReader methodsFor:'accessing'! |
|
867 |
||
868 |
constants |
|
869 |
^ constants. |
|
870 |
||
871 |
"Created: / 10-05-2011 / 13:48:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
872 |
! |
|
873 |
||
874 |
constants: aJavaConstantPool |
|
875 |
constants := aJavaConstantPool. |
|
876 |
||
877 |
"Created: / 10-05-2011 / 13:48:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
878 |
! |
|
879 |
||
880 |
stream |
|
881 |
^ inStream. |
|
882 |
||
883 |
"Created: / 09-05-2011 / 23:22:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
884 |
! |
|
885 |
||
886 |
stream:aReadStream |
|
887 |
inStream := aReadStream. |
|
888 |
||
889 |
"Created: / 09-05-2011 / 23:23:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
890 |
! ! |
|
891 |
||
1 | 892 |
!JavaClassReader methodsFor:'file reading'! |
893 |
||
2151 | 894 |
readClassFileIgnoring: classesbeingLoaded |
7 | 895 |
"reads a class from inStream and returns it. |
38 | 896 |
The JavaClass is not installed as global and its constants |
897 |
(especially strings) may not be fully resolved." |
|
2151 | 898 |
|
899 |
| magic access_flags this_class_index super_class super_class_index this_class_ref existingSuperClass fields interfaces staticFields nStatic superClassName thisClassName existing_class thisMetaClass | |
|
1 | 900 |
|
901 |
"/ |
|
902 |
"/ read magic, determine byte order |
|
903 |
"/ |
|
904 |
msb := true. |
|
2151 | 905 |
magic := inStream nextUnsignedLongMSB: true. |
906 |
magic = (self class magic_MSB) |
|
907 |
ifFalse: |
|
908 |
[ magic = (self class magic_LSB) |
|
909 |
ifFalse: |
|
910 |
[ InvalidClassFormatSignal raiseErrorString: 'not a java class file'. |
|
911 |
^ nil ]. |
|
912 |
msb := false. |
|
913 |
Verbose ifTrue: [ Transcript showCR: 'file is lsb' ]. ] |
|
914 |
ifTrue: [ Verbose ifTrue: [ Transcript showCR: 'file is msb' ]. ]. |
|
915 |
||
1 | 916 |
"/ |
917 |
"/ get version |
|
918 |
"/ |
|
2151 | 919 |
|
920 |
minorVsn := inStream nextUnsignedShortMSB: msb. |
|
921 |
majorVsn := inStream nextUnsignedShortMSB: msb. |
|
922 |
((self class fileMajorVersions includes: majorVsn) not |
|
923 |
or: [ (self class fileMinorVersions includes: minorVsn) not ]) |
|
924 |
ifTrue: |
|
925 |
[ Transcript |
|
926 |
show: 'warning this file has version '; |
|
927 |
show: majorVsn; |
|
928 |
show: '.'; |
|
929 |
showCR: minorVsn. ]. |
|
930 |
Verbose |
|
931 |
ifTrue: |
|
932 |
[ Transcript |
|
933 |
show: 'version = '; |
|
934 |
show: (majorVsn printString); |
|
935 |
show: '.'; |
|
936 |
showCR: (minorVsn printString). ]. |
|
937 |
||
1 | 938 |
"/ |
939 |
"/ get constant pool |
|
940 |
"/ |
|
2151 | 941 |
|
1 | 942 |
self readConstantPool. |
2151 | 943 |
|
1 | 944 |
"/ |
945 |
"/ access flags |
|
946 |
"/ |
|
2151 | 947 |
|
948 |
access_flags := inStream nextUnsignedShortMSB: msb. |
|
949 |
this_class_index := inStream nextUnsignedShortMSB: msb. |
|
950 |
super_class_index := inStream nextUnsignedShortMSB: msb. |
|
951 |
super_class_index == 0 |
|
952 |
ifTrue: [ super_class := nil ] |
|
953 |
ifFalse: |
|
954 |
[ super_class := constants at: super_class_index. |
|
955 |
superClassName := super_class fullName. |
|
956 |
||
957 |
"/ special for ST-classes |
|
958 |
||
959 |
(superClassName startsWith: 'smalltalk.') |
|
960 |
ifTrue: |
|
961 |
[ "/ a Smalltalk class |
|
962 |
superClassName := superClassName copyFrom: 11. |
|
963 |
existingSuperClass := Smalltalk at: superClassName asSymbol. |
|
964 |
existingSuperClass notNil |
|
965 |
ifTrue: [ super_class := existingSuperClass ] |
|
966 |
ifFalse: |
|
967 |
[ "/ self halt - must load superclass ... |
|
968 |
] ] |
|
969 |
ifFalse: |
|
970 |
[ "/ a JAVA class |
|
971 |
super_class := Java classNamed: superClassName. |
|
972 |
super_class ifNil: |
|
973 |
[ super_class := self loadSuperclassIdentifiedBy: (constants at: super_class_index) |
|
974 |
ignoring: classesbeingLoaded ]. |
|
975 |
super_class ifNil: [ self halt: 'Cannot find super class?!!' ]. ]. ]. |
|
976 |
||
1 | 977 |
"/ |
978 |
"/ get interfaces |
|
979 |
"/ |
|
2151 | 980 |
|
38 | 981 |
interfaces := self readInterfaces. |
2151 | 982 |
|
1 | 983 |
"/ |
984 |
"/ get fields |
|
985 |
"/ |
|
2151 | 986 |
|
38 | 987 |
fields := self readFieldInfofields. |
2151 | 988 |
|
40 | 989 |
"/ |
990 |
"/ create the fields as instVars |
|
991 |
"/ static fields are created as class-InstVars |
|
992 |
"/ |
|
2151 | 993 |
|
994 |
staticFields := fields select: [:f | f isStatic ]. |
|
40 | 995 |
nStatic := staticFields size. |
2151 | 996 |
this_class_ref := constants at: this_class_index. |
350 | 997 |
thisClassName := this_class_ref fullName. |
2151 | 998 |
|
350 | 999 |
"/ care for smalltalk classes ... |
2151 | 1000 |
|
1001 |
(thisClassName startsWith: 'smalltalk.') |
|
1002 |
ifTrue: |
|
1003 |
[ thisClassName := thisClassName copyFrom: 11. |
|
1004 |
existing_class := Smalltalk at: thisClassName asSymbol. |
|
1005 |
existing_class notNil |
|
1006 |
ifTrue: |
|
1007 |
[ self halt: ('overloading existing class: ' , thisClassName). |
|
1008 |
thisClassName := (thisClassName , '_new') asSymbol. ]. |
|
1009 |
thisMetaClass := Metaclass new. |
|
1010 |
thisMetaClass setSuperclass: super_class class. |
|
1011 |
thisMetaClass instSize: (super_class class instSize + nStatic). |
|
1012 |
classBeingLoaded := thisMetaClass new. |
|
1013 |
classBeingLoaded setSuperclass: super_class. |
|
1014 |
classBeingLoaded setName: thisClassName asSymbol. ] |
|
1015 |
ifFalse: |
|
1016 |
[ "/ a java class |
|
1017 |
classBeingLoaded := JavaClass fullName: thisClassName numStatic: nStatic. |
|
1018 |
||
1019 |
fields := fields select: [:f | f isStatic not ]. |
|
1020 |
||
1021 |
JavaClass setInstanceVariableStringFromFields: staticFields |
|
1022 |
in: classBeingLoaded class. |
|
1023 |
||
1024 |
classBeingLoaded setStaticFields: staticFields. |
|
1025 |
classBeingLoaded initializeStaticFields. |
|
1026 |
classBeingLoaded setAccessFlags: access_flags. |
|
1027 |
classBeingLoaded setSuperclass: super_class. |
|
1028 |
classBeingLoaded setConstantPool: constants. |
|
1029 |
classBeingLoaded setFields: fields. |
|
1030 |
classBeingLoaded setInterfaces: interfaces. |
|
1031 |
]. |
|
1032 |
||
1 | 1033 |
"/ |
1034 |
"/ get methods |
|
1035 |
"/ |
|
2151 | 1036 |
|
1037 |
self readMethodsFor: classBeingLoaded. |
|
1038 |
self readAttributesFor: classBeingLoaded. |
|
1039 |
"/ classBeingLoaded constantPool |
|
1040 |
"/ do: [:each | self updateOwnerInCPItem: each ]. |
|
1041 |
classBeingLoaded fields do: [:each | self updateOwnerInField: each ]. |
|
1042 |
classBeingLoaded staticFields do: [:each | self updateOwnerInField: each ]. |
|
1043 |
^ classBeingLoaded. |
|
5 | 1044 |
|
1 | 1045 |
" |
355 | 1046 |
JavaClassReader loadFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
1047 |
JavaClassReader loadFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class' |
|
1048 |
JavaClassReader loadFile:'foo.cls' |
|
9 | 1049 |
|
1050 |
JavaClassReader verbose:true. |
|
355 | 1051 |
JavaClassReader loadFile:'/phys/ibm3/hotjava/classes/java/lang/ArithmeticException.class' |
2151 | 1052 |
JavaClassReader loadFile:'/phys/ibm3/java/lib/java/lang/ArithmeticException.class'" |
1053 |
||
1054 |
"Created: / 15-04-1996 / 15:02:47 / cg" |
|
1055 |
"Modified: / 12-11-1998 / 21:14:45 / cg" |
|
1056 |
"Modified: / 15-10-2010 / 17:37:38 / Jan Kurs <kurs.jan@post.cz>" |
|
1057 |
"Modified: / 28-01-2011 / 15:09:48 / Marcel Hlopko <hlopik@gmail.com>" |
|
1058 |
"Modified: / 18-05-2011 / 15:30:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1059 |
"Modified: / 22-05-2011 / 14:23:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
5 | 1060 |
! |
1061 |
||
54 | 1062 |
readStream:aStream ignoring:classesBeingLoaded |
7 | 1063 |
"reads a class from aStream and returns it. |
1064 |
The JavaClass is not installed as global" |
|
1065 |
||
5 | 1066 |
inStream := aStream. |
1067 |
inStream binary. |
|
38 | 1068 |
|
54 | 1069 |
^ self readClassFileIgnoring:classesBeingLoaded |
5 | 1070 |
|
1071 |
" |
|
1072 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1073 |
" |
|
1074 |
||
1075 |
"Created: 15.4.1996 / 15:00:55 / cg" |
|
1076 |
"Modified: 15.4.1996 / 15:06:18 / cg" |
|
1077 |
! ! |
|
1078 |
||
1079 |
!JavaClassReader methodsFor:'file reading - attributes'! |
|
1080 |
||
2151 | 1081 |
readAnnotationDefaultAttributeFor:something |
1082 |
"/ ('JAVA [info]: unhandled attribute: AnnotationDefault') infoPrintCR. |
|
1083 |
||
1084 |
|len startPos endPos annotationDefault| |
|
1085 |
||
1086 |
self assert:something isJavaMethod |
|
1087 |
description:'AnnotationDefault may only occure for methods!!'. |
|
1088 |
len := inStream nextUnsignedLongMSB:msb. |
|
1089 |
startPos := inStream position. |
|
1090 |
annotationDefault := (something ensureHasAnnotations) |
|
1091 |
default:(JavaAnnotationDefault new |
|
1092 |
value:(self readAnnotationValueFor:something)); |
|
1093 |
default. |
|
1094 |
endPos := inStream position. |
|
1095 |
inStream position:startPos. |
|
1096 |
annotationDefault bytes:(inStream next:len). |
|
1097 |
self assert:inStream position = endPos |
|
1098 |
description:'self readAnnotationValueFor: something is reading what it shouldn'. |
|
1099 |
||
1100 |
"Modified: / 28-02-2011 / 17:08:28 / Marcel Hlopko <hlopik@gmail.com>" |
|
1101 |
"Modified: / 03-03-2011 / 23:06:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1102 |
! |
|
1103 |
||
1104 |
readAnnotationFor:something |
|
1105 |
| typeIndex type result attrsCount | |
|
1106 |
||
1107 |
typeIndex := inStream nextUnsignedShortMSB:msb. |
|
1108 |
type := constants at:typeIndex. |
|
1109 |
attrsCount := inStream nextUnsignedShortMSB:msb. |
|
1110 |
result := JavaAnnotation for:something. |
|
1111 |
result name:type. |
|
1112 |
attrsCount timesRepeat: |
|
1113 |
[ | nameIndex name valueIndex attr | |
|
1114 |
||
1115 |
nameIndex := inStream nextUnsignedShortMSB:msb. |
|
1116 |
name := constants at:nameIndex. |
|
1117 |
attr := self readAnnotationValueFor:something. |
|
1118 |
attr name:name. |
|
1119 |
result values at:attr name put:attr. |
|
1120 |
AnnotationsVerbose |
|
1121 |
ifTrue:[ ('JAVA [INFO]: Reading annotation attribute: ' , name) infoPrintCR. ]. ]. |
|
1122 |
^ result. |
|
1123 |
||
1124 |
"Created: / 17-12-2010 / 16:21:28 / Marcel Hlopko <hlopik@gmail.com>" |
|
1125 |
"Modified: / 25-02-2011 / 12:25:36 / Marcel Hlopko <hlopik@gmail.com>" |
|
1126 |
"Modified: / 27-07-2011 / 09:37:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2148 | 1127 |
! |
1128 |
||
2151 | 1129 |
readAnnotationValueFor:something |
1130 |
| tag result | |
|
1131 |
||
1132 |
tag := (inStream nextByte) asCharacter. |
|
1133 |
tag = $e |
|
1134 |
ifTrue: |
|
1135 |
[ result := JavaAnnotationEnumValue for:something. |
|
1136 |
result nameIndex:(inStream nextUnsignedShortMSB:msb). |
|
1137 |
result valueIndex:(inStream nextUnsignedShortMSB:msb). |
|
1138 |
AnnotationsVerbose |
|
1139 |
ifTrue: |
|
1140 |
[ ('JAVA [INFO]: Reading annotation enum value: ' , result name printString, ' -> ' |
|
1141 |
, result value printString) infoPrintCR ]. |
|
1142 |
^ result ]. |
|
1143 |
tag = $c |
|
1144 |
ifTrue: |
|
1145 |
[ result := JavaAnnotationClassValue for:something. |
|
1146 |
result classIndex:(inStream nextUnsignedShortMSB:msb). |
|
1147 |
AnnotationsVerbose |
|
1148 |
ifTrue: |
|
1149 |
[ ('JAVA [INFO]: Reading annotation class value: ' , result name printString, ' -> ' |
|
1150 |
, result value printString) infoPrintCR ]. |
|
1151 |
^ result ]. |
|
1152 |
tag = $@ |
|
1153 |
ifTrue: |
|
1154 |
[ result := JavaAnnotationNestedAnnotationValue for:something. |
|
1155 |
result classIndex:(inStream nextUnsignedShortMSB:msb). |
|
1156 |
AnnotationsVerbose |
|
1157 |
ifTrue: |
|
1158 |
[ ('JAVA [INFO]: Reading annotation nested annotation value: ' , result name printString |
|
1159 |
, ' -> ' , result value printString) |
|
1160 |
infoPrintCR ]. |
|
1161 |
^ result ]. |
|
1162 |
tag = $[ |
|
1163 |
ifTrue: |
|
1164 |
[ result := JavaAnnotationArrayValue for:something. |
|
1165 |
result count:(inStream nextUnsignedShortMSB:msb). |
|
1166 |
AnnotationsVerbose |
|
1167 |
ifTrue:[ ('JAVA [INFO]: Reading annotation array value') infoPrintCR ]. |
|
1168 |
1 to:result count |
|
1169 |
do:[:index | result values at:index put:(self readAnnotationValueFor:something) ]. |
|
1170 |
AnnotationsVerbose |
|
1171 |
ifTrue: |
|
1172 |
[ ('JAVA [INFO]: Finished reading annotation array value: ' |
|
1173 |
, result value printString) infoPrintCR ]. |
|
1174 |
^ result ]. |
|
1175 |
result := JavaAnnotationPrimitiveValue for:something. |
|
1176 |
result valueIndex:(inStream nextUnsignedShortMSB:msb). |
|
1177 |
AnnotationsVerbose |
|
1178 |
ifTrue: |
|
1179 |
[ ('JAVA [INFO]: Finished reading annotation primitive value: ' |
|
1180 |
, result name printString , ' -> ' , result value printString) infoPrintCR ]. |
|
1181 |
^ result. |
|
1182 |
||
1183 |
"Created: / 17-12-2010 / 16:44:14 / Marcel Hlopko <hlopik@gmail.com>" |
|
1184 |
"Modified: / 28-02-2011 / 16:12:09 / Marcel Hlopko <hlopik@gmail.com>" |
|
1185 |
! |
|
1186 |
||
1187 |
readAttribute:attributeName for:something |
|
2148 | 1188 |
"/ implemented JAVA attributes |
2151 | 1189 |
|
1190 |
(attributeName = 'ConstantValue') |
|
1191 |
ifTrue: |
|
1192 |
[ self readConstantValueAttributeFor:something. |
|
1193 |
^ self. ]. |
|
1194 |
(attributeName = 'Code') |
|
1195 |
ifTrue: |
|
1196 |
[ self readCodeAttributeFor:something. |
|
1197 |
^ self. ]. |
|
1198 |
(attributeName = 'Exceptions') |
|
1199 |
ifTrue: |
|
1200 |
[ self readExceptionsAttributeFor:something. |
|
1201 |
^ self. ]. |
|
1202 |
(attributeName = 'InnerClasses') |
|
1203 |
ifTrue: |
|
1204 |
[ self readInnerClassesAttributeFor:something. |
|
1205 |
^ self. ]. |
|
1206 |
(attributeName = 'EnclosingMethod') |
|
1207 |
ifTrue: |
|
1208 |
[ self readEnclosingMethodAttributeFor:something. |
|
1209 |
^ self. ]. |
|
1210 |
(attributeName = 'LineNumberTable') |
|
1211 |
ifTrue: |
|
1212 |
[ self readLineNumberTableAttributeFor:something. |
|
1213 |
^ self. ]. |
|
1214 |
(attributeName = 'LocalVariableTable') |
|
1215 |
ifTrue: |
|
1216 |
[ self readLocalVariableTableAttributeFor:something. |
|
1217 |
^ self. ]. |
|
1218 |
(attributeName = 'LocalVariableTypeTable') |
|
1219 |
ifTrue: |
|
1220 |
[ self readLocalVariableTypeTableAttributeFor:something. |
|
1221 |
^ self. ]. |
|
1222 |
(attributeName = 'SourceFile') |
|
1223 |
ifTrue: |
|
1224 |
[ self readSourceFileAttributeFor:something. |
|
1225 |
^ self. ]. |
|
1226 |
(attributeName = 'SourceDebugExtension') |
|
1227 |
ifTrue: |
|
1228 |
[ self readSourceDebugExtensionAttributeFor:something. |
|
1229 |
^ self. ]. |
|
1230 |
(attributeName = 'Synthetic') |
|
1231 |
ifTrue: |
|
1232 |
[ self readSyntheticAttributeFor:something. |
|
1233 |
^ self. ]. |
|
1234 |
(attributeName = 'Signature') |
|
1235 |
ifTrue: |
|
1236 |
[ self readSignatureAttributeFor:something. |
|
1237 |
^ self. ]. |
|
1238 |
(attributeName = 'Deprecated') |
|
1239 |
ifTrue: |
|
1240 |
[ self readDeprecatedAttributeFor:something. |
|
1241 |
^ self. ]. |
|
1242 |
(attributeName = 'RuntimeVisibleAnnotations') |
|
1243 |
ifTrue: |
|
1244 |
[ self readRuntimeAnnotationsAttributeFor:something visible:true. |
|
1245 |
^ self. ]. |
|
1246 |
(attributeName = 'RuntimeInvisibleAnnotations') |
|
1247 |
ifTrue: |
|
1248 |
[ self readRuntimeAnnotationsAttributeFor:something visible:false. |
|
1249 |
^ self. ]. |
|
1250 |
(attributeName = 'RuntimeVisibleParameterAnnotations') |
|
1251 |
ifTrue: |
|
1252 |
[ self readRuntimeParameterAnnotationsAttributeFor:something visible:true. |
|
1253 |
^ self. ]. |
|
1254 |
(attributeName = 'RuntimeInvisibleParameterAnnotations') |
|
1255 |
ifTrue: |
|
1256 |
[ self readRuntimeParameterAnnotationsAttributeFor:something visible:false. |
|
1257 |
^ self. ]. |
|
1258 |
(attributeName = 'AnnotationDefault') |
|
1259 |
ifTrue: |
|
1260 |
[ self readAnnotationDefaultAttributeFor:something. |
|
1261 |
^ self. ]. |
|
1262 |
||
2148 | 1263 |
"/ ignored JAVA attributes |
2151 | 1264 |
|
1265 |
(attributeName = 'FastJavac1.0') |
|
1266 |
ifTrue: |
|
1267 |
[ "/ ('JAVA [info]: unhandled attribute: ' , attributeName) infoPrintCR. |
|
1268 |
self skipAttribute:attributeName. |
|
1269 |
^ self. ]. |
|
1270 |
(attributeName = 'AbsoluteSourcePath') |
|
1271 |
ifTrue: |
|
1272 |
[ ('JAVA [info]: unhandled attribute: ' , attributeName) infoPrintCR. |
|
1273 |
self skipAttribute:attributeName. |
|
1274 |
^ self. ]. |
|
1275 |
(attributeName startsWith:((Character value:13) asString , 'WARNING:')) |
|
1276 |
ifTrue: |
|
1277 |
[ "/ ('JAVA [info]: unhandled attribute: ' , attributeName) infoPrintCR. |
|
1278 |
self skipAttribute:attributeName. |
|
1279 |
^ self. ]. |
|
1280 |
(attributeName = 'StackMapTable') |
|
1281 |
ifTrue: |
|
1282 |
[ "/ ('JAVA [info]: unhandled attribute: ' , attributeName) infoPrintCR. |
|
1283 |
self readStackMapTableAttributeFor:something. |
|
1284 |
^ self. ]. |
|
1285 |
||
2089 | 1286 |
"/ implemented ST attributes |
2151 | 1287 |
|
1288 |
(attributeName = 'STLiterals') |
|
1289 |
ifTrue: |
|
1290 |
[ self readSTLiteralsAttributeFor:something. |
|
1291 |
^ self. ]. |
|
1292 |
(attributeName = 'ClassRevision') |
|
1293 |
ifTrue: |
|
1294 |
[ self readSTClassRevisionAttributeFor:something. |
|
1295 |
^ self. ]. |
|
1296 |
(attributeName = 'ClassPackage') |
|
1297 |
ifTrue: |
|
1298 |
[ self readSTClassPackageAttributeFor:something. |
|
1299 |
^ self. ]. |
|
1300 |
(attributeName = 'ClassCategory') |
|
1301 |
ifTrue: |
|
1302 |
[ self readSTClassCategoryAttributeFor:something. |
|
1303 |
^ self. ]. |
|
1304 |
(attributeName = 'ClassVarNames') |
|
1305 |
ifTrue: |
|
1306 |
[ self readSTClassVarNamesAttributeFor:something. |
|
1307 |
^ self. ]. |
|
1308 |
(attributeName = 'ClassInstVarNames') |
|
1309 |
ifTrue: |
|
1310 |
[ self readSTClassInstVarNamesAttributeFor:something. |
|
1311 |
^ self. ]. |
|
1312 |
(attributeName = 'InstVarNames') |
|
1313 |
ifTrue: |
|
1314 |
[ self readSTInstVarNamesAttributeFor:something. |
|
1315 |
^ self. ]. |
|
1316 |
(attributeName = 'STCode') |
|
1317 |
ifTrue: |
|
1318 |
[ self readSTCodeAttributeFor:something. |
|
1319 |
^ self. ]. |
|
1320 |
(attributeName = 'MethodCategory') |
|
1321 |
ifTrue: |
|
1322 |
[ self readSTMethodCategoryAttributeFor:something. |
|
1323 |
^ self. ]. |
|
1324 |
||
355 | 1325 |
"/ unknown attributes |
2151 | 1326 |
|
335 | 1327 |
('JAVA [warning]: unrecognized attribute: ' , attributeName) infoPrintCR. |
333 | 1328 |
self skipAttribute:attributeName. |
5 | 1329 |
|
2151 | 1330 |
"Modified: / 03-12-1998 / 13:13:42 / cg" |
1331 |
"Modified: / 25-02-2011 / 18:09:21 / Marcel Hlopko <hlopik@gmail.com>" |
|
5 | 1332 |
! |
1333 |
||
1334 |
readAttributeFor:something |
|
1335 |
|attribute_name_index attribute_name attribute_length attribute_info| |
|
1336 |
||
61 | 1337 |
Verbose ifTrue:[Transcript show:'attrib at pos: '; showCR:inStream position]. |
9 | 1338 |
|
128 | 1339 |
attribute_name_index := inStream nextUnsignedShortMSB:msb. |
2142 | 1340 |
attribute_name_index == 0 ifTrue:[ |
1341 |
self halt. |
|
2151 | 1342 |
"/self skipAttribute:'unnamed'. |
2142 | 1343 |
^ self. |
1344 |
]. |
|
9 | 1345 |
|
1346 |
"/ |
|
1347 |
"/ UNDOC feature ? |
|
1348 |
"/ |
|
1349 |
attribute_name_index > constants size ifTrue:[ |
|
333 | 1350 |
attribute_name_index == 16rb700 ifTrue:[ |
1351 |
self halt. |
|
1352 |
] |
|
9 | 1353 |
]. |
1354 |
||
5 | 1355 |
attribute_name := constants at:attribute_name_index. |
9 | 1356 |
|
61 | 1357 |
Verbose ifTrue:[Transcript show:'attrib name: '; showCR:attribute_name]. |
9 | 1358 |
|
333 | 1359 |
self readAttribute:attribute_name for:something. |
5 | 1360 |
|
1361 |
" |
|
1362 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1363 |
" |
|
1364 |
||
2151 | 1365 |
"Created: / 15-04-1996 / 15:40:17 / cg" |
1366 |
"Modified: / 09-04-1998 / 18:13:34 / cg" |
|
1367 |
"Modified: / 19-10-2010 / 21:43:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
5 | 1368 |
! |
1369 |
||
1370 |
readAttributesFor:something |
|
1371 |
|attributes_count| |
|
1372 |
||
128 | 1373 |
attributes_count := inStream nextUnsignedShortMSB:msb. |
5 | 1374 |
|
1375 |
1 to:attributes_count do:[:i | |
|
252 | 1376 |
self readAttributeFor:something. |
5 | 1377 |
]. |
1378 |
||
1379 |
"Modified: 15.4.1996 / 15:33:28 / cg" |
|
1380 |
"Created: 15.4.1996 / 15:40:17 / cg" |
|
333 | 1381 |
! |
1382 |
||
2151 | 1383 |
readDeprecatedAttributeFor:aJavaMethodWithHandler |
1384 |
||
1385 |
self skipAttribute:'Deprecated'. |
|
1386 |
^self |
|
1387 |
||
1388 |
"Created: / 18-10-2010 / 22:26:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1389 |
! |
|
1390 |
||
2148 | 1391 |
readEnclosingMethodAttributeFor:something |
1392 |
"/ ('JAVA [info]: unhandled attribute: EnclosingMethod') infoPrintCR. |
|
1393 |
self skipAttribute:'EnclosingMethod'. |
|
1394 |
! |
|
1395 |
||
1396 |
readInnerClassesAttributeFor:something |
|
1397 |
"/ ('JAVA [info]: unhandled attribute: InnerClasses') infoPrintCR. |
|
1398 |
self skipAttribute:'InnerClasses'. |
|
1399 |
! |
|
1400 |
||
1401 |
readLocalVariableTypeTableAttributeFor:something |
|
1402 |
"/ ('JAVA [info]: unhandled attribute: LocalVariableTypeTable') infoPrintCR. |
|
1403 |
self skipAttribute:'LocalVariableTypeTable'. |
|
1404 |
! |
|
1405 |
||
2151 | 1406 |
readRuntimeAnnotationsAttributeFor: something visible: visible |
1407 |
| length annotationsCount annotations rawAnnotations startPos endPos | |
|
1408 |
||
1409 |
self assert: inStream isPositionable |
|
1410 |
message: '.class file stream must be positionable'. |
|
1411 |
length := inStream nextUnsignedLongMSB: msb. |
|
1412 |
startPos := inStream position. |
|
1413 |
annotationsCount := inStream nextUnsignedShortMSB: msb. |
|
1414 |
annotationsCount = 0 ifTrue: [ ^ nil ]. |
|
1415 |
annotations := visible ifTrue: [something ensureHasAnnotations ensureRuntimeVisible] ifFalse: [something ensureHasAnnotations ensureRuntimeInvisible]. |
|
1416 |
annotationsCount timesRepeat: |
|
1417 |
[ | currentAnnotation | |
|
1418 |
||
1419 |
currentAnnotation := self readAnnotationFor: something. |
|
1420 |
annotations at: currentAnnotation name put: currentAnnotation. ]. |
|
1421 |
"Cut raw annotations as required by getRawAnnotations()" |
|
1422 |
endPos := inStream position. |
|
1423 |
inStream position: startPos. |
|
1424 |
rawAnnotations := inStream next: length. |
|
1425 |
inStream position ~= endPos |
|
1426 |
ifTrue: [ self halt: 'annotations are probably reading what they shouldnt' ]. |
|
1427 |
annotations rawAnnotations: rawAnnotations. |
|
1428 |
||
1429 |
"Modified: / 07-01-2011 / 22:00:07 / Jan Kurs <kurs.jan@post.cz>" |
|
1430 |
"Modified: / 25-02-2011 / 18:45:58 / Marcel Hlopko <hlopik@gmail.com>" |
|
1431 |
"Modified: / 03-03-2011 / 23:01:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1432 |
"Modified: / 16-03-2011 / 16:57:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
2148 | 1433 |
! |
1434 |
||
2151 | 1435 |
readRuntimeParameterAnnotationsAttributeFor: javaMethod visible: visible |
1436 |
| length paramsCount annotationsCount rawAnnotations startPos endPos | |
|
1437 |
||
1438 |
self assert: inStream isPositionable |
|
1439 |
message: '.class file stream must be positionable'. |
|
1440 |
length := inStream nextUnsignedLongMSB: msb. |
|
1441 |
startPos := inStream position. |
|
1442 |
paramsCount := inStream nextByte. |
|
1443 |
paramsCount = 0 ifTrue: [ ^ nil ]. |
|
1444 |
1 to: paramsCount |
|
1445 |
do: |
|
1446 |
[:paramIndex | |
|
1447 |
annotationsCount := inStream nextUnsignedShortMSB: msb. |
|
1448 |
annotationsCount > 0 |
|
1449 |
ifTrue: |
|
1450 |
[ | annotations | |
|
1451 |
annotations := visible |
|
1452 |
ifTrue: |
|
1453 |
[ javaMethod ensureHasAnnotations ensureVisibleParameterAnnotationsAt: paramIndex ] |
|
1454 |
ifFalse: |
|
1455 |
[javaMethod ensureHasAnnotations ensureInvisibleParameterAnnotationsAt: paramIndex ]. |
|
1456 |
annotationsCount timesRepeat: |
|
1457 |
[ | annotation | |
|
1458 |
||
1459 |
annotation := self readAnnotationFor: javaMethod. |
|
1460 |
annotations at: (annotation name) put: annotation. ] ]]. |
|
1461 |
endPos := inStream position. |
|
1462 |
rawAnnotations := inStream position: startPos. |
|
1463 |
rawAnnotations := inStream next: length. |
|
1464 |
inStream position ~= endPos |
|
1465 |
ifTrue: [ self halt: 'annotations are probably reading what they shouldnt' ]. |
|
1466 |
javaMethod annotations rawAnnotations: rawAnnotations. |
|
1467 |
||
1468 |
"Modified: / 28-02-2011 / 17:05:47 / Marcel Hlopko <hlopik@gmail.com>" |
|
1469 |
"Modified: / 16-03-2011 / 17:26:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
2148 | 1470 |
! |
1471 |
||
1472 |
readSignatureAttributeFor:something |
|
2151 | 1473 |
|
1474 |
|attribute_length signature_index signature| |
|
1475 |
||
1476 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
1477 |
||
1478 |
signature_index := inStream nextUnsignedShortMSB:msb. |
|
1479 |
signature := constants at:signature_index. |
|
1480 |
||
1481 |
something setSignature: signature. |
|
1482 |
||
1483 |
"Modified: / 13-08-2011 / 00:28:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2148 | 1484 |
! |
1485 |
||
1486 |
readSourceDebugExtensionAttributeFor:something |
|
1487 |
"/ ('JAVA [info]: unhandled attribute: SourceDebugExtension') infoPrintCR. |
|
1488 |
self skipAttribute:'SourceDebugExtension'. |
|
1489 |
! |
|
1490 |
||
353 | 1491 |
readSourceFileAttributeFor:aClass |
350 | 1492 |
|attribute_length sourceFile_index sourceFile| |
1493 |
||
1494 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
1495 |
||
1496 |
sourceFile_index := inStream nextUnsignedShortMSB:msb. |
|
1497 |
sourceFile := constants at:sourceFile_index. |
|
1498 |
||
353 | 1499 |
aClass isJavaClass ifTrue:[ |
1500 |
aClass setSourceFile:sourceFile. |
|
1501 |
] ifFalse:[ |
|
1502 |
aClass setClassFilename:sourceFile |
|
1503 |
]. |
|
350 | 1504 |
|
1505 |
Verbose ifTrue:[Transcript show:'sourceFile: '; showCR:sourceFile]. |
|
1506 |
^ true |
|
1507 |
||
1508 |
" |
|
1509 |
JavaClassReader loadFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1510 |
JavaClassReader loadFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class' |
|
1511 |
JavaClassReader loadFile:'foo.cls' |
|
1512 |
" |
|
1513 |
||
1514 |
"Created: / 15.4.1996 / 15:40:17 / cg" |
|
353 | 1515 |
"Modified: / 12.5.1998 / 22:01:07 / cg" |
350 | 1516 |
! |
1517 |
||
2151 | 1518 |
readStackMapTableAttributeFor:something |
1519 |
"/ ('JAVA [info]: unhandled attribute: StackMapTable') infoPrintCR. |
|
1520 |
self skipAttribute:'StackMapTable'. |
|
1521 |
||
1522 |
"Created: / 09-02-2011 / 01:19:20 / Marcel Hlopko <hlopik@gmail.com>" |
|
1523 |
! |
|
1524 |
||
2148 | 1525 |
readSyntheticAttributeFor:something |
1526 |
"/ ('JAVA [info]: unhandled attribute: Synthetic') infoPrintCR. |
|
1527 |
self skipAttribute:'Synthetic'. |
|
1528 |
! |
|
1529 |
||
333 | 1530 |
skipAttribute:attributeName |
1531 |
"dont know about this attribute - skip it here" |
|
1532 |
||
1533 |
|attribute_length attribute_info| |
|
1534 |
||
1535 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
1536 |
attribute_info := ByteArray new:(attribute_length). |
|
1537 |
inStream nextBytes:attribute_length into:attribute_info startingAt:1. |
|
1538 |
||
1539 |
Verbose ifTrue:[Transcript show:'skipped '; show:attributeName; showCR:'-attribute']. |
|
1540 |
||
1541 |
"Created: / 9.4.1998 / 18:12:46 / cg" |
|
1542 |
"Modified: / 9.4.1998 / 18:13:20 / cg" |
|
5 | 1543 |
! ! |
1544 |
||
350 | 1545 |
!JavaClassReader methodsFor:'file reading - attributes-ST'! |
1546 |
||
1547 |
readSTClassCategoryAttributeFor:aClass |
|
1548 |
|attribute_length categoryString_index categoryString| |
|
1549 |
||
1550 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
1551 |
||
1552 |
categoryString_index := inStream nextUnsignedShortMSB:msb. |
|
1553 |
categoryString := constants at:categoryString_index. |
|
1554 |
||
1555 |
aClass category:categoryString. |
|
1556 |
||
1557 |
Verbose ifTrue:[Transcript show:'categoryString: '; showCR:categoryString]. |
|
1558 |
^ true |
|
1559 |
||
1560 |
" |
|
1561 |
JavaClassReader loadFile:'foo.cls' |
|
1562 |
" |
|
1563 |
||
1564 |
"Created: / 9.5.1998 / 02:33:13 / cg" |
|
1565 |
"Modified: / 9.5.1998 / 02:36:55 / cg" |
|
1566 |
! |
|
1567 |
||
353 | 1568 |
readSTClassInstVarNamesAttributeFor:aClass |
1569 |
|attribute_length nameString_index nameString| |
|
1570 |
||
1571 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
1572 |
||
1573 |
nameString_index := inStream nextUnsignedShortMSB:msb. |
|
1574 |
nameString := constants at:nameString_index. |
|
1575 |
||
1576 |
aClass class instanceVariableString:nameString. |
|
1577 |
||
1578 |
Verbose ifTrue:[Transcript show:'nameString: '; showCR:nameString]. |
|
1579 |
^ true |
|
1580 |
||
1581 |
" |
|
1582 |
JavaClassReader loadFile:'foo.cls' |
|
1583 |
" |
|
1584 |
||
1585 |
"Modified: / 12.5.1998 / 22:18:03 / cg" |
|
1586 |
"Created: / 12.5.1998 / 22:18:24 / cg" |
|
1587 |
! |
|
1588 |
||
350 | 1589 |
readSTClassPackageAttributeFor:aClass |
1590 |
|attribute_length packageString_index packageString| |
|
1591 |
||
1592 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
1593 |
||
1594 |
packageString_index := inStream nextUnsignedShortMSB:msb. |
|
1595 |
packageString := constants at:packageString_index. |
|
1596 |
||
1597 |
aClass package:packageString asSymbol. |
|
1598 |
||
1599 |
Verbose ifTrue:[Transcript show:'packageString: '; showCR:packageString]. |
|
1600 |
^ true |
|
1601 |
||
1602 |
" |
|
1603 |
JavaClassReader loadFile:'foo.cls' |
|
1604 |
" |
|
1605 |
||
1606 |
"Modified: / 9.5.1998 / 02:32:38 / cg" |
|
1607 |
"Created: / 9.5.1998 / 02:33:44 / cg" |
|
1608 |
! |
|
1609 |
||
1610 |
readSTClassRevisionAttributeFor:aClass |
|
1611 |
|attribute_length revisionString_index revisionString| |
|
1612 |
||
1613 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
1614 |
||
1615 |
revisionString_index := inStream nextUnsignedShortMSB:msb. |
|
1616 |
revisionString := constants at:revisionString_index. |
|
1617 |
||
1618 |
aClass setBinaryRevision:revisionString. |
|
1619 |
||
1620 |
Verbose ifTrue:[Transcript show:'revisionString: '; showCR:revisionString]. |
|
1621 |
^ true |
|
1622 |
||
1623 |
" |
|
1624 |
JavaClassReader loadFile:'foo.cls' |
|
1625 |
" |
|
1626 |
||
1627 |
"Created: / 9.5.1998 / 02:33:13 / cg" |
|
1628 |
"Modified: / 9.5.1998 / 02:35:01 / cg" |
|
353 | 1629 |
! |
1630 |
||
1631 |
readSTClassVarNamesAttributeFor:aClass |
|
1632 |
|attribute_length nameString_index nameString| |
|
1633 |
||
1634 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
1635 |
||
1636 |
nameString_index := inStream nextUnsignedShortMSB:msb. |
|
1637 |
nameString := constants at:nameString_index. |
|
1638 |
||
1639 |
aClass classVariableString:nameString. |
|
1640 |
||
1641 |
Verbose ifTrue:[Transcript show:'nameString: '; showCR:nameString]. |
|
1642 |
^ true |
|
1643 |
||
1644 |
" |
|
1645 |
JavaClassReader loadFile:'foo.cls' |
|
1646 |
" |
|
1647 |
||
1648 |
"Created: / 9.5.1998 / 02:33:13 / cg" |
|
1649 |
"Modified: / 12.5.1998 / 22:18:03 / cg" |
|
1650 |
! |
|
1651 |
||
1652 |
readSTInstVarNamesAttributeFor:aClass |
|
1653 |
|attribute_length nameString_index nameString| |
|
1654 |
||
1655 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
1656 |
||
1657 |
nameString_index := inStream nextUnsignedShortMSB:msb. |
|
1658 |
nameString := constants at:nameString_index. |
|
1659 |
||
1660 |
aClass setInstanceVariableString:nameString. |
|
1661 |
||
1662 |
Verbose ifTrue:[Transcript show:'nameString: '; showCR:nameString]. |
|
1663 |
^ true |
|
1664 |
||
1665 |
" |
|
1666 |
JavaClassReader loadFile:'foo.cls' |
|
1667 |
" |
|
1668 |
||
1669 |
"Created: / 12.5.1998 / 22:18:14 / cg" |
|
1670 |
"Modified: / 12.5.1998 / 22:21:10 / cg" |
|
350 | 1671 |
! ! |
1672 |
||
5 | 1673 |
!JavaClassReader methodsFor:'file reading - constants'! |
1674 |
||
1 | 1675 |
readConstant |
1676 |
|tag constReader const| |
|
1677 |
||
1678 |
||
11 | 1679 |
constNeeds2Slots := false. |
1680 |
||
1 | 1681 |
"/ |
1682 |
"/ get tag |
|
1683 |
"/ |
|
128 | 1684 |
tag := inStream nextByte. |
61 | 1685 |
Verbose ifTrue:[Transcript show:'tag = '; showCR:tag]. |
1 | 1686 |
|
350 | 1687 |
tag >= 250 ifTrue:[ |
1688 |
constReader := #( |
|
1689 |
"/ ST types |
|
1690 |
readConstant_ST_Large "/ 249 |
|
1691 |
readConstant_ST_Special "/ 250 |
|
1692 |
readConstant_ST_Character "/ 251 |
|
1693 |
readConstant_ST_ByteArray "/ 252 |
|
1694 |
readConstant_ST_Array "/ 253 |
|
1695 |
readConstant_ST_Symbol "/ 254 |
|
1696 |
readConstant_ST_Reserved "/ 255 |
|
1697 |
) at:tag-249+1. |
|
1698 |
] ifFalse:[ |
|
1699 |
constReader := #( |
|
344 | 1700 |
"/ JAVA types |
695 | 1701 |
readConstant_Utf8 "/ 1 - now called Utf8 |
344 | 1702 |
readConstant_Unicode "/ 2 |
1703 |
readConstant_Integer "/ 3 |
|
1704 |
readConstant_Float "/ 4 |
|
1705 |
readConstant_Long "/ 5 |
|
1706 |
readConstant_Double "/ 6 |
|
1707 |
readConstant_Class "/ 7 |
|
1708 |
readConstant_String "/ 8 |
|
1709 |
readConstant_Fieldref "/ 9 |
|
1710 |
readConstant_Methodref "/ 10 |
|
1711 |
readConstant_InterfaceMethodref "/ 11 |
|
1712 |
readConstant_NameAndType "/ 12 |
|
1713 |
) at:tag ifAbsent:[#readConstant_Undef]. |
|
350 | 1714 |
]. |
1 | 1715 |
^ self perform:constReader. |
1716 |
||
1717 |
" |
|
1718 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1719 |
" |
|
1720 |
||
344 | 1721 |
"Created: / 15.4.1996 / 15:46:32 / cg" |
350 | 1722 |
"Modified: / 9.5.1998 / 01:26:05 / cg" |
1 | 1723 |
! |
1724 |
||
1725 |
readConstantPool |
|
2151 | 1726 |
| constantPoolSize const | |
1 | 1727 |
|
1728 |
"/ |
|
1729 |
"/ get constant pool |
|
1730 |
"/ |
|
2151 | 1731 |
constantPoolSize := inStream nextUnsignedShortMSB: msb. |
1732 |
self info: 'constantPoolSize = ' , constantPoolSize printString. |
|
1733 |
constants := JavaConstantPool new: constantPoolSize - 1. |
|
21 | 1734 |
constSlot := 1. |
2151 | 1735 |
[ constSlot < constantPoolSize ] whileTrue: [ |
1736 |
self info: 'const slot: ' , constSlot printString. |
|
1737 |
const := self readConstant. |
|
1738 |
constants at: constSlot put: const. |
|
1739 |
||
1740 |
"/ long & double consts take 2 slots |
|
1741 |
"/ (only first is used) |
|
1742 |
||
1743 |
constNeeds2Slots |
|
1744 |
ifTrue: [ constSlot := constSlot + 2. ] |
|
1745 |
ifFalse: [ constSlot := constSlot + 1. ]]. |
|
52 | 1746 |
constSlot := -1. |
2151 | 1747 |
|
1748 |
1 to: constantPoolSize - 1 |
|
1749 |
do: |
|
1750 |
[:i | |
|
1751 |
| const value | |
|
1752 |
||
1753 |
const := constants at: i. |
|
1754 |
const ifNotNil: |
|
1755 |
[ "/ kludge for 2-slot constants (which only take 1 slot in ST/X) |
|
1756 |
(const isKindOf: JavaUnresolvedConstant) |
|
1757 |
ifTrue: |
|
1758 |
[ value := const preResolve. |
|
1759 |
value ~~ const ifTrue: [ constants at: i put: value. ] ] ] ]. |
|
1 | 1760 |
|
1761 |
" |
|
1762 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
2151 | 1763 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'" |
1764 |
||
1765 |
"Modified: / 07-05-1998 / 11:44:06 / cg" |
|
1766 |
"Created: / 13-05-2011 / 16:52:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1 | 1767 |
! |
1768 |
||
1769 |
readConstant_Asciz |
|
2151 | 1770 |
| len string | |
1771 |
||
1772 |
||
1773 |
len := inStream nextUnsignedShortMSB: msb. |
|
1774 |
string := String new: len. |
|
1775 |
inStream |
|
1776 |
nextBytes: len |
|
1777 |
into: string |
|
1778 |
startingAt: 1. |
|
1779 |
Verbose |
|
1780 |
ifTrue: |
|
1781 |
[ Transcript |
|
1782 |
show: 'asciz; string= '; |
|
1783 |
showCR: string ]. |
|
1 | 1784 |
^ string |
1785 |
||
1786 |
" |
|
1787 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
2151 | 1788 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class'" |
1789 |
||
1790 |
"Created: / 15-04-1996 / 15:15:35 / cg" |
|
1791 |
"Modified: / 15-04-1996 / 16:33:45 / cg" |
|
1792 |
"Modified: / 13-05-2011 / 17:31:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1 | 1793 |
! |
1794 |
||
1795 |
readConstant_Class |
|
2151 | 1796 |
| nameIndex | |
1797 |
||
1798 |
nameIndex := inStream nextUnsignedShortMSB: msb. |
|
1799 |
((constants at: nameIndex) isNil) |
|
1800 |
ifTrue: |
|
1801 |
[ self info: ('reading class; index=' , nameIndex printString , ' name=' |
|
1802 |
, (constants at: nameIndex) printString) ] |
|
1803 |
ifFalse: [ self info: ('reading class; index= ' , nameIndex printString) ]. |
|
1804 |
^ JavaClassRef2 in: constants withNameAt: nameIndex. |
|
1805 |
||
1806 |
"Modified: / 18-05-2011 / 18:21:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1 | 1807 |
! |
1808 |
||
11 | 1809 |
readConstant_Double |
350 | 1810 |
|high low aFloat bytes| |
1811 |
||
1812 |
"/ new code - to be tested |
|
1813 |
"/ bytes := ByteArray new:8. |
|
1814 |
"/ |
|
1815 |
"/ inStream nextBytes:8 into:bytes startingAt:1. |
|
1816 |
"/ msb ~~ UninterpretedBytes isBigEndian ifTrue:[ |
|
1817 |
"/ bytes reverse |
|
1818 |
"/ ]. |
|
1819 |
"/ aFloat := bytes doubleAt:1. |
|
1820 |
||
1821 |
"/ old code |
|
11 | 1822 |
|
128 | 1823 |
high := inStream nextUnsignedLongMSB:msb. |
1824 |
low := inStream nextUnsignedLongMSB:msb. |
|
11 | 1825 |
|
1826 |
aFloat := Float new. |
|
1827 |
UninterpretedBytes isBigEndian ifTrue:[ |
|
350 | 1828 |
aFloat basicAt:1 put:((high bitShift:-24) bitAnd:16rFF). |
1829 |
aFloat basicAt:2 put:((high bitShift:-16) bitAnd:16rFF). |
|
1830 |
aFloat basicAt:3 put:((high bitShift:-8) bitAnd:16rFF). |
|
1831 |
aFloat basicAt:4 put:(high bitAnd:16rFF). |
|
1832 |
aFloat basicAt:5 put:((low bitShift:-24) bitAnd:16rFF). |
|
1833 |
aFloat basicAt:6 put:((low bitShift:-16) bitAnd:16rFF). |
|
1834 |
aFloat basicAt:7 put:((low bitShift:-8) bitAnd:16rFF). |
|
1835 |
aFloat basicAt:8 put:(low bitAnd:16rFF). |
|
11 | 1836 |
] ifFalse:[ |
350 | 1837 |
aFloat basicAt:1 put:(low bitAnd:16rFF). |
1838 |
aFloat basicAt:2 put:((low bitShift:-8) bitAnd:16rFF). |
|
1839 |
aFloat basicAt:3 put:((low bitShift:-16) bitAnd:16rFF). |
|
1840 |
aFloat basicAt:4 put:((low bitShift:-24) bitAnd:16rFF). |
|
1841 |
aFloat basicAt:5 put:(high bitAnd:16rFF). |
|
1842 |
aFloat basicAt:6 put:((high bitShift:-8) bitAnd:16rFF). |
|
1843 |
aFloat basicAt:7 put:((high bitShift:-16) bitAnd:16rFF). |
|
1844 |
aFloat basicAt:8 put:((high bitShift:-24) bitAnd:16rFF). |
|
11 | 1845 |
]. |
1846 |
||
1847 |
constNeeds2Slots := true. |
|
1848 |
||
61 | 1849 |
Verbose ifTrue:[Transcript show:'double; value= '; showCR:aFloat]. |
11 | 1850 |
^ aFloat |
1851 |
||
1852 |
" |
|
1853 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1854 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class' |
|
1855 |
" |
|
1856 |
||
350 | 1857 |
"Created: / 15.4.1996 / 16:34:42 / cg" |
1858 |
"Modified: / 8.5.1998 / 22:06:07 / cg" |
|
11 | 1859 |
! |
1860 |
||
2151 | 1861 |
readConstant_Fieldref |
1862 |
"incrementally changing resolving logic, fields will come later" |
|
1863 |
||
1864 |
| classIndex nameAndTypeIndex | |
|
1865 |
||
1866 |
classIndex := inStream nextUnsignedShortMSB: msb. |
|
1867 |
nameAndTypeIndex := inStream nextUnsignedShortMSB: msb. |
|
1868 |
self |
|
1869 |
info: 'reading fieldref; classindex=' , classIndex printString |
|
1870 |
, ' nameAndTypeIndex=' , nameAndTypeIndex printString. |
|
1871 |
^ JavaFieldRef2 |
|
1872 |
in: constants |
|
1873 |
withNameAndTypeAt: nameAndTypeIndex |
|
1874 |
andClassAt: classIndex. |
|
1875 |
||
1876 |
"Modified: / 15-05-2011 / 14:20:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1 | 1877 |
! |
1878 |
||
11 | 1879 |
readConstant_Float |
433 | 1880 |
|b1 b2 b3 b4 aFloat bytes| |
350 | 1881 |
|
1882 |
"/ new code - to be tested ... |
|
352 | 1883 |
"/ |
1884 |
"/ bytes := ByteArray new:4. |
|
1885 |
"/ inStream nextBytes:4 into:bytes startingAt:1. |
|
1886 |
"/ msb ~~ UninterpretedBytes isBigEndian ifTrue:[ |
|
1887 |
"/ bytes reverse |
|
1888 |
"/ ]. |
|
1889 |
"/ aFloat := bytes floatAt:1. |
|
1890 |
"/ Verbose ifTrue:[Transcript show:'float; value= '; showCR:aFloat]. |
|
1891 |
"/ ^ aFloat. |
|
350 | 1892 |
|
1893 |
"/ old code |
|
11 | 1894 |
|
1895 |
aFloat := ShortFloat basicNew. |
|
433 | 1896 |
|
1897 |
b1 := inStream nextByte. |
|
1898 |
b2 := inStream nextByte. |
|
1899 |
b3 := inStream nextByte. |
|
1900 |
b4 := inStream nextByte. |
|
1901 |
||
11 | 1902 |
UninterpretedBytes isBigEndian ifTrue:[ |
433 | 1903 |
aFloat basicAt:1 put:b1. |
1904 |
aFloat basicAt:2 put:b2. |
|
1905 |
aFloat basicAt:3 put:b3. |
|
1906 |
aFloat basicAt:4 put:b4. |
|
11 | 1907 |
] ifFalse:[ |
433 | 1908 |
aFloat basicAt:4 put:b1. |
1909 |
aFloat basicAt:3 put:b2. |
|
1910 |
aFloat basicAt:2 put:b3. |
|
1911 |
aFloat basicAt:1 put:b4. |
|
11 | 1912 |
]. |
61 | 1913 |
Verbose ifTrue:[Transcript show:'float; value= '; showCR:aFloat]. |
11 | 1914 |
^ aFloat |
1915 |
||
1916 |
" |
|
1917 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1918 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class' |
|
1919 |
" |
|
1920 |
||
350 | 1921 |
"Created: / 15.4.1996 / 16:34:42 / cg" |
433 | 1922 |
"Modified: / 10.11.1998 / 22:04:59 / cg" |
11 | 1923 |
! |
1924 |
||
1 | 1925 |
readConstant_Integer |
1926 |
|value| |
|
1927 |
||
128 | 1928 |
value := inStream nextLongMSB:msb. |
1 | 1929 |
|
61 | 1930 |
Verbose ifTrue:[Transcript show:'integer; value= '; showCR:value]. |
1 | 1931 |
|
1932 |
^ value |
|
1933 |
||
1934 |
" |
|
1935 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1936 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class' |
|
1937 |
" |
|
1938 |
||
1939 |
"Modified: 15.4.1996 / 15:42:16 / cg" |
|
1940 |
"Created: 15.4.1996 / 16:34:42 / cg" |
|
1941 |
! |
|
1942 |
||
14
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
1943 |
readConstant_InterfaceMethodref |
2151 | 1944 |
| classIndex nameAndTypeIndex | |
1945 |
||
1946 |
classIndex := inStream nextUnsignedShortMSB: msb. |
|
1947 |
nameAndTypeIndex := inStream nextUnsignedShortMSB: msb. |
|
1948 |
self |
|
1949 |
info: 'reading interface methodref; classindex=' , classIndex printString |
|
1950 |
, ' nameAndTypeIndex=' , nameAndTypeIndex printString. |
|
1951 |
^ JavaInterfaceMethodRef2 |
|
1952 |
in: constants |
|
1953 |
withNameAndTypeAt: nameAndTypeIndex |
|
1954 |
andClassAt: classIndex. |
|
1955 |
||
1956 |
"Modified: / 12-05-2011 / 18:57:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
14
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
1957 |
! |
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
1958 |
|
11 | 1959 |
readConstant_Long |
1960 |
|high low value| |
|
1961 |
||
128 | 1962 |
high := inStream nextUnsignedLongMSB:msb. |
1963 |
low := inStream nextUnsignedLongMSB:msb. |
|
11 | 1964 |
|
1965 |
value := (high bitShift:32) bitOr:low. |
|
60 | 1966 |
(high bitTest:16r80000000) ifTrue:[ |
252 | 1967 |
value := value - 16r10000000000000000. |
60 | 1968 |
]. |
11 | 1969 |
constNeeds2Slots := true. |
1970 |
||
61 | 1971 |
Verbose ifTrue:[Transcript show:'long; value= '; showCR:value]. |
11 | 1972 |
^ value |
1973 |
||
1974 |
" |
|
1975 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1976 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class' |
|
1977 |
" |
|
1978 |
||
1979 |
"Modified: 15.4.1996 / 15:42:16 / cg" |
|
1980 |
"Created: 15.4.1996 / 16:34:42 / cg" |
|
1981 |
! |
|
1982 |
||
1 | 1983 |
readConstant_Methodref |
2151 | 1984 |
| classIndex nameAndTypeIndex | |
1985 |
||
1986 |
classIndex := inStream nextUnsignedShortMSB: msb. |
|
1987 |
nameAndTypeIndex := inStream nextUnsignedShortMSB: msb. |
|
1988 |
self |
|
1989 |
info: 'reading methodref; classindex=' , classIndex printString , ' nameAndTypeIndex=' |
|
1990 |
, nameAndTypeIndex printString. |
|
1991 |
^ JavaMethodRef2 |
|
1992 |
in: constants |
|
1993 |
withNameAndTypeAt: nameAndTypeIndex |
|
1994 |
andClassAt: classIndex. |
|
1995 |
||
1996 |
"Modified: / 15-05-2011 / 14:20:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1 | 1997 |
! |
1998 |
||
91 | 1999 |
readConstant_NameAndType |
2151 | 2000 |
| nameIndex descriptorIndex | |
2001 |
||
2002 |
nameIndex := inStream nextUnsignedShortMSB: msb. |
|
2003 |
descriptorIndex := inStream nextUnsignedShortMSB: msb. |
|
2004 |
self |
|
2005 |
info: 'reading nameAndType; nameindex=' , nameIndex printString |
|
2006 |
, ' descriptorIndex= ' , descriptorIndex printString. |
|
2007 |
^JavaNameAndType2 |
|
2008 |
in: constants |
|
2009 |
withNameAt: nameIndex |
|
2010 |
andDescriptorAt: descriptorIndex. |
|
2011 |
||
2012 |
"Modified: / 10-05-2011 / 17:09:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1 | 2013 |
! |
2014 |
||
2015 |
readConstant_String |
|
2151 | 2016 |
| string_index chars jString | |
2017 |
||
2018 |
string_index := inStream nextUnsignedShortMSB: msb. |
|
2019 |
Verbose |
|
2020 |
ifTrue: |
|
2021 |
[ Transcript |
|
2022 |
show: 'string; index= '; |
|
2023 |
showCR: string_index ]. |
|
2024 |
||
344 | 2025 |
"/ resolve here if possible |
2151 | 2026 |
|
2027 |
string_index < constSlot |
|
2028 |
ifTrue: |
|
2029 |
[ Java java_lang_String notNil |
|
2030 |
ifTrue: |
|
2031 |
[ chars := (constants at: string_index). |
|
2032 |
chars isString ifFalse: [ self halt: 'should not happen' ]. |
|
2033 |
jString := JavaVM javaStringObjectForString:chars interned:true. |
|
2034 |
^ jString. ] ]. |
|
91 | 2035 |
^ JavaUnresolvedStringConstant |
2151 | 2036 |
pool: constants |
2037 |
poolIndex: constSlot |
|
2038 |
stringIndex: string_index |
|
1 | 2039 |
|
2040 |
" |
|
43 | 2041 |
Verbose := true. |
2151 | 2042 |
JavaClassReader readFile:'/phys/ibm3/java/lib/java/lang/System.class'" |
2043 |
||
2044 |
"Created: / 15-04-1996 / 15:20:33 / cg" |
|
2045 |
"Modified: / 07-05-1998 / 11:42:45 / cg" |
|
2046 |
"Modified: / 13-05-2011 / 17:31:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
2047 |
"Modified: / 10-08-2011 / 23:25:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
695 | 2048 |
! |
2049 |
||
2050 |
readConstant_Unicode |
|
2151 | 2051 |
| len string ascii | |
2052 |
||
2053 |
len := inStream nextUnsignedShortMSB: msb. |
|
2054 |
string := TwoByteString new: len. |
|
2055 |
1 to: len |
|
2056 |
do: |
|
2057 |
[:idx | |
|
2058 |
ascii := inStream nextUnsignedShortMSB: msb. |
|
2059 |
string at: idx put: (Character value: ascii). ]. |
|
2060 |
Verbose |
|
2061 |
ifTrue: |
|
2062 |
[ Transcript |
|
2063 |
show: 'asciz; unicodeString= '; |
|
2064 |
showCR: string ]. |
|
695 | 2065 |
^ string |
2151 | 2066 |
|
2067 |
"Modified: / 13-05-2011 / 17:31:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
695 | 2068 |
! |
2069 |
||
2070 |
readConstant_Utf8 |
|
2151 | 2071 |
| len bytes string | |
2072 |
||
2073 |
len := inStream nextUnsignedShortMSB: msb. |
|
2074 |
bytes := ByteArray new: len. |
|
2075 |
inStream |
|
2076 |
nextBytes: len |
|
2077 |
into: bytes |
|
2078 |
startingAt: 1. |
|
2079 |
string := CharacterArray fromJavaUTF8Bytes: bytes. |
|
2080 |
Verbose |
|
2081 |
ifTrue: |
|
2082 |
[ Transcript |
|
2083 |
show: 'asciz; string= '; |
|
2084 |
showCR: string ]. |
|
695 | 2085 |
^ string |
2151 | 2086 |
|
2087 |
"Modified: / 19-10-2010 / 12:38:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2088 |
"Modified: / 13-05-2011 / 17:31:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
344 | 2089 |
! ! |
2090 |
||
2091 |
!JavaClassReader methodsFor:'file reading - constants-ST'! |
|
2092 |
||
2093 |
readConstant_ST_Array |
|
2094 |
|aSize arr| |
|
2095 |
||
2096 |
aSize := inStream nextUnsignedShortMSB:msb. |
|
2097 |
arr := Array new:aSize. |
|
2098 |
||
2099 |
1 to:aSize do:[:i | |
|
350 | 2100 |
|element_index element| |
344 | 2101 |
|
2102 |
element_index := inStream nextUnsignedShortMSB:msb. |
|
2103 |
arr at:i put:element_index. |
|
2104 |
]. |
|
2105 |
Verbose ifTrue:[Transcript show:'array; size= '; showCR:aSize]. |
|
2106 |
||
2107 |
^ JavaUnresolvedSTArrayConstant |
|
2108 |
pool:constants |
|
2109 |
poolIndex:constSlot |
|
2110 |
array:arr |
|
2111 |
||
2112 |
"Created: / 7.5.1998 / 11:47:01 / cg" |
|
350 | 2113 |
"Modified: / 9.5.1998 / 00:25:34 / cg" |
344 | 2114 |
! |
2115 |
||
2116 |
readConstant_ST_ByteArray |
|
2117 |
|aSize arr| |
|
2118 |
||
2119 |
aSize := inStream nextUnsignedShortMSB:msb. |
|
2120 |
arr := ByteArray new:aSize. |
|
2121 |
||
2122 |
1 to:aSize do:[:i | |
|
2123 |
|element_index| |
|
2124 |
||
2125 |
arr at:i put:(inStream nextByte). |
|
2126 |
]. |
|
2127 |
Verbose ifTrue:[Transcript show:'byteArray; size= '; showCR:aSize]. |
|
2128 |
||
2129 |
^ arr |
|
2130 |
||
2131 |
"Created: / 7.5.1998 / 11:47:12 / cg" |
|
2132 |
! |
|
2133 |
||
2134 |
readConstant_ST_Character |
|
2135 |
|ascii| |
|
2136 |
||
2137 |
ascii := inStream nextUnsignedShortMSB:msb. |
|
2138 |
||
2139 |
Verbose ifTrue:[Transcript show:'char; ascii= '; showCR:ascii]. |
|
2140 |
^ Character value:ascii |
|
2141 |
||
2142 |
"Created: / 7.5.1998 / 11:48:12 / cg" |
|
2143 |
! |
|
2144 |
||
350 | 2145 |
readConstant_ST_Special |
2146 |
|type| |
|
2147 |
||
2148 |
type := inStream nextUnsignedShortMSB:msb. |
|
2149 |
^ #( |
|
2150 |
nil |
|
2151 |
true |
|
2152 |
false |
|
2153 |
) at:(type + 1) |
|
2154 |
||
2155 |
"Created: / 8.5.1998 / 23:06:56 / cg" |
|
2156 |
"Modified: / 9.5.1998 / 00:40:14 / cg" |
|
2157 |
! |
|
2158 |
||
344 | 2159 |
readConstant_ST_String |
2151 | 2160 |
| tag string_index chars | |
2161 |
||
2162 |
||
2163 |
string_index := inStream nextUnsignedShortMSB: msb. |
|
2164 |
Verbose |
|
2165 |
ifTrue: |
|
2166 |
[ Transcript |
|
2167 |
show: 'string; index= '; |
|
2168 |
showCR: string_index ]. |
|
2169 |
||
344 | 2170 |
"/ resolve here if possible |
2151 | 2171 |
|
2172 |
string_index < constSlot |
|
2173 |
ifTrue: |
|
2174 |
[ chars := (constants at: string_index). |
|
2175 |
^ chars ]. |
|
344 | 2176 |
^ JavaUnresolvedSTStringConstant |
2151 | 2177 |
pool: constants |
2178 |
poolIndex: constSlot |
|
2179 |
stringIndex: string_index |
|
2180 |
||
2181 |
"Created: / 07-05-1998 / 11:49:55 / cg" |
|
2182 |
"Modified: / 13-05-2011 / 17:32:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
344 | 2183 |
! |
2184 |
||
2185 |
readConstant_ST_Symbol |
|
2151 | 2186 |
| tag string_index chars | |
2187 |
||
2188 |
||
2189 |
string_index := inStream nextUnsignedShortMSB: msb. |
|
2190 |
Verbose |
|
2191 |
ifTrue: |
|
2192 |
[ Transcript |
|
2193 |
show: 'symbol; index= '; |
|
2194 |
showCR: string_index ]. |
|
2195 |
||
344 | 2196 |
"/ resolve here if possible |
2151 | 2197 |
|
2198 |
string_index < constSlot |
|
2199 |
ifTrue: |
|
2200 |
[ chars := (constants at: string_index). |
|
2201 |
chars isString ifFalse: [ self halt: 'should not happen' ]. |
|
2202 |
^ chars asSymbol ]. |
|
344 | 2203 |
^ JavaUnresolvedSTSymbolConstant |
2151 | 2204 |
pool: constants |
2205 |
poolIndex: constSlot |
|
2206 |
stringIndex: string_index |
|
2207 |
||
2208 |
"Modified: / 07-05-1998 / 11:48:28 / cg" |
|
2209 |
"Modified: / 13-05-2011 / 17:32:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
5 | 2210 |
! ! |
2211 |
||
2212 |
!JavaClassReader methodsFor:'file reading - fields'! |
|
2213 |
||
2214 |
readConstantValueAttributeFor:aField |
|
2215 |
|attribute_length constantvalue_index constantValue| |
|
2216 |
||
128 | 2217 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
5 | 2218 |
|
128 | 2219 |
constantvalue_index := inStream nextUnsignedShortMSB:msb. |
5 | 2220 |
constantValue := constants at:constantvalue_index. |
2221 |
||
59 | 2222 |
aField constantValue:constantValue. |
2223 |
||
61 | 2224 |
Verbose ifTrue:[Transcript show:'constantValue: '; showCR:constantValue]. |
5 | 2225 |
^ true |
2226 |
||
2227 |
" |
|
2228 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
2229 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class' |
|
2230 |
" |
|
2231 |
||
2232 |
"Modified: 15.4.1996 / 15:33:28 / cg" |
|
2233 |
"Created: 15.4.1996 / 15:40:17 / cg" |
|
1 | 2234 |
! |
2235 |
||
2236 |
readFieldInfofield |
|
2151 | 2237 |
| access_flags name_index descriptor_index attributes_count field | |
2238 |
||
2239 |
access_flags := inStream nextUnsignedShortMSB: msb. |
|
2240 |
name_index := inStream nextUnsignedShortMSB: msb. |
|
2241 |
descriptor_index := inStream nextUnsignedShortMSB: msb. |
|
5 | 2242 |
field := JavaField new. |
2151 | 2243 |
field setAccessFlags: access_flags. |
2244 |
field setName: (constants at: name_index) asSymbol. |
|
2245 |
field setDescriptor: (constants at: descriptor_index) asSymbol. |
|
2246 |
field setConstantPool: constants. |
|
2247 |
attributes_count := inStream nextUnsignedShortMSB: msb. |
|
2248 |
Verbose |
|
2249 |
ifTrue: |
|
2250 |
[ Transcript |
|
2251 |
show: ' field name: '; |
|
2252 |
show: (constants at: name_index); |
|
2253 |
show: ' access: '; |
|
2254 |
show: access_flags; |
|
2255 |
show: ' attrib_cnt: '; |
|
2256 |
showCR: attributes_count ]. |
|
2257 |
1 to: attributes_count do: [:i | self readAttributeFor: field. ]. |
|
2258 |
^ field. |
|
27 | 2259 |
|
1 | 2260 |
" |
2151 | 2261 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class'" |
2262 |
||
2263 |
"Created: / 15-04-1996 / 15:38:43 / cg" |
|
2264 |
"Modified: / 15-10-1998 / 10:38:01 / cg" |
|
2265 |
"Modified: / 17-12-2010 / 18:44:30 / Marcel Hlopko <hlopik@gmail.com>" |
|
2266 |
"Modified: / 18-05-2011 / 14:11:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
2267 |
"Modified: / 14-08-2011 / 19:40:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1 | 2268 |
! |
2269 |
||
2270 |
readFieldInfofields |
|
38 | 2271 |
|nFields fields| |
1 | 2272 |
|
2273 |
"/ |
|
38 | 2274 |
"/ get fieldInfos |
1 | 2275 |
"/ |
128 | 2276 |
nFields := inStream nextUnsignedShortMSB:msb. |
61 | 2277 |
Verbose ifTrue:[Transcript show:'fieldsCount = '; showCR:nFields]. |
1 | 2278 |
|
27 | 2279 |
fields := Array new:nFields. |
2280 |
||
2281 |
1 to:nFields do:[:i | |
|
252 | 2282 |
Verbose ifTrue:[Transcript show:'field: '; showCR:i]. |
2283 |
fields at:i put:(self readFieldInfofield) |
|
1 | 2284 |
]. |
38 | 2285 |
^ fields |
1 | 2286 |
|
2287 |
" |
|
2288 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
2289 |
" |
|
2290 |
||
2291 |
"Created: 15.4.1996 / 15:34:41 / cg" |
|
2292 |
"Modified: 15.4.1996 / 15:35:28 / cg" |
|
5 | 2293 |
! ! |
2294 |
||
38 | 2295 |
!JavaClassReader methodsFor:'file reading - interfaces'! |
2296 |
||
2297 |
readInterfaces |
|
110 | 2298 |
|interfacesCount interface_index interface interfaces| |
38 | 2299 |
|
2300 |
"/ |
|
2301 |
"/ get interfaces |
|
2302 |
"/ |
|
128 | 2303 |
interfacesCount := inStream nextUnsignedShortMSB:msb. |
61 | 2304 |
Verbose ifTrue:[Transcript show:'interfacesCount = '; showCR:interfacesCount]. |
38 | 2305 |
|
2306 |
interfaces := Array new:interfacesCount. |
|
2307 |
||
2308 |
1 to:interfacesCount do:[:i | |
|
252 | 2309 |
Verbose ifTrue:[Transcript show:'interface: '; showCR:i]. |
2310 |
interface_index := inStream nextUnsignedShortMSB:msb. |
|
2311 |
interface := constants at:interface_index. |
|
38 | 2312 |
|
252 | 2313 |
interfaces at:i put:interface. |
38 | 2314 |
]. |
2315 |
^ interfaces |
|
2316 |
||
2317 |
" |
|
2318 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
2319 |
" |
|
2320 |
||
2321 |
"Created: 15.4.1996 / 15:31:59 / cg" |
|
2322 |
"Modified: 15.4.1996 / 15:33:28 / cg" |
|
2323 |
! ! |
|
2324 |
||
5 | 2325 |
!JavaClassReader methodsFor:'file reading - methods'! |
2326 |
||
2327 |
readCodeAttributeFor:aJavaMethod |
|
2328 |
|attribute_length max_stack max_locals code_length code |
|
9 | 2329 |
exception_table_length exception_table unknown1 unknown2| |
1 | 2330 |
|
128 | 2331 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
1 | 2332 |
|
357 | 2333 |
Verbose ifTrue:[Transcript show:'code_attribute_length: 0x'; showCR:(attribute_length printStringRadix:16)]. |
9 | 2334 |
|
2151 | 2335 |
((minorVsn > 2) or:[majorVsn > 45]) ifTrue:[ |
348 | 2336 |
"/ should be: |
2337 |
max_stack := inStream nextUnsignedShortMSB:msb. |
|
2338 |
max_locals := inStream nextUnsignedShortMSB:msb. |
|
2339 |
code_length := inStream nextUnsignedLongMSB:msb. |
|
2340 |
||
2341 |
"/ unknown1 := inStream nextByte. |
|
2342 |
"/ max_stack := inStream nextByte. |
|
2343 |
"/ max_locals := inStream nextUnsignedShortMSB:msb. |
|
2344 |
"/ unknown2 := inStream nextUnsignedShortMSB:msb. |
|
2345 |
"/ code_length := inStream nextUnsignedShortMSB:msb. |
|
2346 |
"/ Verbose ifTrue:[Transcript show:'?1: '; showCR:unknown1]. |
|
2347 |
"/ Verbose ifTrue:[Transcript show:'?2: '; showCR:unknown2]. |
|
39 | 2348 |
] ifFalse:[ |
348 | 2349 |
max_stack := inStream nextByte. |
2350 |
max_locals := inStream nextByte. |
|
2351 |
code_length := inStream nextUnsignedShortMSB:msb. |
|
9 | 2352 |
]. |
2353 |
||
357 | 2354 |
Verbose ifTrue:[ |
2355 |
Transcript show:'code_length: '; showCR:(code_length printStringRadix:16). |
|
2356 |
Transcript show:'code at pos: '; showCR:inStream position |
|
2357 |
]. |
|
38 | 2358 |
|
357 | 2359 |
code_length ~~ 0 ifTrue:[ |
2360 |
code := ByteArray new:code_length. |
|
2361 |
inStream nextBytes:code_length into:code startingAt:1. |
|
2362 |
]. |
|
2363 |
Verbose ifTrue:[Transcript show:'method code: '; showCR:code.]. |
|
9 | 2364 |
|
128 | 2365 |
exception_table_length := inStream nextUnsignedShortMSB:msb. |
61 | 2366 |
Verbose ifTrue:[Transcript show:'exception_table_length: '; showCR:(exception_table_length printStringRadix:16)]. |
5 | 2367 |
exception_table_length ~~ 0 ifTrue:[ |
348 | 2368 |
Verbose ifTrue:[Transcript show:'exceptionTable length:'; showCR:exception_table_length.]. |
9 | 2369 |
|
348 | 2370 |
exception_table := Array new:exception_table_length. |
2371 |
1 to:exception_table_length do:[:i | |
|
2372 |
|start_pc end_pc handler_pc catch_type| |
|
1 | 2373 |
|
348 | 2374 |
start_pc := inStream nextUnsignedShortMSB:msb. |
2375 |
end_pc := inStream nextUnsignedShortMSB:msb. |
|
2376 |
handler_pc := inStream nextUnsignedShortMSB:msb. |
|
583 | 2377 |
catch_type := inStream nextUnsignedShortMSB:msb. |
2378 |
catch_type ~= 0 ifTrue:[ |
|
2379 |
catch_type := constants at:catch_type. |
|
2380 |
]. |
|
348 | 2381 |
exception_table at:i put:(JavaExceptionTableEntry |
2382 |
startPC:start_pc |
|
2383 |
endPC:end_pc |
|
2384 |
handlerPC:handler_pc |
|
2385 |
catchType:catch_type). |
|
2386 |
]. |
|
2387 |
aJavaMethod setExceptionHandlerTable:exception_table. |
|
1 | 2388 |
]. |
2389 |
||
29 | 2390 |
aJavaMethod |
348 | 2391 |
setCode:code |
2392 |
maxStack:max_stack |
|
2393 |
maxLocals:max_locals |
|
2394 |
u1:unknown1 |
|
2395 |
u2:unknown2. |
|
5 | 2396 |
|
2397 |
self readAttributesFor:aJavaMethod. |
|
2398 |
^ true |
|
2399 |
||
1 | 2400 |
" |
2401 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
5 | 2402 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class' |
1 | 2403 |
" |
2404 |
||
2151 | 2405 |
"Created: / 15-04-1996 / 15:40:17 / cg" |
2406 |
"Modified: / 16-05-1998 / 01:39:42 / cg" |
|
2407 |
"Modified: / 17-12-2010 / 00:24:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
5 | 2408 |
! |
2409 |
||
83 | 2410 |
readExceptionsAttributeFor:aJavaMethod |
2411 |
|attribute_length exception_table_length exception_table| |
|
2412 |
||
128 | 2413 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
83 | 2414 |
|
128 | 2415 |
exception_table_length := inStream nextUnsignedShortMSB:msb. |
83 | 2416 |
exception_table_length ~~ 0 ifTrue:[ |
252 | 2417 |
exception_table := Array new:exception_table_length. |
2418 |
1 to:exception_table_length do:[:i | |
|
2419 |
|idx ex| |
|
83 | 2420 |
|
252 | 2421 |
idx := inStream nextUnsignedShortMSB:msb. |
2422 |
ex := constants at:idx. |
|
2423 |
exception_table at:i put:ex. |
|
2424 |
]. |
|
83 | 2425 |
]. |
2426 |
||
2427 |
Verbose ifTrue:[Transcript showCR:'method has an exceptionTable']. |
|
2428 |
||
2429 |
aJavaMethod setExceptionTable:exception_table. |
|
2430 |
^ true |
|
2431 |
||
2432 |
"Modified: 15.4.1996 / 15:33:28 / cg" |
|
2433 |
"Created: 15.4.1996 / 15:40:17 / cg" |
|
2434 |
! |
|
2435 |
||
5 | 2436 |
readLineNumberTableAttributeFor:aJavaMethod |
2437 |
|attribute_length line_number_table_length line_number_table| |
|
2438 |
||
128 | 2439 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
5 | 2440 |
|
128 | 2441 |
line_number_table_length := inStream nextUnsignedShortMSB:msb. |
5 | 2442 |
line_number_table_length ~~ 0 ifTrue:[ |
330 | 2443 |
line_number_table := Array new:line_number_table_length. |
2444 |
1 to:line_number_table_length do:[:i | |
|
2445 |
|start_pc line_number| |
|
5 | 2446 |
|
330 | 2447 |
start_pc := inStream nextUnsignedShortMSB:msb. |
2448 |
line_number := inStream nextUnsignedShortMSB:msb. |
|
2449 |
line_number_table at:i put:(start_pc -> line_number). |
|
2450 |
]. |
|
2451 |
Verbose ifTrue:[Transcript showCR:'method has a lineNumberTable']. |
|
2452 |
||
2453 |
aJavaMethod setLineNumberTable:line_number_table. |
|
5 | 2454 |
]. |
2455 |
||
2456 |
^ true |
|
2457 |
||
2458 |
" |
|
2459 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
2460 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/java/lang/Boolean.class' |
|
2461 |
" |
|
2462 |
||
330 | 2463 |
"Created: / 15.4.1996 / 15:40:17 / cg" |
2464 |
"Modified: / 7.4.1998 / 19:08:42 / cg" |
|
1 | 2465 |
! |
2466 |
||
50 | 2467 |
readLocalVariableTableAttributeFor:aJavaMethod |
2468 |
|attribute_length local_variable_table_length local_variable_table| |
|
2469 |
||
128 | 2470 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
50 | 2471 |
|
128 | 2472 |
local_variable_table_length := inStream nextUnsignedShortMSB:msb. |
50 | 2473 |
local_variable_table_length ~~ 0 ifTrue:[ |
252 | 2474 |
local_variable_table := JavaLocalVariableTable new:local_variable_table_length. |
2475 |
1 to:local_variable_table_length do:[:i | |
|
2476 |
|start_pc length name_index sig_index slot name signature| |
|
50 | 2477 |
|
252 | 2478 |
start_pc := inStream nextUnsignedShortMSB:msb. |
2479 |
length := inStream nextUnsignedShortMSB:msb. |
|
2480 |
name_index := inStream nextUnsignedShortMSB:msb. |
|
2481 |
name := constants at:name_index. |
|
2482 |
sig_index := inStream nextUnsignedShortMSB:msb. |
|
2483 |
signature := constants at:sig_index. |
|
2484 |
slot := inStream nextUnsignedShortMSB:msb. |
|
50 | 2485 |
|
252 | 2486 |
local_variable_table at:i put:(JavaLocalVariableTableEntry new |
2487 |
startPC:start_pc |
|
2488 |
length:length |
|
2489 |
name:name |
|
2490 |
signature:signature |
|
2491 |
slot:slot) |
|
2492 |
]. |
|
50 | 2493 |
]. |
2494 |
||
61 | 2495 |
Verbose ifTrue:[Transcript showCR:'method has a localvariableTable']. |
50 | 2496 |
|
2497 |
aJavaMethod setLocalVariableTable:local_variable_table. |
|
2498 |
^ true |
|
2499 |
||
2500 |
" |
|
2501 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
2502 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/java/lang/Boolean.class' |
|
2503 |
" |
|
2504 |
||
2505 |
"Modified: 15.4.1996 / 15:33:28 / cg" |
|
2506 |
"Created: 15.4.1996 / 15:40:17 / cg" |
|
2507 |
! |
|
2508 |
||
357 | 2509 |
readMethodFor:aClass |
2151 | 2510 |
|m access_flags name_index name descriptor_index descriptor |
273 | 2511 |
tooManyArgs| |
1 | 2512 |
|
2513 |
"/ |
|
2514 |
"/ get a method |
|
2515 |
"/ |
|
128 | 2516 |
access_flags := inStream nextUnsignedShortMSB:msb. |
2517 |
name_index := inStream nextUnsignedShortMSB:msb. |
|
2151 | 2518 |
descriptor_index := inStream nextUnsignedShortMSB:msb. |
1 | 2519 |
|
5 | 2520 |
name := constants at:name_index. |
2151 | 2521 |
descriptor := constants at:descriptor_index. |
9 | 2522 |
|
357 | 2523 |
Verbose ifTrue:[ |
2524 |
Transcript show:'method name:'; showCR:name. |
|
2151 | 2525 |
Transcript show:'descriptor:'; showCR:descriptor. |
357 | 2526 |
]. |
9 | 2527 |
|
357 | 2528 |
aClass isJavaClass ifTrue:[ |
612 | 2529 |
(access_flags bitAnd:JavaMethod A_NATIVE) ~~ 0 ifTrue:[ |
2530 |
m := JavaNativeMethod new. |
|
2531 |
] ifFalse:[ |
|
2532 |
m := JavaMethodWithHandler new. |
|
2533 |
]. |
|
357 | 2534 |
m setAccessFlags:access_flags. |
2535 |
tooManyArgs := false. |
|
2142 | 2536 |
ArgumentError handle:[:ex | |
357 | 2537 |
'JAVA: ***** java method has too many arguments - will fail to execute' infoPrintCR. |
2538 |
tooManyArgs := true. |
|
2539 |
ex proceed. |
|
2540 |
] do:[ |
|
2151 | 2541 |
m setName:name descriptor:descriptor. |
357 | 2542 |
]. |
2543 |
m setJavaClass:aClass. |
|
2544 |
||
2545 |
self readAttributesFor:m. |
|
2546 |
||
2547 |
tooManyArgs ifTrue:[ |
|
2548 |
m code:nil. |
|
2549 |
m byteCode:nil. |
|
2550 |
]. |
|
423 | 2551 |
(m exceptionHandlerTable isNil) ifTrue:[ |
612 | 2552 |
m isNative ifFalse:[ |
2151 | 2553 |
m getExceptionTable isNil ifTrue:[ |
612 | 2554 |
m := JavaMethod fromMethod:m |
2555 |
] ifFalse:[ |
|
2556 |
m := JavaMethodWithException fromMethod:m |
|
2557 |
] |
|
423 | 2558 |
] |
468 | 2559 |
] ifFalse:[ |
470 | 2560 |
m setAccessFlags:(m accessFlags bitOr:JavaMethod A_HASHANDLER) |
386 | 2561 |
]. |
2151 | 2562 |
aClass addMethod:m name:name signature:descriptor. |
357 | 2563 |
] ifFalse:[ |
2564 |
m := Method new. |
|
2565 |
self readAttributesFor:m. |
|
2566 |
(access_flags bitTest:JavaMethod A_STATIC) ifTrue:[ |
|
2567 |
aClass class primAddSelector:name asSymbol withMethod:m. |
|
2568 |
] ifFalse:[ |
|
2569 |
aClass primAddSelector:name asSymbol withMethod:m. |
|
2570 |
] |
|
273 | 2571 |
]. |
1 | 2572 |
|
2573 |
" |
|
2574 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
2575 |
" |
|
2576 |
||
2151 | 2577 |
"Created: / 15-04-1996 / 16:48:49 / cg" |
2578 |
"Modified: / 25-09-1999 / 23:16:25 / cg" |
|
2579 |
"Modified: / 14-08-2011 / 19:42:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1 | 2580 |
! |
2581 |
||
38 | 2582 |
readMethodsFor:aJavaClass |
1 | 2583 |
|methodsCount method| |
2584 |
||
2585 |
"/ |
|
2586 |
"/ get methods |
|
2587 |
"/ |
|
128 | 2588 |
methodsCount := inStream nextUnsignedShortMSB:msb. |
61 | 2589 |
Verbose ifTrue:[Transcript show:'methodsCount = '; showCR:methodsCount]. |
1 | 2590 |
|
2591 |
1 to:methodsCount do:[:i | |
|
348 | 2592 |
Verbose ifTrue:[Transcript show:'method: '; showCR:i]. |
2593 |
method := self readMethodFor:aJavaClass |
|
1 | 2594 |
]. |
2595 |
||
2596 |
" |
|
2597 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
2598 |
" |
|
2599 |
||
348 | 2600 |
"Created: / 15.4.1996 / 16:46:30 / cg" |
2601 |
"Modified: / 8.5.1998 / 21:20:59 / cg" |
|
1 | 2602 |
! ! |
2603 |
||
344 | 2604 |
!JavaClassReader methodsFor:'file reading - methods-ST'! |
2605 |
||
348 | 2606 |
readSTCodeAttributeFor:aSmalltalkMethod |
2607 |
|attribute_length max_stack max_locals code_length code |
|
2608 |
exception_table_length unknown1 unknown2| |
|
2609 |
||
2610 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
2611 |
||
2612 |
Verbose ifTrue:[Transcript show:'attribute_length: 0x'; showCR:(attribute_length printStringRadix:16)]. |
|
2613 |
||
2614 |
max_stack := inStream nextUnsignedShortMSB:msb. |
|
2615 |
max_locals := inStream nextUnsignedShortMSB:msb. |
|
2616 |
||
2617 |
code_length := inStream nextUnsignedLongMSB:msb. |
|
2618 |
Verbose ifTrue:[Transcript show:'code_length: '; showCR:(code_length printStringRadix:16)]. |
|
2619 |
Verbose ifTrue:[Transcript show:'code at pos: '; showCR:inStream position]. |
|
2620 |
||
357 | 2621 |
code_length ~~ 0 ifTrue:[ |
2622 |
code := ByteArray new:code_length. |
|
2623 |
inStream nextBytes:code_length into:code startingAt:1. |
|
2624 |
]. |
|
2625 |
Verbose ifTrue:[Transcript show:'method code: '; showCR:code.]. |
|
348 | 2626 |
|
2627 |
exception_table_length := inStream nextUnsignedShortMSB:msb. |
|
2628 |
Verbose ifTrue:[Transcript show:'exception_table_length: '; showCR:(exception_table_length printStringRadix:16)]. |
|
2629 |
exception_table_length ~~ 0 ifTrue:[ |
|
2630 |
self error:'unexpected exceptionTable length'. |
|
2631 |
"/ skip it. |
|
2632 |
1 to:exception_table_length do:[:i | |
|
2633 |
"start_pc :=" inStream nextUnsignedShortMSB:msb. |
|
2634 |
"end_pc :=" inStream nextUnsignedShortMSB:msb. |
|
2635 |
"handler_pc :=" inStream nextUnsignedShortMSB:msb. |
|
2636 |
"catch_type :=" inStream nextUnsignedShortMSB:msb. |
|
2637 |
]. |
|
2638 |
]. |
|
2639 |
||
357 | 2640 |
aSmalltalkMethod byteCode:code. |
2641 |
aSmalltalkMethod stackSize:max_stack . |
|
2642 |
aSmalltalkMethod numberOfVars:max_locals. |
|
348 | 2643 |
|
2644 |
self readAttributesFor:aSmalltalkMethod. |
|
2645 |
^ true |
|
2646 |
||
357 | 2647 |
"Modified: / 16.5.1998 / 01:39:30 / cg" |
348 | 2648 |
! |
2649 |
||
344 | 2650 |
readSTLiteralsAttributeFor:aSmalltalkMethod |
348 | 2651 |
|attribute_length literal_table_length literal_table litIndex literal| |
2652 |
||
2653 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
2654 |
||
2655 |
literal_table_length := inStream nextUnsignedShortMSB:msb. |
|
2656 |
literal_table_length ~~ 0 ifTrue:[ |
|
2657 |
literal_table := Array new:literal_table_length. |
|
2658 |
1 to:literal_table_length do:[:i | |
|
2659 |
litIndex := inStream nextUnsignedShortMSB:msb. |
|
2660 |
literal := (constants at:litIndex). |
|
2661 |
literal_table at:i put:literal. |
|
2662 |
]. |
|
2663 |
]. |
|
357 | 2664 |
Verbose ifTrue:[Transcript show:'literals: '; showCR:literal_table storeString.]. |
344 | 2665 |
|
2666 |
"Created: / 7.5.1998 / 11:52:28 / cg" |
|
357 | 2667 |
"Modified: / 16.5.1998 / 01:52:27 / cg" |
2668 |
! |
|
2669 |
||
2670 |
readSTMethodCategoryAttributeFor:aSmalltalkMethod |
|
2671 |
|attribute_length name_index name| |
|
2672 |
||
2673 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
|
2674 |
||
2675 |
name_index := inStream nextUnsignedShortMSB:msb. |
|
2676 |
name := (constants at:name_index). |
|
2677 |
||
2678 |
aSmalltalkMethod category:name. |
|
2679 |
||
348 | 2680 |
"Modified: / 8.5.1998 / 20:39:59 / cg" |
357 | 2681 |
"Created: / 16.5.1998 / 01:04:19 / cg" |
344 | 2682 |
! ! |
2683 |
||
2151 | 2684 |
!JavaClassReader methodsFor:'helpers'! |
2685 |
||
2686 |
loadSuperclassIdentifiedBy: something ignoring: classesBeingLoaded |
|
2687 |
"overriding method, here we expect something to be new JavaClassRef2" |
|
2688 |
||
2689 |
self assert: something isJavaRef |
|
2690 |
message: 'class identifier is not a java reference'. |
|
2691 |
||
2692 |
self assert: something isJavaClassRef |
|
2693 |
message: 'class identifier is not a java class reference'. |
|
2694 |
||
2695 |
(classesBeingLoaded includes: something fullName) ifTrue: |
|
2696 |
[self error: 'class we want to load is being loaded and that means something went wrong. tell mh']. |
|
2697 |
||
2698 |
"Do NOT use >>something resolve<< here, since something |
|
2699 |
has no owner set and therefore access check will cause DNU. |
|
2700 |
Ask JV for details." |
|
2701 |
||
2702 |
^Java classForName: something javaClassName. |
|
2703 |
||
2704 |
"Created: / 18-05-2011 / 14:55:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
2705 |
"Modified: / 22-05-2011 / 13:58:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2706 |
! |
|
2707 |
||
2708 |
updateOwnerInCPItem: each |
|
2709 |
((each isJavaRef and: [ each isNewJavaRef ]) |
|
2710 |
or: [ each isJavaNameAndType and: [ each isNewJavaNameAndType ] ]) |
|
2711 |
ifTrue: [ each owner: classBeingLoaded ]. |
|
2712 |
||
2713 |
"Created: / 12-05-2011 / 17:40:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
2714 |
! |
|
2715 |
||
2716 |
updateOwnerInField: each |
|
2717 |
||
2718 |
each setClass: classBeingLoaded. |
|
2719 |
||
2720 |
"Created: / 18-05-2011 / 13:57:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
2721 |
! ! |
|
2722 |
||
2723 |
!JavaClassReader methodsFor:'logging'! |
|
2724 |
||
2725 |
info: message |
|
2726 |
Verbose ifTrue: [ Transcript showCR: message printString ]. |
|
2727 |
||
2728 |
"Created: / 18-05-2011 / 15:06:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
2729 |
! ! |
|
2730 |
||
135 | 2731 |
!JavaClassReader class methodsFor:'documentation'! |
1 | 2732 |
|
2733 |
version |
|
2151 | 2734 |
^ '$Header: /cvs/stx/stx/libjava/JavaClassReader.st,v 1.93 2011-08-18 18:42:48 vrany Exp $' |
2148 | 2735 |
! |
2736 |
||
2737 |
version_CVS |
|
2151 | 2738 |
^ '§Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaClassReader.st,v 1.92 2009/10/09 14:21:53 cg Exp §' |
2739 |
! |
|
2740 |
||
2741 |
version_SVN |
|
2742 |
^ '$Id: JavaClassReader.st,v 1.93 2011-08-18 18:42:48 vrany Exp $' |
|
1 | 2743 |
! ! |
2108 | 2744 |
|
2089 | 2745 |
JavaClassReader initialize! |