author | cg |
Sat, 17 Jan 1998 14:44:47 +0000 | |
changeset 264 | 44aedfcd08d1 |
parent 255 | 2d8b3948a08a |
child 269 | 5a946303d451 |
permissions | -rw-r--r-- |
1 | 1 |
Object subclass:#JavaClassReader |
91 | 2 |
instanceVariableNames:'inStream msb constants majorVsn minorVsn constNeeds2Slots |
38 | 3 |
constSlot' |
198 | 4 |
classVariableNames:'Verbose Silent AbsolutelySilent LazyClassLoading |
223 | 5 |
InvalidClassFormatSignal ClassLoaderQuerySignal' |
1 | 6 |
poolDictionaries:'' |
7 |
category:'Java-Support' |
|
8 |
! |
|
9 |
||
10 |
||
135 | 11 |
!JavaClassReader class methodsFor:'initialization'! |
1 | 12 |
|
13 |
initialize |
|
198 | 14 |
InvalidClassFormatSignal := Signal new mayProceed:true. |
15 |
InvalidClassFormatSignal notifierString:'class load failure'. |
|
16 |
InvalidClassFormatSignal nameClass:self message:#invalidClassFormatSignal. |
|
17 |
||
91 | 18 |
Verbose := false. |
19 |
Silent := true. |
|
20 |
AbsolutelySilent := false. |
|
21 |
||
22 |
LazyClassLoading := false. "/ true. |
|
223 | 23 |
ClassLoaderQuerySignal := QuerySignal new |
29 | 24 |
|
25 |
" |
|
26 |
JavaClassReader initialize |
|
27 |
" |
|
28 |
||
223 | 29 |
"Modified: 14.8.1997 / 19:48:56 / cg" |
198 | 30 |
! ! |
31 |
||
32 |
!JavaClassReader class methodsFor:'Signal constants'! |
|
33 |
||
223 | 34 |
classLoaderQuerySignal |
35 |
^ ClassLoaderQuerySignal |
|
36 |
||
37 |
"Created: 14.8.1997 / 19:56:03 / cg" |
|
38 |
! |
|
39 |
||
198 | 40 |
invalidClassFormatSignal |
41 |
^ InvalidClassFormatSignal |
|
42 |
||
43 |
"Created: 3.8.1997 / 18:17:21 / cg" |
|
1 | 44 |
! ! |
45 |
||
135 | 46 |
!JavaClassReader class methodsFor:'debugging'! |
1 | 47 |
|
48 |
verbose:aBoolean |
|
49 |
Verbose := aBoolean |
|
50 |
||
51 |
" |
|
67 | 52 |
Java flushClasses. |
1 | 53 |
JavaClassReader verbose:true |
54 |
JavaClassReader verbose:false |
|
55 |
" |
|
56 |
! ! |
|
57 |
||
135 | 58 |
!JavaClassReader class methodsFor:'file reading'! |
1 | 59 |
|
21 | 60 |
loadClass:aClassName |
43 | 61 |
"reads a class, installs and returns it. |
62 |
The classes string constants are resolved & <clinit> is called, |
|
63 |
if it implements it." |
|
21 | 64 |
|
223 | 65 |
|rslt loader| |
21 | 66 |
|
223 | 67 |
loader := ClassLoaderQuerySignal raise. |
68 |
loader isNil ifTrue:[ |
|
252 | 69 |
rslt := self loadClassLazy:aClassName ignoring:(Set new). |
70 |
rslt notNil ifTrue:[self postLoadActions]. |
|
40 | 71 |
|
252 | 72 |
^ rslt |
223 | 73 |
]. |
74 |
||
75 |
^ loader loadClass:aClassName |
|
21 | 76 |
|
77 |
" |
|
78 |
JavaClassReader loadClass:'awt/Component' |
|
79 |
JavaClassReader loadClass:'awt/Button' |
|
80 |
JavaClassReader loadClass:'browser/AddButton' |
|
81 |
||
82 |
JavaClassReader loadClass:'java/lang/Object' |
|
83 |
JavaClassReader loadClass:'java/lang/AbstractMethodError' |
|
84 |
JavaClassReader loadClass:'java/lang/Thread' |
|
85 |
" |
|
86 |
||
252 | 87 |
"Created: / 15.4.1996 / 14:58:53 / cg" |
88 |
"Modified: / 3.1.1998 / 22:36:13 / cg" |
|
21 | 89 |
! |
90 |
||
54 | 91 |
loadClassLazy:aClassName ignoring:classesBeingLoaded |
38 | 92 |
"private helper: |
93 |
reads a class, installs and returns it. |
|
94 |
The class is searched along the ClassPath. |
|
43 | 95 |
|
96 |
This is a partial load (to load other classes): |
|
97 |
- The classes stringConstants are not fixed to be JavaStrings |
|
98 |
(i.e they are still ST-Strings). |
|
252 | 99 |
- The class is NOT initialized." |
38 | 100 |
|
91 | 101 |
|rslt clsName cls loadedClass| |
50 | 102 |
|
52 | 103 |
(aClassName endsWith:';') ifTrue:[ |
252 | 104 |
('oops - loading of ' , aClassName , ' attempted') printNL. |
105 |
self halt:'should not happen'. |
|
106 |
^ nil |
|
91 | 107 |
]. |
108 |
(aClassName endsWith:'[]') ifTrue:[ |
|
252 | 109 |
('oops - loading of ' , aClassName , ' attempted') printNL. |
110 |
self halt:'should not happen'. |
|
111 |
^ nil |
|
52 | 112 |
]. |
113 |
||
50 | 114 |
clsName := aClassName. |
115 |
(clsName includes:$.) ifTrue:[ |
|
252 | 116 |
clsName := clsName asString copy replaceAll:$. with:$/ |
50 | 117 |
]. |
38 | 118 |
|
91 | 119 |
(classesBeingLoaded notNil and:[classesBeingLoaded includes:clsName]) ifTrue:[ |
252 | 120 |
('oops - recursive load of ' , clsName , ' attempted') printNL. |
121 |
self halt:'should not happen'. |
|
122 |
^ JavaUnresolvedClassConstant fullName:clsName |
|
54 | 123 |
]. |
124 |
||
91 | 125 |
(cls := Java at:clsName) notNil ifTrue:[ |
252 | 126 |
('oops - ' , clsName , ' is already loaded') printNL. |
127 |
self halt:clsName , ' is already loaded - should not happen'. |
|
128 |
^ cls |
|
91 | 129 |
]. |
130 |
||
131 |
classesBeingLoaded isNil ifTrue:[ |
|
252 | 132 |
loadedClass := Set with:clsName |
91 | 133 |
] ifFalse:[ |
252 | 134 |
loadedClass := Set withAll:classesBeingLoaded. |
135 |
loadedClass add:clsName. |
|
91 | 136 |
]. |
54 | 137 |
|
135 | 138 |
Java classPath do:[:path | |
252 | 139 |
|nm p| |
91 | 140 |
|
252 | 141 |
p := path. |
142 |
(p endsWith:Filename separator) ifFalse:[ |
|
143 |
p := p , (Filename separator asString) |
|
144 |
]. |
|
145 |
(Array |
|
146 |
with:clsName |
|
147 |
with:clsName asLowercase |
|
148 |
with:clsName asUppercase) |
|
149 |
do:[:tryName | |
|
150 |
(nm := p , tryName , '.class') asFilename exists ifTrue:[ |
|
151 |
rslt := self loadFileLazy:nm ignoring:loadedClass. |
|
152 |
rslt notNil ifTrue:[^ rslt]. |
|
153 |
]. |
|
154 |
] |
|
38 | 155 |
]. |
156 |
||
91 | 157 |
('JAVA: no file found for: ' , clsName) infoPrintCR. |
158 |
^ nil |
|
135 | 159 |
|
252 | 160 |
"Modified: / 14.8.1997 / 11:38:42 / stefan" |
161 |
"Modified: / 3.1.1998 / 22:28:37 / cg" |
|
38 | 162 |
! |
163 |
||
7 | 164 |
loadFile:aFilename |
43 | 165 |
"reads a class from aFilename, installs and returns it. |
166 |
The classes strings are fixed and its class-init function is called." |
|
167 |
||
54 | 168 |
self loadFileLazy:aFilename ignoring:(Set new). |
43 | 169 |
self postLoadActions |
170 |
! |
|
171 |
||
54 | 172 |
loadFileLazy:aFilename ignoring:classesBeingLoaded |
43 | 173 |
"reads a class from aFilename, installs and returns it. |
91 | 174 |
Strings are fixed and classrefs are fixed, |
175 |
but NO no class-init functions are called." |
|
7 | 176 |
|
21 | 177 |
|javaClass pool| |
7 | 178 |
|
54 | 179 |
javaClass := self readFile:aFilename ignoring:classesBeingLoaded. |
7 | 180 |
javaClass notNil ifTrue:[ |
252 | 181 |
Java at:(javaClass fullName asSymbol) put:javaClass. |
21 | 182 |
|
252 | 183 |
classesBeingLoaded remove:javaClass fullName ifAbsent:nil. |
21 | 184 |
|
252 | 185 |
JavaUnresolvedConstant resolveFor:javaClass. |
7 | 186 |
]. |
9 | 187 |
^ javaClass |
7 | 188 |
|
189 |
" |
|
190 |
JavaClassReader loadFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
9 | 191 |
|
192 |
'/phys/ibm3/java/lib/java/lang' asFilename |
|
252 | 193 |
directoryContents do:[:nm | |
194 |
(nm endsWith:'.class') ifTrue:[ |
|
195 |
('/phys/ibm3/java/lib/java/lang/' , nm) printNL. |
|
196 |
JavaClassReader loadFile:'/phys/ibm3/java/lib/java/lang/' , nm |
|
197 |
] |
|
198 |
]. |
|
9 | 199 |
|
14
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
200 |
'/phys/ibm3/java/lib/java/io' asFilename |
252 | 201 |
directoryContents do:[:nm | |
202 |
(nm endsWith:'.class') ifTrue:[ |
|
203 |
('/phys/ibm3/java/lib/java/io/' , nm) printNL. |
|
204 |
JavaClassReader loadFile:'/phys/ibm3/java/lib/java/io/' , nm |
|
205 |
] |
|
206 |
]. |
|
14
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
207 |
|
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
208 |
'/phys/ibm3/java/lib/java/net' asFilename |
252 | 209 |
directoryContents do:[:nm | |
210 |
(nm endsWith:'.class') ifTrue:[ |
|
211 |
('/phys/ibm3/java/lib/java/net/' , nm) printNL. |
|
212 |
JavaClassReader loadFile:'/phys/ibm3/java/lib/java/net/' , nm |
|
213 |
] |
|
214 |
]. |
|
14
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
215 |
|
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
216 |
'/phys/ibm3/java/lib/java/util' asFilename |
252 | 217 |
directoryContents do:[:nm | |
218 |
(nm endsWith:'.class') ifTrue:[ |
|
219 |
('/phys/ibm3/java/lib/java/util/' , nm) printNL. |
|
220 |
JavaClassReader loadFile:'/phys/ibm3/java/lib/java/util/' , nm |
|
221 |
] |
|
222 |
]. |
|
14
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
223 |
|
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
224 |
'/phys/ibm3/java/lib/java/awt' asFilename |
252 | 225 |
directoryContents do:[:nm | |
226 |
(nm endsWith:'.class') ifTrue:[ |
|
227 |
('/phys/ibm3/java/lib/java/awt/' , nm) printNL. |
|
228 |
JavaClassReader loadFile:'/phys/ibm3/java/lib/java/awt/' , nm |
|
229 |
] |
|
230 |
]. |
|
14
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
231 |
|
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
232 |
'/phys/ibm3/java/lib/java/applet' asFilename |
252 | 233 |
directoryContents do:[:nm | |
234 |
(nm endsWith:'.class') ifTrue:[ |
|
235 |
('/phys/ibm3/java/lib/java/applet/' , nm) printNL. |
|
236 |
JavaClassReader loadFile:'/phys/ibm3/java/lib/java/applet/' , nm |
|
237 |
] |
|
238 |
]. |
|
14
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
239 |
|
9 | 240 |
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
|
241 |
JavaClassReader loadFile:'/phys/ibm3/java/lib/java/lang/Thread.class' |
7 | 242 |
" |
243 |
||
244 |
"Created: 15.4.1996 / 14:58:53 / cg" |
|
245 |
! |
|
246 |
||
43 | 247 |
postLoadActions |
248 |
"Resolve all classes' string constants. |
|
249 |
Perform all class initialization functions (of those which are not |
|
250 |
yet initialized)." |
|
251 |
||
225 | 252 |
^ self postLoadActions:true |
253 |
||
254 |
"Modified: 15.8.1997 / 01:02:17 / cg" |
|
255 |
! |
|
256 |
||
257 |
postLoadActions:loadUnresolved |
|
258 |
"Resolve all classes' string constants. |
|
252 | 259 |
Perform all class initialization functions |
260 |
(of those which are not yet initialized)." |
|
225 | 261 |
|
223 | 262 |
|classes prevUnresolved newUnresolved loader| |
43 | 263 |
|
91 | 264 |
"/ need at least java.lang.String, for valid constants |
167 | 265 |
Java java_lang_String isNil ifTrue:[ |
255 | 266 |
self loadClassLazy:'java.lang.String' ignoring:(Set new). |
54 | 267 |
]. |
268 |
||
91 | 269 |
LazyClassLoading ifFalse:[ |
255 | 270 |
loader := ClassLoaderQuerySignal raise. |
271 |
||
272 |
prevUnresolved := nil. |
|
273 |
newUnresolved := JavaUnresolvedConstant unresolvedClassNames asArray. |
|
274 |
loadUnresolved ifTrue:[ |
|
275 |
[prevUnresolved ~= newUnresolved] whileTrue:[ |
|
276 |
newUnresolved do:[:nextUnresolved | |
|
277 |
|classURL| |
|
223 | 278 |
|
255 | 279 |
(Java at:nextUnresolved) isNil ifTrue:[ "/ could have been loaded in the meantime |
280 |
Silent ifFalse:[ |
|
281 |
'loading unresolved: ' print. nextUnresolved printCR. |
|
282 |
]. |
|
283 |
loader isNil ifTrue:[ |
|
284 |
self |
|
285 |
loadClassLazy:nextUnresolved |
|
286 |
ignoring:(Set new). |
|
287 |
] ifFalse:[ |
|
288 |
"/ |
|
289 |
"/ the aquired loader is a javaClassLoader |
|
290 |
"/ which expects an URL as arg. |
|
291 |
"/ |
|
292 |
"/ classURL := Java as_URL:('file:' , nextUnresolved asString , '.class'). |
|
293 |
"/ loader loadClass:classURL |
|
294 |
loader |
|
295 |
perform:#'loadClass(Ljava/lang/String;)Ljava/lang/Class;' |
|
296 |
with:(Java as_String:(nextUnresolved asString)). |
|
297 |
] |
|
298 |
] |
|
299 |
]. |
|
300 |
prevUnresolved := newUnresolved. |
|
301 |
newUnresolved := JavaUnresolvedConstant unresolvedClassNames asArray. |
|
302 |
]. |
|
303 |
]. |
|
229 | 304 |
|
255 | 305 |
newUnresolved size == 0 ifTrue:[ |
306 |
"/ nothing unresolved |
|
91 | 307 |
|
255 | 308 |
(classes := Java allClasses) notNil ifTrue:[ |
309 |
"/ init all new classes |
|
310 |
"/ fetch again - there could be new ones ... |
|
91 | 311 |
|
255 | 312 |
classes := Java allClasses. |
313 |
classes do:[:aJavaClass | |
|
314 |
aJavaClass isInitialized ifFalse:[ |
|
315 |
Silent ifFalse:[ |
|
316 |
'performing class initialization of ' print. aJavaClass fullName printCR. |
|
317 |
]. |
|
318 |
aJavaClass classInit |
|
319 |
] |
|
320 |
] |
|
321 |
] |
|
322 |
]. |
|
43 | 323 |
] |
167 | 324 |
|
252 | 325 |
"Created: / 15.8.1997 / 01:01:44 / cg" |
255 | 326 |
"Modified: / 7.1.1998 / 14:13:55 / cg" |
43 | 327 |
! |
328 |
||
54 | 329 |
readFile:aFilename ignoring:classesBeingLoaded |
7 | 330 |
"reads a class from aFilename and returns it. |
91 | 331 |
The JavaClass is NOT installed as global and unresolved |
332 |
refs are NOT patched." |
|
7 | 333 |
|
73 | 334 |
|inStream javaClass| |
1 | 335 |
|
43 | 336 |
Silent ifFalse:[ |
252 | 337 |
'reading ' print. aFilename print. ' ...' printNL. |
43 | 338 |
]. |
21 | 339 |
|
1 | 340 |
inStream := aFilename asFilename readStream. |
91 | 341 |
inStream isNil ifTrue:[ |
252 | 342 |
('no file: ' , aFilename) printCR. |
343 |
self halt. |
|
344 |
^ nil |
|
91 | 345 |
]. |
346 |
||
347 |
javaClass := self new readStream:inStream ignoring:classesBeingLoaded. |
|
73 | 348 |
javaClass notNil ifTrue:[ |
252 | 349 |
javaClass setBinaryFilePath:(inStream pathName). |
73 | 350 |
]. |
1 | 351 |
inStream close. |
27 | 352 |
|
91 | 353 |
AbsolutelySilent ifFalse:[ |
252 | 354 |
' ... loaded ' print. javaClass displayString printNL. |
43 | 355 |
]. |
27 | 356 |
|
73 | 357 |
^ javaClass |
1 | 358 |
|
359 |
"Created: 15.4.1996 / 14:58:53 / cg" |
|
360 |
! |
|
361 |
||
198 | 362 |
readStream:aStream |
363 |
"reads a class from aStream and returns it. |
|
223 | 364 |
The JavaClass is installed as global. |
365 |
If new classes are required to be loaded, a new standard loader |
|
366 |
is created." |
|
198 | 367 |
|
223 | 368 |
^ self readStream:aStream loader:nil |
198 | 369 |
|
223 | 370 |
"Modified: 14.8.1997 / 19:51:50 / cg" |
198 | 371 |
! |
372 |
||
54 | 373 |
readStream:aStream ignoring:classesBeingLoaded |
7 | 374 |
"reads a class from aStream and returns it. |
375 |
The JavaClass is not installed as global" |
|
376 |
||
54 | 377 |
^ self new readStream:aStream ignoring:classesBeingLoaded |
1 | 378 |
|
379 |
" |
|
380 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
381 |
" |
|
382 |
||
383 |
"Modified: 15.4.1996 / 15:01:30 / cg" |
|
223 | 384 |
! |
385 |
||
386 |
readStream:aStream loader:aClassLoader |
|
387 |
"reads a class from aStream and returns it. |
|
388 |
The JavaClass is installed as global. |
|
389 |
If new classes are required to be loaded, aClassLoader is |
|
390 |
asked to do it. If aClassLoader is nil, a new standard loader |
|
391 |
is created." |
|
392 |
||
225 | 393 |
^ self |
252 | 394 |
readStream:aStream |
395 |
loader:aClassLoader |
|
396 |
loadUnresolved:true |
|
225 | 397 |
|
398 |
"Modified: 15.8.1997 / 01:00:35 / cg" |
|
399 |
! |
|
400 |
||
401 |
readStream:aStream loader:aClassLoader loadUnresolved:loadUnresolved |
|
402 |
"reads a class from aStream and returns it. |
|
403 |
The JavaClass is installed as global. |
|
404 |
If new classes are required to be loaded, aClassLoader is |
|
405 |
asked to do it. If aClassLoader is nil, a new standard loader |
|
406 |
is created." |
|
407 |
||
223 | 408 |
|javaClass| |
409 |
||
410 |
javaClass := self readStream:aStream ignoring:(Set new). |
|
411 |
javaClass notNil ifTrue:[ |
|
252 | 412 |
ClassLoaderQuerySignal answer:aClassLoader |
413 |
do:[ |
|
414 |
self postLoadActions:loadUnresolved. |
|
415 |
Java at:(javaClass fullName asSymbol) put:javaClass. |
|
416 |
JavaUnresolvedConstant resolveFor:javaClass. |
|
417 |
]. |
|
223 | 418 |
]. |
419 |
^ javaClass |
|
420 |
||
421 |
"Modified: 3.8.1997 / 19:48:45 / cg" |
|
225 | 422 |
"Created: 15.8.1997 / 00:59:24 / cg" |
1 | 423 |
! ! |
424 |
||
425 |
!JavaClassReader methodsFor:'file reading'! |
|
426 |
||
54 | 427 |
readClassFileIgnoring:classesbeingLoaded |
7 | 428 |
"reads a class from inStream and returns it. |
38 | 429 |
The JavaClass is not installed as global and its constants |
430 |
(especially strings) may not be fully resolved." |
|
7 | 431 |
|
9 | 432 |
|magic |
38 | 433 |
access_flags this_class this_class_index super_class super_class_index |
434 |
realSuperClass this_class_ref existingSuperClass |
|
40 | 435 |
fields interfaces staticFields nStatic| |
1 | 436 |
|
437 |
"/ |
|
438 |
"/ read magic, determine byte order |
|
439 |
"/ |
|
440 |
msb := true. |
|
128 | 441 |
magic := inStream nextUnsignedLongMSB:msb. |
1 | 442 |
magic = 16rCAFEBABE ifFalse:[ |
252 | 443 |
magic = 16rBEBAFECA ifFalse:[ |
444 |
InvalidClassFormatSignal raiseErrorString:'not a java class file'. |
|
445 |
^ nil |
|
446 |
]. |
|
447 |
msb := false. |
|
448 |
Verbose ifTrue:[Transcript showCR:'file is lsb']. |
|
1 | 449 |
] ifTrue:[ |
252 | 450 |
Verbose ifTrue:[Transcript showCR:'file is msb']. |
1 | 451 |
]. |
452 |
||
453 |
"/ |
|
454 |
"/ get version |
|
455 |
"/ |
|
128 | 456 |
minorVsn := inStream nextUnsignedShortMSB:msb. |
457 |
majorVsn := inStream nextUnsignedShortMSB:msb. |
|
9 | 458 |
|
99 | 459 |
(majorVsn ~~ 45 or:[minorVsn ~~ 3]) ifTrue:[ |
252 | 460 |
Transcript show:'warning this file has version '; show:majorVsn; show:'.'; showCR:minorVsn. |
99 | 461 |
]. |
462 |
||
463 |
Verbose ifTrue:[ |
|
252 | 464 |
Transcript show:'version = '; |
465 |
show:(majorVsn printString); |
|
466 |
show:'.'; |
|
467 |
showCR:(minorVsn printString). |
|
99 | 468 |
]. |
1 | 469 |
|
470 |
"/ |
|
471 |
"/ get constant pool |
|
472 |
"/ |
|
473 |
self readConstantPool. |
|
474 |
||
475 |
"/ |
|
476 |
"/ access flags |
|
477 |
"/ |
|
128 | 478 |
access_flags := inStream nextUnsignedShortMSB:msb. |
479 |
this_class_index := inStream nextUnsignedShortMSB:msb. |
|
480 |
super_class_index := inStream nextUnsignedShortMSB:msb. |
|
1 | 481 |
|
14
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
482 |
super_class_index == 0 ifTrue:[ |
252 | 483 |
super_class := nil |
14
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
484 |
] ifFalse:[ |
252 | 485 |
super_class := constants at:super_class_index. |
486 |
existingSuperClass := Java classNamed:super_class fullName. |
|
487 |
existingSuperClass notNil ifTrue:[ |
|
488 |
super_class := existingSuperClass |
|
489 |
] ifFalse:[ |
|
490 |
(super_class isMemberOf:JavaUnresolvedClassConstant) ifTrue:[ |
|
491 |
Silent ifFalse:[ |
|
492 |
'load superClass: ' print. super_class fullName printCR. |
|
493 |
]. |
|
91 | 494 |
|
252 | 495 |
existingSuperClass := self class |
496 |
loadClassLazy:(super_class fullName) |
|
497 |
ignoring:classesbeingLoaded. |
|
91 | 498 |
|
252 | 499 |
existingSuperClass isNil ifTrue:[ |
500 |
self halt:('cannot find superclass: ' , super_class fullName). |
|
501 |
]. |
|
502 |
super_class := existingSuperClass |
|
503 |
] ifFalse:[ |
|
504 |
self halt:'oops - superclass ?' |
|
505 |
] |
|
506 |
]. |
|
14
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
507 |
]. |
1 | 508 |
|
509 |
"/ |
|
510 |
"/ get interfaces |
|
511 |
"/ |
|
38 | 512 |
interfaces := self readInterfaces. |
1 | 513 |
|
514 |
"/ |
|
515 |
"/ get fields |
|
516 |
"/ |
|
38 | 517 |
fields := self readFieldInfofields. |
40 | 518 |
|
519 |
"/ |
|
520 |
"/ create the fields as instVars |
|
521 |
"/ static fields are created as class-InstVars |
|
522 |
"/ |
|
523 |
staticFields := fields select:[:f | f isStatic]. |
|
524 |
nStatic := staticFields size. |
|
525 |
||
526 |
this_class_ref := constants at:this_class_index. |
|
182 | 527 |
this_class := JavaClass fullName:(this_class_ref fullName) numStatic:nStatic. |
528 |
||
40 | 529 |
nStatic ~~ 0 ifTrue:[ |
252 | 530 |
fields := fields select:[:f | f isStatic not]. |
40 | 531 |
|
252 | 532 |
JavaClass setInstanceVariableStringFromFields:staticFields in:this_class class. |
533 |
this_class setStaticFields:staticFields. |
|
534 |
this_class initializeStaticFields. |
|
40 | 535 |
]. |
536 |
||
537 |
this_class setAccessFlags:access_flags. |
|
538 |
this_class setSuperclass:super_class. |
|
539 |
this_class setConstantPool:constants. |
|
540 |
||
52 | 541 |
this_class setFields:fields. |
110 | 542 |
this_class setInterfaces:interfaces. |
1 | 543 |
|
544 |
"/ |
|
545 |
"/ get methods |
|
546 |
"/ |
|
38 | 547 |
self readMethodsFor:this_class. |
1 | 548 |
|
5 | 549 |
self readAttributesFor:this_class. |
550 |
||
91 | 551 |
constants owner:this_class. |
552 |
||
5 | 553 |
^ this_class |
554 |
||
1 | 555 |
" |
556 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
557 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class' |
|
9 | 558 |
|
559 |
JavaClassReader verbose:true. |
|
560 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/java/lang/ArithmeticException.class' |
|
561 |
JavaClassReader readFile:'/phys/ibm3/java/lib/java/lang/ArithmeticException.class' |
|
1 | 562 |
" |
563 |
||
252 | 564 |
"Created: / 15.4.1996 / 15:02:47 / cg" |
565 |
"Modified: / 3.1.1998 / 22:33:16 / cg" |
|
1 | 566 |
! |
567 |
||
5 | 568 |
readSourceFileAttributeFor:aJavaClass |
569 |
|attribute_length sourceFile_index sourceFile| |
|
570 |
||
128 | 571 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
5 | 572 |
|
128 | 573 |
sourceFile_index := inStream nextUnsignedShortMSB:msb. |
5 | 574 |
sourceFile := constants at:sourceFile_index. |
575 |
||
576 |
aJavaClass setSourceFile:sourceFile. |
|
577 |
||
61 | 578 |
Verbose ifTrue:[Transcript show:'sourceFile: '; showCR:sourceFile]. |
5 | 579 |
^ true |
580 |
||
581 |
" |
|
582 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
583 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class' |
|
584 |
" |
|
585 |
||
586 |
"Modified: 15.4.1996 / 15:33:28 / cg" |
|
587 |
"Created: 15.4.1996 / 15:40:17 / cg" |
|
588 |
! |
|
589 |
||
54 | 590 |
readStream:aStream ignoring:classesBeingLoaded |
7 | 591 |
"reads a class from aStream and returns it. |
592 |
The JavaClass is not installed as global" |
|
593 |
||
5 | 594 |
inStream := aStream. |
595 |
inStream binary. |
|
38 | 596 |
|
54 | 597 |
^ self readClassFileIgnoring:classesBeingLoaded |
5 | 598 |
|
599 |
" |
|
600 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
601 |
" |
|
602 |
||
603 |
"Created: 15.4.1996 / 15:00:55 / cg" |
|
604 |
"Modified: 15.4.1996 / 15:06:18 / cg" |
|
605 |
! ! |
|
606 |
||
607 |
!JavaClassReader methodsFor:'file reading - attributes'! |
|
608 |
||
609 |
readAttribute:attributeName for:something |
|
83 | 610 |
|
5 | 611 |
(attributeName = 'Code') ifTrue:[ |
252 | 612 |
self readCodeAttributeFor:something. |
613 |
^ true. |
|
5 | 614 |
]. |
83 | 615 |
(attributeName = 'Exceptions') ifTrue:[ |
252 | 616 |
self readExceptionsAttributeFor:something. |
617 |
^ true. |
|
83 | 618 |
]. |
5 | 619 |
(attributeName = 'LineNumberTable') ifTrue:[ |
252 | 620 |
self readLineNumberTableAttributeFor:something. |
621 |
^ true. |
|
5 | 622 |
]. |
623 |
(attributeName = 'LocalVariableTable') ifTrue:[ |
|
252 | 624 |
self readLocalVariableTableAttributeFor:something. |
625 |
^ true. |
|
5 | 626 |
]. |
627 |
(attributeName = 'ConstantValue') ifTrue:[ |
|
252 | 628 |
self readConstantValueAttributeFor:something. |
629 |
^ true. |
|
5 | 630 |
]. |
631 |
(attributeName = 'SourceFile') ifTrue:[ |
|
252 | 632 |
self readSourceFileAttributeFor:something. |
633 |
^ true. |
|
634 |
]. |
|
635 |
(attributeName = 'Deprecated') ifTrue:[ |
|
636 |
^ false. |
|
5 | 637 |
]. |
83 | 638 |
|
639 |
('JAVA: unrecognized attribute: ' , attributeName) infoPrintCR. |
|
5 | 640 |
^ false |
641 |
||
642 |
"Modified: 15.4.1996 / 15:33:28 / cg" |
|
643 |
"Created: 15.4.1996 / 15:40:17 / cg" |
|
644 |
! |
|
645 |
||
646 |
readAttributeFor:something |
|
647 |
|attribute_name_index attribute_name attribute_length attribute_info| |
|
648 |
||
61 | 649 |
Verbose ifTrue:[Transcript show:'attrib at pos: '; showCR:inStream position]. |
9 | 650 |
|
128 | 651 |
attribute_name_index := inStream nextUnsignedShortMSB:msb. |
9 | 652 |
|
653 |
"/ |
|
654 |
"/ UNDOC feature ? |
|
655 |
"/ |
|
656 |
attribute_name_index > constants size ifTrue:[ |
|
252 | 657 |
attribute_name_index == 16rb700 ifTrue:[ |
658 |
self halt. |
|
659 |
] |
|
9 | 660 |
]. |
661 |
||
5 | 662 |
attribute_name := constants at:attribute_name_index. |
9 | 663 |
|
61 | 664 |
Verbose ifTrue:[Transcript show:'attrib name: '; showCR:attribute_name]. |
9 | 665 |
|
5 | 666 |
(self readAttribute:attribute_name for:something) ifFalse:[ |
252 | 667 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
668 |
attribute_info := ByteArray new:(attribute_length). |
|
669 |
inStream nextBytes:attribute_length into:attribute_info startingAt:1. |
|
5 | 670 |
|
252 | 671 |
Verbose ifTrue:[Transcript show:'skipped '; show:attribute_name; showCR:'-attribute']. |
5 | 672 |
]. |
673 |
||
674 |
" |
|
675 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
676 |
" |
|
677 |
||
678 |
"Modified: 15.4.1996 / 15:33:28 / cg" |
|
679 |
"Created: 15.4.1996 / 15:40:17 / cg" |
|
680 |
! |
|
681 |
||
682 |
readAttributesFor:something |
|
683 |
|attributes_count| |
|
684 |
||
128 | 685 |
attributes_count := inStream nextUnsignedShortMSB:msb. |
5 | 686 |
|
687 |
1 to:attributes_count do:[:i | |
|
252 | 688 |
self readAttributeFor:something. |
5 | 689 |
]. |
690 |
||
691 |
"Modified: 15.4.1996 / 15:33:28 / cg" |
|
692 |
"Created: 15.4.1996 / 15:40:17 / cg" |
|
693 |
! ! |
|
694 |
||
695 |
!JavaClassReader methodsFor:'file reading - constants'! |
|
696 |
||
1 | 697 |
readConstant |
698 |
|tag constReader const| |
|
699 |
||
700 |
||
11 | 701 |
constNeeds2Slots := false. |
702 |
||
1 | 703 |
"/ |
704 |
"/ get tag |
|
705 |
"/ |
|
128 | 706 |
tag := inStream nextByte. |
61 | 707 |
Verbose ifTrue:[Transcript show:'tag = '; showCR:tag]. |
1 | 708 |
|
709 |
constReader := #( |
|
252 | 710 |
readConstant_Asciz "/ 1 - now called Utf8 |
711 |
readConstant_Unicode "/ 2 |
|
712 |
readConstant_Integer "/ 3 |
|
713 |
readConstant_Float "/ 4 |
|
714 |
readConstant_Long "/ 5 |
|
715 |
readConstant_Double "/ 6 |
|
716 |
readConstant_Class "/ 7 |
|
717 |
readConstant_String "/ 8 |
|
718 |
readConstant_Fieldref "/ 9 |
|
719 |
readConstant_Methodref "/ 10 |
|
720 |
readConstant_InterfaceMethodref "/ 11 |
|
721 |
readConstant_NameAndType "/ 12 |
|
722 |
) at:tag ifAbsent:[#readConstant_Undef]. |
|
1 | 723 |
|
724 |
^ self perform:constReader. |
|
725 |
||
726 |
" |
|
727 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
728 |
" |
|
729 |
||
730 |
"Created: 15.4.1996 / 15:46:32 / cg" |
|
731 |
"Modified: 15.4.1996 / 15:47:00 / cg" |
|
732 |
! |
|
733 |
||
734 |
readConstantPool |
|
11 | 735 |
|constantPoolCount const i| |
1 | 736 |
|
737 |
"/ |
|
738 |
"/ get constant pool |
|
739 |
"/ |
|
128 | 740 |
constantPoolCount := inStream nextUnsignedShortMSB:msb. |
61 | 741 |
Verbose ifTrue:[Transcript show:'constantPoolCount = '; showCR:constantPoolCount]. |
1 | 742 |
|
91 | 743 |
constants := JavaConstantPool "Array" new:constantPoolCount-1. |
1 | 744 |
|
21 | 745 |
constSlot := 1. |
746 |
[constSlot < constantPoolCount] whileTrue:[ |
|
252 | 747 |
Verbose ifTrue:[Transcript show:'const: '; showCR:constSlot]. |
748 |
const := self readConstant. |
|
749 |
constants at:constSlot put:const. |
|
750 |
constNeeds2Slots ifTrue:[ |
|
751 |
constSlot := constSlot + 1. |
|
752 |
]. |
|
753 |
constSlot := constSlot + 1. |
|
1 | 754 |
]. |
755 |
||
52 | 756 |
constSlot := -1. |
757 |
||
91 | 758 |
"/ preresolve what can be (especially, strings are resolved here) |
759 |
||
1 | 760 |
1 to:constantPoolCount-1 do:[:i | |
252 | 761 |
|const value| |
1 | 762 |
|
252 | 763 |
const := constants at:i. |
764 |
const notNil ifTrue:[ "/ kludge for 2-slot constants (which only take 1 slot in ST/X) |
|
765 |
(const isKindOf:JavaUnresolvedConstant) ifTrue:[ |
|
766 |
value := const preResolve. |
|
767 |
value ~~ const ifTrue:[ |
|
768 |
constants at:i put:value. |
|
769 |
] |
|
770 |
] |
|
771 |
] |
|
1 | 772 |
]. |
773 |
||
774 |
" |
|
775 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
776 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class' |
|
777 |
" |
|
778 |
||
779 |
"Created: 15.4.1996 / 15:14:11 / cg" |
|
780 |
"Modified: 15.4.1996 / 16:41:57 / cg" |
|
781 |
! |
|
782 |
||
783 |
readConstant_Asciz |
|
784 |
|len string| |
|
785 |
||
128 | 786 |
len := inStream nextUnsignedShortMSB:msb. |
1 | 787 |
string := String new:len. |
788 |
inStream nextBytes:len into:string startingAt:1. |
|
789 |
||
61 | 790 |
Verbose ifTrue:[Transcript show:'asciz; string= '; showCR:string]. |
1 | 791 |
|
792 |
^ string |
|
793 |
||
794 |
" |
|
795 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
796 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class' |
|
797 |
" |
|
798 |
||
799 |
"Created: 15.4.1996 / 15:15:35 / cg" |
|
800 |
"Modified: 15.4.1996 / 16:33:45 / cg" |
|
801 |
! |
|
802 |
||
803 |
readConstant_Class |
|
52 | 804 |
|name_index name| |
1 | 805 |
|
128 | 806 |
name_index := inStream nextUnsignedShortMSB:msb. |
1 | 807 |
|
61 | 808 |
Verbose ifTrue:[Transcript show:'class; index= '; showCR:name_index]. |
1 | 809 |
|
52 | 810 |
name := constants at:name_index. |
811 |
name notNil ifTrue:[ |
|
252 | 812 |
Verbose ifTrue:[Transcript showCR:'name in constant_class already resolved']. |
813 |
"/ self halt |
|
52 | 814 |
]. |
815 |
||
21 | 816 |
^ JavaUnresolvedClassConstant |
252 | 817 |
pool:constants |
818 |
poolIndex:constSlot |
|
819 |
nameIndex:name_index |
|
91 | 820 |
|
1 | 821 |
" |
822 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
823 |
" |
|
824 |
||
825 |
"Created: 15.4.1996 / 15:21:13 / cg" |
|
193 | 826 |
"Modified: 1.8.1997 / 21:27:28 / cg" |
1 | 827 |
! |
828 |
||
11 | 829 |
readConstant_Double |
830 |
|high low aFloat| |
|
831 |
||
128 | 832 |
high := inStream nextUnsignedLongMSB:msb. |
833 |
low := inStream nextUnsignedLongMSB:msb. |
|
11 | 834 |
|
835 |
aFloat := Float new. |
|
836 |
UninterpretedBytes isBigEndian ifTrue:[ |
|
252 | 837 |
aFloat basicAt:1 put:((high bitShift:-24) bitAnd:16rFF). |
838 |
aFloat basicAt:2 put:((high bitShift:-16) bitAnd:16rFF). |
|
839 |
aFloat basicAt:3 put:((high bitShift:-8) bitAnd:16rFF). |
|
840 |
aFloat basicAt:4 put:(high bitAnd:16rFF). |
|
841 |
aFloat basicAt:5 put:((low bitShift:-24) bitAnd:16rFF). |
|
842 |
aFloat basicAt:6 put:((low bitShift:-16) bitAnd:16rFF). |
|
843 |
aFloat basicAt:7 put:((low bitShift:-8) bitAnd:16rFF). |
|
844 |
aFloat basicAt:8 put:(low bitAnd:16rFF). |
|
11 | 845 |
] ifFalse:[ |
252 | 846 |
aFloat basicAt:1 put:(low bitAnd:16rFF). |
847 |
aFloat basicAt:2 put:((low bitShift:-8) bitAnd:16rFF). |
|
848 |
aFloat basicAt:3 put:((low bitShift:-16) bitAnd:16rFF). |
|
849 |
aFloat basicAt:4 put:((low bitShift:-24) bitAnd:16rFF). |
|
850 |
aFloat basicAt:5 put:(high bitAnd:16rFF). |
|
851 |
aFloat basicAt:6 put:((high bitShift:-8) bitAnd:16rFF). |
|
852 |
aFloat basicAt:7 put:((high bitShift:-16) bitAnd:16rFF). |
|
853 |
aFloat basicAt:8 put:((high bitShift:-24) bitAnd:16rFF). |
|
11 | 854 |
]. |
855 |
||
856 |
constNeeds2Slots := true. |
|
857 |
||
61 | 858 |
Verbose ifTrue:[Transcript show:'double; value= '; showCR:aFloat]. |
11 | 859 |
^ aFloat |
860 |
||
861 |
" |
|
862 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
863 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class' |
|
864 |
" |
|
865 |
||
866 |
"Modified: 15.4.1996 / 15:42:16 / cg" |
|
867 |
"Created: 15.4.1996 / 16:34:42 / cg" |
|
868 |
! |
|
869 |
||
1 | 870 |
readConstant_Fieldref |
871 |
|class_index name_and_type_index| |
|
872 |
||
128 | 873 |
class_index := inStream nextUnsignedShortMSB:msb. |
874 |
name_and_type_index := inStream nextUnsignedShortMSB:msb. |
|
1 | 875 |
|
61 | 876 |
Verbose ifTrue:[Transcript show:'fieldref; classindex= '; showCR:class_index]. |
877 |
Verbose ifTrue:[Transcript show:'fieldref; name&typeindex= '; showCR:name_and_type_index]. |
|
1 | 878 |
|
91 | 879 |
^ JavaUnresolvedFieldrefConstant |
252 | 880 |
pool:constants |
881 |
poolIndex:constSlot |
|
882 |
classIndex:class_index |
|
883 |
nameandTypeIndex:name_and_type_index |
|
1 | 884 |
|
885 |
" |
|
886 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
887 |
" |
|
888 |
||
889 |
"Created: 15.4.1996 / 15:22:18 / cg" |
|
890 |
"Modified: 15.4.1996 / 16:07:01 / cg" |
|
891 |
! |
|
892 |
||
11 | 893 |
readConstant_Float |
894 |
|high aFloat| |
|
895 |
||
128 | 896 |
high := inStream nextUnsignedLongMSB:msb. |
11 | 897 |
|
898 |
aFloat := ShortFloat basicNew. |
|
899 |
UninterpretedBytes isBigEndian ifTrue:[ |
|
252 | 900 |
aFloat basicAt:1 put:((high bitShift:-24) bitAnd:16rFF). |
901 |
aFloat basicAt:2 put:((high bitShift:-16) bitAnd:16rFF). |
|
902 |
aFloat basicAt:3 put:((high bitShift:-8) bitAnd:16rFF). |
|
903 |
aFloat basicAt:4 put:(high bitAnd:16rFF). |
|
11 | 904 |
] ifFalse:[ |
252 | 905 |
aFloat basicAt:1 put:(high bitAnd:16rFF). |
906 |
aFloat basicAt:2 put:((high bitShift:-8) bitAnd:16rFF). |
|
907 |
aFloat basicAt:3 put:((high bitShift:-16) bitAnd:16rFF). |
|
908 |
aFloat basicAt:4 put:((high bitShift:-24) bitAnd:16rFF). |
|
11 | 909 |
]. |
910 |
||
61 | 911 |
Verbose ifTrue:[Transcript show:'float; value= '; showCR:aFloat]. |
11 | 912 |
^ aFloat |
913 |
||
914 |
" |
|
915 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
916 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class' |
|
917 |
" |
|
918 |
||
919 |
"Modified: 15.4.1996 / 15:42:16 / cg" |
|
920 |
"Created: 15.4.1996 / 16:34:42 / cg" |
|
921 |
! |
|
922 |
||
1 | 923 |
readConstant_Integer |
924 |
|value| |
|
925 |
||
128 | 926 |
value := inStream nextLongMSB:msb. |
1 | 927 |
|
61 | 928 |
Verbose ifTrue:[Transcript show:'integer; value= '; showCR:value]. |
1 | 929 |
|
930 |
^ value |
|
931 |
||
932 |
" |
|
933 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
934 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class' |
|
935 |
" |
|
936 |
||
937 |
"Modified: 15.4.1996 / 15:42:16 / cg" |
|
938 |
"Created: 15.4.1996 / 16:34:42 / cg" |
|
939 |
! |
|
940 |
||
14
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
941 |
readConstant_InterfaceMethodref |
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
942 |
|class_index name_and_type_index| |
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
943 |
|
128 | 944 |
class_index := inStream nextUnsignedShortMSB:msb. |
945 |
name_and_type_index := inStream nextUnsignedShortMSB:msb. |
|
14
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
946 |
|
61 | 947 |
Verbose ifTrue:[Transcript show:'methodref; classindex= '; showCR:class_index]. |
948 |
Verbose ifTrue:[Transcript show:'methodref; name&typeindex= '; showCR:name_and_type_index]. |
|
14
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
949 |
|
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
950 |
^ JavaUnresolvedInterfaceMethodrefConstant |
252 | 951 |
pool:constants |
952 |
poolIndex:constSlot |
|
953 |
classIndex:class_index |
|
954 |
nameandTypeIndex:name_and_type_index |
|
14
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
955 |
|
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
956 |
" |
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
957 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
958 |
" |
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
959 |
|
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
960 |
"Created: 15.4.1996 / 15:22:37 / cg" |
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
961 |
"Modified: 15.4.1996 / 16:07:19 / cg" |
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
962 |
! |
c1d9f60eb650
can now load all java.class files (see JavaClassReader>>loadFile:)
cg
parents:
11
diff
changeset
|
963 |
|
11 | 964 |
readConstant_Long |
965 |
|high low value| |
|
966 |
||
128 | 967 |
high := inStream nextUnsignedLongMSB:msb. |
968 |
low := inStream nextUnsignedLongMSB:msb. |
|
11 | 969 |
|
970 |
value := (high bitShift:32) bitOr:low. |
|
60 | 971 |
(high bitTest:16r80000000) ifTrue:[ |
252 | 972 |
value := value - 16r10000000000000000. |
60 | 973 |
]. |
11 | 974 |
constNeeds2Slots := true. |
975 |
||
61 | 976 |
Verbose ifTrue:[Transcript show:'long; value= '; showCR:value]. |
11 | 977 |
^ value |
978 |
||
979 |
" |
|
980 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
981 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class' |
|
982 |
" |
|
983 |
||
984 |
"Modified: 15.4.1996 / 15:42:16 / cg" |
|
985 |
"Created: 15.4.1996 / 16:34:42 / cg" |
|
986 |
! |
|
987 |
||
1 | 988 |
readConstant_Methodref |
989 |
|class_index name_and_type_index| |
|
990 |
||
128 | 991 |
class_index := inStream nextUnsignedShortMSB:msb. |
992 |
name_and_type_index := inStream nextUnsignedShortMSB:msb. |
|
1 | 993 |
|
61 | 994 |
Verbose ifTrue:[Transcript show:'methodref; classindex= '; showCR:class_index]. |
995 |
Verbose ifTrue:[Transcript show:'methodref; name&typeindex= '; showCR:name_and_type_index]. |
|
1 | 996 |
|
997 |
^ JavaUnresolvedMethodrefConstant |
|
252 | 998 |
pool:constants |
999 |
poolIndex:constSlot |
|
1000 |
classIndex:class_index |
|
1001 |
nameandTypeIndex:name_and_type_index |
|
1 | 1002 |
|
1003 |
" |
|
1004 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1005 |
" |
|
1006 |
||
1007 |
"Created: 15.4.1996 / 15:22:37 / cg" |
|
1008 |
"Modified: 15.4.1996 / 16:07:19 / cg" |
|
1009 |
! |
|
1010 |
||
91 | 1011 |
readConstant_NameAndType |
1 | 1012 |
|name_index signature_index| |
1013 |
||
128 | 1014 |
name_index := inStream nextUnsignedShortMSB:msb. |
1015 |
signature_index := inStream nextUnsignedShortMSB:msb. |
|
1 | 1016 |
|
61 | 1017 |
Verbose ifTrue:[Transcript show:'methodref; nameindex= '; showCR:name_index]. |
1018 |
Verbose ifTrue:[Transcript show:'methodref; signatureindex= '; showCR:signature_index]. |
|
1 | 1019 |
|
1020 |
^ JavaUnresolvedNameandTypeConstant |
|
252 | 1021 |
pool:constants |
1022 |
poolIndex:constSlot |
|
1023 |
nameIndex:name_index |
|
1024 |
signatureIndex:signature_index |
|
1 | 1025 |
|
1026 |
" |
|
1027 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1028 |
" |
|
1029 |
||
1030 |
"Created: 15.4.1996 / 15:23:43 / cg" |
|
1031 |
"Modified: 15.4.1996 / 16:17:16 / cg" |
|
1032 |
! |
|
1033 |
||
1034 |
readConstant_String |
|
1035 |
|tag string_index| |
|
1036 |
||
128 | 1037 |
string_index := inStream nextUnsignedShortMSB:msb. |
1 | 1038 |
|
61 | 1039 |
Verbose ifTrue:[Transcript show:'string; index= '; showCR:string_index]. |
1 | 1040 |
|
91 | 1041 |
^ JavaUnresolvedStringConstant |
252 | 1042 |
pool:constants |
1043 |
poolIndex:constSlot |
|
1044 |
stringIndex:string_index |
|
1 | 1045 |
|
1046 |
" |
|
43 | 1047 |
Verbose := true. |
1048 |
JavaClassReader readFile:'/phys/ibm3/java/lib/java/lang/System.class' |
|
1 | 1049 |
" |
1050 |
||
1051 |
"Created: 15.4.1996 / 15:20:33 / cg" |
|
1052 |
"Modified: 15.4.1996 / 16:01:37 / cg" |
|
5 | 1053 |
! ! |
1054 |
||
1055 |
!JavaClassReader methodsFor:'file reading - fields'! |
|
1056 |
||
1057 |
readConstantValueAttributeFor:aField |
|
1058 |
|attribute_length constantvalue_index constantValue| |
|
1059 |
||
128 | 1060 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
5 | 1061 |
|
128 | 1062 |
constantvalue_index := inStream nextUnsignedShortMSB:msb. |
5 | 1063 |
constantValue := constants at:constantvalue_index. |
1064 |
||
59 | 1065 |
aField constantValue:constantValue. |
1066 |
||
61 | 1067 |
Verbose ifTrue:[Transcript show:'constantValue: '; showCR:constantValue]. |
5 | 1068 |
^ true |
1069 |
||
1070 |
" |
|
1071 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1072 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class' |
|
1073 |
" |
|
1074 |
||
1075 |
"Modified: 15.4.1996 / 15:33:28 / cg" |
|
1076 |
"Created: 15.4.1996 / 15:40:17 / cg" |
|
1 | 1077 |
! |
1078 |
||
1079 |
readFieldInfofield |
|
5 | 1080 |
|access_flags name_index signature_index attributes_count field| |
1 | 1081 |
|
128 | 1082 |
access_flags := inStream nextUnsignedShortMSB:msb. |
1083 |
name_index := inStream nextUnsignedShortMSB:msb. |
|
1084 |
signature_index := inStream nextUnsignedShortMSB:msb. |
|
5 | 1085 |
|
1086 |
field := JavaField new. |
|
1087 |
field setAccessFlags:access_flags. |
|
1088 |
field setName:(constants at:name_index). |
|
1089 |
field setSignature:(constants at:signature_index). |
|
1090 |
||
128 | 1091 |
attributes_count := inStream nextUnsignedShortMSB:msb. |
1 | 1092 |
|
99 | 1093 |
Verbose ifTrue:[Transcript show:' field name: '; show:(constants at:name_index); |
252 | 1094 |
show:' access: '; show:access_flags; |
1095 |
show:' attrib_cnt: '; showCR:attributes_count]. |
|
99 | 1096 |
|
1 | 1097 |
1 to:attributes_count do:[:i | |
252 | 1098 |
self readAttributeFor:field. |
1 | 1099 |
]. |
1100 |
||
27 | 1101 |
^ field |
1102 |
||
1 | 1103 |
" |
1104 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1105 |
" |
|
1106 |
||
1107 |
"Modified: 15.4.1996 / 15:33:28 / cg" |
|
1108 |
"Created: 15.4.1996 / 15:38:43 / cg" |
|
1109 |
! |
|
1110 |
||
1111 |
readFieldInfofields |
|
38 | 1112 |
|nFields fields| |
1 | 1113 |
|
1114 |
"/ |
|
38 | 1115 |
"/ get fieldInfos |
1 | 1116 |
"/ |
128 | 1117 |
nFields := inStream nextUnsignedShortMSB:msb. |
61 | 1118 |
Verbose ifTrue:[Transcript show:'fieldsCount = '; showCR:nFields]. |
1 | 1119 |
|
27 | 1120 |
fields := Array new:nFields. |
1121 |
||
1122 |
1 to:nFields do:[:i | |
|
252 | 1123 |
Verbose ifTrue:[Transcript show:'field: '; showCR:i]. |
1124 |
fields at:i put:(self readFieldInfofield) |
|
1 | 1125 |
]. |
38 | 1126 |
^ fields |
1 | 1127 |
|
1128 |
" |
|
1129 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1130 |
" |
|
1131 |
||
1132 |
"Created: 15.4.1996 / 15:34:41 / cg" |
|
1133 |
"Modified: 15.4.1996 / 15:35:28 / cg" |
|
5 | 1134 |
! ! |
1135 |
||
38 | 1136 |
!JavaClassReader methodsFor:'file reading - interfaces'! |
1137 |
||
1138 |
readInterfaces |
|
110 | 1139 |
|interfacesCount interface_index interface interfaces| |
38 | 1140 |
|
1141 |
"/ |
|
1142 |
"/ get interfaces |
|
1143 |
"/ |
|
128 | 1144 |
interfacesCount := inStream nextUnsignedShortMSB:msb. |
61 | 1145 |
Verbose ifTrue:[Transcript show:'interfacesCount = '; showCR:interfacesCount]. |
38 | 1146 |
|
1147 |
interfaces := Array new:interfacesCount. |
|
1148 |
||
1149 |
1 to:interfacesCount do:[:i | |
|
252 | 1150 |
Verbose ifTrue:[Transcript show:'interface: '; showCR:i]. |
1151 |
interface_index := inStream nextUnsignedShortMSB:msb. |
|
1152 |
interface := constants at:interface_index. |
|
38 | 1153 |
|
252 | 1154 |
interfaces at:i put:interface. |
38 | 1155 |
]. |
1156 |
^ interfaces |
|
1157 |
||
1158 |
" |
|
1159 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1160 |
" |
|
1161 |
||
1162 |
"Created: 15.4.1996 / 15:31:59 / cg" |
|
1163 |
"Modified: 15.4.1996 / 15:33:28 / cg" |
|
1164 |
! ! |
|
1165 |
||
5 | 1166 |
!JavaClassReader methodsFor:'file reading - methods'! |
1167 |
||
1168 |
readCodeAttributeFor:aJavaMethod |
|
1169 |
|attribute_length max_stack max_locals code_length code |
|
9 | 1170 |
exception_table_length exception_table unknown1 unknown2| |
1 | 1171 |
|
128 | 1172 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
1 | 1173 |
|
9 | 1174 |
|
61 | 1175 |
Verbose ifTrue:[Transcript show:'attribute_length: 0x'; showCR:(attribute_length printStringRadix:16)]. |
9 | 1176 |
|
99 | 1177 |
minorVsn > 2 ifTrue:[ |
252 | 1178 |
unknown1 := inStream nextByte. |
1179 |
max_stack := inStream nextByte. |
|
1180 |
max_locals := inStream nextUnsignedShortMSB:msb. |
|
1181 |
unknown2 := inStream nextUnsignedShortMSB:msb. |
|
1182 |
Verbose ifTrue:[Transcript show:'?1: '; showCR:unknown1]. |
|
1183 |
Verbose ifTrue:[Transcript show:'?2: '; showCR:unknown2]. |
|
39 | 1184 |
] ifFalse:[ |
252 | 1185 |
max_stack := inStream nextByte. |
1186 |
max_locals := inStream nextByte. |
|
9 | 1187 |
]. |
1188 |
||
128 | 1189 |
code_length := inStream nextUnsignedShortMSB:msb. |
61 | 1190 |
Verbose ifTrue:[Transcript show:'code_length: '; showCR:(code_length printStringRadix:16)]. |
1191 |
Verbose ifTrue:[Transcript show:'code at pos: '; showCR:inStream position]. |
|
38 | 1192 |
|
5 | 1193 |
code := ByteArray new:code_length. |
1194 |
inStream nextBytes:code_length into:code startingAt:1. |
|
1 | 1195 |
|
61 | 1196 |
Verbose ifTrue:[Transcript show:'method code:'; showCR:code.]. |
9 | 1197 |
|
128 | 1198 |
exception_table_length := inStream nextUnsignedShortMSB:msb. |
61 | 1199 |
Verbose ifTrue:[Transcript show:'exception_table_length: '; showCR:(exception_table_length printStringRadix:16)]. |
5 | 1200 |
exception_table_length ~~ 0 ifTrue:[ |
252 | 1201 |
Verbose ifTrue:[Transcript show:'exceptionTable length:'; showCR:exception_table_length.]. |
9 | 1202 |
|
252 | 1203 |
exception_table := Array new:exception_table_length. |
1204 |
1 to:exception_table_length do:[:i | |
|
1205 |
|start_pc end_pc handler_pc catch_type| |
|
1 | 1206 |
|
252 | 1207 |
start_pc := inStream nextUnsignedShortMSB:msb. |
1208 |
end_pc := inStream nextUnsignedShortMSB:msb. |
|
1209 |
handler_pc := inStream nextUnsignedShortMSB:msb. |
|
1210 |
catch_type := constants at:(inStream nextUnsignedShortMSB:msb). |
|
1211 |
exception_table at:i put:(JavaExceptionTableEntry |
|
1212 |
startPC:start_pc |
|
1213 |
endPC:end_pc |
|
1214 |
handlerPC:handler_pc |
|
1215 |
catchType:catch_type). |
|
1216 |
]. |
|
1217 |
aJavaMethod setExceptionHandlerTable:exception_table. |
|
1 | 1218 |
]. |
1219 |
||
29 | 1220 |
aJavaMethod |
252 | 1221 |
setCode:code |
1222 |
maxStack:max_stack |
|
1223 |
maxLocals:max_locals |
|
1224 |
u1:unknown1 |
|
1225 |
u2:unknown2. |
|
5 | 1226 |
|
1227 |
self readAttributesFor:aJavaMethod. |
|
1228 |
^ true |
|
1229 |
||
1 | 1230 |
" |
1231 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
5 | 1232 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/Alignable.class' |
1 | 1233 |
" |
1234 |
||
1235 |
"Modified: 15.4.1996 / 15:33:28 / cg" |
|
5 | 1236 |
"Created: 15.4.1996 / 15:40:17 / cg" |
1237 |
! |
|
1238 |
||
83 | 1239 |
readExceptionsAttributeFor:aJavaMethod |
1240 |
|attribute_length exception_table_length exception_table| |
|
1241 |
||
128 | 1242 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
83 | 1243 |
|
128 | 1244 |
exception_table_length := inStream nextUnsignedShortMSB:msb. |
83 | 1245 |
exception_table_length ~~ 0 ifTrue:[ |
252 | 1246 |
exception_table := Array new:exception_table_length. |
1247 |
1 to:exception_table_length do:[:i | |
|
1248 |
|idx ex| |
|
83 | 1249 |
|
252 | 1250 |
idx := inStream nextUnsignedShortMSB:msb. |
1251 |
ex := constants at:idx. |
|
1252 |
exception_table at:i put:ex. |
|
1253 |
]. |
|
83 | 1254 |
]. |
1255 |
||
1256 |
Verbose ifTrue:[Transcript showCR:'method has an exceptionTable']. |
|
1257 |
||
1258 |
aJavaMethod setExceptionTable:exception_table. |
|
1259 |
^ true |
|
1260 |
||
1261 |
"Modified: 15.4.1996 / 15:33:28 / cg" |
|
1262 |
"Created: 15.4.1996 / 15:40:17 / cg" |
|
1263 |
! |
|
1264 |
||
5 | 1265 |
readLineNumberTableAttributeFor:aJavaMethod |
1266 |
|attribute_length line_number_table_length line_number_table| |
|
1267 |
||
128 | 1268 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
5 | 1269 |
|
128 | 1270 |
line_number_table_length := inStream nextUnsignedShortMSB:msb. |
5 | 1271 |
line_number_table_length ~~ 0 ifTrue:[ |
252 | 1272 |
line_number_table := Array new:line_number_table_length. |
1273 |
1 to:line_number_table_length do:[:i | |
|
1274 |
|start_pc line_number| |
|
5 | 1275 |
|
252 | 1276 |
start_pc := inStream nextUnsignedShortMSB:msb. |
1277 |
line_number := inStream nextUnsignedShortMSB:msb. |
|
1278 |
line_number_table at:i put:(start_pc -> line_number). |
|
1279 |
]. |
|
5 | 1280 |
]. |
1281 |
||
61 | 1282 |
Verbose ifTrue:[Transcript showCR:'method has a lineNumberTable']. |
9 | 1283 |
|
5 | 1284 |
aJavaMethod setLineNumberTable:line_number_table. |
1285 |
^ true |
|
1286 |
||
1287 |
" |
|
1288 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1289 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/java/lang/Boolean.class' |
|
1290 |
" |
|
1291 |
||
1292 |
"Modified: 15.4.1996 / 15:33:28 / cg" |
|
1293 |
"Created: 15.4.1996 / 15:40:17 / cg" |
|
1 | 1294 |
! |
1295 |
||
50 | 1296 |
readLocalVariableTableAttributeFor:aJavaMethod |
1297 |
|attribute_length local_variable_table_length local_variable_table| |
|
1298 |
||
128 | 1299 |
attribute_length := inStream nextUnsignedLongMSB:msb. |
50 | 1300 |
|
128 | 1301 |
local_variable_table_length := inStream nextUnsignedShortMSB:msb. |
50 | 1302 |
local_variable_table_length ~~ 0 ifTrue:[ |
252 | 1303 |
local_variable_table := JavaLocalVariableTable new:local_variable_table_length. |
1304 |
1 to:local_variable_table_length do:[:i | |
|
1305 |
|start_pc length name_index sig_index slot name signature| |
|
50 | 1306 |
|
252 | 1307 |
start_pc := inStream nextUnsignedShortMSB:msb. |
1308 |
length := inStream nextUnsignedShortMSB:msb. |
|
1309 |
name_index := inStream nextUnsignedShortMSB:msb. |
|
1310 |
name := constants at:name_index. |
|
1311 |
sig_index := inStream nextUnsignedShortMSB:msb. |
|
1312 |
signature := constants at:sig_index. |
|
1313 |
slot := inStream nextUnsignedShortMSB:msb. |
|
50 | 1314 |
|
252 | 1315 |
local_variable_table at:i put:(JavaLocalVariableTableEntry new |
1316 |
startPC:start_pc |
|
1317 |
length:length |
|
1318 |
name:name |
|
1319 |
signature:signature |
|
1320 |
slot:slot) |
|
1321 |
]. |
|
50 | 1322 |
]. |
1323 |
||
61 | 1324 |
Verbose ifTrue:[Transcript showCR:'method has a localvariableTable']. |
50 | 1325 |
|
1326 |
aJavaMethod setLocalVariableTable:local_variable_table. |
|
1327 |
^ true |
|
1328 |
||
1329 |
" |
|
1330 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1331 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/java/lang/Boolean.class' |
|
1332 |
" |
|
1333 |
||
1334 |
"Modified: 15.4.1996 / 15:33:28 / cg" |
|
1335 |
"Created: 15.4.1996 / 15:40:17 / cg" |
|
1336 |
! |
|
1337 |
||
38 | 1338 |
readMethodFor:aJavaClass |
9 | 1339 |
|m access_flags name_index name signature_index signature| |
1 | 1340 |
|
1341 |
"/ |
|
1342 |
"/ get a method |
|
1343 |
"/ |
|
128 | 1344 |
access_flags := inStream nextUnsignedShortMSB:msb. |
1345 |
name_index := inStream nextUnsignedShortMSB:msb. |
|
1346 |
signature_index := inStream nextUnsignedShortMSB:msb. |
|
1 | 1347 |
|
5 | 1348 |
name := constants at:name_index. |
1349 |
signature := constants at:signature_index. |
|
9 | 1350 |
|
61 | 1351 |
Verbose ifTrue:[Transcript show:'method name:'; showCR:name. |
252 | 1352 |
Transcript show:'signature:'; showCR:signature.]. |
9 | 1353 |
|
5 | 1354 |
m := JavaMethod new. |
1355 |
m setAccessFlags:access_flags. |
|
252 | 1356 |
m setName:name signature:signature. |
38 | 1357 |
m setJavaClass:aJavaClass. |
5 | 1358 |
|
1359 |
self readAttributesFor:m. |
|
1360 |
||
38 | 1361 |
aJavaClass addMethod:m name:name signature:signature. |
1 | 1362 |
|
1363 |
" |
|
1364 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1365 |
" |
|
1366 |
||
1367 |
"Modified: 15.4.1996 / 15:33:28 / cg" |
|
1368 |
"Created: 15.4.1996 / 16:48:49 / cg" |
|
1369 |
! |
|
1370 |
||
38 | 1371 |
readMethodsFor:aJavaClass |
1 | 1372 |
|methodsCount method| |
1373 |
||
1374 |
||
1375 |
"/ |
|
1376 |
"/ get methods |
|
1377 |
"/ |
|
128 | 1378 |
methodsCount := inStream nextUnsignedShortMSB:msb. |
61 | 1379 |
Verbose ifTrue:[Transcript show:'methodsCount = '; showCR:methodsCount]. |
1 | 1380 |
|
1381 |
1 to:methodsCount do:[:i | |
|
252 | 1382 |
Verbose ifTrue:[Transcript show:'method: '; showCR:i]. |
1383 |
method := self readMethodFor:aJavaClass |
|
1 | 1384 |
]. |
1385 |
||
1386 |
" |
|
1387 |
JavaClassReader readFile:'/phys/ibm3/hotjava/classes/browser/AddButton.class' |
|
1388 |
" |
|
1389 |
||
1390 |
"Modified: 15.4.1996 / 15:33:28 / cg" |
|
1391 |
"Created: 15.4.1996 / 16:46:30 / cg" |
|
1392 |
! ! |
|
1393 |
||
135 | 1394 |
!JavaClassReader class methodsFor:'documentation'! |
1 | 1395 |
|
1396 |
version |
|
264 | 1397 |
^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaClassReader.st,v 1.51 1998/01/17 14:44:47 cg Exp $' |
1 | 1398 |
! ! |
1399 |
JavaClassReader initialize! |