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