src/JavaClassRef2.st
author hlopkmar
Wed, 02 Nov 2011 21:40:47 +0000
branchjk_new_structure
changeset 1073 e842ab17fe16
parent 1062 69aac7194016
child 1152 040cba55a7d2
permissions -rw-r--r--
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
877
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
     1
"
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
     2
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
     3
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
     4
                            SWING Research Group, Czech Technical University in Prague
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
     5
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
     6
 Parts of the code written by Claus Gittinger are under following
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
     7
 license:
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
     8
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
     9
 This software is furnished under a license and may be used
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    10
 only in accordance with the terms of that license and with the
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    11
 inclusion of the above copyright notice.   This software may not
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    12
 be provided or otherwise made available to, or used by, any
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    13
 other person.  No title to or ownership of the software is
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    14
 hereby transferred.
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    15
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    16
 Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    17
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    18
 Permission is hereby granted, free of charge, to any person
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    19
 obtaining a copy of this software and associated documentation
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    20
 files (the 'Software'), to deal in the Software without
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    21
 restriction, including without limitation the rights to use,
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    22
 copy, modify, merge, publish, distribute, sublicense, and/or sell
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    23
 copies of the Software, and to permit persons to whom the
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    24
 Software is furnished to do so, subject to the following
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    25
 conditions:
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    26
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    27
 The above copyright notice and this permission notice shall be
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    28
 included in all copies or substantial portions of the Software.
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    29
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    30
 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    31
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    32
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    33
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    34
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    35
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    36
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    37
 OTHER DEALINGS IN THE SOFTWARE.
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    38
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    39
 [1] Code written at SWING Research Group contain a signature
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    40
     of one of the above copright owners.
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    41
"
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    42
"{ Package: 'stx:libjava' }"
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    43
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    44
JavaRef2 subclass:#JavaClassRef2
778
caa3a009f617 refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents: 777
diff changeset
    45
	instanceVariableNames:'nameIndex'
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    46
	classVariableNames:''
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    47
	poolDictionaries:''
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    48
	category:'Languages-Java-Reader-Support-new'
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    49
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    50
877
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    51
!JavaClassRef2 class methodsFor:'documentation'!
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    52
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    53
copyright
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    54
"
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    55
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    56
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    57
                            SWING Research Group, Czech Technical University in Prague
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    58
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    59
 Parts of the code written by Claus Gittinger are under following
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    60
 license:
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    61
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    62
 This software is furnished under a license and may be used
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    63
 only in accordance with the terms of that license and with the
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    64
 inclusion of the above copyright notice.   This software may not
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    65
 be provided or otherwise made available to, or used by, any
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    66
 other person.  No title to or ownership of the software is
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    67
 hereby transferred.
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    68
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    69
 Parts of the code written at SWING Reasearch Group [1] are MIT licensed:
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    70
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    71
 Permission is hereby granted, free of charge, to any person
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    72
 obtaining a copy of this software and associated documentation
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    73
 files (the 'Software'), to deal in the Software without
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    74
 restriction, including without limitation the rights to use,
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    75
 copy, modify, merge, publish, distribute, sublicense, and/or sell
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    76
 copies of the Software, and to permit persons to whom the
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    77
 Software is furnished to do so, subject to the following
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    78
 conditions:
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    79
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    80
 The above copyright notice and this permission notice shall be
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    81
 included in all copies or substantial portions of the Software.
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    82
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    83
 THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    84
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    85
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    86
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    87
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    88
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    89
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    90
 OTHER DEALINGS IN THE SOFTWARE.
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    91
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    92
 [1] Code written at SWING Research Group contain a signature
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    93
     of one of the above copright owners.
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    94
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    95
"
f5a5b93e1c78 Cleanup phase 1
vranyj1
parents: 814
diff changeset
    96
! !
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    97
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    98
!JavaClassRef2 class methodsFor:'instance creation'!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
    99
771
fb8026dda011 Merged with /trunk
vranyj1
parents: 761
diff changeset
   100
in: aJavaConstantPool withNameAt: nameIndex
fb8026dda011 Merged with /trunk
vranyj1
parents: 761
diff changeset
   101
   
758
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   102
    
771
fb8026dda011 Merged with /trunk
vranyj1
parents: 761
diff changeset
   103
    ^ self basicNew initializeIn: aJavaConstantPool withNameAt: nameIndex.
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   104
771
fb8026dda011 Merged with /trunk
vranyj1
parents: 761
diff changeset
   105
    "Created: / 10-05-2011 / 14:56:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
758
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   106
! !
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   107
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   108
!JavaClassRef2 methodsFor:'accessing'!
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   109
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 758
diff changeset
   110
