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