JavaMethodRefTests.st
author Claus Gittinger <cg@exept.de>
Sun, 23 Feb 2020 14:03:15 +0100
branchcvs_MAIN
changeset 3997 5bb44f7e1d20
parent 3412 df11bb428463
permissions -rw-r--r--
#REFACTORING by exept class: Java class changed: #dumpConfigOn:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
     1
"
3324
a58245c0e83a Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2992
diff changeset
     2
 COPYRIGHT (c) 1996-2015 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
3324
a58245c0e83a Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2992
diff changeset
     6
 COPYRIGHT (c) 2010-2015 by Jan Vrany, Jan Kurs and Marcel Hlopko
749
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
3330
b14c58b2876c Oops, moved stray reloading-related methods from stx:libjava/experiments to stx:libjava.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    23
"{ NameSpace: Smalltalk }"
b14c58b2876c Oops, moved stray reloading-related methods from stx:libjava/experiments to stx:libjava.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
    24
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
    25
JavaRefsAndConstantPoolTestCase subclass:#JavaMethodRefTests
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    26
	instanceVariableNames:''
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    27
	classVariableNames:''
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    28
	poolDictionaries:''
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    29
	category:'Languages-Java-Tests-RuntimeConstantPool'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    30
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    31
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    32
!JavaMethodRefTests class methodsFor:'documentation'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    33
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    34
copyright
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    35
"
3324
a58245c0e83a Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2992
diff changeset
    36
 COPYRIGHT (c) 1996-2015 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
    37
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2152
diff changeset
    38
 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
    39
