author | vranyj1 |
Wed, 14 Dec 2011 21:44:44 +0000 | |
branch | jk_new_structure |
changeset 1281 | b46adbe75503 |
parent 1276 | 5a302466ecb8 |
child 1321 | dc6b9bf7bfea |
permissions | -rw-r--r-- |
752 | 1 |
" |
877 | 2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
1152 | 3 |
|
1155 | 4 |
New code and modifications done at SWING Research Group [1]: |
1152 | 5 |
|
877 | 6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
7 |
SWING Research Group, Czech Technical University in Prague |
|
8 |
||
752 | 9 |
This software is furnished under a license and may be used |
10 |
only in accordance with the terms of that license and with the |
|
11 |
inclusion of the above copyright notice. This software may not |
|
12 |
be provided or otherwise made available to, or used by, any |
|
13 |
other person. No title to or ownership of the software is |
|
14 |
hereby transferred. |
|
877 | 15 |
|
1155 | 16 |
[1] Code written at SWING Research Group contains a signature |
17 |
of one of the above copright owners. For exact set of such code, |
|
18 |
see the differences between this version and version stx:libjava |
|
1152 | 19 |
as of 1.9.2010 |
752 | 20 |
" |
21 |
"{ Package: 'stx:libjava' }" |
|
22 |
||
23 |
Object subclass:#Java |
|
24 |
instanceVariableNames:'' |
|
959 | 25 |
classVariableNames:'Classes UnresolvedClassRefs Release ClassPath ClassPathExt |
26 |
SourceDirectories CacheDirectory JavaHome InternedStrings |
|
27 |
Java_lang_String Java_lang_Class PrettyPrintStyle |
|
28 |
LastArgumentString Threads ExcludedClassPath FailedToLoadClasses |
|
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
29 |
SourceCache SourceArchiveCache JavaClassLoaderQuerySignal |
1249 | 30 |
ClassLoaderQuerySignal ThreadsAccess' |
752 | 31 |
poolDictionaries:'' |
32 |
category:'Languages-Java-Support' |
|
33 |
! |
|
34 |
||
35 |
!Java class methodsFor:'documentation'! |
|
36 |
||
37 |
copyright |
|
38 |
" |
|
877 | 39 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
1152 | 40 |
|
1155 | 41 |
New code and modifications done at SWING Research Group [1]: |
1152 | 42 |
|
877 | 43 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
44 |
SWING Research Group, Czech Technical University in Prague |
|
45 |
||
752 | 46 |
This software is furnished under a license and may be used |
47 |
only in accordance with the terms of that license and with the |
|
48 |
inclusion of the above copyright notice. This software may not |
|
49 |
be provided or otherwise made available to, or used by, any |
|
50 |
other person. No title to or ownership of the software is |
|
51 |
hereby transferred. |
|
877 | 52 |
|
1155 | 53 |
[1] Code written at SWING Research Group contains a signature |
54 |
of one of the above copright owners. For exact set of such code, |
|
55 |
see the differences between this version and version stx:libjava |
|
1152 | 56 |
as of 1.9.2010 |
877 | 57 |
|
58 |
" |
|
752 | 59 |
! ! |
60 |
||
61 |
!Java class methodsFor:'accessing'! |
|
62 |
||
1021
8ae6c261878a
changed class loaders order, loading of primitive arrays, refactoring coming soon..
hlopkmar
parents:
1016
diff
changeset
|
63 |
classForName: aString |
1033 | 64 |
^JavaVM classForName: aString. |
752 | 65 |
! |
66 |
||
1033 | 67 |
classNamed: aString |
68 |
^JavaVM classNamed: aString. |
|
752 | 69 |
! |
70 |
||
1035 | 71 |
classRegistry |
72 |
||
73 |
<resource: #obsolete> |
|
74 |
||
75 |
self breakPoint: #mh. |
|
76 |
self breakPoint: #jv. |
|
77 |
||
78 |
^ JavaVM classRegistry. |
|
79 |
||
80 |
"Modified: / 21-10-2011 / 11:12:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
81 |
! |
|
82 |
||
752 | 83 |
intern:aJavaString |
84 |
|stString internedString| |
|
85 |
||
86 |
stString := self as_ST_String:aJavaString. |
|
87 |
internedString := InternedStrings at:stString ifAbsent:nil. |
|
88 |
internedString isNil ifTrue:[ |
|
89 |
InternedStrings at:stString put:aJavaString. |
|
90 |
internedString := aJavaString |
|
91 |
]. |
|
92 |
^ internedString |
|
93 |
! |
|
94 |
||
959 | 95 |
javaExtDirs |
96 |
||
97 |
^Java release javaExtDirs |
|
98 |
"/ ,{ |
|
99 |
"/ ((Smalltalk packageDirectoryForPackageId: 'stx:libjava') asFilename |
|
100 |
"/ / 'java' / 'libs') }. |
|
101 |
||
102 |
"Created: / 31-08-2011 / 22:55:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
103 |
! |
|
104 |
||
752 | 105 |
java_lang_Class |
106 |
Java_lang_Class isNil ifTrue:[ |
|
107 |
Java_lang_Class := self at:'java.lang.Class' |
|
108 |
]. |
|
109 |
^ Java_lang_Class |
|
110 |
||
111 |
"Created: 26.3.1997 / 13:42:59 / cg" |
|
112 |
"Modified: 26.3.1997 / 13:46:24 / cg" |
|
113 |
! |
|
114 |
||
115 |
java_lang_String |
|
1027
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
116 |
Java_lang_String isNil ifTrue: [ |
1036 | 117 |
Java_lang_String := JavaVM classNamed: 'java/lang/String'. |
752 | 118 |
]. |
1027
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
119 |
^ Java_lang_String. |
752 | 120 |
|
1036 | 121 |
"Created: / 26-03-1997 / 13:43:17 / cg" |
122 |
"Modified: / 21-10-2011 / 13:41:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
752 | 123 |
! |
124 |
||
125 |
prettyPrintStyle |
|
126 |
^ PrettyPrintStyle |
|
127 |
||
128 |
"Created: 1.8.1997 / 10:37:57 / cg" |
|
129 |
! |
|
130 |
||
131 |
release |
|
132 |
||
133 |
^Release |
|
134 |
||
135 |
"Created: / 22-11-2010 / 12:38:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
136 |
! |
|
137 |
||
138 |
release: aJavaRelease |
|
139 |
||
140 |
Release := aJavaRelease. |
|
141 |
||
142 |
" |
|
143 |
Java release: JavaRelease openJDK6. |
|
144 |
Java release: JavaRelease sunJDK6. |
|
145 |
||
146 |
" |
|
147 |
||
148 |
"Created: / 22-11-2010 / 12:38:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
149 |
"Modified: / 30-11-2010 / 11:54:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
150 |
! |
|
151 |
||
152 |
systemPropertyAt:key put:something |
|
153 |
JavaVM systemProperties at:key put:something |
|
154 |
||
155 |
"Created: / 9.1.1999 / 14:49:35 / cg" |
|
156 |
! ! |
|
157 |
||
158 |
!Java class methodsFor:'accessing paths'! |
|
159 |
||
1276
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
160 |
addToClassPath:pathOrCollection |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
161 |
^ self addToPath:ClassPath path:pathOrCollection |
752 | 162 |
|
163 |
"Created: / 01-08-1997 / 21:10:07 / cg" |
|
164 |
"Modified: / 17-09-1998 / 20:43:55 / cg" |
|
1276
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
165 |
"Modified: / 14-12-2011 / 00:04:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 166 |
! |
167 |
||
1033 | 168 |
addToClassPathInRuntime: aPath |
169 |
| path file url scl | |
|
883 | 170 |
|
171 |
"Java might not be loaded/or initialized, in this case |
|
172 |
there is no no need to inform java about new entry in classpath" |
|
1033 | 173 |
JavaVM booted ifFalse: [ ^ self ]. |
1059 | 174 |
scl := JavaVM systemClassLoader. |
175 |
scl isNil ifTrue:[ ^self ]. |
|
1033 | 176 |
path := Java as_String: aPath asString. |
177 |
file := ((JavaVM at: 'java.io.File') new) |
|
178 |
perform: #'<init>(Ljava/lang/String;)V' with: path; |
|
179 |
yourself. |
|
883 | 180 |
url := file perform: #'toURL()Ljava/net/URL;'. |
889 | 181 |
scl perform: #'addURL(Ljava/net/URL;)V' with: url. |
883 | 182 |
|
183 |
"Created: / 01-08-1997 / 21:10:07 / cg" |
|
184 |
"Modified: / 17-09-1998 / 20:43:55 / cg" |
|
185 |
"Created: / 07-08-2011 / 14:01:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
186 |
! |
|
187 |
||
1276
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
188 |
addToPath:cp filesMatching:pattern in:path |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
189 |
|dir| |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
190 |
|
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
191 |
dir := path asFilename. |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
192 |
dir directoryContents do:[:fname | |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
193 |
(fname matches:pattern) ifTrue:[ |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
194 |
|p| |
1133 | 195 |
|
1276
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
196 |
p := (dir / fname) pathName. |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
197 |
(cp includes:p) ifFalse:[ |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
198 |
cp add:p. |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
199 |
cp == ClassPath ifTrue:[ |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
200 |
self addToClassPathInRuntime:p. |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
201 |
]. |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
202 |
FailedToLoadClasses := nil |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
203 |
] |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
204 |
] |
1133 | 205 |
]. |
206 |
||
1276
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
207 |
"Created: / 14-12-2011 / 00:04:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
208 |
! |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
209 |
|
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
210 |
addToPath:cp path:pathOrCollection |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
211 |
|path| |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
212 |
|
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
213 |
(pathOrCollection isSequenceable and:[pathOrCollection isCharacters not]) ifTrue:[ |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
214 |
pathOrCollection do:[:each | |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
215 |
self addToPath:cp path:each |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
216 |
]. |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
217 |
^ self. |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
218 |
]. |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
219 |
path := pathOrCollection asFilename. |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
220 |
(pathOrCollection asString includes:$*) ifTrue:[ |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
221 |
self |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
222 |
addToPath:cp |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
223 |
filesMatching:path baseName |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
224 |
in:path directoryName. |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
225 |
] ifFalse:[ |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
226 |
(ClassPath includes:pathOrCollection asString) ifFalse:[ |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
227 |
cp add:pathOrCollection asString. |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
228 |
cp == ClassPath ifTrue:[ |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
229 |
self addToClassPathInRuntime:pathOrCollection. |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
230 |
]. |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
231 |
FailedToLoadClasses := nil |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
232 |
] |
752 | 233 |
] |
234 |
||
1276
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
235 |
"Created: / 01-08-1997 / 21:10:07 / cg" |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
236 |
"Modified: / 17-09-1998 / 20:43:55 / cg" |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
237 |
"Created: / 14-12-2011 / 00:03:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
238 |
! |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
239 |
|
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
240 |
addToSourcePath:pathOrCollection |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
241 |
|
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
242 |
self addToPath: SourceDirectories path: pathOrCollection |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
243 |
|
752 | 244 |
"Created: / 02-08-1997 / 14:12:31 / cg" |
1276
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
245 |
"Modified: / 14-12-2011 / 00:08:24 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 246 |
! |
247 |
||
754 | 248 |
cacheDirectory |
249 |
||
756 | 250 |
CacheDirectory ifNil:[ |
251 |
CacheDirectory := Filename homeDirectory / '.smalltalk' / 'libjava' / 'caches' / |
|
758 | 252 |
(((Smalltalk at:#stx_libjava) svnRepositoryUrlBase copyReplaceAll:$/ with:$_) replaceAll:$: with:$_) |
756 | 253 |
]. |
254 |
^CacheDirectory |
|
754 | 255 |
|
256 |
"Created: / 08-04-2011 / 15:02:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
756 | 257 |
"Modified: / 08-04-2011 / 16:58:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
754 | 258 |
! |
259 |
||
752 | 260 |
classPath |
908
d990d0d520d9
ClassLoader trickery, maybe not a good idea, we will see.
vranyj1
parents:
906
diff
changeset
|
261 |
|
1276
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
262 |
^ ClassPath , |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
263 |
self classPathFromEnvironment , |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
264 |
self classPathFromPackages . |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
265 |
|
752 | 266 |
|
1276
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
267 |
"/ |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
268 |
"/ ^ "for testing only" |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
269 |
"/ "/Release classPath, |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
270 |
"/ |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
271 |
"/ {(packagePath / 'java' / 'libjava-projects' / 'Conversion' / 'bin') |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
272 |
"/ pathName. |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
273 |
"/ (packagePath / 'java' / 'libjava-support' / 'bin') pathName} |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
274 |
"/ , ((packagePath / 'java' / 'libs') directoryContentsAsFilenames |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
275 |
"/ select:[:f | f suffix = 'jar'] |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
276 |
"/ thenCollect:[:f | f pathName]) |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
277 |
"/ , (ClassPath ? #()) , cp |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
278 |
"/ |
908
d990d0d520d9
ClassLoader trickery, maybe not a good idea, we will see.
vranyj1
parents:
906
diff
changeset
|
279 |
" |
d990d0d520d9
ClassLoader trickery, maybe not a good idea, we will see.
vranyj1
parents:
906
diff
changeset
|
280 |
Java classPath |
d990d0d520d9
ClassLoader trickery, maybe not a good idea, we will see.
vranyj1
parents:
906
diff
changeset
|
281 |
" |
d990d0d520d9
ClassLoader trickery, maybe not a good idea, we will see.
vranyj1
parents:
906
diff
changeset
|
282 |
|
d990d0d520d9
ClassLoader trickery, maybe not a good idea, we will see.
vranyj1
parents:
906
diff
changeset
|
283 |
"Created: / 07-02-1997 / 19:23:45 / cg" |
1276
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
284 |
"Modified: / 13-12-2011 / 23:56:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 285 |
! |
286 |
||
287 |
classPath:aCollectionOfPaths |
|
288 |
ClassPath := aCollectionOfPaths asOrderedCollection. |
|
289 |
FailedToLoadClasses := nil |
|
290 |
||
291 |
"Created: / 7.2.1997 / 19:23:45 / cg" |
|
292 |
"Modified: / 17.9.1998 / 20:44:09 / cg" |
|
293 |
! |
|
294 |
||
1276
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
295 |
classPathFromEnvironment |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
296 |
|
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
297 |
^ ((OperatingSystem getEnvironment:'CLASSPATH') ? '') |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
298 |
tokensBasedOn:OperatingSystem pathSeparator |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
299 |
|
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
300 |
"Modified (format): / 13-12-2011 / 23:54:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
301 |
! |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
302 |
|
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
303 |
classPathFromPackages |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
304 |
|
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
305 |
| cp | |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
306 |
|
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
307 |
cp := OrderedCollection new. |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
308 |
ProjectDefinition allSubclassesDo:[:pkg| |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
309 |
self addToPath: cp path: pkg javaClassPath. |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
310 |
]. |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
311 |
^cp. |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
312 |
|
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
313 |
|
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
314 |
" |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
315 |
Java classPathFromPackages |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
316 |
" |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
317 |
|
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
318 |
"Created: / 07-02-1997 / 19:23:45 / cg" |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
319 |
"Created: / 13-12-2011 / 23:56:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
320 |
! |
5a302466ecb8
Default class path hanling changed, now each Smalltalk/X package can define its own class path, that is included initial class path
vranyj1
parents:
1259
diff
changeset
|
321 |
|
752 | 322 |
effectiveClassPath |
323 |
||
959 | 324 |
ClassPathExt ifNil:[ |
325 |
ClassPathExt := OrderedCollection new. |
|
326 |
self javaExtDirs do:[:dir| |
|
327 |
dir isDirectory ifTrue:[ |
|
328 |
dir directoryContentsAsFilenamesDo:[:file| |
|
329 |
file suffix = 'jar' ifTrue:[ |
|
330 |
ClassPathExt add: file pathName |
|
331 |
] |
|
332 |
] |
|
333 |
] |
|
334 |
] |
|
335 |
]. |
|
336 |
||
337 |
^self release classPath , "ClassPathExt ," self classPath |
|
752 | 338 |
|
339 |
" |
|
908
d990d0d520d9
ClassLoader trickery, maybe not a good idea, we will see.
vranyj1
parents:
906
diff
changeset
|
340 |
Java effectiveClassPath |
752 | 341 |
" |
342 |
||
343 |
"Created: / 22-11-2010 / 13:03:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
344 |
"Modified: / 17-01-2011 / 09:44:16 / kursjan <kursjan@fit.cvut.cz>" |
|
959 | 345 |
"Modified: / 31-08-2011 / 23:17:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 346 |
! |
347 |
||
348 |
effectiveSourceDirectories |
|
349 |
||
350 |
^Release sourcePath , |
|
1281 | 351 |
self sourcePath |
752 | 352 |
|
353 |
" |
|
354 |
Java effectiveSourceDirectories |
|
355 |
" |
|
356 |
||
357 |
"Created: / 30-11-2010 / 11:53:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
358 |
! |
|
359 |
||
360 |
excludedClassPath |
|
361 |
^ ExcludedClassPath |
|
362 |
||
363 |
"Modified: / 7.2.1997 / 19:23:55 / cg" |
|
364 |
"Created: / 27.1.1998 / 21:57:13 / cg" |
|
365 |
! |
|
366 |
||
367 |
isExcludedFromClassPath:fileName |
|
368 |
|nm| |
|
369 |
||
370 |
nm := fileName asFilename pathName. |
|
371 |
ExcludedClassPath do:[:excludedPath | |
|
372 |
(nm startsWith:excludedPath) ifTrue:[^ true]. |
|
373 |
]. |
|
374 |
^ false |
|
375 |
||
376 |
"Created: / 27.1.1998 / 22:00:40 / cg" |
|
377 |
! |
|
378 |
||
379 |
javaHome |
|
380 |
^ JavaHome ifNil:[Release javaHome] |
|
381 |
||
382 |
"Created: / 06-08-1997 / 00:53:19 / cg" |
|
383 |
"Modified: / 22-11-2010 / 12:39:19 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
384 |
! |
|
385 |
||
386 |
javaHome:aPath |
|
387 |
||
388 |
<resource: #obsolete> |
|
389 |
||
390 |
self obsoleteMethodWarning: 'javaHome is now controlled by java release'. |
|
391 |
||
392 |
JavaHome := aPath |
|
393 |
||
394 |
"Created: / 06-08-1997 / 00:53:23 / cg" |
|
395 |
"Modified: / 22-11-2010 / 12:40:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
396 |
! |
|
397 |
||
398 |
newJavaHome:newJavaHome |
|
399 |
self javaHome:newJavaHome. |
|
400 |
||
401 |
! |
|
402 |
||
403 |
removeFromClassPath:aPath |
|
404 |
(ClassPath includes:aPath) ifTrue:[ |
|
405 |
ClassPath remove:aPath |
|
406 |
] |
|
407 |
||
408 |
"Modified: 7.2.1997 / 19:23:55 / cg" |
|
409 |
"Created: 1.8.1997 / 21:10:21 / cg" |
|
410 |
! |
|
411 |
||
412 |
removeFromSourcePath:aPath |
|
413 |
(SourceDirectories includes:aPath) ifTrue:[ |
|
414 |
SourceDirectories remove:aPath |
|
415 |
] |
|
416 |
||
417 |
"Modified: 7.2.1997 / 19:23:55 / cg" |
|
418 |
"Created: 2.8.1997 / 14:13:01 / cg" |
|
419 |
! |
|
420 |
||
421 |
sourceDirectories |
|
422 |
^ SourceDirectories |
|
423 |
! |
|
424 |
||
425 |
sourceDirectories:aCollectionOfPaths |
|
426 |
SourceDirectories := aCollectionOfPaths asOrderedCollection |
|
427 |
||
428 |
" |
|
429 |
Java |
|
430 |
sourceDirectories:#( |
|
431 |
'/phys/ibm3/java/src' |
|
432 |
) |
|
433 |
" |
|
434 |
||
435 |
||
436 |
! |
|
437 |
||
438 |
sourcePath |
|
1281 | 439 |
^ |
440 |
SourceDirectories ? #() , |
|
441 |
self sourcePathFromPackages |
|
442 |
||
443 |
"Created: / 16-01-1998 / 13:26:55 / cg" |
|
444 |
"Modified: / 14-12-2011 / 20:00:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
445 |
! |
|
446 |
||
447 |
sourcePathFromPackages |
|
448 |
||
449 |
| sp | |
|
752 | 450 |
|
1281 | 451 |
sp := OrderedCollection new. |
452 |
ProjectDefinition allSubclassesDo:[:pkg| |
|
453 |
self addToPath: sp path: pkg javaSourcePath. |
|
454 |
]. |
|
455 |
^sp. |
|
456 |
||
457 |
||
458 |
" |
|
459 |
Java classPathFromPackages |
|
460 |
" |
|
461 |
||
462 |
"Created: / 07-02-1997 / 19:23:45 / cg" |
|
463 |
"Created: / 14-12-2011 / 19:59:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 464 |
! ! |
465 |
||
466 |
!Java class methodsFor:'change & update'! |
|
467 |
||
468 |
update: what with: param from: sender |
|
469 |
||
470 |
what == #restarted ifTrue:[ |
|
471 |
self reinitialize. |
|
472 |
] |
|
473 |
||
474 |
"Created: / 14-12-2010 / 21:00:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
475 |
! ! |
|
476 |
||
477 |
!Java class methodsFor:'class initialization'! |
|
478 |
||
479 |
initAllClasses |
|
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
480 |
| system | |
752 | 481 |
|
1033 | 482 |
FailedToLoadClasses := nil. |
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
483 |
self initAllStaticFields. |
1033 | 484 |
system := JavaVM classForName: 'java.lang.System'. |
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
485 |
system isInitialized ifFalse: [ self initSystemClass. ]. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
486 |
self allClassesDo: [:cls | cls isInitialized ifFalse: [ cls classInit ] ] |
752 | 487 |
|
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
488 |
" |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
489 |
Java initAllClasses" |
752 | 490 |
"Modified: / 27.11.1998 / 00:33:05 / cg" |
491 |
! |
|
492 |
||
493 |
initAllStaticFields |
|
494 |
self allClassesDo:[:cls | |
|
495 |
cls initializeStaticFields |
|
496 |
] |
|
497 |
||
498 |
! |
|
499 |
||
500 |
initSystemClass |
|
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
501 |
| system | |
1033 | 502 |
|
503 |
system := JavaVM classForName: 'java.lang.System'. |
|
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
504 |
system isNil ifTrue: [ |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
505 |
"/ JavaVM initializeVM. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
506 |
"/ system := Java at:'java.lang.System'. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
507 |
"/ system isNil ifTrue:[ |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
508 |
self warn: 'JavaVM: no ''' , 'java.lang.System' allBold , ''' class.'. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
509 |
|
752 | 510 |
"/ self error:'no ''java.lang.System'' class'. |
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
511 |
|
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
512 |
^ |
752 | 513 |
"/ ]. |
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
514 |
self |
752 | 515 |
]. |
516 |
system classInit. |
|
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
517 |
(system implements: #'initializeSystemClass()V') ifTrue: [ |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
518 |
system "invokeStatic:" perform: #'initializeSystemClass()V'. |
752 | 519 |
]. |
520 |
||
521 |
" |
|
522 |
Java initSystemClass |
|
523 |
||
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
524 |
(Java at:'java.lang.System') |
752 | 525 |
perform:#'getProperty(Ljava/lang/String;)Ljava/lang/String;' |
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
526 |
with:(Java as_String:'java.home')" |
752 | 527 |
"Modified: / 10.11.1998 / 12:39:58 / cg" |
528 |
! |
|
529 |
||
530 |
initialize |
|
531 |
JavaNativeMethod flushAllCachedNativeMethods. |
|
532 |
InternedStrings := Dictionary new. |
|
533 |
FailedToLoadClasses := nil. |
|
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
534 |
ClassPath := OrderedCollection new. |
959 | 535 |
ClassPathExt := nil. |
752 | 536 |
ExcludedClassPath := OrderedCollection new. |
537 |
SourceCache := CacheDictionary new: 32. |
|
538 |
SourceArchiveCache := CacheDictionary new: 32. |
|
1249 | 539 |
Threads := IdentityDictionary new. |
540 |
ThreadsAccess := RecursionLock forMutualExclusion. |
|
752 | 541 |
self initializeRelease. "lazy initialization of Release" |
542 |
self initializePrettyPrintStyle. |
|
1249 | 543 |
ObjectMemory addDependent: self. |
752 | 544 |
|
545 |
" |
|
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
546 |
Java flushAllJavaResources. |
752 | 547 |
Java initialize. |
548 |
JavaVM initializeVM |
|
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
549 |
Java classPath inspect" |
1249 | 550 |
|
752 | 551 |
"Modified: / 06-11-2001 / 09:24:12 / cg" |
552 |
"Created: / 03-10-2010 / 15:54:02 / Jan Kurs <kurs.jan@post.cz>" |
|
553 |
"Modified: / 15-10-2010 / 17:37:20 / Jan Kurs <kurs.jan@post.cz>" |
|
959 | 554 |
"Modified: / 31-08-2011 / 22:50:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1249 | 555 |
"Modified: / 09-12-2011 / 13:16:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 556 |
! |
557 |
||
558 |
initializePrettyPrintStyle |
|
559 |
PrettyPrintStyle := IdentityDictionary new. |
|
560 |
PrettyPrintStyle at:#accessAttribute put:(#color -> (Color red:0 green:0 blue:25)). |
|
561 |
PrettyPrintStyle at:#className put:(Array with:(#color -> Color black) with:#bold). |
|
562 |
PrettyPrintStyle at:#methodName put:(Array with:(#color -> Color black) with:#bold). |
|
563 |
PrettyPrintStyle at:#code put:(#color -> Color black). |
|
564 |
||
565 |
||
566 |
" |
|
567 |
Java initializePrettyPrintStyle |
|
568 |
" |
|
569 |
||
570 |
"Created: 1.8.1997 / 11:08:43 / cg" |
|
571 |
"Modified: 1.8.1997 / 11:09:58 / cg" |
|
572 |
! |
|
573 |
||
574 |
initializeRelease |
|
575 |
||
576 |
Release ifNil:[Release := JavaRelease any]. |
|
577 |
||
578 |
" |
|
579 |
Release := nil. |
|
580 |
self initializeRelease. |
|
581 |
Release |
|
582 |
" |
|
583 |
||
584 |
"Created: / 22-11-2010 / 13:41:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
585 |
! |
|
586 |
||
587 |
reinitAllClasses |
|
588 |
self markAllClassesUninitialized. |
|
589 |
self initAllClasses |
|
590 |
||
591 |
" |
|
592 |
Java reinitAllClasses |
|
593 |
" |
|
594 |
||
595 |
"Modified: / 4.1.1998 / 00:34:29 / cg" |
|
596 |
! |
|
597 |
||
598 |
reinitialize |
|
599 |
"/ all JavaThreads are lost on a restart (for now) |
|
600 |
||
601 |
FailedToLoadClasses := nil. |
|
602 |
Threads := nil. |
|
603 |
||
604 |
"Kludge" |
|
605 |
JavaMethod reinitialize. |
|
606 |
JavaMethodWithException reinitialize. |
|
607 |
JavaMethodWithHandler reinitialize. |
|
608 |
JavaNativeMethod reinitialize. |
|
609 |
JavaNativeMethod flushAllCachedNativeMethods. |
|
610 |
||
611 |
||
612 |
" |
|
613 |
Java reinitialize |
|
614 |
" |
|
615 |
||
616 |
"Created: / 26-08-1997 / 20:07:00 / cg" |
|
617 |
"Modified: / 27-04-1998 / 14:57:23 / cg" |
|
618 |
"Modified: / 14-12-2010 / 21:30:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
619 |
! |
|
620 |
||
621 |
startupJavaSystem |
|
1249 | 622 |
| javaEventThread haveEventThread haveScreenUpdater | |
752 | 623 |
FailedToLoadClasses := nil. |
1249 | 624 |
|
752 | 625 |
"/ |
626 |
"/ check if already running |
|
627 |
"/ |
|
1249 | 628 |
|
752 | 629 |
haveEventThread := true. |
630 |
javaEventThread := JavaVM javaEventThread. |
|
1249 | 631 |
(javaEventThread isNil or: [ javaEventThread isDead ]) ifTrue: [ |
752 | 632 |
haveEventThread := false |
633 |
]. |
|
634 |
haveScreenUpdater := false. |
|
1249 | 635 |
haveEventThread ifTrue: [ |
636 |
self threadsDo: [ |
|
637 |
:aJavaThread | |
|
638 |
aJavaThread name = 'JAVA-Screen Updater' ifTrue: [ |
|
639 |
aJavaThread isDead ifFalse: [ |
|
752 | 640 |
"/ already running |
641 |
haveScreenUpdater := true |
|
642 |
] |
|
643 |
] |
|
644 |
]. |
|
645 |
]. |
|
1249 | 646 |
(haveEventThread and: [ haveScreenUpdater ]) ifTrue: [ ^ self ]. |
647 |
JavaClass orderOfClassInits isNil ifTrue: [ |
|
752 | 648 |
"/ the very first start ... |
1249 | 649 |
'JAVA [info]: (re)initializing JAVA environment completely ...' |
650 |
infoPrintCR. |
|
752 | 651 |
JavaVM initializeVM. |
1249 | 652 |
] ifFalse: [ JavaVM initializeVMIfNoEventThreadRunning ]. |
752 | 653 |
'JAVA [info]: done JAVA initialization.' infoPrintCR. |
654 |
||
655 |
" |
|
1249 | 656 |
Java startupJavaSystem" |
752 | 657 |
|
1249 | 658 |
"Modified: / 24-12-1999 / 01:37:49 / cg" |
659 |
"Modified: / 09-12-2011 / 12:50:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
752 | 660 |
! |
661 |
||
662 |
terminateAllThreads |
|
1118 | 663 |
| myself threadsToKill semaphore | |
1116
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1113
diff
changeset
|
664 |
Threads isNil ifTrue: [ ^ self ]. |
752 | 665 |
myself := Processor activeProcess. |
666 |
threadsToKill := IdentitySet new. |
|
1116
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1113
diff
changeset
|
667 |
Threads do: [ |
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1113
diff
changeset
|
668 |
:aJavaThread | |
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1113
diff
changeset
|
669 |
aJavaThread ~~ myself ifTrue: [ |
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1113
diff
changeset
|
670 |
(aJavaThread isNil or: [ aJavaThread == 0 ]) ifFalse: [ |
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1113
diff
changeset
|
671 |
(aJavaThread isMemberOf: JavaProcess) ifTrue: [ |
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1113
diff
changeset
|
672 |
aJavaThread isDead ifFalse: [ threadsToKill add: aJavaThread ] |
752 | 673 |
] |
674 |
] |
|
675 |
] |
|
676 |
]. |
|
1116
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1113
diff
changeset
|
677 |
threadsToKill size > 0 ifTrue: [ |
1118 | 678 |
Logger |
679 |
log: 'Killing ' , threadsToKill size printString , ' java processes' |
|
680 |
severity: #info |
|
681 |
facility: #JVM. |
|
682 |
semaphore := Semaphore new: 1 - threadsToKill size. |
|
683 |
semaphore name: 'Java thread killer'. |
|
684 |
threadsToKill do: [ |
|
685 |
:aThread | |
|
686 |
aThread == JavaVM javaScreenUpdaterThread ifTrue: [ self halt ]. |
|
687 |
aThread == JavaVM javaEventQueueThread ifTrue: [ self halt ]. |
|
688 |
aThread |
|
689 |
addExitAction: [ |
|
690 |
Logger |
|
691 |
log: 'Java thread killed successfully' |
|
692 |
severity: #info |
|
693 |
facility: #JVM. |
|
694 |
semaphore signal |
|
695 |
]. |
|
1130 | 696 |
|
1118 | 697 |
aThread terminate |
698 |
]. |
|
1119
0f4d4bc3d346
warning!! bug possibly fixed :) probably not but maybe ;)
hlopkmar
parents:
1118
diff
changeset
|
699 |
semaphore wait. |
752 | 700 |
]. |
1119
0f4d4bc3d346
warning!! bug possibly fixed :) probably not but maybe ;)
hlopkmar
parents:
1118
diff
changeset
|
701 |
JavaVM releaseAllMonitors. |
1118 | 702 |
Logger |
703 |
log: 'No Java threads running at this point' |
|
704 |
severity: #info |
|
705 |
facility: #JVM. |
|
1130 | 706 |
|
752 | 707 |
Threads := nil. |
708 |
||
709 |
" |
|
1116
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1113
diff
changeset
|
710 |
Java terminateAllThreads" |
752 | 711 |
|
1116
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1113
diff
changeset
|
712 |
"Created: / 26-08-1997 / 19:57:40 / cg" |
3d108134cd76
in-the-middle-of-the-work commit, may break stuff, fixes to come soon :)
hlopkmar
parents:
1113
diff
changeset
|
713 |
"Modified: / 24-12-1999 / 02:34:53 / cg" |
1130 | 714 |
"Modified: / 17-11-2011 / 21:31:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 715 |
! ! |
716 |
||
1016
2b20730b8717
work on ticket #28(illegal access after evaluating expresion in workspace).
hlopkmar
parents:
1000
diff
changeset
|
717 |
!Java class methodsFor:'debugging'! |
2b20730b8717
work on ticket #28(illegal access after evaluating expresion in workspace).
hlopkmar
parents:
1000
diff
changeset
|
718 |
|
2b20730b8717
work on ticket #28(illegal access after evaluating expresion in workspace).
hlopkmar
parents:
1000
diff
changeset
|
719 |
dontHaltOnKnownBugs |
2b20730b8717
work on ticket #28(illegal access after evaluating expresion in workspace).
hlopkmar
parents:
1000
diff
changeset
|
720 |
Object disableBreakPoint: #knownBugs. |
2b20730b8717
work on ticket #28(illegal access after evaluating expresion in workspace).
hlopkmar
parents:
1000
diff
changeset
|
721 |
|
2b20730b8717
work on ticket #28(illegal access after evaluating expresion in workspace).
hlopkmar
parents:
1000
diff
changeset
|
722 |
"Created: / 09-10-2011 / 17:29:17 / m" |
2b20730b8717
work on ticket #28(illegal access after evaluating expresion in workspace).
hlopkmar
parents:
1000
diff
changeset
|
723 |
! |
2b20730b8717
work on ticket #28(illegal access after evaluating expresion in workspace).
hlopkmar
parents:
1000
diff
changeset
|
724 |
|
1259 | 725 |
dumpConfig |
726 |
||
727 |
Transcript notNil ifTrue:[ |
|
728 |
self dumpConfigOn: Transcript |
|
729 |
] ifFalse:[ |
|
730 |
self dumpConfigOn: Stdout |
|
731 |
] |
|
732 |
||
733 |
"Created: / 10-12-2011 / 12:54:28 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
734 |
! |
|
735 |
||
736 |
dumpConfigOn: stream |
|
737 |
"Prints current config (java home, initial system properties etc) on a stream." |
|
738 |
||
739 |
| props | |
|
740 |
||
741 |
Java release dumpConfigOn: stream. |
|
742 |
props := Dictionary new. |
|
743 |
JavaVM initializeSystemPropertiesInto: props. |
|
744 |
stream nextPutAll: '== Initial system properties =='; cr. |
|
745 |
props keysAndValuesDo:[:key :value| |
|
746 |
'%-30s : %s' printf: { key . value } on: stream. |
|
747 |
stream cr. |
|
748 |
]. |
|
749 |
||
750 |
" |
|
751 |
Java dumpConfigOn: Transcript. |
|
752 |
" |
|
753 |
||
754 |
"Created: / 10-12-2011 / 12:54:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
755 |
! |
|
756 |
||
1016
2b20730b8717
work on ticket #28(illegal access after evaluating expresion in workspace).
hlopkmar
parents:
1000
diff
changeset
|
757 |
haltOnKnownBugs |
2b20730b8717
work on ticket #28(illegal access after evaluating expresion in workspace).
hlopkmar
parents:
1000
diff
changeset
|
758 |
Object enableBreakPoint: #knownBugs. |
2b20730b8717
work on ticket #28(illegal access after evaluating expresion in workspace).
hlopkmar
parents:
1000
diff
changeset
|
759 |
|
2b20730b8717
work on ticket #28(illegal access after evaluating expresion in workspace).
hlopkmar
parents:
1000
diff
changeset
|
760 |
"Created: / 09-10-2011 / 17:29:05 / m" |
2b20730b8717
work on ticket #28(illegal access after evaluating expresion in workspace).
hlopkmar
parents:
1000
diff
changeset
|
761 |
! ! |
2b20730b8717
work on ticket #28(illegal access after evaluating expresion in workspace).
hlopkmar
parents:
1000
diff
changeset
|
762 |
|
752 | 763 |
!Java class methodsFor:'enumerating'! |
764 |
||
765 |
allClasses |
|
766 |
||
1039 | 767 |
^JavaVM classRegistry classes |
752 | 768 |
|
1039 | 769 |
"Modified: / 28-01-1998 / 01:42:04 / cg" |
770 |
"Modified: / 23-10-2011 / 20:14:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 771 |
! |
772 |
||
773 |
allClassesDo:aBlock |
|
1039 | 774 |
|
775 |
^JavaVM classRegistry classesDo: aBlock |
|
776 |
||
777 |
"Modified: / 23-10-2011 / 20:14:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 778 |
! ! |
779 |
||
780 |
!Java class methodsFor:'object conversions'! |
|
781 |
||
782 |
as_Float:aNumber |
|
783 |
"convert an ST-float into a Java Float" |
|
784 |
||
785 |
|i| |
|
786 |
||
787 |
i := (Java at:'java.lang.Float') new. |
|
788 |
i perform:#'<init>(F)V' with:(aNumber asShortFloat). |
|
789 |
^ i |
|
790 |
||
791 |
" |
|
792 |
Java as_Float:1 |
|
793 |
Java as_Float:3.14159 |
|
794 |
" |
|
795 |
||
796 |
"Created: 7.8.1997 / 21:21:13 / cg" |
|
797 |
"Modified: 7.8.1997 / 21:22:05 / cg" |
|
798 |
! |
|
799 |
||
1033 | 800 |
as_Hashtable: aDictionary |
752 | 801 |
"given a smalltalk dictionary, create and return |
802 |
a Java hashTable for it" |
|
1033 | 803 |
|
804 |
| hashTable | |
|
752 | 805 |
|
1033 | 806 |
hashTable := (JavaVM classForName: 'java.util.Hashtable') new. |
807 |
aDictionary |
|
808 |
keysAndValuesDo: [ |
|
809 |
:k :v | |
|
810 |
| sk sv jk jv | |
|
752 | 811 |
|
1033 | 812 |
(sk := k) isSymbol ifTrue: [ sk := sk asString ]. |
813 |
(sv := v) isSymbol ifTrue: [ sv := sv asString ]. |
|
814 |
jk := self as_Object: sk. |
|
815 |
jv := self as_Object: sv. |
|
816 |
hashTable |
|
817 |
perform: #'put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;' |
|
818 |
with: jk |
|
819 |
with: jv. |
|
752 | 820 |
]. |
821 |
^ hashTable |
|
822 |
||
823 |
" |
|
824 |
Java as_Hashtable:(Dictionary new |
|
825 |
at:'hello' put:'Hallo'; |
|
1033 | 826 |
at:'world' put:'Welt'; |
827 |
yourself)" |
|
752 | 828 |
"Modified: / 14.1.1998 / 17:02:13 / cg" |
829 |
! |
|
830 |
||
831 |
as_Integer:anInteger |
|
832 |
"convert an ST-integer into a Java Integer" |
|
833 |
||
834 |
|i| |
|
835 |
||
836 |
i := (Java at:'java.lang.Integer') new. |
|
837 |
i perform:#'<init>(I)V' with:anInteger. |
|
838 |
^ i |
|
839 |
||
840 |
" |
|
841 |
Java as_Integer:1 |
|
842 |
" |
|
843 |
||
844 |
"Modified: 7.8.1997 / 21:19:37 / cg" |
|
845 |
"Created: 7.8.1997 / 21:21:13 / cg" |
|
846 |
! |
|
847 |
||
848 |
as_Object:anObject |
|
849 |
"convert an ST-Object into a Java Object" |
|
850 |
||
851 |
anObject isString ifTrue:[ |
|
852 |
^ self as_String:anObject |
|
853 |
]. |
|
854 |
anObject isInteger ifTrue:[ |
|
855 |
^ self as_Integer:anObject |
|
856 |
]. |
|
857 |
||
858 |
self halt. |
|
859 |
||
860 |
" |
|
861 |
Java as_Object:'hello world' |
|
862 |
" |
|
863 |
||
864 |
"Created: 7.8.1997 / 21:15:38 / cg" |
|
865 |
"Modified: 7.8.1997 / 21:20:07 / cg" |
|
866 |
! |
|
867 |
||
868 |
as_ST_String: aJavaString |
|
869 |
"hard-coding internas of java.lang.String here is bad ..." |
|
870 |
||
871 |
| str count offs start stop | |
|
872 |
||
873 |
aJavaString isNil ifTrue: [ ^ nil ]. |
|
874 |
||
875 |
"/ count := aJavaString instVarNamed:'count'. |
|
876 |
||
877 |
count := aJavaString instVarAt: 3. |
|
878 |
||
879 |
"/ str := aJavaString instVarNamed:'value' |
|
880 |
||
881 |
str := aJavaString instVarAt: 1. |
|
882 |
str size == count |
|
883 |
ifTrue: |
|
884 |
[ "cos I don't see any reason to do this" |
|
885 |
"/ ^ str asOneByteString. |
|
906
fea23aa2b228
Few more fixes and workarounds for Saxon 6.5.5: the Othello example works fine...
vranyj1
parents:
889
diff
changeset
|
886 |
^ str ]. |
752 | 887 |
|
888 |
"/ offs := (aJavaString instVarNamed:'offset'). |
|
889 |
||
890 |
offs := aJavaString instVarAt: 2. |
|
891 |
||
892 |
"/ start := offs + 1. |
|
893 |
||
894 |
start := offs + 1. |
|
895 |
||
896 |
"/ stop := start + (aJavaString instVarNamed:'count') - 1. |
|
897 |
||
898 |
stop := start + count - 1. |
|
899 |
||
900 |
"/ ^ ((aJavaString instVarNamed:'value') copyFrom:start to:stop) asString |
|
901 |
||
902 |
^ (str copyFrom: start to: stop) asOneByteString |
|
903 |
||
904 |
"Created: / 08-08-1997 / 12:02:55 / cg" |
|
905 |
"Modified: / 04-01-1999 / 23:55:08 / cg" |
|
906 |
"Modified: / 22-03-2011 / 17:21:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
906
fea23aa2b228
Few more fixes and workarounds for Saxon 6.5.5: the Othello example works fine...
vranyj1
parents:
889
diff
changeset
|
907 |
"Modified: / 10-08-2011 / 23:32:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 908 |
! |
909 |
||
910 |
as_String:aString |
|
911 |
"convert an ST-String into a Java String" |
|
912 |
||
913 |
"hard-coding internas of java.lang.String here is bad ..." |
|
914 |
||
915 |
|s| |
|
916 |
||
1027
43dc608e14aa
another dose of fixes, still not able to boot javavm
hlopkmar
parents:
1026
diff
changeset
|
917 |
s := self java_lang_String basicNew. |
752 | 918 |
s instVarNamed:'value' put: aString. |
919 |
s instVarNamed:'offset' put: 0. |
|
920 |
s instVarNamed:'count' put: aString size. |
|
921 |
s instVarNamed:'hash' put: 0. |
|
922 |
^ s |
|
923 |
||
924 |
" |
|
925 |
Java as_String:'hello world' |
|
926 |
" |
|
927 |
||
928 |
"Created: / 07-08-1997 / 21:15:49 / cg" |
|
929 |
"Modified: / 03-02-2011 / 23:33:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
930 |
! |
|
931 |
||
932 |
as_URL:aString |
|
933 |
"convert an ST-String into a Java String" |
|
934 |
||
935 |
"hard-coding internas of java.lang.String here is bad ..." |
|
936 |
||
937 |
|u s| |
|
938 |
||
939 |
s := aString. |
|
940 |
||
941 |
"/ kludge for volume |
|
942 |
OperatingSystem isMSDOSlike ifTrue:[ |
|
943 |
((s size > 1) and:[(s at:2) == $:]) ifTrue:[ |
|
944 |
s := 'file:' , (s copy at:2 put:$|) |
|
945 |
] |
|
946 |
]. |
|
947 |
u := (self at:'java.net.URL') newCleared. |
|
948 |
u perform:#'<init>(Ljava/lang/String;)V' with:(self as_String:s). |
|
949 |
^ u |
|
950 |
||
951 |
" |
|
952 |
Java as_URL:'http://www.altavista.com' |
|
953 |
Java as_URL:'file:/foo/bar' |
|
954 |
" |
|
955 |
||
956 |
"Created: / 7.8.1997 / 21:15:49 / cg" |
|
957 |
"Modified: / 25.9.1999 / 22:22:21 / cg" |
|
958 |
! ! |
|
959 |
||
960 |
!Java class methodsFor:'queries'! |
|
961 |
||
962 |
smalltalkClassFor:typeRef |
|
963 |
self halt. |
|
964 |
"/ (typeString startsWith:'[[') ifTrue:[ |
|
965 |
"/ ^ Array |
|
966 |
"/ ]. |
|
967 |
"/ (typeString startsWith:'[F') ifTrue:[ |
|
968 |
"/ ^ FloatArray |
|
969 |
"/ ]. |
|
970 |
self halt. |
|
971 |
||
972 |
"Modified: 7.4.1997 / 13:33:46 / cg" |
|
973 |
! |
|
974 |
||
975 |
smalltalkDerefType:typeString |
|
976 |
(typeString startsWith:'[') ifTrue:[ |
|
977 |
^ typeString copyFrom:2 |
|
978 |
]. |
|
979 |
self halt. |
|
980 |
||
981 |
"Modified: 7.4.1997 / 13:13:24 / cg" |
|
982 |
! ! |
|
983 |
||
984 |
!Java class methodsFor:'registering java classes'! |
|
985 |
||
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
986 |
at: aJavaName |
1035 | 987 |
|
988 |
^JavaVM at: aJavaName. |
|
752 | 989 |
|
1035 | 990 |
"Modified: / 18-07-1998 / 22:55:16 / cg" |
991 |
"Modified (format): / 21-10-2011 / 10:40:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 992 |
! |
993 |
||
1035 | 994 |
at: aJavaName put: aJavaClass |
995 |
||
996 |
^JavaVM at:aJavaName put:aJavaClass. |
|
752 | 997 |
|
1035 | 998 |
"Created: / 17-04-1996 / 23:29:31 / cg" |
999 |
"Modified: / 07-08-1997 / 19:15:58 / cg" |
|
1000 |
"Modified (format): / 21-10-2011 / 10:39:46 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 1001 |
! |
1002 |
||
1003 |
flushAllJavaResources |
|
1004 |
self flushClasses. |
|
1005 |
SourceCache := CacheDictionary new: 32. |
|
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1060
diff
changeset
|
1006 |
SourceArchiveCache := CacheDictionary new: 32. |
1109
9bd0544f9046
Initial version of finalize() support - may crash VM!
vranyj1
parents:
1073
diff
changeset
|
1007 |
Smalltalk garbageCollect. |
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
1008 |
ObjectMemory |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
1009 |
allObjectsDo: [ |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
1010 |
:someObject | |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
1011 |
someObject isBehavior ifTrue: [ |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
1012 |
someObject isJavaClass ifTrue: [ |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
1013 |
someObject setConstantPool: nil. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
1014 |
someObject setInterfaces: nil. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
1015 |
someObject setMethodDictionary: (MethodDictionary new). |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
1016 |
Logger |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
1017 |
log: 'flushing ' , someObject fullName |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
1018 |
severity: #info |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
1019 |
facility: 'JVM'. |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
1020 |
] |
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
1021 |
]. |
752 | 1022 |
]. |
1204 | 1023 |
JavaEvaluator flushWorkspaceBinding . |
752 | 1024 |
JavaClass flushClassesInitOrder. |
1025 |
self flushClasses |
|
1026 |
||
1027 |
" |
|
1026
5badd1d31864
introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents:
1022
diff
changeset
|
1028 |
Java flushAllJavaResources" |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1060
diff
changeset
|
1029 |
|
752 | 1030 |
"Modified: / 06-11-2001 / 09:49:37 / cg" |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1060
diff
changeset
|
1031 |
"Modified: / 02-11-2011 / 21:34:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1204 | 1032 |
"Modified: / 02-12-2011 / 23:24:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 1033 |
! |
1034 |
||
1035 |
flushClasses |
|
1039 | 1036 |
UnresolvedClassRefs := nil. |
1060 | 1037 |
JavaVM flushClasses. |
1209 | 1038 |
Smalltalk keysAndValuesDo:[:name :class | |
1039 |
class isJavaClass ifTrue:[ |
|
1040 |
Smalltalk removeKey: name. |
|
1041 |
] |
|
752 | 1042 |
]. |
1043 |
Smalltalk removeKey:#'JAVA'. |
|
1044 |
||
1045 |
Java_lang_String := Java_lang_Class := nil. |
|
1046 |
JavaVM releaseAllJavaResources. |
|
1047 |
JavaUnresolvedConstant flushPatchLists. |
|
1048 |
Debugger == DebugView ifTrue:[Debugger newDebugger]. |
|
1049 |
ObjectMemory flushCaches. |
|
1050 |
||
1051 |
" |
|
1052 |
Java flushClasses |
|
1053 |
" |
|
1054 |
||
1039 | 1055 |
"Modified: / 06-11-2001 / 09:47:49 / cg" |
1113
7ac31c29769f
fixed flushAllJavaResources.. suprisingly easy :))
hlopkmar
parents:
1109
diff
changeset
|
1056 |
"Modified: / 16-11-2011 / 09:43:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1209 | 1057 |
"Modified: / 04-12-2011 / 11:35:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 1058 |
! |
1059 |
||
1060 |
markAllClassesUninitialized |
|
1061 |
self allClassesDo:[:aJavaClass | |
|
1062 |
aJavaClass markUninitialized |
|
1063 |
]. |
|
1064 |
||
1065 |
" |
|
1066 |
Java markAllClassesUninitialized |
|
1067 |
" |
|
1068 |
! |
|
1069 |
||
1070 |
rememberUnresolved:anUnresolvedClassRef |
|
1071 |
('JAVA: remember unresolved class: ' , anUnresolvedClassRef fullName) infoPrintCR. |
|
1072 |
||
1073 |
UnresolvedClassRefs isNil ifTrue:[ |
|
1074 |
UnresolvedClassRefs := Dictionary new. |
|
1075 |
]. |
|
1076 |
UnresolvedClassRefs |
|
1077 |
at:anUnresolvedClassRef fullName |
|
1078 |
put:anUnresolvedClassRef |
|
1079 |
||
1080 |
"Created: / 18.4.1996 / 00:05:31 / cg" |
|
1081 |
"Modified: / 19.10.1998 / 20:57:44 / cg" |
|
1082 |
! |
|
1083 |
||
1084 |
removeClass:aJavaClass |
|
1085 |
"/ remove it from myself |
|
1086 |
||
1087 |
|javaName sym nm cls p ns| |
|
1088 |
||
1039 | 1089 |
self breakPoint: #jv. |
1090 |
self breakPoint: #mh. |
|
1091 |
||
752 | 1092 |
javaName := aJavaClass fullName. |
1093 |
||
1094 |
sym := javaName asSymbolIfInterned. |
|
1095 |
sym notNil ifTrue:[ |
|
1096 |
cls := Classes at:sym ifAbsent:nil. |
|
1097 |
]. |
|
1098 |
cls isNil ifTrue:[ |
|
1099 |
nm := javaName. |
|
1100 |
(nm includes:$.) ifTrue:[ |
|
1101 |
"/ |
|
1102 |
"/ try pckg/.../name |
|
1103 |
"/ |
|
1104 |
nm := (nm asString copyReplaceAll:$. with:$/). |
|
1105 |
sym := nm asSymbolIfInterned. |
|
1106 |
sym notNil ifTrue:[ |
|
1107 |
cls := Classes at:sym ifAbsent:nil. |
|
1108 |
]. |
|
1109 |
]. |
|
1110 |
]. |
|
1111 |
(cls notNil and:[cls == aJavaClass]) ifTrue:[ |
|
1112 |
Classes removeKey:sym. |
|
1113 |
self updateClassRefsFrom:aJavaClass to:nil. |
|
1114 |
]. |
|
1115 |
Smalltalk removeKey:('JAVA::' , javaName) asSymbol. |
|
1116 |
Smalltalk removeKey:javaName asSymbol. |
|
1117 |
Smalltalk removeKey:((javaName , '') copy replaceAll:$/ with:$.) asSymbol. |
|
1118 |
||
1119 |
"/ remove myself from the JAVA::-::-:: namespace |
|
1120 |
"/ (which exists for convenient smalltalk access only) |
|
1121 |
||
1122 |
p := aJavaClass nameSpacePath. |
|
1123 |
p knownAsSymbol ifTrue:[ |
|
1124 |
ns := Smalltalk at:p asSymbol. |
|
1125 |
(ns notNil and:[ns isNameSpace]) ifTrue:[ |
|
1126 |
Smalltalk removeKey:(p , '::' , aJavaClass lastName) asSymbol |
|
1127 |
] |
|
1128 |
]. |
|
1129 |
||
1039 | 1130 |
"Modified: / 19-10-1998 / 20:58:49 / cg" |
1131 |
"Modified (format): / 23-10-2011 / 20:18:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 1132 |
! |
1133 |
||
1134 |
unresolvedClassRefFor:aClassName |
|
1135 |
UnresolvedClassRefs isNil ifTrue:[^ nil]. |
|
1136 |
^ UnresolvedClassRefs at:aClassName ifAbsent:nil. |
|
1137 |
||
1138 |
"Modified: / 19.10.1998 / 20:56:46 / cg" |
|
1139 |
! |
|
1140 |
||
1141 |
updateClassRefsFrom:oldClass to:newClass |
|
1142 |
"update all references to oldClass to now refer to newClass. |
|
1143 |
sent, when a class is reloaded" |
|
1144 |
||
1145 |
newClass notNil ifTrue:[ |
|
1146 |
"/ |
|
1147 |
"/ kludge: the new class might have been resolved with the oldClass ... |
|
1148 |
"/ |
|
1149 |
newClass constantPool |
|
1150 |
updateClassRefsFrom:oldClass to:newClass. |
|
1151 |
]. |
|
1152 |
||
1153 |
self allClassesDo:[:aJavaClass | |
|
1154 |
aJavaClass updateClassRefsFrom:oldClass to:newClass |
|
1155 |
]. |
|
1156 |
||
1157 |
"Created: 26.3.1997 / 13:49:20 / cg" |
|
1158 |
"Modified: 12.8.1997 / 03:04:44 / cg" |
|
1159 |
! ! |
|
1160 |
||
1161 |
!Java class methodsFor:'source management'! |
|
1162 |
||
1163 |
classSource:filename package:package in:dirOrZipFile |
|
1164 |
|fn zar f | |
|
1165 |
||
1166 |
fn := dirOrZipFile asFilename. |
|
1167 |
fn isDirectory |
|
1168 |
ifTrue: |
|
1169 |
[ package notNil |
|
1170 |
ifTrue:[ (f:= fn / package / filename) exists ifTrue:[ ^ f contents asString ]. ]. |
|
1171 |
(f := fn / filename) exists ifTrue:[ ^ f contents asString ]. ] |
|
1172 |
ifFalse: |
|
1281 | 1173 |
[ ((dirOrZipFile last == $p and: [fn hasSuffix:'zip']) or: |
1174 |
[(dirOrZipFile last == $r and: [fn hasSuffix:'jar'])]) |
|
752 | 1175 |
ifTrue: |
1176 |
[ zar := SourceArchiveCache |
|
1177 |
at: dirOrZipFile |
|
1178 |
ifAbsentPut:[ZipArchive oldFileNamed:fn pathName]. |
|
1179 |
zar notNil |
|
1180 |
ifTrue: |
|
1181 |
[ package notNil |
|
1182 |
ifTrue:[ |
|
1183 |
OperatingSystem fileSeparator ~~ $/ ifTrue: [ |
|
1184 |
f := (package copyReplaceAll: OperatingSystem fileSeparator with: $/) , '/' , filename |
|
1185 |
] ifFalse:[ |
|
1186 |
f := package , '/' , filename. |
|
1187 |
]] |
|
1188 |
ifFalse:[ f := filename]. |
|
1189 |
(zar findMember: f) ifNotNil: |
|
1190 |
[ |
|
1191 |
"Kludge because of broken ZipArchive" |
|
1192 |
| cache | |
|
754 | 1193 |
cache := Java cacheDirectory / Release name / 'src'. |
752 | 1194 |
cache exists ifFalse:[cache recursiveMakeDirectory]. |
1195 |
(cache / f) exists ifTrue:[^(cache / f) contents asString]. |
|
1196 |
OperatingSystem |
|
1197 |
executeCommand:('unzip "%1" "%2"' bindWith: fn asAbsoluteFilename asString |
|
1198 |
with: f asString) |
|
1199 |
inDirectory: cache asString. |
|
1200 |
(f := cache / f) exists ifTrue:[^f contents asString] |
|
1201 |
] |
|
1202 |
]]]. |
|
1203 |
||
1204 |
^ nil |
|
1205 |
||
1206 |
" |
|
1207 |
Java classSource: 'Object.java' package:'java/lang' in:'/home/jv/Projects/JavaX/java-6-openjdk/src' |
|
1208 |
Java classSource: 'Object.java' package:'java/lang' in:'/usr/lib/jvm/java-6-openjdk/src.zip' |
|
1209 |
||
1210 |
" |
|
1211 |
||
1212 |
"Modified: / 29-03-1998 / 21:46:40 / cg" |
|
1213 |
"Created: / 30-11-2010 / 12:32:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1281 | 1214 |
"Modified: / 14-12-2011 / 20:13:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 1215 |
! |
1216 |
||
1217 |
classSourceOf:aClass |
|
1218 |
|package dirName binary sourceFileName sourceFile loader codeBaseURL protocol codeBaseURLIdx src| |
|
1219 |
||
1220 |
aClass isNil ifTrue:[ |
|
1221 |
^ nil |
|
1222 |
]. |
|
1223 |
"/ look at the cache" |
|
1224 |
SourceCache at: aClass ifPresent: [:src|^src]. |
|
1225 |
||
1226 |
"/ first, look in the directory, where the binary |
|
1227 |
"/ was loaded from. |
|
1228 |
||
1229 |
binary := aClass binaryFile. |
|
1230 |
binary notNil ifTrue:[ |
|
1231 |
binary := binary asFilename. |
|
1232 |
aClass sourceFile notNil ifTrue:[ |
|
1233 |
sourceFileName := binary directory constructString:(aClass sourceFile). |
|
1234 |
sourceFileName asFilename exists ifFalse:[ |
|
1235 |
sourceFileName := nil. |
|
1236 |
] |
|
1237 |
]. |
|
1238 |
sourceFileName isNil ifTrue:[ |
|
1239 |
sourceFileName := binary withSuffix:'java'. |
|
1240 |
]. |
|
1241 |
sourceFile := sourceFileName asFilename. |
|
1242 |
] ifFalse:[ |
|
1243 |
"/ maybe it was loaded by a java classLoader ... |
|
1244 |
(loader := aClass classLoader) notNil ifTrue:[ |
|
1245 |
codeBaseURLIdx := loader class instVarOffsetOf:'codeBaseURL'. |
|
1246 |
codeBaseURLIdx notNil ifTrue:[ |
|
1247 |
(codeBaseURL := loader instVarAt:codeBaseURLIdx) notNil ifTrue:[ |
|
1248 |
(protocol := codeBaseURL instVarNamed:'protocol') notNil ifTrue:[ |
|
1249 |
(Java as_ST_String:protocol) = 'file' ifTrue:[ |
|
1250 |
dirName := Java as_ST_String:(codeBaseURL instVarNamed:'file'). |
|
1251 |
dirName := dirName asFilename. |
|
1252 |
dirName exists ifTrue:[ |
|
1253 |
aClass sourceFile notNil ifTrue:[ |
|
1254 |
sourceFile := sourceFileName := dirName construct:aClass sourceFile. |
|
1255 |
] |
|
1256 |
] |
|
1257 |
] |
|
1258 |
] |
|
1259 |
] |
|
1260 |
] |
|
1261 |
] |
|
1262 |
]. |
|
1263 |
sourceFile notNil ifTrue:[ |
|
1264 |
sourceFile exists ifFalse:[ |
|
1265 |
binary notNil ifTrue:[ |
|
1266 |
sourceFileName := binary withSuffix:'jav'. |
|
1267 |
sourceFile := sourceFileName asFilename. |
|
1268 |
sourceFile exists ifFalse:[ |
|
1269 |
sourceFileName := binary withSuffix:'JAV'. |
|
1270 |
sourceFile := sourceFileName asFilename. |
|
1271 |
sourceFile exists ifFalse:[ |
|
1272 |
sourceFileName := binary withSuffix:'JAVA'. |
|
1273 |
sourceFile := sourceFileName asFilename. |
|
1274 |
]. |
|
1275 |
]. |
|
1276 |
] |
|
1277 |
]. |
|
1278 |
]. |
|
1279 |
||
1280 |
"/ special case: there were multiple classes in a single |
|
1281 |
"/ source file. |
|
1282 |
||
1283 |
(binary notNil and:[aClass sourceFile notNil]) ifTrue:[ |
|
1284 |
binary withoutSuffix baseName ~= aClass sourceFile asFilename withoutSuffix baseName ifTrue:[ |
|
1285 |
'JAVA: trouble extracting fileName: ' infoPrint. |
|
1286 |
binary withoutSuffix baseName print. ' vs. ' infoPrint. |
|
1287 |
aClass sourceFile asFilename withoutSuffix baseName infoPrintCR. |
|
1288 |
]. |
|
1289 |
]. |
|
1290 |
||
1291 |
"/ if that fails, look in standard places |
|
1292 |
||
1293 |
(sourceFile isNil or:[sourceFile exists not]) ifTrue:[ |
|
1294 |
sourceFile := aClass sourceFile. |
|
1295 |
package := aClass javaPackageAsDirname. |
|
1296 |
self effectiveSourceDirectories do:[:dir| |
|
1297 |
src := self classSource: sourceFile package: package in: dir. |
|
1298 |
src ifNotNil:[^src] |
|
1299 |
] |
|
1300 |
||
1301 |
||
1302 |
]. |
|
1303 |
sourceFile isFilename ifFalse:[^nil]. |
|
1304 |
^ (sourceFile contentsOfEntireFile). |
|
1305 |
||
1306 |
" |
|
1307 |
Java classSourceOf: JAVA::java::lang::Object |
|
1308 |
" |
|
1309 |
||
1310 |
"Modified: / 27-01-1999 / 20:40:30 / cg" |
|
1311 |
"Modified: / 10-02-2011 / 23:10:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1312 |
! ! |
|
1313 |
||
1314 |
!Java class methodsFor:'starting apps'! |
|
1315 |
||
1316 |
javaProcessForMainOf:aJavaClass |
|
1317 |
"ask for a commandLine, create a java process to invoke |
|
1318 |
its main and return it. The process is not scheduled for |
|
1319 |
execution." |
|
1320 |
||
1321 |
^ self javaProcessForMainOf:aJavaClass argumentString:nil |
|
1322 |
||
1323 |
"Modified: / 30.12.1998 / 20:24:25 / cg" |
|
1324 |
! |
|
1325 |
||
1326 |
javaProcessForMainOf:aJavaClass argumentString:argStringIn |
|
1327 |
"create a java process, ready to invoke the classes main |
|
1328 |
method. Returns the process - ready to run but not yet resumed" |
|
1329 |
||
1330 |
|p argStringArray argString stdInReplacement alreadyAskedForStdin| |
|
1331 |
||
1332 |
argString := argStringIn. |
|
1333 |
argString isNil ifTrue:[ |
|
1334 |
argString := Dialog |
|
1335 |
request:'argument string:' |
|
1336 |
initialAnswer:LastArgumentString ? '' |
|
1337 |
onCancel:nil. |
|
1338 |
argString isNil ifTrue:[^ nil]. |
|
1339 |
||
1340 |
LastArgumentString := argString. |
|
1341 |
]. |
|
1342 |
||
1343 |
JavaVM initializeVMIfNoEventThreadRunning. |
|
1344 |
(Java at:'java.lang.System') instVarNamed:'security' put:nil. |
|
1345 |
||
1346 |
argString isEmpty ifTrue:[ |
|
1347 |
argStringArray := #() |
|
1348 |
] ifFalse:[ |
|
1349 |
argStringArray := argString asCollectionOfWords collect:[:s | Java as_String:s] as:Array. |
|
1350 |
]. |
|
1351 |
||
1352 |
p := JavaProcess |
|
1353 |
for:[ |
|
1354 |
"/ if the program reads from stdin, let user provide a file |
|
1355 |
"/ for it. |
|
1356 |
JavaVM stdinReplacementFileQuerySignal handle:[:ex | |
|
1357 |
|fn| |
|
1358 |
||
1359 |
alreadyAskedForStdin == true ifFalse:[ |
|
1360 |
fn := Dialog |
|
1361 |
requestFileName:'Program reads from Stdin - give inputFile or cancel for EOF' |
|
1362 |
default:nil |
|
1363 |
fromDirectory:(FileSelectionBox lastFileSelectionDirectory). |
|
1364 |
fn notNil ifTrue:[ |
|
1365 |
stdInReplacement := fn asFilename readStream. |
|
1366 |
]. |
|
1367 |
alreadyAskedForStdin := true. |
|
1368 |
]. |
|
1369 |
ex proceedWith:stdInReplacement |
|
1370 |
] do:[ |
|
1371 |
aJavaClass |
|
1372 |
performStatic:#'main([Ljava/lang/String;)V' |
|
1373 |
with:argStringArray. |
|
1374 |
] |
|
1375 |
] |
|
1376 |
priority:(Processor activePriority - 1). |
|
1377 |
||
1378 |
p name:(aJavaClass fullName , '::main()'). |
|
1379 |
p restartable:true. |
|
1380 |
^ p |
|
1381 |
||
1382 |
"Created: / 15.8.1997 / 04:41:20 / cg" |
|
1383 |
"Modified: / 24.12.1999 / 01:50:21 / cg" |
|
1384 |
! ! |
|
1385 |
||
1249 | 1386 |
!Java class methodsFor:'threads'! |
1387 |
||
1250 | 1388 |
addThread: jThread for: stProcess |
1389 |
ThreadsAccess |
|
1390 |
critical: [ |
|
1391 |
self assert: (Threads includesKey: jThread) not. |
|
1392 |
jThread == 0 ifTrue: [self breakPoint:#mh]. |
|
1393 |
Threads at: jThread put: stProcess. |
|
1394 |
] |
|
1395 |
||
1396 |
"Created: / 26-08-1997 / 19:53:57 / cg" |
|
1397 |
"Created: / 09-12-2011 / 12:47:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1398 |
! |
|
1399 |
||
1400 |
initializeCurrentThread |
|
1401 |
"adds current thread into known threads" |
|
1402 |
||
1403 |
| thisProcess jThread | |
|
1404 |
thisProcess := Processor activeProcess. |
|
1405 |
jThread := JavaVM newThread: thisProcess name. |
|
1406 |
jThread instVarNamed: 'tid' put: thisProcess id. |
|
1407 |
Java addThread: jThread for: thisProcess. |
|
1408 |
||
1409 |
"Created: / 09-12-2011 / 12:08:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1410 |
! |
|
1411 |
||
1412 |
removeThread: jThread for: stProcess |
|
1413 |
ThreadsAccess |
|
1414 |
critical: [ |
|
1415 |
self assert: (Threads includesKey: jThread). |
|
1416 |
Threads removeKey: jThread.] |
|
1417 |
||
1418 |
"Created: / 26-08-1997 / 19:53:57 / cg" |
|
1419 |
"Created: / 09-12-2011 / 12:47:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1420 |
! |
|
1421 |
||
1422 |
removeThread: jThread ifAbsent: block |
|
1423 |
ThreadsAccess |
|
1424 |
critical: [ |
|
1425 |
||
1426 |
Threads removeKey: jThread ifAbsent: block |
|
1427 |
] |
|
1428 |
||
1429 |
"Created: / 26-08-1997 / 19:53:57 / cg" |
|
1430 |
"Created: / 09-12-2011 / 12:51:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1431 |
! |
|
1432 |
||
1433 |
threadForStProcess: stProcess |
|
1434 |
ThreadsAccess critical: [ ^Threads keyAtValue: stProcess ]. |
|
1435 |
||
1436 |
"Created: / 26-08-1997 / 19:53:57 / cg" |
|
1437 |
"Created: / 09-12-2011 / 12:50:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1438 |
! |
|
1439 |
||
1440 |
threadForStProcess: stProcess ifAbsent: block |
|
1441 |
ThreadsAccess |
|
1442 |
critical: [ |result| result := Threads keyAtValue: stProcess ifAbsent: block. result == 0 ifTrue: [self breakPoint:#mh]. ^ result ]. |
|
1443 |
||
1444 |
"Created: / 26-08-1997 / 19:53:57 / cg" |
|
1445 |
"Created: / 09-12-2011 / 12:53:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1446 |
! |
|
1447 |
||
1249 | 1448 |
threads |
1449 |
self breakPoint:#mh. |
|
1450 |
^ Threads. |
|
1451 |
||
1452 |
"Created: / 26-08-1997 / 19:53:57 / cg" |
|
1453 |
"Modified: / 09-12-2011 / 12:49:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1250 | 1454 |
! |
1455 |
||
1456 |
threadsAt: key |
|
1457 |
^Threads at: key. |
|
1458 |
||
1459 |
"Created: / 26-08-1997 / 19:53:57 / cg" |
|
1460 |
"Created: / 09-12-2011 / 12:31:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1461 |
! |
|
1462 |
||
1463 |
threadsAt: key ifAbsent: block |
|
1464 |
ThreadsAccess critical: [ ^ Threads at: key ifAbsent: block ] |
|
1465 |
||
1466 |
"Created: / 26-08-1997 / 19:53:57 / cg" |
|
1467 |
"Created: / 09-12-2011 / 12:49:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1468 |
! |
|
1469 |
||
1470 |
threadsDo: block |
|
1471 |
ThreadsAccess |
|
1472 |
critical: [ Threads do: block] |
|
1473 |
||
1474 |
"Created: / 26-08-1997 / 19:53:57 / cg" |
|
1475 |
"Created: / 09-12-2011 / 12:49:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1249 | 1476 |
! ! |
1477 |
||
752 | 1478 |
!Java class methodsFor:'documentation'! |
1479 |
||
1480 |
version |
|
1022 | 1481 |
^ '$Id$' |
752 | 1482 |
! |
1483 |
||
1484 |
version_SVN |
|
1022 | 1485 |
^ '$Id$' |
923 | 1486 |
|
752 | 1487 |
! ! |
1488 |
||
1489 |
Java initialize! |