experiments/JavaSingleClassReloadingTests.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Fri, 19 Apr 2013 13:50:19 +0200
branchdevelopment
changeset 2532 64a784c73d1e
parent 2531 cce7791abdb1
child 2533 5e9a3673a297
permissions -rw-r--r--
Update bytecode and constpool upon context restart. This way the restarted method can execute new code. This allows for fix & continue workflow. Should check for exceptions - will do it later.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     2
 Copyright (c) 2010-2011 Jan Vrany, Jan Kurs & Marcel Hlopko,
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
                         SWING Research Group, Czech Technical University 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     4
                         in Prague
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     6
 Permission is hereby granted, free of charge, to any person
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     7
 obtaining a copy of this software and associated documentation
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
 files (the 'Software'), to deal in the Software without
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
 restriction, including without limitation the rights to use,
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
 copy, modify, merge, publish, distribute, sublicense, and/or sell
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    11
 copies of the Software, and to permit persons to whom the
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
 Software is furnished to do so, subject to the following
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
 conditions:
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    14
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
 The above copyright notice and this permission notice shall be
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
 included in all copies or substantial portions of the Software.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    17
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    18
 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    22
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    25
 OTHER DEALINGS IN THE SOFTWARE.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
"{ Package: 'stx:libjava/experiments' }"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
2487
e4e3c9071b68 ClassReloadingTests/SingleClassReloadingTests renamed to start with Java.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2486
diff changeset
    29
JavaClassReloadingTests subclass:#JavaSingleClassReloadingTests
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    30
	instanceVariableNames:''
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    31
	classVariableNames:''
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    32
	poolDictionaries:''
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    33
	category:'Languages-Java-Tests-ClassReloading'
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    34
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    35
2487
e4e3c9071b68 ClassReloadingTests/SingleClassReloadingTests renamed to start with Java.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2486
diff changeset
    36
!JavaSingleClassReloadingTests class methodsFor:'documentation'!
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    37
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    38
copyright
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    39
"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    40
 Copyright (c) 2010-2011 Jan Vrany, Jan Kurs & Marcel Hlopko,
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    41
                         SWING Research Group, Czech Technical University 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    42
                         in Prague
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    43
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    44
 Permission is hereby granted, free of charge, to any person
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    45
 obtaining a copy of this software and associated documentation
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    46
 files (the 'Software'), to deal in the Software without
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    47
 restriction, including without limitation the rights to use,
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    48
 copy, modify, merge, publish, distribute, sublicense, and/or sell
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    49
 copies of the Software, and to permit persons to whom the
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    50
 Software is furnished to do so, subject to the following
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    51
 conditions:
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    52
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    53
 The above copyright notice and this permission notice shall be
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    54
 included in all copies or substantial portions of the Software.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    55
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    56
 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    57
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    58
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    59
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    60
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    61
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    62
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    63
 OTHER DEALINGS IN THE SOFTWARE.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    64
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    65
"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    66
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    67
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    68
history
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    69
2490
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
    70
    "Created: #test_overloads_01b / 11-04-2013 / 13:35:15 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
2505
3240724d9a1a fixing JavaSingleReloadingTests>>test_03ab tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2490
diff changeset
    71
    "Modified: #test_03a / 14-04-2013 / 15:22:18 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
3240724d9a1a fixing JavaSingleReloadingTests>>test_03ab tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2490
diff changeset
    72
    "Modified: #test_03b / 14-04-2013 / 15:23:25 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    73
! !
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    74
2487
e4e3c9071b68 ClassReloadingTests/SingleClassReloadingTests renamed to start with Java.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2486
diff changeset
    75
!JavaSingleClassReloadingTests methodsFor:'interfaces'!
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    76
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    77
testAddingInterface
2481
7281d4922170 Pass a class loader to ECJ's CompilerAdapter.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2429
diff changeset
    78
    OperatingSystem getLoginName = 'm' ifTrue:[
7281d4922170 Pass a class loader to ECJ's CompilerAdapter.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2429
diff changeset
    79
        self assert: false message: 'implement me!!'
7281d4922170 Pass a class loader to ECJ's CompilerAdapter.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2429
diff changeset
    80
    ]
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    81
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    82
    "Created: / 16-12-2012 / 17:40:40 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
2481
7281d4922170 Pass a class loader to ECJ's CompilerAdapter.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2429
diff changeset
    83
    "Modified: / 03-04-2013 / 22:07:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    84
! !
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    85
2487
e4e3c9071b68 ClassReloadingTests/SingleClassReloadingTests renamed to start with Java.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2486
diff changeset
    86
!JavaSingleClassReloadingTests methodsFor:'tests - fields'!
2486
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
    87
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
    88
test_fields_00
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
    89
    "
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
    90
    1) compile simple class with one field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
    91
    2) change type of the field from int to Object
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
    92
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
    93
    "
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
    94
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
    95
    | jclass1 jinst1 jclass2 jinst2 callerClass |
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
    96
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
    97
    jclass1 := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
    98