3324
a58245c0e83a Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2992
diff changeset
    40
 COPYRIGHT (c) 2010-2015 by Jan Vrany, Jan Kurs and Marcel Hlopko
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    41
                            SWING Research Group, Czech Technical University in Prague
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    42
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    43
 This software is furnished under a license and may be used
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    44
 only in accordance with the terms of that license and with the
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    45
 inclusion of the above copyright notice.   This software may not
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    46
 be provided or otherwise made available to, or used by, any
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    47
 other person.  No title to or ownership of the software is
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    48
 hereby transferred.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    49
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
    50
 [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
    51
     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
    52
     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
    53
     as of 1.9.2010
749
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
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    57
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    58
!JavaMethodRefTests methodsFor:'permission tests'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    59
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    60
testAccessingPPFromOutside
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    61
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    62
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    63
    initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    64
    self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    65
        should: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    66
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    67
                        getMethodRefNamed: 'packagePrivateMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    68
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    69
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    70
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    71
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    72
        raise: Error
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    73
        suchThat: [:e | e messageText = 'IllegalAccessError' ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    74
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    75
    "Created: / 14-04-2011 / 15:10:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    76
    "Modified: / 23-05-2011 / 17:15:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    77
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    78
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    79
testAccessingPPFromSubclass
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    80
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    81
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    82
    initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    83
    self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    84
        shouldnt: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    85
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    86
                        getMethodRefNamed: 'packagePrivateMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    87
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    88
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    89
            javaMethodRef 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    90
                owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    91
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    92
        raise: Error
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    93
        .
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    94
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    95
    "Created: / 14-04-2011 / 15:10:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    96
    "Modified: / 23-05-2011 / 17:14:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    97
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    98
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
    99
testAccessingPrivateFromOutside
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   100
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   101
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   102
    initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   103
    self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   104
        should: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   105
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   106
                        getMethodRefNamed: 'privateMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   107
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   108
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   109
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   110
        raise: Error
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   111
        suchThat: [:e | e messageText = 'IllegalAccessError' ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   112
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   113
    "Created: / 13-04-2011 / 14:44:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   114
    "Modified: / 23-05-2011 / 17:16:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   115
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   116
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   117
testAccessingPrivateFromOutsideInNonPublic
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   118
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   119
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   120
    initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   121
    self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   122
        should: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   123
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   124
                        getMethodRefNamed: 'privateMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   125
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   126
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   127
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   128
        raise: Error
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   129
        suchThat: [:e | e messageText = 'IllegalAccessError' ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   130
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   131
    "Created: / 13-04-2011 / 14:47:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   132
    "Modified: / 23-05-2011 / 17:17:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   133
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   134
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   135
testAccessingPrivateFromSubclass
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   136
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   137
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   138
    initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   139
    self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   140
        should: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   141
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   142
                        getMethodRefNamed: 'privateMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   143
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   144
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   145
                javaMethodRef owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   146
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   147
        raise: Error
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   148
        suchThat: [:e | e messageText = 'IllegalAccessError' ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   149
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   150
    "Created: / 13-04-2011 / 14:49:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   151
    "Modified: / 23-05-2011 / 17:13:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   152
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   153
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   154
testAccessingProtectedFromOutside
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   155
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   156
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   157
    initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   158
    self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   159
        should: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   160
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   161
                        getMethodRefNamed: 'protectedMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   162
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   163
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   164
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   165
        raise: Error
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   166
        suchThat: [:e | e messageText = 'IllegalAccessError' ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   167
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   168
    "Created: / 13-04-2011 / 14:44:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   169
    "Modified: / 23-05-2011 / 17:12:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   170
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   171
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   172
testAccessingProtectedFromOutsideInNonPublic
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   173
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   174
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   175
    initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   176
    self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   177
        should: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   178
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   179
                        getMethodRefNamed: 'protectedMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   180
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   181
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   182
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   183
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   184
        raise: Error
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   185
        suchThat: [:e | e messageText = 'IllegalAccessError' ].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   186
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   187
    "Created: / 13-04-2011 / 14:47:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   188
    "Modified: / 23-05-2011 / 17:12:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   189
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   190
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   191
testAccessingProtectedFromPackage
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   192
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   193
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   194
initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   195
    self shouldnt: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   196
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   197
                        getMethodRefNamed: 'publicMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   198
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   199
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   200
            javaMethodRef 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   201
                owner: (Java classForName: 'stx.libjava.tests.mocks.Crate').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   202
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   203
        raise: Error.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   204
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   205
    "Created: / 14-04-2011 / 15:09:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   206
    "Modified: / 23-05-2011 / 17:11:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   207
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   208
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   209
testAccessingProtectedFromSubclass
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   210
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   211
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   212
    initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   213
    self shouldnt: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   214
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   215
                        getMethodRefNamed: 'protectedMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   216
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   217
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   218
            javaMethodRef 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   219
                owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   220
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   221
        raise: Error.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   222
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   223
    "Created: / 13-04-2011 / 14:49:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   224
    "Modified: / 23-05-2011 / 17:11:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   225
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   226
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   227
testAccessingPublicFromOutside
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   228
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   229
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   230
    initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   231
    self shouldnt: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   232
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   233
                        getMethodRefNamed: 'publicMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   234
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   235
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   236
            javaMethodRef 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   237
                owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   238
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   239
        raise: Error.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   240
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   241
    "Created: / 13-04-2011 / 14:44:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   242
    "Modified: / 23-05-2011 / 17:10:40 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   243
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   244
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   245
testAccessingPublicFromOutsideInNonPublic
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   246
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   247
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   248
    initString := 'Lstx/libjava/tests/mocks/NonPublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   249
    self shouldnt: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   250
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   251
                        getMethodRefNamed: 'publicMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   252
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   253
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   254
            javaMethodRef 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   255
                owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   256
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   257
        raise: Error.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   258
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   259
    "Created: / 13-04-2011 / 14:48:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   260
    "Modified: / 23-05-2011 / 17:10:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   261
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   262
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   263
testAccessingPublicFromSubclass
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   264
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   265
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   266
    initString := 'Lstx/libjava/tests/mocks/PublicClass;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   267
    self shouldnt: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   268
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   269
                        getMethodRefNamed: 'publicMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   270
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   271
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   272
            javaMethodRef 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   273
                owner: (Java classForName: 'stx.libjava.tests.mocks.SubclassOfPublicClass').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   274
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   275
        raise: Error.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   276
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   277
    "Created: / 13-04-2011 / 14:49:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   278
    "Modified: / 23-05-2011 / 17:10:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   279
!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   280
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   281
testAccessingPublicInterfaceFromOutside
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   282
    | javaMethodRef  initString |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   283
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   284
    initString := 'Lstx/libjava/tests/mocks/PublicInterface;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   285
    self should: 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   286
            [ javaMethodRef := self 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   287
                        getMethodRefNamed: 'publicMethod'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   288
                        typed: '()Ljava/lang/String;'
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   289
                        inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   290
            javaMethodRef 
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   291
                owner: (Java classForName: 'stx.libjava.tests.mocks.PublicClass').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   292
            javaMethodRef resolve. ]
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   293
        raise: Error suchThat: [:e | e messageText = 'IncompatibleClassChangeError'].
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   294
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   295
    "Created: / 23-05-2011 / 17:54:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   296
! !
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   297
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
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   317
!JavaMethodRefTests methodsFor:'resolving tests'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   318
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   319
testCorrectInstanceCreation
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   320
    | initString  javaMethodRef |
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   321
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   322
    initString := 'Ljava/lang/String;'.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   323
    javaMethodRef := self getMethodRefNamed: '<init>' typed: '()V' inClass: initString.
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   324
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   325
    self assertTrue: (javaMethodRef isResolved not).
2992
732f9db2a195 Cleanup & refactoring of constant pool references (JavaRef2 hierarchy)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2731
diff changeset
   326
    self assertTrue: (javaMethodRef resolvedValue isNil).
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   327
    self assertTrue: (javaMethodRef name = '<init>').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   328
    self assertTrue: (javaMethodRef descriptor = '()V').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   329
    self assertTrue: (javaMethodRef classRef name = 'Ljava/lang/String;').
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   330
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   331
    "Created: / 08-04-2011 / 14:01:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   332
    "Modified: / 23-05-2011 / 17:03:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
2992
732f9db2a195 Cleanup & refactoring of constant pool references (JavaRef2 hierarchy)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2731
diff changeset
   333
    "Modified: / 31-01-2014 / 09:08:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
749
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
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   429
!JavaMethodRefTests class methodsFor:'documentation'!
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   430
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
   431
version_CVS
3412
df11bb428463 Merged with mercurial revision 4f3cc813be4 (8 changesets total)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3360
diff changeset
   432
    ^ '$Header: /cvs/stx/stx/libjava/JavaMethodRefTests.st,v 1.6 2015-03-20 12:08:00 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
   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
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
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
   436
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
    ^ '$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
   438
!
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
749
e898eaeff091 Synchronized with CVS repository at:
vranyj1
parents:
diff changeset
   440
version_SVN
2731
13f5be2bf83b Merged d87e89dd5276 and fe83a843a7bf (branch default - CVS HEAD)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2711 2678
diff changeset
   441
    ^ 'Id'
2152
1cbdfbcc685c Jan's version
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 749
diff changeset
   442
! !
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
   443