classLoader
777
e6e61412ae43 refactoring tests.. and more needed
hlopkmar
parents: 772
diff changeset
   111
    self owner ifNil: [ ^ nil ] ifNotNil: [ ^ self owner classLoader ].
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 758
diff changeset
   112
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 758
diff changeset
   113
    "Created: / 11-04-2011 / 21:52:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
777
e6e61412ae43 refactoring tests.. and more needed
hlopkmar
parents: 772
diff changeset
   114
    "Modified: / 12-05-2011 / 18:32:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 758
diff changeset
   115
!
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 758
diff changeset
   116
1073
e842ab17fe16 quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents: 1062
diff changeset
   117
displayString
e842ab17fe16 quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents: 1062
diff changeset
   118
    ^self name.
e842ab17fe16 quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents: 1062
diff changeset
   119
e842ab17fe16 quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents: 1062
diff changeset
   120
    "Created: / 01-11-2011 / 15:29:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e842ab17fe16 quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents: 1062
diff changeset
   121
!
e842ab17fe16 quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents: 1062
diff changeset
   122
1062
69aac7194016 Fixes in classloaders to make Groovy running (again)
vranyj1
parents: 1038
diff changeset
   123
fullName
69aac7194016 Fixes in classloaders to make Groovy running (again)
vranyj1
parents: 1038
diff changeset
   124
69aac7194016 Fixes in classloaders to make Groovy running (again)
vranyj1
parents: 1038
diff changeset
   125
    ^self javaClassName
69aac7194016 Fixes in classloaders to make Groovy running (again)
vranyj1
parents: 1038
diff changeset
   126
69aac7194016 Fixes in classloaders to make Groovy running (again)
vranyj1
parents: 1038
diff changeset
   127
    "Created: / 08-04-2011 / 13:48:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
69aac7194016 Fixes in classloaders to make Groovy running (again)
vranyj1
parents: 1038
diff changeset
   128
    "Modified: / 13-05-2011 / 09:59:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
69aac7194016 Fixes in classloaders to make Groovy running (again)
vranyj1
parents: 1038
diff changeset
   129
    "Created: / 30-10-2011 / 22:00:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
69aac7194016 Fixes in classloaders to make Groovy running (again)
vranyj1
parents: 1038
diff changeset
   130
!
69aac7194016 Fixes in classloaders to make Groovy running (again)
vranyj1
parents: 1038
diff changeset
   131
809
0fd3dbe06abb Few fixes in resolving.
vranyj1
parents: 786
diff changeset
   132
javaClass
0fd3dbe06abb Few fixes in resolving.
vranyj1
parents: 786
diff changeset
   133
1038
bf2ece5a5362 Few fixes
vranyj1
parents: 1035
diff changeset
   134
    valueCache isNil ifTrue:[self resolve].
809
0fd3dbe06abb Few fixes in resolving.
vranyj1
parents: 786
diff changeset
   135
    ^valueCache
0fd3dbe06abb Few fixes in resolving.
vranyj1
parents: 786
diff changeset
   136
0fd3dbe06abb Few fixes in resolving.
vranyj1
parents: 786
diff changeset
   137
    "Created: / 22-05-2011 / 14:02:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
0fd3dbe06abb Few fixes in resolving.
vranyj1
parents: 786
diff changeset
   138
!
0fd3dbe06abb Few fixes in resolving.
vranyj1
parents: 786
diff changeset
   139
758
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   140
javaClassName
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 758
diff changeset
   141
    "return java class name as written in java programs e.g. java.util.String
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 758
diff changeset
   142
     in case of array, return class name without square brackets"
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 758
diff changeset
   143
    
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 758
diff changeset
   144
    | tmp |
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 758
diff changeset
   145
814
68df82c46fb0 finally forced myself to refactor tests.. fieldRef tests are ok now.. methodRef to come..
hlopkmar
parents: 809
diff changeset
   146
    tmp := self name copy.
68df82c46fb0 finally forced myself to refactor tests.. fieldRef tests are ok now.. methodRef to come..
hlopkmar
parents: 809
diff changeset
   147
    [ tmp startsWith: '[' ] whileTrue: [ tmp := tmp copyFrom: 2 ].
786
e3de6a198e63 simple methods are the worst :)
hlopkmar
parents: 785
diff changeset
   148
    tmp := tmp replaceAll: $/ with: $..
785
7811d2e77ca6 aaaargh forgot to delete old code after fixing it.. and wondering why it's not working :)
hlopkmar
parents: 783
diff changeset
   149
    (tmp startsWith: 'L') ifTrue: [ tmp := tmp copyFrom: 2 to: tmp size ].