public class test_01 { 
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
    99
    public String foo = 1;
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   100
    public int bar() {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   101
        return 1;
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   102
    }
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   103
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   104
    jinst1 := jclass1 new.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   105
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   106
    jclass2 := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   107
public class test_01 { 
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   108
    public Object foo = new Object();
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   109
    public int bar() {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   110
        return 2;
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   111
    }
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   112
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   113
    jinst2 := jclass2 new.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   114
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   115
    callerClass := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   116
public class CallerClass {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   117
    public static Object getFoo(test_01 inst) {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   118
        return inst.foo;
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   119
    }
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   120
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   121
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   122
    self assert: jclass1 ~~ jclass2.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   123
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   124
    self assert: jclass1 fields size == 1.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   125
    self assert: jclass1 fields anElement descriptor = 'Ljava/lang/String;'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   126
    self assert: jinst1 bar == 1.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   127
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   128
    self assert: jclass2 fields size == 1.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   129
    self assert: jclass2 fields anElement descriptor = 'Ljava/lang/Object;'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   130
    self assert: jinst2 bar == 2.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   131
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   132
    self should:   [ callerClass getFoo: jinst1 ] raise: Error.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   133
    self shouldnt: [ callerClass getFoo: jinst2 ] raise: Error.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   134
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   135
    "Created: / 09-04-2013 / 15:00:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   136
    "Modified: / 09-04-2013 / 16:17:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   137
!
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   138
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   139
test_fields_01a
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   140
    "
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   141
    1) compile simple class with one field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   142
    2) change type of the field from String to Object
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   143
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   144
    "
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   145
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   146
    | jclass1 jinst1 jclass2 jinst2 callerClass |
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   147
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   148
    jclass1 := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   149
public class test_01 { 
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   150
    public String foo = "xxx";
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   151
    public int bar() {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   152
        return 1;
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   153
    }
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   154
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   155
    jinst1 := jclass1 new.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   156
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   157
    jclass2 := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   158
public class test_01 { 
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   159
    public Object foo = new Object();
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   160
    public int bar() {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   161
        return 2;
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   162
    }
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   163
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   164
    jinst2 := jclass2 new.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   165
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   166
    callerClass := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   167
public class CallerClass {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   168
    public static Object getFoo(test_01 inst) {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   169
        return inst.foo;
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   170
    }
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   171
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   172
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   173
    self assert: jclass1 ~~ jclass2.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   174
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   175
    self assert: jclass1 fields size == 1.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   176
    self assert: jclass1 fields anElement descriptor = 'Ljava/lang/String;'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   177
    self assert: jinst1 bar == 1.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   178
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   179
    self assert: jclass2 fields size == 1.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   180
    self assert: jclass2 fields anElement descriptor = 'Ljava/lang/Object;'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   181
    self assert: jinst2 bar == 2.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   182
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   183
    self should:   [ callerClass getFoo: jinst1 ] raise: Error.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   184
    self shouldnt: [ callerClass getFoo: jinst2 ] raise: Error.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   185
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   186
    "Created: / 09-04-2013 / 15:24:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   187
!
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   188
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   189
test_fields_01b
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   190
    "
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   191
    1) compile simple class with one field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   192
    2) change type of the field from String to Object
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   193
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   194
    "
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   195
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   196
    | jclass1 jinst1 jclass2 jinst2 callerClass |
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   197
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   198
    jclass1 := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   199
public class test_01 { 
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   200
    public String foo = "XXX";
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   201
    public int bar() {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   202
        return 1;
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   203
    }
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   204
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   205
    jinst1 := jclass1 new.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   206
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   207
    callerClass := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   208
public class CallerClass {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   209
    public static Object getFoo(test_01 inst) {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   210
        return inst.foo;
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   211
    }
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   212
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   213
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   214
    jclass2 := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   215
public class test_01 { 
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   216
    public Object foo = new Object();
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   217
    public int bar() {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   218
        return 2;
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   219
    }
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   220
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   221
    jinst2 := jclass2 new.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   222
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   223
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   224
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   225
    self assert: jclass1 ~~ jclass2.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   226
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   227
    self assert: jclass1 fields size == 1.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   228
    self assert: jclass1 fields anElement descriptor = 'Ljava/lang/String;'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   229
    self assert: jinst1 bar == 1.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   230
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   231
    self assert: jclass2 fields size == 1.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   232
    self assert: jclass2 fields anElement descriptor = 'Ljava/lang/Object;'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   233
    self assert: jinst2 bar == 2.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   234
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   235
    self shouldnt: [ callerClass getFoo: jinst1 ] raise: Error.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   236
    self should:   [ callerClass getFoo: jinst2 ] raise: Error.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   237
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   238
    "Created: / 09-04-2013 / 15:25:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   239
!
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   240
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   241
test_fields_02a
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   242
    "
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   243
    1) compile simple class with one public field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   244
    2) add second field after the first one
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   245
    3) create caller class that accesses the public field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   246
    4) check that caller class accesses the right field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   247
       on both old and new instance
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   248
    "
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   249
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   250
    | jclass1 jinst1 jclass2 jinst2 callerClass |
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   251
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   252
    jclass1 := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   253
public class test_fields_02a { 
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   254
    public String foo = "foo";
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   255
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   256
    jinst1 := jclass1 new.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   257
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   258
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   259
    jclass2 := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   260
public class test_fields_02a { 
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   261
    public String foo = "foo+bar";
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   262
    public String bar = "foo+bar";
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   263
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   264
    jinst2 := jclass2 new.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   265
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   266
    callerClass := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   267
public class test_fields_02a_caller {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   268
    public static String getFoo(test_fields_02a x) {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   269
        return x.foo;
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   270
    }
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   271
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   272
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   273
    self assert: jclass2 fields size == 2.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   274
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   275
    self assert: (callerClass getFoo: jinst1) = 'foo'.   
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   276
    self assert: (callerClass getFoo: jinst2) = 'foo+bar'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   277
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   278
    "Created: / 09-04-2013 / 15:32:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   279
!
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   280
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   281
test_fields_02b
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   282
    "
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   283
    1) compile simple class with one public field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   284
    2) add second field after the first one
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   285
    3) create caller class that accesses the public field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   286
    4) check that caller class accesses the right field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   287
       on both old and new instance
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   288
    "
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   289
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   290
    | jclass1 jinst1 jclass2 jinst2 callerClass |
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   291
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   292
    jclass1 := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   293
public class test_fields_02b { 
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   294
    public String foo = "foo";
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   295
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   296
    jinst1 := jclass1 new.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   297
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   298
    callerClass := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   299
public class test_fields_02b_caller {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   300
    public static String getFoo(test_fields_02b x) {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   301
        return x.foo;
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   302
    }
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   303
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   304
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   305
    jclass2 := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   306
public class test_fields_02b { 
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   307
    public String foo = "foo+bar";
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   308
    public String bar = "foo+bar";
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   309
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   310
    jinst2 := jclass2 new.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   311
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   312
    self assert: jclass2 fields size == 2.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   313
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   314
    self assert: (callerClass getFoo: jinst1) = 'foo'.   
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   315
    self assert: (callerClass getFoo: jinst2) = 'foo+bar'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   316
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   317
    "Created: / 09-04-2013 / 15:30:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   318
!
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   319
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   320
test_fields_03a
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   321
    "
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   322
    1) compile simple class with one public field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   323
    2) add second field before the first one
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   324
    3) create caller class that accesses the public field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   325
    4) check that caller class accesses the right field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   326
       on both old and new instance
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   327
    "
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   328
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   329
    | jclass1 jinst1 jclass2 jinst2 callerClass |
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   330
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   331
    jclass1 := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   332
public class test_fields_03a { 
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   333
    public String foo = "foo";
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   334
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   335
    jinst1 := jclass1 new.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   336
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   337
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   338
    jclass2 := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   339
public class test_fields_03a { 
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   340
    public String bar = "foo+bar";
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   341
    public String foo = "foo+bar";
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   342
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   343
    jinst2 := jclass2 new.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   344
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   345
    callerClass := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   346
public class test_fields_03a_caller {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   347
    public static String getFoo(test_fields_03a x) {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   348
        return x.foo;
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   349
    }
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   350
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   351
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   352
    self assert: jclass2 fields size == 2.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   353
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   354
    self assert: (callerClass getFoo: jinst1) = 'foo'.   
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   355
    self assert: (callerClass getFoo: jinst2) = 'foo+bar'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   356
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   357
    "Created: / 09-04-2013 / 15:33:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   358
!
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   359
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   360
test_fields_03b
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   361
    "
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   362
    1) compile simple class with one public field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   363
    2) add second field before the first one
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   364
    3) create caller class that accesses the public field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   365
    4) check that caller class accesses the right field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   366
       on both old and new instance
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   367
    "
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   368
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   369
    | jclass1 jinst1 jclass2 jinst2 callerClass |
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   370
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   371
    jclass1 := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   372
