author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Fri, 04 Jan 2013 15:23:52 +0000 | |
branch | development |
changeset 1923 | 10990021296a |
parent 1916 | bfd8ca240746 |
child 2069 | 75d40b7b986f |
permissions | -rw-r--r-- |
1869
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
1 |
" |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
2 |
Copyright (c) 2010-2011 Jan Vrany, Jan Kurs & Marcel Hlopko, |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
3 |
SWING Research Group, Czech Technical University |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
4 |
in Prague |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
5 |
|
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
6 |
Permission is hereby granted, free of charge, to any person |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
7 |
obtaining a copy of this software and associated documentation |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
8 |
files (the 'Software'), to deal in the Software without |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
9 |
restriction, including without limitation the rights to use, |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
10 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
11 |
copies of the Software, and to permit persons to whom the |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
12 |
Software is furnished to do so, subject to the following |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
13 |
conditions: |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
14 |
|
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
15 |
The above copyright notice and this permission notice shall be |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
16 |
included in all copies or substantial portions of the Software. |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
17 |
|
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
18 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
19 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
20 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
21 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
22 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
23 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
24 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
25 |
OTHER DEALINGS IN THE SOFTWARE. |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
26 |
" |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
27 |
"{ Package: 'stx:libjava/experiments' }" |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
28 |
|
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
29 |
TestCase subclass:#ClassReloadingTests |
1895
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
30 |
instanceVariableNames:'testClassLoader' |
1869
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
31 |
classVariableNames:'' |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
32 |
poolDictionaries:'' |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
33 |
category:'Languages-Java-Tests-ClassReloading' |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
34 |
! |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
35 |
|
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
36 |
!ClassReloadingTests class methodsFor:'documentation'! |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
37 |
|
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
38 |
copyright |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
39 |
" |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
40 |
Copyright (c) 2010-2011 Jan Vrany, Jan Kurs & Marcel Hlopko, |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
41 |
SWING Research Group, Czech Technical University |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
42 |
in Prague |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
43 |
|
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
44 |
Permission is hereby granted, free of charge, to any person |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
45 |
obtaining a copy of this software and associated documentation |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
46 |
files (the 'Software'), to deal in the Software without |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
47 |
restriction, including without limitation the rights to use, |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
48 |
copy, modify, merge, publish, distribute, sublicense, and/or sell |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
49 |
copies of the Software, and to permit persons to whom the |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
50 |
Software is furnished to do so, subject to the following |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
51 |
conditions: |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
52 |
|
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
53 |
The above copyright notice and this permission notice shall be |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
54 |
included in all copies or substantial portions of the Software. |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
55 |
|
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
56 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
57 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
58 |
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
59 |
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
60 |
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
61 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
62 |
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
63 |
OTHER DEALINGS IN THE SOFTWARE. |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
64 |
|
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
65 |
" |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
66 |
! |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
67 |
|
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
68 |
history |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
69 |
|
1916
bfd8ca240746
adding missing resources for tests, skipping failing uninteresting interpreter tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1904
diff
changeset
|
70 |
"Created: #resources / 21-12-2012 / 18:09:27 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>" |
bfd8ca240746
adding missing resources for tests, skipping failing uninteresting interpreter tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1904
diff
changeset
|
71 |
! ! |
bfd8ca240746
adding missing resources for tests, skipping failing uninteresting interpreter tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1904
diff
changeset
|
72 |
|
bfd8ca240746
adding missing resources for tests, skipping failing uninteresting interpreter tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1904
diff
changeset
|
73 |
!ClassReloadingTests class methodsFor:'resources'! |
bfd8ca240746
adding missing resources for tests, skipping failing uninteresting interpreter tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1904
diff
changeset
|
74 |
|
bfd8ca240746
adding missing resources for tests, skipping failing uninteresting interpreter tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1904
diff
changeset
|
75 |
resources |
bfd8ca240746
adding missing resources for tests, skipping failing uninteresting interpreter tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1904
diff
changeset
|
76 |
|
bfd8ca240746
adding missing resources for tests, skipping failing uninteresting interpreter tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1904
diff
changeset
|
77 |
^ Array |
bfd8ca240746
adding missing resources for tests, skipping failing uninteresting interpreter tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1904
diff
changeset
|
78 |
with: JavaInitializedResource. |
bfd8ca240746
adding missing resources for tests, skipping failing uninteresting interpreter tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1904
diff
changeset
|
79 |
|
bfd8ca240746
adding missing resources for tests, skipping failing uninteresting interpreter tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1904
diff
changeset
|
80 |
"Created: / 21-12-2012 / 18:09:27 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>" |
1895
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
81 |
! ! |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
82 |
|
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
83 |
!ClassReloadingTests methodsFor:'private'! |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
84 |
|
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
85 |
compile: sourceCode |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
86 |
|
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
87 |
^ JavaCompiler compile: sourceCode. |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
88 |
|
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
89 |
"Created: / 16-12-2012 / 17:02:41 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>" |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
90 |
! |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
91 |
|
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
92 |
compileAndRegister: sourceCode |
1923 | 93 |
|compiledClasses| |
1895
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
94 |
|
1923 | 95 |
compiledClasses := self compile: sourceCode. |
96 |
^ self register: compiledClasses. |
|
1895
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
97 |
|
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
98 |
"Created: / 16-12-2012 / 16:59:19 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>" |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
99 |
! |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
100 |
|
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
101 |
performTest |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
102 |
|
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
103 |
JavaClassReader classLoaderQuerySignal answer: testClassLoader do:[ |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
104 |
super performTest |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
105 |
]. |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
106 |
|
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
107 |
"Created: / 16-12-2012 / 16:35:01 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>" |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
108 |
! |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
109 |
|
1923 | 110 |
register: aClassOrArray |
1895
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
111 |
|
1923 | 112 |
^aClassOrArray isArray ifTrue:[ |
113 |
JavaVM registry registerClasses: aClassOrArray . |
|
114 |
JavaVM registry classNamed: aClassOrArray anElement name. |
|
115 |
] ifFalse:[ |
|
116 |
JavaVM registry registerClass: aClassOrArray. |
|
117 |
JavaVM registry classNamed: aClassOrArray name |
|
118 |
]. |
|
1895
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
119 |
|
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
120 |
"Created: / 16-12-2012 / 17:02:04 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>" |
1923 | 121 |
"Modified: / 04-01-2013 / 14:54:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1895
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
122 |
! |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
123 |
|
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
124 |
testInfrastructure |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
125 |
|
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
126 |
|compiledClass| |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
127 |
|
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
128 |
self assert: (JavaClassReader classLoaderQuerySignal query = testClassLoader ) |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
129 |
message: 'tests should run in testClassLoader sandbox'. |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
130 |
compiledClass := self compileAndRegister: ' |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
131 |
public class HelloSun { |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
132 |
|
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
133 |
public String hello() { |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
134 |
return "helloooo"; |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
135 |
} |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
136 |
|
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
137 |
} |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
138 |
'. |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
139 |
self assert: compiledClass notNil message: 'Java compiler should be working for these tests to run'. |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
140 |
self assert: compiledClass classLoader = testClassLoader message: 'compiled classes should have testClassLoader as their defining cl'. |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
141 |
self assert: (JavaVM registry getClassesDefinedBy: testClassLoader) size = 1 message: 'only classes from these tests should use testClassLoader'. |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
142 |
self assert: (JavaVM registry getClassesDefinedBy: testClassLoader) anElement == compiledClass message: 'compiled classes should be registered in testClassLoader'. |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
143 |
|
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
144 |
"Created: / 16-12-2012 / 16:38:17 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>" |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
145 |
! ! |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
146 |
|
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
147 |
!ClassReloadingTests methodsFor:'running'! |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
148 |
|
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
149 |
setUp |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
150 |
testClassLoader := JAVA java lang ClassLoader new. |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
151 |
|
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
152 |
"Created: / 16-12-2012 / 16:32:32 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>" |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
153 |
! |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
154 |
|
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
155 |
tearDown |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
156 |
JavaVM registry unregisterClassLoader: testClassLoader. |
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
157 |
|
2d30e588124c
added reloading tests and naive implementation
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1883
diff
changeset
|
158 |
"Created: / 16-12-2012 / 16:33:31 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>" |
1869
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
159 |
! ! |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
160 |
|
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
161 |
!ClassReloadingTests methodsFor:'test helpers'! |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
162 |
|
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
163 |
callerClass |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
164 |
| callerClass | |
1923 | 165 |
callerClass := (JavaCompiler |
1869
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
166 |
compile: ' |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
167 |
package classReloadingTests; |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
168 |
public class Caller { |
1904
bffe474406f7
refactored reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1903
diff
changeset
|
169 |
public String callFooToString(Object c) { |
bffe474406f7
refactored reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1903
diff
changeset
|
170 |
return c.toString(); |
1869
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
171 |
} |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
172 |
} |
1923 | 173 |
') anElement. |
1869
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
174 |
callerClass |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
175 |
ifNil: [ self error: 'callerClass is expected to be not nil in these tests' ]. |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
176 |
^ callerClass. |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
177 |
|
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
178 |
"Created: / 06-12-2012 / 21:41:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1904
bffe474406f7
refactored reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1903
diff
changeset
|
179 |
"Modified: / 18-12-2012 / 14:00:12 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>" |
1923 | 180 |
"Modified: / 04-01-2013 / 14:51:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1869
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
181 |
! |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
182 |
|
1904
bffe474406f7
refactored reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1903
diff
changeset
|
183 |
compileAndRegisterChangingClassParent |
1869
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
184 |
|
1904
bffe474406f7
refactored reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1903
diff
changeset
|
185 |
self compileAndRegister: ' |
1869
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
186 |
package classReloadingTests; |
1904
bffe474406f7
refactored reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1903
diff
changeset
|
187 |
public class ChangingClassParent { |
bffe474406f7
refactored reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1903
diff
changeset
|
188 |
public String foo() { |
bffe474406f7
refactored reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1903
diff
changeset
|
189 |
return "parent"; |
bffe474406f7
refactored reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1903
diff
changeset
|
190 |
} |
1869
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
191 |
|
1904
bffe474406f7
refactored reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1903
diff
changeset
|
192 |
public String toString() { |
bffe474406f7
refactored reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1903
diff
changeset
|
193 |
return "" + foo(); |
bffe474406f7
refactored reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1903
diff
changeset
|
194 |
} |
bffe474406f7
refactored reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1903
diff
changeset
|
195 |
}'. |
1869
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
196 |
|
1904
bffe474406f7
refactored reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents:
1903
diff
changeset
|
197 |
"Created: / 18-12-2012 / 13:47:32 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>" |
1869
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
198 |
! ! |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
199 |
|
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
200 |
!ClassReloadingTests class methodsFor:'documentation'! |
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
201 |
|
1883
b36e52129040
Initial implementation of JavaCompiler using Oracle javac toolbox. Not yet finished.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1880
diff
changeset
|
202 |
version_HG |
b36e52129040
Initial implementation of JavaCompiler using Oracle javac toolbox. Not yet finished.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1880
diff
changeset
|
203 |
|
b36e52129040
Initial implementation of JavaCompiler using Oracle javac toolbox. Not yet finished.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1880
diff
changeset
|
204 |
^ '$Changeset: <not expanded> $' |
b36e52129040
Initial implementation of JavaCompiler using Oracle javac toolbox. Not yet finished.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1880
diff
changeset
|
205 |
! |
b36e52129040
Initial implementation of JavaCompiler using Oracle javac toolbox. Not yet finished.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1880
diff
changeset
|
206 |
|
1869
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
207 |
version_SVN |
1880
27b932afa4a7
Refactored JavaCompiler (part 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1869
diff
changeset
|
208 |
^ '§Id:: §' |
1869
0ae14ac1c9af
java compiler (javac wrapper) and basic class reloading tests
hlopkmar
parents:
diff
changeset
|
209 |
! ! |