7811d2e77ca6 aaaargh forgot to delete old code after fixing it.. and wondering why it's not working :)
hlopkmar
parents: 783
diff changeset
   150
    (tmp endsWith: ';') ifTrue: [ tmp := tmp copyFrom: 1 to: tmp size - 1 ].
7811d2e77ca6 aaaargh forgot to delete old code after fixing it.. and wondering why it's not working :)
hlopkmar
parents: 783
diff changeset
   151
    ^ tmp.
758
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   152
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   153
    "Created: / 08-04-2011 / 18:30:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
814
68df82c46fb0 finally forced myself to refactor tests.. fieldRef tests are ok now.. methodRef to come..
hlopkmar
parents: 809
diff changeset
   154
    "Modified: / 23-05-2011 / 15:30:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
758
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   155
!
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   156
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   157
name
778
caa3a009f617 refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents: 777
diff changeset
   158
    ^constantPool at: nameIndex.
758
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   159
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   160
    "Created: / 08-04-2011 / 13:48:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
778
caa3a009f617 refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents: 777
diff changeset
   161
    "Modified: / 13-05-2011 / 09:59:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
758
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   162
! !
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   163
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   164
!JavaClassRef2 methodsFor:'array support'!
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   165
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   166
arrayDimensions
778
caa3a009f617 refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents: 777
diff changeset
   167
    ^ self name occurrencesOf: $[.
758
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   168
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   169
    "Created: / 08-04-2011 / 18:42:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
778
caa3a009f617 refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents: 777
diff changeset
   170
    "Modified: / 13-05-2011 / 10:00:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
758
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   171
!
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   172
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   173
isJavaArrayClassRef
778
caa3a009f617 refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents: 777
diff changeset
   174
    ^ self name startsWith: '['.
758
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   175
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   176
    "Created: / 08-04-2011 / 18:40:40 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
778
caa3a009f617 refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents: 777
diff changeset
   177
    "Modified: / 13-05-2011 / 10:00:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   178
! !
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   179
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   180
!JavaClassRef2 methodsFor:'comparing'!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   181
758
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   182
= anotherJavaClassRef 
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   183
    "superclass JavaRef2 says that I am responsible to implement this method"
758
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   184
    
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   185
    anotherJavaClassRef isJavaClassRef ifFalse: [ ^ false ].
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   186
    ^ self name = anotherJavaClassRef name.
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   187
758
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   188
    "Modified: / 08-04-2011 / 13:48:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   189
!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   190
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   191
hash
778
caa3a009f617 refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents: 777
diff changeset
   192
    ^ self name hash.
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   193
778
caa3a009f617 refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents: 777
diff changeset
   194
    "Modified: / 13-05-2011 / 10:00:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   195
! !
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   196
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   197
!JavaClassRef2 methodsFor:'initialization'!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   198
771
fb8026dda011 Merged with /trunk
vranyj1
parents: 761
diff changeset
   199
initializeIn: aJavaConstantPool withNameAt: nameCPIndex
fb8026dda011 Merged with /trunk
vranyj1
parents: 761
diff changeset
   200
    nameIndex := nameCPIndex.
fb8026dda011 Merged with /trunk
vranyj1
parents: 761
diff changeset
   201
    constantPool := aJavaConstantPool.
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   202
    super initialize.
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   203
771
fb8026dda011 Merged with /trunk
vranyj1
parents: 761
diff changeset
   204
    "Modified: / 10-05-2011 / 14:57:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
fb8026dda011 Merged with /trunk
vranyj1
parents: 761
diff changeset
   205
! !
fb8026dda011 Merged with /trunk
vranyj1
parents: 761
diff changeset
   206
1062
69aac7194016 Fixes in classloaders to make Groovy running (again)
vranyj1
parents: 1038
diff changeset
   207
!JavaClassRef2 methodsFor:'printing & storing'!
915
vranyj1
parents: 912
diff changeset
   208
1062
69aac7194016 Fixes in classloaders to make Groovy running (again)
vranyj1
parents: 1038
diff changeset
   209
printOn:aStream
69aac7194016 Fixes in classloaders to make Groovy running (again)
vranyj1
parents: 1038
diff changeset
   210
    "append a printed representation if the receiver to the argument, aStream"
915
vranyj1
parents: 912
diff changeset
   211
1062
69aac7194016 Fixes in classloaders to make Groovy running (again)
vranyj1
parents: 1038
diff changeset
   212
    super printOn:aStream.
69aac7194016 Fixes in classloaders to make Groovy running (again)
vranyj1
parents: 1038
diff changeset
   213
    aStream nextPut:$(.
69aac7194016 Fixes in classloaders to make Groovy running (again)
vranyj1
parents: 1038
diff changeset
   214
    self name printOn: aStream.
69aac7194016 Fixes in classloaders to make Groovy running (again)
vranyj1
parents: 1038
diff changeset
   215
    aStream nextPut:$).
771
fb8026dda011 Merged with /trunk
vranyj1
parents: 761
diff changeset
   216
1062
69aac7194016 Fixes in classloaders to make Groovy running (again)
vranyj1
parents: 1038
diff changeset
   217
    "Modified: / 30-10-2011 / 21:59:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   218
! !
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   219
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   220
!JavaClassRef2 methodsFor:'private - resolving'!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   221
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 758
diff changeset
   222
findResolvedStaticValue
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 758
diff changeset
   223
    "Resolving static inner classes is not different from resolving any other class, it's only done in different circumstances"
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 758
diff changeset
   224
    
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 758
diff changeset
   225
    ^ self findResolvedValue.
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 758
diff changeset
   226
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 758
diff changeset
   227
    "Created: / 28-04-2011 / 21:57:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 758
diff changeset
   228
!
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 758
diff changeset
   229
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   230
findResolvedValue
758
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   231
    "Resolve reference and set valueCache."
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   232
    
1035
712d2090e68b Small refactoring of class registry, more follows
vranyj1
parents: 1026
diff changeset
   233
    self findResolvedValue: true
758
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   234
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   235
    "Modified: / 08-04-2011 / 17:39:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
1035
712d2090e68b Small refactoring of class registry, more follows
vranyj1
parents: 1026
diff changeset
   236
    "Modified: / 21-10-2011 / 10:58:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
912
e651488f5741 Many fixes in reflection, expecially for generic types support
vranyj1
parents: 877
diff changeset
   237
!
e651488f5741 Many fixes in reflection, expecially for generic types support
vranyj1
parents: 877
diff changeset
   238
e651488f5741 Many fixes in reflection, expecially for generic types support
vranyj1
parents: 877
diff changeset
   239
findResolvedValue: doInit
e651488f5741 Many fixes in reflection, expecially for generic types support
vranyj1
parents: 877
diff changeset
   240
    "Resolve reference and set valueCache."
e651488f5741 Many fixes in reflection, expecially for generic types support
vranyj1
parents: 877
diff changeset
   241
    
e651488f5741 Many fixes in reflection, expecially for generic types support
vranyj1
parents: 877
diff changeset
   242
    valueCache := JavaResolver uniqueInstance 
e651488f5741 Many fixes in reflection, expecially for generic types support
vranyj1
parents: 877
diff changeset
   243
                resolveClassIndentifiedByRef: self init: doInit.
e651488f5741 Many fixes in reflection, expecially for generic types support
vranyj1
parents: 877
diff changeset
   244
e651488f5741 Many fixes in reflection, expecially for generic types support
vranyj1
parents: 877
diff changeset
   245
    "Modified: / 08-04-2011 / 17:39:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e651488f5741 Many fixes in reflection, expecially for generic types support
vranyj1
parents: 877
diff changeset
   246
    "Created: / 12-08-2011 / 22:19:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
758
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   247
! !
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   248
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 758
diff changeset
   249
!JavaClassRef2 methodsFor:'queries'!
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 758
diff changeset
   250
1026
5badd1d31864 introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents: 915
diff changeset
   251
isJavaClassOrStringRef
5badd1d31864 introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents: 915
diff changeset
   252
    ^ true.
5badd1d31864 introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents: 915
diff changeset
   253
5badd1d31864 introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents: 915
diff changeset
   254
    "Created: / 11-04-2011 / 19:10:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
5badd1d31864 introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents: 915
diff changeset
   255
!
5badd1d31864 introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents: 915
diff changeset
   256
761
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 758
diff changeset
   257
isJavaClassRef
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 758
diff changeset
   258
^true.
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 758
diff changeset
   259
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 758
diff changeset
   260
    "Created: / 11-04-2011 / 19:10:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 758
diff changeset
   261
! !
43e017ec7958 Merged with /branches/jk
vranyj1
parents: 758
diff changeset
   262
758
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   263
!JavaClassRef2 methodsFor:'resolving'!
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   264
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   265
invalidateForClass: internalJavaClassName 
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   266
    "Invalidate (means call invalidate) reference if it has something to do with given class (e.g Class named internalJavaClassName was unloaded).
814
68df82c46fb0 finally forced myself to refactor tests.. fieldRef tests are ok now.. methodRef to come..
hlopkmar
parents: 809
diff changeset
   267
     Return true, if reference was invalidated."
68df82c46fb0 finally forced myself to refactor tests.. fieldRef tests are ok now.. methodRef to come..
hlopkmar
parents: 809
diff changeset
   268
    
778
caa3a009f617 refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents: 777
diff changeset
   269
    self name = internalJavaClassName 
caa3a009f617 refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents: 777
diff changeset
   270
        ifTrue: 
814
68df82c46fb0 finally forced myself to refactor tests.. fieldRef tests are ok now.. methodRef to come..
hlopkmar
parents: 809
diff changeset
   271
            [ 
68df82c46fb0 finally forced myself to refactor tests.. fieldRef tests are ok now.. methodRef to come..
hlopkmar
parents: 809
diff changeset
   272
            self invalidate.
778
caa3a009f617 refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents: 777
diff changeset
   273
            ^ true ].
caa3a009f617 refactoring tests and fixing related bugs, added functionality to constantPool
hlopkmar
parents: 777
diff changeset
   274
    ^ false.
758
be8e84381ce0 Merged with /branches/jk
vranyj1
parents: 752
diff changeset
   275
814
68df82c46fb0 finally forced myself to refactor tests.. fieldRef tests are ok now.. methodRef to come..
hlopkmar
parents: 809
diff changeset
   276
    "Modified: / 23-05-2011 / 15:21:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
912
e651488f5741 Many fixes in reflection, expecially for generic types support
vranyj1
parents: 877
diff changeset
   277
!
e651488f5741 Many fixes in reflection, expecially for generic types support
vranyj1
parents: 877
diff changeset
   278
e651488f5741 Many fixes in reflection, expecially for generic types support
vranyj1
parents: 877
diff changeset
   279
resolve
e651488f5741 Many fixes in reflection, expecially for generic types support
vranyj1
parents: 877
diff changeset
   280
e651488f5741 Many fixes in reflection, expecially for generic types support
vranyj1
parents: 877
diff changeset
   281
    ^self resolve: true
e651488f5741 Many fixes in reflection, expecially for generic types support
vranyj1
parents: 877
diff changeset
   282
e651488f5741 Many fixes in reflection, expecially for generic types support
vranyj1
parents: 877
diff changeset
   283
    "Created: / 08-04-2011 / 11:30:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e651488f5741 Many fixes in reflection, expecially for generic types support
vranyj1
parents: 877
diff changeset
   284
    "Created: / 12-08-2011 / 22:18:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e651488f5741 Many fixes in reflection, expecially for generic types support
vranyj1
parents: 877
diff changeset
   285
!
e651488f5741 Many fixes in reflection, expecially for generic types support
vranyj1
parents: 877
diff changeset
   286
1026
5badd1d31864 introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents: 915
diff changeset
   287
resolve: doInit 
912
e651488f5741 Many fixes in reflection, expecially for generic types support
vranyj1
parents: 877
diff changeset
   288
    "
1026
5badd1d31864 introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents: 915
diff changeset
   289
     Resolves a class. If doInit is true, then the class is initialuzed,
5badd1d31864 introduced JavaClassRegistry, taken loading responsibilities from JavaClassReader, got rid of stringConstants and started using StringRefs.. Bugs very likely :)
hlopkmar
parents: 915
diff changeset
   290
     otherwise not."
912
e651488f5741 Many fixes in reflection, expecially for generic types support
vranyj1
parents: 877
diff changeset
   291
    self isResolved ifFalse: [ self findResolvedValue: doInit ].
e651488f5741 Many fixes in reflection, expecially for generic types support
vranyj1
parents: 877
diff changeset
   292
    ^ valueCache.
e651488f5741 Many fixes in reflection, expecially for generic types support
vranyj1
parents: 877
diff changeset
   293
e651488f5741 Many fixes in reflection, expecially for generic types support
vranyj1
parents: 877
diff changeset
   294
    "Created: / 08-04-2011 / 11:30:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
e651488f5741 Many fixes in reflection, expecially for generic types support
vranyj1
parents: 877
diff changeset
   295
    "Created: / 12-08-2011 / 22:18:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
752
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   296
! !
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   297
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   298
!JavaClassRef2 class methodsFor:'documentation'!
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   299
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   300
version_SVN
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   301
    ^ '$Id$'
ff7bc6428c9c branch jk_new_structure resurrected
vranyj1
parents:
diff changeset
   302
! !