public class test_fields_03b { 
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   373
    public String foo = "foo";
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   374
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   375
    jinst1 := jclass1 new.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   376
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   377
    callerClass := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   378
public class test_fields_03b_caller {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   379
    public static String getFoo(test_fields_03b x) {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   380
        return x.foo;
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   381
    }
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   382
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   383
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   384
    jclass2 := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   385
public class test_fields_03b { 
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   386
    public String bar = "foo+bar";
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   387
    public String foo = "foo+bar";
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   388
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   389
    jinst2 := jclass2 new.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   390
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   391
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   392
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   393
    self assert: jclass2 fields size == 2.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   394
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   395
    self assert: (callerClass getFoo: jinst1) = 'foo'.   
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   396
    self assert: (callerClass getFoo: jinst2) = 'foo+bar'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   397
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   398
    "Created: / 09-04-2013 / 15:34:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   399
!
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   400
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   401
test_fields_03c
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   402
    "
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   403
    1) compile simple class with one public field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   404
    2) add second field before the first one
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   405
    3) create caller class that accesses the new field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   406
    4) check that caller class accesses the new field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   407
       on new instance
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   408
    5) check that caller class accessing new field on
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   409
       old instances throws exception
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   410
    "
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   411
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   412
    | jclass1 jinst1 jclass2 jinst2 callerClass |
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   413
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   414
    jclass1 := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   415
public class test_fields_03c { 
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   416
    public String foo = "foo";
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   417
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   418
    jinst1 := jclass1 new.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   419
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   420
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   421
    jclass2 := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   422
public class test_fields_03c { 
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   423
    public String bar = "foo+bar";
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   424
    public String foo = "foo+bar";
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   425
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   426
    jinst2 := jclass2 new.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   427
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   428
    callerClass := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   429
public class test_fields_03c_caller {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   430
    public static String getBar(test_fields_03c x) {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   431
        return x.bar;
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   432
    }
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   433
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   434
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   435
    self assert: jclass2 fields size == 2.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   436
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   437
    self assert: (callerClass getBar: jinst2) = 'foo+bar'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   438
    self should: [ callerClass getBar: jinst1 ] raise: Error.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   439
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   440
    "Created: / 09-04-2013 / 15:53:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   441
!
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   442
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   443
test_fields_04a
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   444
    "
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   445
    1) compile simple class with two public fields
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   446
    2) remove first field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   447
    3) create caller class that accesses the second field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   448
    4) check that caller class accesses the right field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   449
       on both old and new instances
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   450
    "
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   451
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   452
    | jclass1 jinst1 jclass2 jinst2 callerClass |
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   453
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   454
    jclass1 := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   455
public class test_fields_04a { 
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   456
    public String foo = "foo";
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   457
    public String bar = "bar+foo";
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   458
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   459
    jinst1 := jclass1 new.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   460
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   461
    jclass2 := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   462
public class test_fields_04a { 
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   463
    public String bar = "bar";
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   464
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   465
    jinst2 := jclass2 new.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   466
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   467
    callerClass := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   468
public class test_fields_04a_caller {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   469
    public static String getBar(test_fields_04a x) {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   470
        return x.bar;
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   471
    }
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   472
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   473
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   474
    self assert: jclass2 fields size == 1.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   475
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   476
    self assert: (callerClass getBar: jinst1) = 'bar+foo'.   
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   477
    self assert: (callerClass getBar: jinst2) = 'bar'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   478
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   479
    "Created: / 09-04-2013 / 15:46:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   480
!
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   481
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   482
test_fields_04b
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   483
    "
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   484
    1) compile simple class with two public fields
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   485
    2) remove first field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   486
    3) create caller class that accesses the second field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   487
    4) check that caller class accesses the right field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   488
       on both old and new instances
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   489
    "
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   490
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   491
    | jclass1 jinst1 jclass2 jinst2 callerClass |
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   492
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   493
    jclass1 := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   494
public class test_fields_04b { 
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   495
    public String foo = "foo";
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   496
    public String bar = "bar+foo";
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   497
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   498
    jinst1 := jclass1 new.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   499
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   500
    callerClass := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   501
public class test_fields_04b_caller {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   502
    public static String getBar(test_fields_04b x) {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   503
        return x.bar;
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   504
    }
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   505
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   506
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   507
    jclass2 := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   508
public class test_fields_04b { 
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   509
    public String bar = "bar";
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   510
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   511
    jinst2 := jclass2 new.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   512
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   513
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   514
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   515
    self assert: jclass2 fields size == 1.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   516
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   517
    self assert: (callerClass getBar: jinst1) = 'bar+foo'.   
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   518
    self assert: (callerClass getBar: jinst2) = 'bar'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   519
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   520
    "Created: / 09-04-2013 / 15:45:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   521
!
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   522
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   523
test_fields_04c
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   524
    "
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   525
    1) compile simple class with two public fields
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   526
    2) create caller class that accesses the first field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   527
    3) remove first field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   528
    4) check that caller class accesses the first field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   529
       on old instances
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   530
    5) check that accessing the first field on new instances
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   531
       raises exception
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   532
    "
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   533
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   534
    | jclass1 jinst1 jclass2 jinst2 callerClass |
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   535
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   536
    jclass1 := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   537
public class test_fields_04c { 
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   538
    public String foo = "foo";
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   539
    public String bar = "bar+foo";
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   540
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   541
    jinst1 := jclass1 new.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   542
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   543
    callerClass := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   544
public class test_fields_04c_caller {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   545
    public static String getFoo(test_fields_04c x) {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   546
        return x.foo;
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   547
    }
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   548
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   549
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   550
    jclass2 := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   551
public class test_fields_04c { 
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   552
    public String bar = "bar";
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   553
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   554
    jinst2 := jclass2 new.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   555
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   556
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   557
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   558
    self assert: jclass2 fields size == 1.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   559
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   560
    self assert: (callerClass getFoo: jinst1) = 'bar+foo'.   
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   561
    self should: [ callerClass getFoo: jinst2 ] raise: Error.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   562
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   563
    "Created: / 09-04-2013 / 15:57:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   564
!
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   565
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   566
test_fields_05a
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   567
    "
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   568
    1) compile simple class with one field
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   569
    2) change visibility of the field
2490
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   570
    3) accessing the field should raise exception
2486
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   571
    "
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   572
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   573
    | jclass1 jinst1 jclass2 jinst2 callerClass |
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   574
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   575
    jclass1 := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   576
public class test_fields_05a { 
2490
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   577
    public String foo = "public_foo";
2486
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   578
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   579
    jinst1 := jclass1 new.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   580
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   581
    jclass2 := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   582
public class test_fields_05a { 
2490
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   583
    private String foo = "private_foo";
2486
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   584
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   585
    jinst2 := jclass2 new.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   586
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   587
    callerClass := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   588
public class CallerClass {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   589
    public static Object getFoo(test_fields_05a inst) {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   590
        return inst.foo;
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   591
    }
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   592
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   593
2490
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   594
    self assert: (callerClass getFoo: jinst1) = 'public_foo'.
2486
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   595
    self should:   [ callerClass getFoo: jinst2 ] raise: Error.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   596
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   597
    "Created: / 09-04-2013 / 16:16:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2490
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   598
    "Modified: / 11-04-2013 / 10:40:26 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   599
!
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   600
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   601
test_fields_05b
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   602
    "
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   603
    1) compile simple class with private field
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   604
    2) change visibility of the field to public
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   605
    3) accessing the field should not raise exception anymore
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   606
    "
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   607
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   608
    | jclass1 jinst1 jclass2 jinst2 callerClass |
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   609
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   610
    jclass1 := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   611
