JavaMethodRefTests.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Fri, 24 May 2013 17:55:42 +0100
branchbuiltin-class-support
changeset 2629 cedb88626902
parent 2578 fc6186a4961f
child 2711 a00302fe5083
permissions -rw-r--r--
Closing branch.
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
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    56
!JavaMethodRefTests methodsFor:'permission tests'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    57
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    58
testAccessingPPFromOutside
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    59
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    60
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    61
    initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    62
    self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    63
        should: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    64
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    65
                        getMethodRefNamed: 'packagePrivateMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    66
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    67
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    68
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    69
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    70
        raise: Error
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    71
        suchThat: [:e | e messageText = 'IllegalAccessError' ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    72
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    73
    "Created: / 14-04-2011 / 15:10:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    74
    "Modified: / 23-05-2011 / 17:15:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    75
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    76
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    77
testAccessingPPFromSubclass
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    78
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    79
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    80
    initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    81
    self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    82
        shouldnt: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    83
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    84
                        getMethodRefNamed: 'packagePrivateMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    85
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    86
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    87
            javaMethodRef 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    88
                owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    89
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    90
        raise: Error
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    91
        .
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    92
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    93
    "Created: / 14-04-2011 / 15:10:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    94
    "Modified: / 23-05-2011 / 17:14:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    95
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    96
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    97
testAccessingPrivateFromOutside
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    98
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    99
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   100
    initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   101
    self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   102
        should: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   103
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   104
                        getMethodRefNamed: 'privateMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   105
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   106
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   107
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   108
        raise: Error
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   109
        suchThat: [:e | e messageText = 'IllegalAccessError' ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   110
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   111
    "Created: / 13-04-2011 / 14:44:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   112
    "Modified: / 23-05-2011 / 17:16:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   113
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   114
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   115
testAccessingPrivateFromOutsideInNonPublic
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   116
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   117
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   118
    initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   119
    self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   120
        should: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   121
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   122
                        getMethodRefNamed: 'privateMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   123
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   124
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   125
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   126
        raise: Error
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   127
        suchThat: [:e | e messageText = 'IllegalAccessError' ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   128
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   129
    "Created: / 13-04-2011 / 14:47:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   130
    "Modified: / 23-05-2011 / 17:17:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   131
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   132
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   133
testAccessingPrivateFromSubclass
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   134
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   135
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   136
    initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   137
    self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   138
        should: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   139
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   140
                        getMethodRefNamed: 'privateMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   141
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   142
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   143
                javaMethodRef owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   144
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   145
        raise: Error
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   146
        suchThat: [:e | e messageText = 'IllegalAccessError' ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   147
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   148
    "Created: / 13-04-2011 / 14:49:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   149
    "Modified: / 23-05-2011 / 17:13:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   150
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   151
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   152
testAccessingProtectedFromOutside
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   153
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   154
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   155
    initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   156
    self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   157
        should: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   158
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   159
                        getMethodRefNamed: 'protectedMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   160
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   161
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   162
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   163
        raise: Error
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   164
        suchThat: [:e | e messageText = 'IllegalAccessError' ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   165
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   166
    "Created: / 13-04-2011 / 14:44:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   167
    "Modified: / 23-05-2011 / 17:12:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   168
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   169
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   170
testAccessingProtectedFromOutsideInNonPublic
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   171
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   172
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   173
    initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   174
    self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   175
        should: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   176
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   177
                        getMethodRefNamed: 'protectedMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   178
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   179
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   180
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   181
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   182
        raise: Error
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   183
        suchThat: [:e | e messageText = 'IllegalAccessError' ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   184
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   185
    "Created: / 13-04-2011 / 14:47:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   186
    "Modified: / 23-05-2011 / 17:12:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   187
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   188
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   189
testAccessingProtectedFromPackage
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   190
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   191
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   192
initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   193
    self shouldnt: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   194
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   195
                        getMethodRefNamed: 'publicMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   196
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   197
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   198
            javaMethodRef 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   199
                owner: (Java classForName: 'stx.libjava.tests.mocks.Crate').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   200
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   201
        raise: Error.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   202
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   203
    "Created: / 14-04-2011 / 15:09:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   204
    "Modified: / 23-05-2011 / 17:11:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   205
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   206
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   207
testAccessingProtectedFromSubclass
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   208
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   209
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   210
    initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   211
    self shouldnt: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   212
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   213
                        getMethodRefNamed: 'protectedMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   214
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   215
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   216
            javaMethodRef 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   217
                owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   218
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   219
        raise: Error.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   220
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   221
    "Created: / 13-04-2011 / 14:49:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   222
    "Modified: / 23-05-2011 / 17:11:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   223
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   224
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   225
testAccessingPublicFromOutside
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   226
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   227
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   228
    initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   229
    self shouldnt: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   230
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   231
                        getMethodRefNamed: 'publicMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   232
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   233
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   234
            javaMethodRef 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   235
                owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   236
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   237
        raise: Error.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   238
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   239
    "Created: / 13-04-2011 / 14:44:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   240
    "Modified: / 23-05-2011 / 17:10:40 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   241
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   242
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   243
testAccessingPublicFromOutsideInNonPublic
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   244
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   245
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   246
    initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   247
    self shouldnt: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   248
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   249
                        getMethodRefNamed: 'publicMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   250
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   251
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   252
            javaMethodRef 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   253
                owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   254
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   255
        raise: Error.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   256
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   257
    "Created: / 13-04-2011 / 14:48:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   258
    "Modified: / 23-05-2011 / 17:10:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   259
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   260
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   261
testAccessingPublicFromSubclass
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   262
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   263
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   264
    initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   265
    self shouldnt: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   266
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   267
                        getMethodRefNamed: 'publicMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   268
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   269
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   270
            javaMethodRef 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   271
                owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   272
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   273
        raise: Error.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   274
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   275
    "Created: / 13-04-2011 / 14:49:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   276
    "Modified: / 23-05-2011 / 17:10:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   277
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   278
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   279
testAccessingPublicInterfaceFromOutside
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   280
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   281
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   282
    initString := 'Lstx/libjava/tests/mocks/PublicInterface;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   283
    self should: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   284
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   285
                        getMethodRefNamed: 'publicMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   286
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   287
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   288
            javaMethodRef 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   289
                owner: (Java classForName: 'stx.libjava.tests.mocks.PublicClass').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   290
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   291
        raise: Error suchThat: [:e | e messageText = 'IncompatibleClassChangeError'].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   292
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   293
    "Created: / 23-05-2011 / 17:54:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   294
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   295
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   296
!JavaMethodRefTests methodsFor:'resolving static tests'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   297
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   298
testCorrectStaticResolving
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   299
    | initString  javaMethodRef  expectedResult  result |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   300
    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
   301
    javaMethodRef := self 
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   302
                getMethodRefNamed: 'publicStaticMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   303
                typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   304
                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
   305
    result := javaMethodRef resolve.
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   306
    expectedResult := (Java 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   307
                classForName: 'stx.libjava.tests.mocks.PublicClass') methodDictionary 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   308
                at: #'publicStaticMethod()Ljava/lang/String;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   309
    self assertTrue: (result = expectedResult).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   310
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   311
    "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
   312
    "Modified: / 08-12-2011 / 19:25:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   313
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   314
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   315
!JavaMethodRefTests methodsFor:'resolving tests'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   316
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   317
testCorrectInstanceCreation
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   318
    | initString  javaMethodRef |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   319
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   320
    initString := 'Ljava/lang/String;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   321
    javaMethodRef := self getMethodRefNamed: '<init>' typed: '()V' inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   322
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   323
    self assertTrue: (javaMethodRef isResolved not).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   324
    self assertTrue: (javaMethodRef valueCache isNil).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   325
    self assertTrue: (javaMethodRef name = '<init>').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   326
    self assertTrue: (javaMethodRef descriptor = '()V').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   327
    self assertTrue: (javaMethodRef classRef name = 'Ljava/lang/String;').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   328
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   329
    "Created: / 08-04-2011 / 14:01:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   330
    "Modified: / 23-05-2011 / 17:03:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   331
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   332
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   333
testCorrectResolving
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   334
    | initString  javaMethodRef  expectedResult  result |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   335
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   336
    initString := 'Ljava/lang/String;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   337
    javaMethodRef :=  self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   338
                getMethodRefNamed: '<init>'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   339
                typed: '()V'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   340
                inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   341
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   342
    result := javaMethodRef resolve.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   343
    expectedResult := (Java classForName: 'java.lang.String') methodDictionary 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   344
                at: #'<init>()V'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   345
    self assertTrue: (result = expectedResult).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   346
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   347
    "Created: / 08-04-2011 / 14:07:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   348
    "Modified: / 23-05-2011 / 17:06:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   349
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   350
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   351
testInvalidation
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   352
    | javaMethodRef  initString|
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   353
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   354
    initString := 'Ljava/lang/String;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   355
     javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   356
                getMethodRefNamed: '<init>'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   357
                typed: '()V'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   358
                inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   359
    self assertTrue: (javaMethodRef isResolved not).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   360
    javaMethodRef resolve.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   361
    self assertTrue: (javaMethodRef isResolved).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   362
    self assertTrue: (javaMethodRef classRef isResolved).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   363
    javaMethodRef invalidate.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   364
    self assertTrue: (javaMethodRef isResolved not).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   365
    self assertTrue: (javaMethodRef classRef isResolved not).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   366
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   367
    "Created: / 08-04-2011 / 14:09:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   368
    "Modified: / 23-05-2011 / 17:06:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   369
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   370
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   371
testInvalidationForClassNegative
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   372
    | javaMethodRef  initString|
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   373
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   374
    initString := 'Ljava/lang/String;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   375
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   376
    javaMethodRef :=  self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   377
                getMethodRefNamed: '<init>'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   378
                typed: '()V'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   379
                inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   380
    self assertTrue: (javaMethodRef isResolved not).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   381
    javaMethodRef resolve.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   382
    self assertTrue: (javaMethodRef isResolved).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   383
    javaMethodRef invalidateForClass: 'Ljava/lang/Object;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   384
    self assertTrue: (javaMethodRef isResolved).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   385
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   386
    "Created: / 08-04-2011 / 16:23:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   387
    "Modified: / 23-05-2011 / 17:07:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   388
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   389
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   390
testInvalidationForClassPositive
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   391
    | javaMethodRef  initString|
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   392
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   393
    initString := 'Ljava/lang/String;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   394
    javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   395
                getMethodRefNamed: '<init>'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   396
                typed: '()V'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   397
                inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   398
    self assertTrue: (javaMethodRef isResolved not).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   399
    javaMethodRef resolve.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   400
    self assertTrue: (javaMethodRef isResolved).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   401
    javaMethodRef invalidateForClass: 'Ljava/lang/String;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   402
    self assertTrue: (javaMethodRef isResolved not).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   403
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   404
    "Created: / 08-04-2011 / 16:23:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   405
    "Modified: / 23-05-2011 / 17:07:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   406
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   407
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   408
testResolving
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   409
    | initString javaMethodRef |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   410
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   411
    initString := 'Ljava/lang/String;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   412
    javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   413
                getMethodRefNamed: '<init>'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   414
                typed: '()V'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   415
                inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   416
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   417
    self assertTrue: (javaMethodRef isResolved not).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   418
    javaMethodRef resolve.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   419
    self assertTrue: (javaMethodRef classRef isResolved).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   420
    self assertTrue: (javaMethodRef isResolved).
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   421
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   422
    "Created: / 08-04-2011 / 14:04:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   423
    "Modified: / 23-05-2011 / 17:05:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   424
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   425
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   426
!JavaMethodRefTests class methodsFor:'documentation'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   427
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
   428
version_CVS
2578
fc6186a4961f Performance optimization: rewrote 'JavaVM classNamed:' to 'JavaVM classNamed:...definedBy:...'.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2429
diff changeset
   429
    ^ '$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
   430
!
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
   431
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_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
   433
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
    ^ '$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
   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
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   437
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
   438
    ^ '§Id§'
2152
1cbdfbcc685c Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 749
diff changeset
   439
! !
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
   440