JavaMethodRefTests.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Fri, 19 Apr 2013 13:50:19 +0200
branchdevelopment
changeset 2532 64a784c73d1e
parent 2429 ebece4dcaab9
child 2578 fc6186a4961f
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:
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     1
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     2
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
     3
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
     4
 New code and modifications done at SWING Research Group [1]:
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
     5
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     6
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     7
                            SWING Research Group, Czech Technical University in Prague
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     8
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     9
 This software is furnished under a license and may be used
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    10
 only in accordance with the terms of that license and with the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    11
 inclusion of the above copyright notice.   This software may not
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    12
 be provided or otherwise made available to, or used by, any
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    13
 other person.  No title to or ownership of the software is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    14
 hereby transferred.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    15
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
    16
 [1] Code written at SWING Research Group contains a signature
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
    17
     of one of the above copright owners. For exact set of such code,
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
    18
     see the differences between this version and version stx:libjava
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
    19
     as of 1.9.2010
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    20
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    21
"{ Package: 'stx:libjava' }"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    22
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
    23
JavaRefsAndConstantPoolTestCase subclass:#JavaMethodRefTests
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    24
	instanceVariableNames:''
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    25
	classVariableNames:''
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    26
	poolDictionaries:''
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    27
	category:'Languages-Java-Tests-RuntimeConstantPool'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    28
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    29
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    30
!JavaMethodRefTests class methodsFor:'documentation'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    31
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    32
copyright
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    33
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    34
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
    35
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
    36
 New code and modifications done at SWING Research Group [1]:
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
    37
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    38
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    39
                            SWING Research Group, Czech Technical University in Prague
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    40
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    41
 This software is furnished under a license and may be used
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    42
 only in accordance with the terms of that license and with the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    43
 inclusion of the above copyright notice.   This software may not
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    44
 be provided or otherwise made available to, or used by, any
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    45
 other person.  No title to or ownership of the software is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    46
 hereby transferred.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    47
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
    48
 [1] Code written at SWING Research Group contains a signature
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
    49
     of one of the above copright owners. For exact set of such code,
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
    50
     see the differences between this version and version stx:libjava
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
    51
     as of 1.9.2010
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    52
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    53
"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    54
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    55
2396
fadc6d7a2f5b Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2353
diff changeset
    56
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    57
!JavaMethodRefTests methodsFor:'permission tests'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    58
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    59
testAccessingPPFromOutside
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    60
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    61
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    62
    initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    63
    self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    64
        should: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    65
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    66
                        getMethodRefNamed: 'packagePrivateMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    67
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    68
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    69
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    70
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    71
        raise: Error
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    72
        suchThat: [:e | e messageText = 'IllegalAccessError' ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    73
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    74
    "Created: / 14-04-2011 / 15:10:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    75
    "Modified: / 23-05-2011 / 17:15:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    76
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    77
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    78
testAccessingPPFromSubclass
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    79
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    80
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    81
    initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    82
    self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    83
        shouldnt: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    84
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    85
                        getMethodRefNamed: 'packagePrivateMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    86
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    87
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    88
            javaMethodRef 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    89
                owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    90
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    91
        raise: Error
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    92
        .
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    93
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    94
    "Created: / 14-04-2011 / 15:10:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    95
    "Modified: / 23-05-2011 / 17:14:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    96
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    97
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    98
testAccessingPrivateFromOutside
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    99
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   100
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   101
    initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   102
    self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   103
        should: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   104
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   105
                        getMethodRefNamed: 'privateMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   106
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   107
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   108
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   109
        raise: Error
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   110
        suchThat: [:e | e messageText = 'IllegalAccessError' ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   111
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   112
    "Created: / 13-04-2011 / 14:44:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   113
    "Modified: / 23-05-2011 / 17:16:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   114
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   115
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   116
testAccessingPrivateFromOutsideInNonPublic
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   117
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   118
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   119
    initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   120
    self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   121
        should: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   122
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   123
                        getMethodRefNamed: 'privateMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   124
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   125
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   126
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   127
        raise: Error
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   128
        suchThat: [:e | e messageText = 'IllegalAccessError' ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   129
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   130
    "Created: / 13-04-2011 / 14:47:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   131
    "Modified: / 23-05-2011 / 17:17:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   132
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   133
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   134
testAccessingPrivateFromSubclass
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   135
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   136
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   137
    initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   138
    self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   139
        should: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   140
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   141
                        getMethodRefNamed: 'privateMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   142
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   143
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   144
                javaMethodRef owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   145
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   146
        raise: Error
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   147
        suchThat: [:e | e messageText = 'IllegalAccessError' ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   148
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   149
    "Created: / 13-04-2011 / 14:49:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   150
    "Modified: / 23-05-2011 / 17:13:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   151
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   152
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   153
testAccessingProtectedFromOutside
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   154
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   155
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   156
    initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   157
    self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   158
        should: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   159
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   160
                        getMethodRefNamed: 'protectedMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   161
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   162
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   163
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   164
        raise: Error
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   165
        suchThat: [:e | e messageText = 'IllegalAccessError' ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   166
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   167
    "Created: / 13-04-2011 / 14:44:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   168
    "Modified: / 23-05-2011 / 17:12:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   169
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   170
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   171
testAccessingProtectedFromOutsideInNonPublic
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   172
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   173
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   174
    initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   175
    self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   176
        should: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   177
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   178
                        getMethodRefNamed: 'protectedMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   179
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   180
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   181
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   182
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   183
        raise: Error
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   184
        suchThat: [:e | e messageText = 'IllegalAccessError' ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   185
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   186
    "Created: / 13-04-2011 / 14:47:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   187
    "Modified: / 23-05-2011 / 17:12:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   188
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   189
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   190
testAccessingProtectedFromPackage
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   191
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   192
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   193
initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   194
    self shouldnt: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   195
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   196
                        getMethodRefNamed: 'publicMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   197
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   198
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   199
            javaMethodRef 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   200
                owner: (Java classForName: 'stx.libjava.tests.mocks.Crate').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   201
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   202
        raise: Error.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   203
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   204
    "Created: / 14-04-2011 / 15:09:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   205
    "Modified: / 23-05-2011 / 17:11:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   206
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   207
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   208
testAccessingProtectedFromSubclass
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   209
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   210
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   211
    initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   212
    self shouldnt: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   213
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   214
                        getMethodRefNamed: 'protectedMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   215
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   216
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   217
            javaMethodRef 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   218
                owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   219
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   220
        raise: Error.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   221
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   222
    "Created: / 13-04-2011 / 14:49:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   223
    "Modified: / 23-05-2011 / 17:11:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   224
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   225
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   226
testAccessingPublicFromOutside
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   227
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   228
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   229
    initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   230
    self shouldnt: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   231
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   232
                        getMethodRefNamed: 'publicMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   233
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   234
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   235
            javaMethodRef 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   236
                owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   237
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   238
        raise: Error.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   239
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   240
    "Created: / 13-04-2011 / 14:44:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   241
    "Modified: / 23-05-2011 / 17:10:40 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   242
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   243
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   244
testAccessingPublicFromOutsideInNonPublic
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   245
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   246
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   247
    initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   248
    self shouldnt: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   249
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   250
                        getMethodRefNamed: 'publicMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   251
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   252
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   253
            javaMethodRef 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   254
                owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   255
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   256
        raise: Error.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   257
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   258
    "Created: / 13-04-2011 / 14:48:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   259
    "Modified: / 23-05-2011 / 17:10:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   260
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   261
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   262
testAccessingPublicFromSubclass
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   263
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   264
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   265
    initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   266
    self shouldnt: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   267
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   268
                        getMethodRefNamed: 'publicMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   269
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   270
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   271
            javaMethodRef 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   272
                owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   273
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   274
        raise: Error.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   275
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   276
    "Created: / 13-04-2011 / 14:49:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   277
    "Modified: / 23-05-2011 / 17:10:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   278
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   279
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   280
testAccessingPublicInterfaceFromOutside
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   281
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   282
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   283
    initString := 'Lstx/libjava/tests/mocks/PublicInterface;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   284
    self should: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   285
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   286
                        getMethodRefNamed: 'publicMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   287
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   288
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   289
            javaMethodRef 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   290
                owner: (Java classForName: 'stx.libjava.tests.mocks.PublicClass').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   291
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   292
        raise: Error suchThat: [:e | e messageText = 'IncompatibleClassChangeError'].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   293
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   294
    "Created: / 23-05-2011 / 17:54:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   295
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   296
2396
fadc6d7a2f5b Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2353
diff changeset
   297
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   298
!JavaMethodRefTests methodsFor:'resolving static tests'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   299
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   300
testCorrectStaticResolving
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   301
    | initString  javaMethodRef  expectedResult  result |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   302
    initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
   303
    javaMethodRef := self 
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   304
                getMethodRefNamed: 'publicStaticMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   305
                typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   306
                inClass: initString.
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
   307
    result := javaMethodRef resolve.
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   308
    expectedResult := (Java 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   309
                classForName: 'stx.libjava.tests.mocks.PublicClass') methodDictionary 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   310
                at: #'publicStaticMethod()Ljava/lang/String;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   311
    self assertTrue: (result = expectedResult).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   312
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   313
    "Created: / 28-04-2011 / 22:46:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
   314
    "Modified: / 08-12-2011 / 19:25:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   315
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   316
2396
fadc6d7a2f5b Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2353
diff changeset
   317
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   318
!JavaMethodRefTests methodsFor:'resolving tests'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   319
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   320
testCorrectInstanceCreation
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   321
    | initString  javaMethodRef |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   322
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   323
    initString := 'Ljava/lang/String;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   324
    javaMethodRef := self getMethodRefNamed: '<init>' typed: '()V' inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   325
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   326
    self assertTrue: (javaMethodRef isResolved not).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   327
    self assertTrue: (javaMethodRef valueCache isNil).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   328
    self assertTrue: (javaMethodRef name = '<init>').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   329
    self assertTrue: (javaMethodRef descriptor = '()V').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   330
    self assertTrue: (javaMethodRef classRef name = 'Ljava/lang/String;').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   331
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   332
    "Created: / 08-04-2011 / 14:01:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   333
    "Modified: / 23-05-2011 / 17:03:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   334
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   335
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   336
testCorrectResolving
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   337
    | initString  javaMethodRef  expectedResult  result |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   338
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   339
    initString := 'Ljava/lang/String;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   340
    javaMethodRef :=  self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   341
                getMethodRefNamed: '<init>'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   342
                typed: '()V'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   343
                inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   344
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   345
    result := javaMethodRef resolve.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   346
    expectedResult := (Java classForName: 'java.lang.String') methodDictionary 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   347
                at: #'<init>()V'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   348
    self assertTrue: (result = expectedResult).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   349
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   350
    "Created: / 08-04-2011 / 14:07:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   351
    "Modified: / 23-05-2011 / 17:06:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   352
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   353
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   354
testInvalidation
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   355
    | javaMethodRef  initString|
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   356
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   357
    initString := 'Ljava/lang/String;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   358
     javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   359
                getMethodRefNamed: '<init>'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   360
                typed: '()V'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   361
                inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   362
    self assertTrue: (javaMethodRef isResolved not).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   363
    javaMethodRef resolve.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   364
    self assertTrue: (javaMethodRef isResolved).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   365
    self assertTrue: (javaMethodRef classRef isResolved).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   366
    javaMethodRef invalidate.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   367
    self assertTrue: (javaMethodRef isResolved not).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   368
    self assertTrue: (javaMethodRef classRef isResolved not).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   369
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   370
    "Created: / 08-04-2011 / 14:09:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   371
    "Modified: / 23-05-2011 / 17:06:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   372
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   373
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   374
testInvalidationForClassNegative
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   375
    | javaMethodRef  initString|
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   376
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   377
    initString := 'Ljava/lang/String;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   378
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   379
    javaMethodRef :=  self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   380
                getMethodRefNamed: '<init>'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   381
                typed: '()V'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   382
                inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   383
    self assertTrue: (javaMethodRef isResolved not).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   384
    javaMethodRef resolve.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   385
    self assertTrue: (javaMethodRef isResolved).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   386
    javaMethodRef invalidateForClass: 'Ljava/lang/Object;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   387
    self assertTrue: (javaMethodRef isResolved).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   388
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   389
    "Created: / 08-04-2011 / 16:23:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   390
    "Modified: / 23-05-2011 / 17:07:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   391
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   392
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   393
testInvalidationForClassPositive
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   394
    | javaMethodRef  initString|
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   395
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   396
    initString := 'Ljava/lang/String;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   397
    javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   398
                getMethodRefNamed: '<init>'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   399
                typed: '()V'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   400
                inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   401
    self assertTrue: (javaMethodRef isResolved not).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   402
    javaMethodRef resolve.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   403
    self assertTrue: (javaMethodRef isResolved).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   404
    javaMethodRef invalidateForClass: 'Ljava/lang/String;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   405
    self assertTrue: (javaMethodRef isResolved not).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   406
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   407
    "Created: / 08-04-2011 / 16:23:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   408
    "Modified: / 23-05-2011 / 17:07:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   409
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   410
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   411
testResolving
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   412
    | initString javaMethodRef |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   413
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   414
    initString := 'Ljava/lang/String;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   415
    javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   416
                getMethodRefNamed: '<init>'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   417
                typed: '()V'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   418
                inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   419
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   420
    self assertTrue: (javaMethodRef isResolved not).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   421
    javaMethodRef resolve.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   422
    self assertTrue: (javaMethodRef classRef isResolved).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   423
    self assertTrue: (javaMethodRef isResolved).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   424
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   425
    "Created: / 08-04-2011 / 14:04:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   426
    "Modified: / 23-05-2011 / 17:05:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   427
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   428
2396
fadc6d7a2f5b Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2353
diff changeset
   429
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   430
!JavaMethodRefTests class methodsFor:'documentation'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   431
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
   432
version_CVS
2396
fadc6d7a2f5b Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2353
diff changeset
   433
    ^ '$Header: /cvs/stx/stx/libjava/JavaMethodRefTests.st,v 1.3 2013-02-25 11:15:31 vrany Exp $'
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
   434
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
   435
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
   436
version_HG
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
   437
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
   438
    ^ '$Changeset: <not expanded> $'
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
   439
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
   440
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   441
version_SVN
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
   442
    ^ '§Id§'
2152
1cbdfbcc685c Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 749
diff changeset
   443
! !
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
   444