public class test_fields_05b { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   612
    private String foo = "private_foo";
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   613
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   614
    jinst1 := jclass1 new.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   615
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   616
    jclass2 := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   617
public class test_fields_05b { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   618
    public String foo = "public_foo";
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   619
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   620
    jinst2 := jclass2 new.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   621
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   622
    callerClass := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   623
public class CallerClass {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   624
    public static Object getFoo(test_fields_05b inst) {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   625
        return inst.foo;
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   626
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   627
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   628
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   629
    self should: [ callerClass getFoo: jinst1 ] raise: Error.    
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   630
    self assert: (callerClass getFoo: jinst2) = 'public_foo'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   631
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   632
    "Created: / 11-04-2013 / 10:41:52 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
2486
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   633
! !
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   634
2487
e4e3c9071b68 ClassReloadingTests/SingleClassReloadingTests renamed to start with Java.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2486
diff changeset
   635
!JavaSingleClassReloadingTests methodsFor:'tests - hierarchy'!
2486
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   636
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   637
test_hierarchy_00
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   638
2490
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   639
    "
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   640
    1) compile a parent and a child class, parent having a method
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   641
    2) change parent's method
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   642
    3) assert the method is changed in child
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   643
    "
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   644
2486
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   645
    | jclass1_A jclass1_B jinst1_B jclass_caller jinst2_B jclass2_B |
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   646
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   647
    jclass1_A := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   648
public class test_hierarchy_00_A { 
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   649
    public int foo() {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   650
        return 1;
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   651
    }
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   652
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   653
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   654
     jclass1_B := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   655
public class test_hierarchy_00_B extends test_hierarchy_00_A { 
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   656
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   657
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   658
    jclass_caller :=  self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   659
public class test_hierarchy_00_caller  {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   660
    public int call(test_hierarchy_00_B b) {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   661
        return b.foo();
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   662
    }
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   663
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   664
2490
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   665
    jinst1_B := jclass1_B new.
2486
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   666
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   667
    self assert: (jclass_caller new call: jinst1_B) == 1.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   668
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   669
    jclass2_B := self compileAndRegister:'
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   670
public class test_hierarchy_00_B extends test_hierarchy_00_A { 
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   671
  public int foo() {
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   672
        return 2;
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   673
    }
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   674
}'.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   675
2490
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   676
    jinst2_B := jclass2_B new.
2486
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   677
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   678
    self assert: (jclass_caller new call: jinst1_B) == 2.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   679
    self assert: (jclass_caller new call: jinst2_B) == 2.
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   680
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   681
    "Created: / 09-04-2013 / 16:09:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2490
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   682
    "Modified: / 11-04-2013 / 11:24:33 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   683
!
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   684
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   685
test_hierarchy_01a
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   686
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   687
    "
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   688
    1) compile a parent and a child class
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   689
    2) add field to parent
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   690
    3) assert the field is present in new instances of child
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   691
    "
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   692
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   693
    | jclass1_A jclass1_B jinst1_B jclass_caller jinst2_B jclass2_B |
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   694
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   695
    jclass1_A := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   696
public class test_hierarchy_01_A {}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   697
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   698
     jclass1_B := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   699
public class test_hierarchy_01_B extends test_hierarchy_01_A {}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   700
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   701
    jinst1_B := jclass1_B new.    
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   702
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   703
    jclass2_B := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   704
public class test_hierarchy_01_A {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   705
    public int foo = 1;
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   706
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   707
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   708
    jclass_caller :=  self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   709
public class test_hierarchy_01_caller  {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   710
    public int call(test_hierarchy_01_B b) {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   711
        return b.foo;
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   712
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   713
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   714
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   715
    jinst2_B := jclass2_B new.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   716
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   717
    self should: [ jclass_caller new call: jinst1_B ] raise: Error.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   718
    self assert: (jclass_caller new call: jinst2_B) == 1.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   719
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   720
    "Created: / 11-04-2013 / 11:37:21 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   721
!
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   722
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   723
test_hierarchy_02a
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   724
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   725
    "
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   726
    1) compile a parent and a child class, parent having a method
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   727
    2) change parent's method
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   728
    3) assert the method is changed in child
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   729
    "
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   730
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   731
    | jclass1_A jclass1_B jclass1_C jinst1_C jclass_caller jinst2_C jclass2_B |
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   732
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   733
    jclass1_A := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   734
public class test_hierarchy_02_A { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   735
    public int foo() {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   736
        return 1;
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   737
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   738
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   739
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   740
     jclass1_B := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   741
public class test_hierarchy_02_B extends test_hierarchy_02_A {}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   742
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   743
     jclass1_C := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   744
public class test_hierarchy_02_C extends test_hierarchy_02_B {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   745
    public int foo() {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   746
        return super.foo();
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   747
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   748
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   749
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   750
    jclass_caller :=  self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   751
public class test_hierarchy_02_caller  {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   752
    public int call(test_hierarchy_02_C c) {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   753
        return c.foo();
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   754
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   755
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   756
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   757
    jinst1_C := jclass1_C new.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   758
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   759
    self assert: (jclass_caller new call: jinst1_C) == 1.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   760
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   761
    jclass2_B := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   762
public class test_hierarchy_02_B extends test_hierarchy_02_A { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   763
  public int foo() {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   764
        return 2;
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   765
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   766
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   767
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   768
    jinst2_C := jclass1_C new.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   769
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   770
    self assert: (jclass_caller new call: jinst1_C) == 2.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   771
    self assert: (jclass_caller new call: jinst2_C) == 2.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   772
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   773
    "Created: / 11-04-2013 / 11:07:26 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   774
!
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   775
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   776
test_hierarchy_02b
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   777
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   778
    "
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   779
    1) compile a parent and a child class, parent having a method
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   780
    2) change parent's method
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   781
    3) assert the method is changed in child
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   782
    "
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   783
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   784
    | jclass1_A jclass1_B jclass1_C jinst1_C jclass_caller jinst2_C jclass2_B |
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   785
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   786
    jclass1_A := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   787
public class test_hierarchy_02_A { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   788
    public int foo() {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   789
        return 1;
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   790
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   791
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   792
    public int bar() {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   793
        return 10;
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   794
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   795
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   796
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   797
     jclass1_B := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   798
public class test_hierarchy_02_B extends test_hierarchy_02_A {}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   799
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   800
     jclass1_C := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   801
public class test_hierarchy_02_C extends test_hierarchy_02_B {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   802
    public int foo() {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   803
        return super.foo();
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   804
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   805
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   806
    public int bar() {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   807
        return super.bar();
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   808
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   809
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   810
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   811
    jclass_caller :=  self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   812
public class test_hierarchy_02_caller  {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   813
    public int callFoo(test_hierarchy_02_C c) {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   814
        return c.foo();
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   815
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   816
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   817
    public int callBar(test_hierarchy_02_C c) {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   818
        return c.bar();
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   819
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   820
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   821
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   822
    jinst1_C := jclass1_C new.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   823
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   824
    self assert: (jclass_caller new callFoo: jinst1_C) == 1.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   825
    self assert: (jclass_caller new callBar: jinst1_C) == 10.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   826
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   827
    jclass2_B := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   828
public class test_hierarchy_02_B extends test_hierarchy_02_A { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   829
    public int bar() {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   830
        return 20;
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   831
    }        
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   832
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   833
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   834
    jinst2_C := jclass1_C new.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   835
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   836
    self assert: (jclass_caller new callFoo: jinst1_C) == 1.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   837
    self assert: (jclass_caller new callFoo: jinst2_C) == 1.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   838
    self assert: (jclass_caller new callBar: jinst1_C) == 20.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   839
    self assert: (jclass_caller new callBar: jinst2_C) == 20.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   840
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   841
    "Created: / 11-04-2013 / 11:07:49 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   842
!
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   843
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   844
test_hierarchy_03a
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   845
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   846
    "
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   847
    1) compile a parent and a child class, parent having a constructor
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   848
    2) change parent's constructor
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   849
    3) assert new instances of child use new constructor
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   850
    "
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   851
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   852
    | jclass1_A jclass1_B jclass1_C jinst1_C jclass_caller jinst2_C jclass2_B |
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   853
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   854
    jclass1_A := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   855
public class test_hierarchy_03_A {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   856
    protected int foo;
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   857
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   858
    public test_hierarchy_03_A(int foo) {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   859
        this.foo = foo;
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   860
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   861
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   862
    public int getFoo() {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   863
        return foo;
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   864
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   865
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   866
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   867
     jclass1_B := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   868
public class test_hierarchy_03_B extends test_hierarchy_03_A {}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   869
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   870
     jclass1_C := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   871
public class test_hierarchy_03_C extends test_hierarchy_03_B {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   872
    public test_hierarchy_03_C(int foo) {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   873
        super(foo);
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   874
    }    
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   875
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   876
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   877
    jclass_caller :=  self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   878
public class test_hierarchy_03_caller  {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   879
    public int getFoo(test_hierarchy_03_C c) {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   880
        return c.getFoo();
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   881
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   882
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   883
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   884
    jinst1_C := jclass1_C new: 1.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   885
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   886
    self assert: (jclass_caller new getFoo: jinst1_C) == 1.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   887
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   888
    jclass2_B := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   889
public class test_hierarchy_03_B extends test_hierarchy_03_A { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   890
    public test_hierarchy_03_B(int foo) {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   891
        this.foo = 2 * foo;
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   892
    }        
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   893
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   894
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   895
    jinst2_C := jclass1_C new: 2.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   896
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   897
    self assert: (jclass_caller new getFoo: jinst1_C) == 1.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   898
    self assert: (jclass_caller new getFoo: jinst2_C) == 4.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   899
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   900
    "Created: / 11-04-2013 / 11:14:12 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   901
!
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   902
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   903
test_hierarchy_04a
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   904
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   905
    "
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   906
    1) compile a parent and a child class, parent having a field
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   907
    2) change child's superclass to parent2, having different field
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   908
    3) assert new instances of child have new field
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   909
    "
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   910
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   911
    | jclass1_A1 jclass1_A2 jclass1_B jclass2_B jinst1_B jinst2_B jclass_caller |
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   912
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   913
    jclass1_A1 := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   914
public class test_hierarchy_04_A1 {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   915
    public int foo = 1;
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   916
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   917
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   918
    jclass1_A2 := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   919
public class test_hierarchy_04_A2 {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   920
    public String foo = "foo";
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   921
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   922
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   923
     jclass1_B := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   924
public class test_hierarchy_04_B extends test_hierarchy_04_A1 {}'.     
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   925
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   926
    jclass_caller :=  self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   927
public class test_hierarchy_04_caller  {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   928
    public Object getFoo(test_hierarchy_04_B c) {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   929
        return c.foo;
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   930
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   931
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   932
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   933
    jinst1_B := jclass1_B new.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   934
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   935
    self assert: (jclass_caller new getFoo: jinst1_B) == 1.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   936
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   937
    jclass2_B := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   938
public class test_hierarchy_04_B extends test_hierarchy_04_A2 {}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   939
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   940
    jinst2_B := jclass1_B new.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   941
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   942
    self assert: (jclass_caller new getFoo: jinst1_B) = 1.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   943
    self assert: (jclass_caller new getFoo: jinst2_B) = 'foo'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   944
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
   945
    "Created: / 11-04-2013 / 13:16:03 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
2486
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   946
! !
6b94908daf75 More tests for dynamic code updates.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2481
diff changeset
   947
2487
e4e3c9071b68 ClassReloadingTests/SingleClassReloadingTests renamed to start with Java.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2486
diff changeset
   948
!JavaSingleClassReloadingTests methodsFor:'tests - methods'!
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   949
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   950
testAddingMethod    
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   951
    "    
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   952
    1) compile a class inheriting from ChangingClassParent.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   953
    2) instantiate inheriting class.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   954
    3) assert calling foo on subclass uses method from superclass'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   955
    4) recompile inheriting class with overridden foo method.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   956
    5) assert overridden method is used.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   957
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   958
   | caller inst |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   959
   caller := self callerClass new.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   960
   self compileAndRegisterChangingClassParent.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   961
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   962
    self compileAndRegister: '
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   963
package classReloadingTests;
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   964
public class ChangingClass extends ChangingClassParent {}
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   965
'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   966
     
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   967
    inst := JAVA classReloadingTests ChangingClass new.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   968
    self assert: (caller callFooToString: inst) = 'parent'.        
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   969
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   970
    self compileAndRegister: '
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   971
package classReloadingTests;
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   972
public class ChangingClass extends ChangingClassParent {
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   973
    public String foo() {
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   974
        return "child";
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   975
    }
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   976
}'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   977
    self assert: (caller callFooToString: inst) = 'child'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   978
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   979
    "Created: / 06-12-2012 / 21:52:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   980
    "Modified (comment): / 18-12-2012 / 14:12:06 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   981
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   982
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   983
testChangingSignatureOfMethod
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   984
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   985
    1) compile a class with foo method returning string.    
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   986
    2) instantiate the class.    
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   987
    3) assert method returns string.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   988
    4) recompile class with foo method returning int.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   989
    5) assert new method is used.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   990
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   991
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   992
    | caller inst |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   993
    caller := self callerClass new.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   994
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   995
    self compileAndRegister: '
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   996
package classReloadingTests;
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   997
public class ChangingClass {
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   998
    public String toString() {
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   999
        return "" + foo();
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1000
    }
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1001
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1002
    public String foo() {
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1003
        return "child";
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1004
    }
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1005
}
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1006
'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1007
    inst := JAVA classReloadingTests ChangingClass new.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1008
    self assert: (caller callFooToString: inst) = 'child'.        
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1009
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1010
    self compileAndRegister: '
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1011
package classReloadingTests;
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1012
public class ChangingClass {
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1013
    public String toString() {
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1014
        return "" + foo();
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1015
    }
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1016
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1017
    public int foo() {
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1018
        return 5;
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1019
    }
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1020
}'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1021
    self assert: (caller callFooToString: inst) = '5'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1022
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1023
    "Created: / 06-12-2012 / 21:50:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1024
    "Modified (comment): / 18-12-2012 / 14:08:36 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1025
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1026
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1027
testModifyingMethod
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1028
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1029
    1) compile a class with foo method.    
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1030
    2) instantiate the class.    
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1031
    3) assert method returns string.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1032
    4) recompile class with foo method returning different string.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1033
    5) assert new method is used.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1034
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1035
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1036
    | caller inst |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1037
    caller := self callerClass new.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1038
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1039
    self compileAndRegister: '
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1040
package classReloadingTests;
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1041
public class ChangingClass {
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1042
    public String toString() {
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1043
        return "" + foo();
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1044
    }
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1045
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1046
    public String foo() {
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1047
        return "child";
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1048
    }
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1049
}
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1050
'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1051
    inst := JAVA classReloadingTests ChangingClass new.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1052
    self assert: (caller callFooToString: inst) = 'child'.        
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1053
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1054
    self compileAndRegister: '
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1055
package classReloadingTests;
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1056
public class ChangingClass {
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1057
    public String toString() {
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1058
        return "" + foo();
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1059
    }
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1060
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1061
    public String foo() {
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1062
        return "modified child";
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1063
    }
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1064
}'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1065
        self assert: (caller callFooToString: inst) = 'modified child'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1066
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1067
    "Created: / 06-12-2012 / 21:51:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1068
    "Modified (comment): / 18-12-2012 / 14:09:48 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1069
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1070
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1071
testRemovingMethod   
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1072
  "    
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1073
    1) compile a class inheriting from ChangingClassParent, which overrides foo method.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1074
    2) instantiate inheriting class.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1075
    3) assert calling foo on subclass uses overridden method'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1076
    4) recompile inheriting class without foo method.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1077
    5) assert parent method is used.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1078
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1079
   | caller inst |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1080
   caller := self callerClass new.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1081
   self compileAndRegisterChangingClassParent.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1082
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1083
    self compileAndRegister: '
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1084
package classReloadingTests;
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1085
public class ChangingClass extends ChangingClassParent {
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1086
    public String foo() {
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1087
        return "child";
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1088
    }
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1089
}'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1090
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1091
    inst := JAVA classReloadingTests ChangingClass new.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1092
    self assert: (caller callFooToString: inst) = 'child'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1093
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1094
    self compileAndRegister: '
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1095
package classReloadingTests;
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1096
public class ChangingClass extends ChangingClassParent {}'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1097
    self assert: (caller callFooToString: inst) = 'parent'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1098
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1099
    "Created: / 16-12-2012 / 16:01:58 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1100
    "Modified (comment): / 18-12-2012 / 14:11:56 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1101
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1102
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1103
test_00
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1104
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1105
    1) compile simple class with no method
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1106
    3) recompile same source again.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1107
    4) check that class does not change
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1108
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1109
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1110
    | jclass1 jclass2 |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1111
    jclass1 := self compileAndRegister:'
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1112
public class test_01 { 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1113
    public int foo() { 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1114
        return 10; 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1115
    }
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1116
}'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1117
    self assert: jclass1 new foo == 10.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1118
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1119
    jclass2 := self compileAndRegister:'
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1120
public class test_01 { 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1121
    public int foo() { 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1122
        return 10; 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1123
    }
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1124
}'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1125
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1126
    self assert: jclass1 == jclass2. "/only method update, so reloaded class should be the same
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1127
    self assert: (JavaVM registry getClassesDefinedBy: testClassLoader) size = 1 message: 'only classes from these tests should use testClassLoader'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1128
    self assert: (JavaVM registry getClassesDefinedBy: testClassLoader) anElement == jclass1 message: 'compiled classes should be registered in testClassLoader'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1129
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1130
    "Created: / 16-12-2012 / 23:51:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1131
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1132
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1133
test_00b
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1134
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1135
    1) compile simple class with no method but in package
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1136
    3) recompile same source again.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1137
    4) check that class does not change
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1138
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1139
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1140
    | jclass1 jclass2 |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1141
    jclass1 := self compileAndRegister:'
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1142
package zork;
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1143
public class test_01 { 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1144
    public int foo() { 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1145
        return 10; 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1146
    }
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1147
}'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1148
    self assert: jclass1 new foo == 10.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1149
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1150
    jclass2 := self compileAndRegister:'
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1151
package zork;
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1152
public class test_01 { 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1153
    public int foo() { 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1154
        return 10; 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1155
    }
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1156
}'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1157
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1158
    self assert: jclass1 == jclass2. "/only method update, so reloaded class should be the same
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1159
    self assert: (JavaVM registry getClassesDefinedBy: testClassLoader) size = 1 message: 'only classes from these tests should use testClassLoader'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1160
    self assert: (JavaVM registry getClassesDefinedBy: testClassLoader) anElement == jclass1 message: 'compiled classes should be registered in testClassLoader'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1161
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1162
    "Created: / 16-12-2012 / 23:56:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1163
    "Modified (comment): / 18-12-2012 / 12:02:24 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1164
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1165
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1166
test_01
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1167
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1168
    1) compile simple class with one method return 10
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1169
    2) call that method, check that it returns 10
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1170
    3) recompile to return 20
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1171
    4) call that method, check that it returns 20
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1172
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1173
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1174
    | jclass1 jclass2 |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1175
    jclass1 := self compileAndRegister:'
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1176
public class test_01 { 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1177
    public int foo() { 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1178
        return 10; 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1179
    }
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1180
}'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1181
    self assert: jclass1 new foo == 10.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1182
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1183
    jclass2 := self compileAndRegister:'
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1184
public class test_01 { 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1185
    public int foo() { 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1186
        return 20; 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1187
    }
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1188
}'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1189
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1190
    self assert: jclass2 new foo == 20.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1191
    self assert: jclass1 == jclass2. "/only method update, so reloaded class should be the same
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1192
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1193
    "Created: / 16-12-2012 / 23:48:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1194
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1195
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1196
test_02a
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1197
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1198
    1) compile simple class with one method return 10
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1199
    2) call that method indirectly, check that it returns 10
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1200
    3) recompile to return 20
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1201
    4) call that method indirectly, check that it returns 20
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1202
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1203
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1204
    | jclass1 jclass2 caller |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1205
    jclass1 := self compileAndRegister:'
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1206
public class test_02 { 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1207
    public int foo() { 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1208
        return 10; 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1209
    }
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1210
}'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1211
    caller := self compileAndRegister:'
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1212
public class test_02_caller {
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1213
    public int qux(test_02 t) {
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1214
        return t.foo();
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1215
    }
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1216
}
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1217
'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1218
    self assert: (caller new qux: (jclass1 new)) == 10.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1219
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1220
    jclass2 := self compileAndRegister:'
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1221
public class test_02 { 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1222
    public int foo() { 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1223
        return 20; 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1224
    }
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1225
}'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1226
    self assert: (caller new qux: (jclass2 new)) == 20.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1227
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1228
    "Created: / 17-12-2012 / 00:02:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1229
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1230
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1231
test_02b
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1232
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1233
    1) compile simple class with one method return 10
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1234
    2) call that method indirectly using fresh instance (NEW), 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1235
       check that it returns 10
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1236
    3) recompile to return 20
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1237
    4) call that method indirectly, check that it returns 20
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1238
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1239
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1240
    | jclass1 jclass2 caller |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1241
    jclass1 := self compileAndRegister:'
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1242
public class test_02 { 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1243
    public int foo() { 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1244
        return 10; 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1245
    }
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1246
}'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1247
    caller := self compileAndRegister:'
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1248
public class test_02_caller {
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1249
    public int qux() {
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1250
        test_02 t = new test_02();
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1251
        return t.foo();
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1252
    }
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1253
}
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1254
'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1255
    self assert: (caller new qux) == 10.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1256
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1257
    jclass2 := self compileAndRegister:'
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1258
public class test_02 { 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1259
    public int foo() { 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1260
        return 20; 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1261
    }
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1262
}'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1263
    self assert: (caller new qux) == 20.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1264
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1265
    "Created: / 17-12-2012 / 00:04:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1266
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1267
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1268
test_02c
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1269
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1270
    Same as 02a, but with static methods
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1271
    "
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1272
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1273
    | jclass1 jclass2 caller |
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1274
    jclass1 := self compileAndRegister:'
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1275
public class test_02 { 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1276
    public static int foo() {
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1277
        return 10; 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1278
    }
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1279
}'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1280
    caller := self compileAndRegister:'
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1281
public class test_02_caller {
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1282
    public int qux() {
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1283
        return test_02.foo();
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1284
    }
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1285
}
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1286
'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1287
    self assert: (caller new qux) == 10.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1288
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1289
    jclass2 := self compileAndRegister:'
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1290
public class test_02 { 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1291
    public static int foo() { 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1292
        return 20; 
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1293
    }
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1294
}'.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1295
    self assert: (caller new qux) == 20.
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1296
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1297
    "Created: / 17-12-2012 / 00:03:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1298
    "Modified: / 18-12-2012 / 12:07:59 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
2490
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1299
!
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1300
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1301
test_03a
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1302
    "
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1303
    1) compile simple class with one public method that returns 10
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1304
    2) call that method indirectly, check that it returns 10
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1305
    3) change it to private method
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1306
    4) calling method should raise exception
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1307
    "
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1308
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1309
    | jclass1 jclass2 caller |
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1310
    jclass1 := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1311
public class test_03 { 
2503
3a74844d15ec fix 2 Java reloading tests. A warmup :)
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2490
diff changeset
  1312
    public static int foo() {
2490
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1313
        return 10; 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1314
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1315
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1316
    caller := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1317
public class test_03_caller {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1318
    public int qux() {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1319
        return test_03.foo();
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1320
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1321
}
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1322
'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1323
    self assert: (caller new qux) == 10.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1324
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1325
    jclass2 := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1326
public class test_03 { 
2503
3a74844d15ec fix 2 Java reloading tests. A warmup :)
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2490
diff changeset
  1327
    private static int foo() { 
2490
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1328
        return 20; 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1329
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1330
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1331
    self should: [ caller new qux ] raise: Error.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1332
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1333
    "Created: / 11-04-2013 / 10:44:18 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
2505
3240724d9a1a fixing JavaSingleReloadingTests>>test_03ab tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2490
diff changeset
  1334
    "Modified: / 14-04-2013 / 15:22:18 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
2490
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1335
!
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1336
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1337
test_03b
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1338
    "
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1339
    1) compile simple class with one private method that returns 10
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1340
    2) call that method indirectly, check that it raises exception
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1341
    3) change it to public method
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1342
    4) calling method should not raise exception anymore
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1343
    "
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1344
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1345
    | jclass1 jclass2 caller |
2503
3a74844d15ec fix 2 Java reloading tests. A warmup :)
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2490
diff changeset
  1346
    self compileAndRegister:'
2490
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1347
public class test_03 { 
2503
3a74844d15ec fix 2 Java reloading tests. A warmup :)
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2490
diff changeset
  1348
    public static int foo() {
2490
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1349
        return 10; 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1350
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1351
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1352
    caller := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1353
public class test_03_caller {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1354
    public int qux() {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1355
        return test_03.foo();
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1356
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1357
}
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1358
'.
2503
3a74844d15ec fix 2 Java reloading tests. A warmup :)
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2490
diff changeset
  1359
    jclass1 := self compileAndRegister:'
3a74844d15ec fix 2 Java reloading tests. A warmup :)
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2490
diff changeset
  1360
public class test_03 { 
3a74844d15ec fix 2 Java reloading tests. A warmup :)
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2490
diff changeset
  1361
    private static int foo() {
3a74844d15ec fix 2 Java reloading tests. A warmup :)
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2490
diff changeset
  1362
        return 10; 
3a74844d15ec fix 2 Java reloading tests. A warmup :)
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2490
diff changeset
  1363
    }
3a74844d15ec fix 2 Java reloading tests. A warmup :)
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2490
diff changeset
  1364
}'.
2490
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1365
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1366
    self should: [ caller new qux ] raise: Error.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1367
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1368
    jclass2 := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1369
public class test_03 { 
2505
3240724d9a1a fixing JavaSingleReloadingTests>>test_03ab tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2490
diff changeset
  1370
    public static int foo() { 
2490
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1371
        return 20; 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1372
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1373
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1374
   self assert: (caller new qux) == 20.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1375
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1376
    "Created: / 11-04-2013 / 10:46:31 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
2505
3240724d9a1a fixing JavaSingleReloadingTests>>test_03ab tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2490
diff changeset
  1377
    "Modified: / 14-04-2013 / 15:23:25 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
2490
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1378
! !
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1379
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1380
!JavaSingleClassReloadingTests methodsFor:'tests - overloads'!
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1381
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1382
test_overloads_00a
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1383
    "
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1384
    1) compile simple class with one method taking Object arg
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1385
    3) compile caller class passing in String
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1386
    4) recompile simple class, overload the method with one taking String arg
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1387
    5) assert caller class invokes the String method
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1388
    "
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1389
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1390
    | jclass1 jclass2 callerClass jinst1 jinst2 |
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1391
    jclass1 := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1392
public class test_overloads_00 { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1393
    public int foo(Object o) { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1394
        return 1; 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1395
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1396
}'.    
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1397
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1398
    callerClass := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1399
public class CallerClass { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1400
    public int call(test_overloads_00 o) { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1401
        return o.foo("foo"); 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1402
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1403
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1404
    jinst1 := jclass1 new.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1405
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1406
    self assert: (callerClass new call: jinst1) = 1.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1407
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1408
    jclass2 := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1409
public class test_overloads_00 { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1410
    public int foo(Object o) { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1411
        return 1; 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1412
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1413
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1414
    public int foo(String s) { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1415
        return 2; 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1416
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1417
}'. 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1418
    jinst2 := jclass2 new.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1419
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1420
    self assert: (callerClass new call: jinst1) = 2.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1421
    self assert: (callerClass new call: jinst2) = 2.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1422
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1423
    "Created: / 11-04-2013 / 13:29:44 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1424
!
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1425
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1426
test_overloads_00b
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1427
    "
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1428
    1) compile simple class with two methods taking Object and String arg
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1429
    3) compile caller class passing in String
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1430
    4) recompile simple class, remove overloaded method taking String arg
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1431
    5) assert caller class invokes the Object method
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1432
    "
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1433
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1434
    | jclass1 jclass2 callerClass jinst1 jinst2 |
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1435
    jclass1 := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1436
public class test_overloads_00 { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1437
    public int foo(Object o) { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1438
        return 1; 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1439
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1440
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1441
    public int foo(String s) { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1442
        return 2; 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1443
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1444
}'.    
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1445
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1446
    callerClass := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1447
public class CallerClass { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1448
    public int call(test_overloads_00 o) { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1449
        return o.foo("foo"); 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1450
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1451
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1452
    jinst1 := jclass1 new.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1453
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1454
    self assert: (callerClass new call: jinst1) = 2.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1455
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1456
    jclass2 := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1457
public class test_overloads_00 { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1458
    public int foo(Object o) { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1459
        return 1; 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1460
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1461
}'. 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1462
    jinst2 := jclass2 new.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1463
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1464
    self assert: (callerClass new call: jinst1) = 1.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1465
    self assert: (callerClass new call: jinst2) = 1.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1466
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1467
    "Created: / 11-04-2013 / 13:30:38 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1468
!
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1469
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1470
test_overloads_01a
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1471
    "
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1472
    1) compile simple class with one method taking Object arg
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1473
    3) compile caller class passing in String
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1474
    4) recompile simple class, overload the method with one taking String arg
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1475
    5) assert caller class invokes the String method
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1476
    "
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1477
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1478
    | jclass1A jclass1B jclass2A callerClass jinst1 jinst2 |
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1479
    jclass1A := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1480
public class test_overloads_01_A { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1481
    public int foo(Object o) { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1482
        return 1; 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1483
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1484
}'.    
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1485
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1486
    jclass1B := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1487
public class test_overloads_01_B extends test_overloads_01_A {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1488
    public int foo(String foo) {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1489
        return super.foo(foo) + 10;
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1490
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1491
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1492
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1493
    callerClass := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1494
public class CallerClass { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1495
    public int call(test_overloads_01_B o) { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1496
        return o.foo("foo"); 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1497
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1498
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1499
    jinst1 := jclass1B new.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1500
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1501
    self assert: (callerClass new call: jinst1) = 11.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1502
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1503
    jclass2A := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1504
public class test_overloads_01_A { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1505
    public int foo(Object o) { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1506
        return 1; 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1507
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1508
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1509
    public int foo(String s) { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1510
        return 2; 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1511
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1512
}'. 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1513
    jinst2 := jclass2A new.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1514
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1515
    self assert: (callerClass new call: jinst1) = 12.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1516
    self assert: (callerClass new call: jinst2) = 12.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1517
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1518
    "Created: / 11-04-2013 / 13:34:59 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1519
!
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1520
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1521
test_overloads_01b
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1522
    "
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1523
    1) compile simple class with two overloaded methods taking Object and String arg
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1524
    3) compile caller class passing in String
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1525
    4) recompile simple class, remove overloaded method aking String arg
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1526
    5) assert caller class invokes the Object method
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1527
    "
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1528
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1529
    | jclass1A jclass1B jclass2A callerClass jinst1 jinst2 |
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1530
    jclass1A := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1531
public class test_overloads_01_A { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1532
    public int foo(Object o) { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1533
        return 1; 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1534
    }    
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1535
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1536
    public int foo(String s) { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1537
        return 2; 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1538
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1539
}'.    
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1540
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1541
    jclass1B := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1542
public class test_overloads_01_B extends test_overloads_01_A {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1543
    public int foo(String foo) {
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1544
        return super.foo(foo) + 10;
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1545
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1546
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1547
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1548
    callerClass := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1549
public class CallerClass { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1550
    public int call(test_overloads_01_B o) { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1551
        return o.foo("foo"); 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1552
    }
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1553
}'.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1554
    jinst1 := jclass1B new.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1555
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1556
    self assert: (callerClass new call: jinst1) = 12.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1557
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1558
    jclass2A := self compileAndRegister:'
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1559
public class test_overloads_01_A { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1560
    public int foo(Object o) { 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1561
        return 1; 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1562
    } 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1563
}'. 
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1564
    jinst2 := jclass2A new.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1565
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1566
    self assert: (callerClass new call: jinst1) = 11.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1567
    self assert: (callerClass new call: jinst2) = 11.
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1568
c1b287b2fdd4 add many reloading tests
Marcel Hlopko <marcel.hlopko@fit.cvut.cz>
parents: 2487
diff changeset
  1569
    "Created: / 11-04-2013 / 13:35:15 / Marcel Hlopko <marcel.hlopko@fit.cvut.cz>"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1570
! !
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1571
2531
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1572
!JavaSingleClassReloadingTests methodsFor:'tests - restart'!
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1573
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1574
test_restart_01
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1575
    "
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1576
    This is a tricky test. It compiles a class with errorneous 
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1577
    method anr run it. It raises JavaUnresolvedCompilationProblem which
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1578
    is catched and, while the errorneous method is still running (i.e.,
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1579
    it is still on the stack) it fixes the code. Then it restarts
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1580
    the context of errorneous method and checks, whether a new
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1581
    (fixed) code is executed. This requires some support in the VM."
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1582
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1583
    | source1 source2 inst gotError retval |
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1584
    source1 := '
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1585
    public class Foo {
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1586
        public int foo() {
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1587
            return true;
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1588
        }
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1589
    }
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1590
'.
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1591
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1592
    source2 := '
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1593
    public class Foo {
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1594
        public int foo() {
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1595
            return 100;
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1596
        }
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1597
    }
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1598
'.
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1599
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1600
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1601
    JavaCompiler compile: source1 register: true notifying: nil.
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1602
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1603
    gotError := false.
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1604
    inst := JAVA Foo new.
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1605
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1606
    [
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1607
        retval := inst foo.
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1608
    ] on: JavaUnresolvedCompilationError do:[:ex|
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1609
        gotError ifFalse:[
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1610
            "First error - fix the method"
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1611
            self assert: ex suspendedContext sender selector == #'foo()I'.
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1612
            gotError := true.
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1613
            JavaCompiler compile: source1 register: true notifying: nil.
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1614
            self assert: ex suspendedContext sender restart
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1615
        ] ifFalse:[
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1616
            self assert: false. "/ did not executed new code...
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1617
        ].
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1618
    ]
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1619
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1620
    "Created: / 19-04-2013 / 10:28:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1621
! !
cce7791abdb1 More tests for fix & restart support.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2509
diff changeset
  1622
2487
e4e3c9071b68 ClassReloadingTests/SingleClassReloadingTests renamed to start with Java.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2486
diff changeset
  1623
!JavaSingleClassReloadingTests class methodsFor:'documentation'!
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1624
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1625
version_CVS
2396
fadc6d7a2f5b Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2353
diff changeset
  1626
    ^ '$Header: /cvs/stx/stx/libjava/experiments/SingleClassReloadingTests.st,v 1.2 2013-02-25 11:15:34 vrany Exp $'
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1627
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1628
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1629
version_HG
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1630
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1631
    ^ '$Changeset: <not expanded> $'
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1632
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1633
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1634
version_SVN
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1635
    ^ '§Id::                                                                                                                        §'
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1636
! !
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1637