author | hlopkmar |
Thu, 23 Feb 2012 16:38:53 +0000 | |
branch | jk_new_structure |
changeset 1378 | 9d64d8357509 |
parent 1376 | c4b2cf1467c3 |
child 1728 | 0d275432230d |
permissions | -rw-r--r-- |
877 | 1 |
" |
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
1152 | 3 |
|
1155 | 4 |
New code and modifications done at SWING Research Group [1]: |
1152 | 5 |
|
877 | 6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
7 |
SWING Research Group, Czech Technical University in Prague |
|
8 |
||
9 |
This software is furnished under a license and may be used |
|
10 |
only in accordance with the terms of that license and with the |
|
11 |
inclusion of the above copyright notice. This software may not |
|
12 |
be provided or otherwise made available to, or used by, any |
|
13 |
other person. No title to or ownership of the software is |
|
14 |
hereby transferred. |
|
15 |
||
1155 | 16 |
[1] Code written at SWING Research Group contains a signature |
17 |
of one of the above copright owners. For exact set of such code, |
|
18 |
see the differences between this version and version stx:libjava |
|
1152 | 19 |
as of 1.9.2010 |
877 | 20 |
" |
752 | 21 |
"{ Package: 'stx:libjava' }" |
22 |
||
774 | 23 |
Object subclass:#JavaNameAndType2 |
795 | 24 |
instanceVariableNames:'constantPool nameIndex descriptorIndex nameCache descriptorCache' |
752 | 25 |
classVariableNames:'' |
26 |
poolDictionaries:'' |
|
27 |
category:'Languages-Java-Reader-Support-new' |
|
28 |
! |
|
29 |
||
758 | 30 |
!JavaNameAndType2 class methodsFor:'documentation'! |
31 |
||
877 | 32 |
copyright |
33 |
" |
|
34 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
1152 | 35 |
|
1155 | 36 |
New code and modifications done at SWING Research Group [1]: |
1152 | 37 |
|
877 | 38 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
39 |
SWING Research Group, Czech Technical University in Prague |
|
40 |
||
41 |
This software is furnished under a license and may be used |
|
42 |
only in accordance with the terms of that license and with the |
|
43 |
inclusion of the above copyright notice. This software may not |
|
44 |
be provided or otherwise made available to, or used by, any |
|
45 |
other person. No title to or ownership of the software is |
|
46 |
hereby transferred. |
|
47 |
||
1155 | 48 |
[1] Code written at SWING Research Group contains a signature |
49 |
of one of the above copright owners. For exact set of such code, |
|
50 |
see the differences between this version and version stx:libjava |
|
1152 | 51 |
as of 1.9.2010 |
877 | 52 |
|
53 |
" |
|
758 | 54 |
! ! |
752 | 55 |
|
56 |
!JavaNameAndType2 class methodsFor:'instance creation'! |
|
57 |
||
771 | 58 |
in: aJavaConstantPool withNameAt: arg1 andDescriptorAt: arg2 |
752 | 59 |
"Create & return a new instance for arg." |
771 | 60 |
|
61 |
^ self basicNew |
|
62 |
initializeIn: aJavaConstantPool |
|
63 |
withNameAt: arg1 |
|
64 |
andDescriptorAt: arg2 |
|
752 | 65 |
|
771 | 66 |
"Created: / 10-05-2011 / 15:45:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 67 |
! ! |
68 |
||
1376 | 69 |
!JavaNameAndType2 methodsFor:'* As yet uncategorized *'! |
70 |
||
71 |
invalidateForClass:aSymbol |
|
72 |
"Name and type cannot be invalid..." |
|
73 |
||
74 |
^false |
|
75 |
||
76 |
"Created: / 22-02-2012 / 20:50:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
77 |
! ! |
|
78 |
||
752 | 79 |
!JavaNameAndType2 methodsFor:'accessing'! |
80 |
||
774 | 81 |
constantPool |
82 |
^constantPool. |
|
83 |
||
84 |
"Created: / 10-05-2011 / 17:16:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
85 |
! |
|
86 |
||
87 |
constantPool: aJavaConstantPool |
|
88 |
constantPool := aJavaConstantPool. |
|
89 |
||
90 |
"Created: / 10-05-2011 / 17:16:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
91 |
! |
|
92 |
||
752 | 93 |
descriptor |
777 | 94 |
^constantPool at: descriptorIndex. |
752 | 95 |
|
96 |
"Created: / 08-04-2011 / 11:55:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
777 | 97 |
"Modified: / 12-05-2011 / 18:51:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 98 |
! |
99 |
||
100 |
name |
|
777 | 101 |
^ constantPool at: nameIndex. |
752 | 102 |
|
103 |
"Created: / 08-04-2011 / 11:55:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
777 | 104 |
"Modified: / 12-05-2011 / 18:42:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
761 | 105 |
! |
106 |
||
774 | 107 |
owner |
777 | 108 |
^ constantPool owner. |
774 | 109 |
|
777 | 110 |
"Created: / 12-05-2011 / 18:43:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
774 | 111 |
! |
112 |
||
777 | 113 |
owner: javaClass |
114 |
constantPool owner: javaClass. |
|
115 |
||
116 |
"Created: / 12-05-2011 / 18:43:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
117 |
! |
|
118 |
||
119 |
selector |
|
120 |
^ (self name , self descriptor) asSymbol. |
|
761 | 121 |
|
122 |
"Created: / 11-04-2011 / 21:31:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
777 | 123 |
"Modified: / 12-05-2011 / 18:51:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 124 |
! ! |
125 |
||
787
cae769b9b5c1
added JavaNameAndType2>>isUnresolved - only temporarily
hlopkmar
parents:
777
diff
changeset
|
126 |
!JavaNameAndType2 methodsFor:'backward compatibility'! |
cae769b9b5c1
added JavaNameAndType2>>isUnresolved - only temporarily
hlopkmar
parents:
777
diff
changeset
|
127 |
|
cae769b9b5c1
added JavaNameAndType2>>isUnresolved - only temporarily
hlopkmar
parents:
777
diff
changeset
|
128 |
isUnresolved |
cae769b9b5c1
added JavaNameAndType2>>isUnresolved - only temporarily
hlopkmar
parents:
777
diff
changeset
|
129 |
^false. |
cae769b9b5c1
added JavaNameAndType2>>isUnresolved - only temporarily
hlopkmar
parents:
777
diff
changeset
|
130 |
|
cae769b9b5c1
added JavaNameAndType2>>isUnresolved - only temporarily
hlopkmar
parents:
777
diff
changeset
|
131 |
"Created: / 13-05-2011 / 18:43:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
788 | 132 |
! |
133 |
||
134 |
signature |
|
135 |
^self descriptor. |
|
136 |
||
137 |
"Created: / 13-05-2011 / 18:45:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
787
cae769b9b5c1
added JavaNameAndType2>>isUnresolved - only temporarily
hlopkmar
parents:
777
diff
changeset
|
138 |
! ! |
cae769b9b5c1
added JavaNameAndType2>>isUnresolved - only temporarily
hlopkmar
parents:
777
diff
changeset
|
139 |
|
752 | 140 |
!JavaNameAndType2 methodsFor:'comparing'! |
141 |
||
142 |
= aNameAndType |
|
777 | 143 |
self name ~= aNameAndType name ifTrue: [ ^ false ]. |
144 |
^ self descriptor = aNameAndType descriptor. |
|
752 | 145 |
|
146 |
"Created: / 08-04-2011 / 11:56:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
777 | 147 |
"Modified: / 12-05-2011 / 18:44:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 148 |
! |
149 |
||
150 |
hash |
|
777 | 151 |
^ self name hash bitXor: self descriptor hash. |
752 | 152 |
|
153 |
"Created: / 08-04-2011 / 11:57:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
777 | 154 |
"Modified: / 12-05-2011 / 18:44:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 155 |
! ! |
156 |
||
157 |
!JavaNameAndType2 methodsFor:'initialization'! |
|
158 |
||
771 | 159 |
initializeIn: aJavaConstantPool withNameAt: nameCPIndex andDescriptorAt: descriptorCPIndex |
160 |
nameIndex := nameCPIndex. |
|
161 |
descriptorIndex := descriptorCPIndex. |
|
162 |
constantPool := aJavaConstantPool. |
|
752 | 163 |
super initialize. |
164 |
||
771 | 165 |
"Created: / 10-05-2011 / 15:45:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
166 |
! ! |
|
167 |
||
774 | 168 |
!JavaNameAndType2 methodsFor:'logging'! |
169 |
||
170 |
info: arg |
|
1000 | 171 |
|
172 |
Logger log: arg severity: #info facility: 'JVM' |
|
774 | 173 |
|
174 |
"Created: / 10-05-2011 / 16:50:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1000 | 175 |
"Modified: / 14-09-2011 / 21:42:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
774 | 176 |
! |
177 |
||
178 |
warning: arg |
|
1000 | 179 |
|
180 |
Logger log: arg severity: #warn facility: 'JVM' |
|
774 | 181 |
|
182 |
"Created: / 10-05-2011 / 15:01:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1000 | 183 |
"Modified: / 14-09-2011 / 21:42:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
774 | 184 |
! ! |
185 |
||
771 | 186 |
!JavaNameAndType2 methodsFor:'printing'! |
187 |
||
188 |
printString |
|
777 | 189 |
^ 'JavaNameAndType name=' , self name printString , ' descriptor= ' |
190 |
, self descriptor printString. |
|
771 | 191 |
|
192 |
"Created: / 10-05-2011 / 14:17:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
777 | 193 |
"Modified: / 12-05-2011 / 18:44:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
771 | 194 |
! ! |
195 |
||
196 |
!JavaNameAndType2 methodsFor:'queries'! |
|
197 |
||
198 |
isJavaNameAndType |
|
199 |
"return true, if given object represents name and type struct in java constant pool" |
|
200 |
||
201 |
^ true. |
|
202 |
||
203 |
"Created: / 10-05-2011 / 12:23:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
204 |
! |
|
205 |
||
206 |
isNewJavaNameAndType |
|
207 |
"only temporary, to know if name and type is old (claus' version) or new (m version)" |
|
208 |
||
209 |
^ true. |
|
210 |
||
211 |
"Created: / 10-05-2011 / 12:24:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
212 |
! ! |
|
213 |
||
214 |
!JavaNameAndType2 methodsFor:'resolving'! |
|
215 |
||
795 | 216 |
resolve |
217 |
nameCache := constantPool at: nameIndex. |
|
218 |
descriptorCache := constantPool at: descriptorIndex. |
|
219 |
(nameCache isNil or: [ descriptorCache isNil ]) |
|
220 |
ifTrue: [ self breakPoint: #mh ]. |
|
221 |
^self. |
|
222 |
||
223 |
"Created: / 18-05-2011 / 13:19:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
224 |
! |
|
225 |
||
1378 | 226 |
resolve: doClassInit |
227 |
^ self resolve. |
|
228 |
||
229 |
"Created: / 18-05-2011 / 13:19:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
230 |
"Created: / 23-02-2012 / 17:14:51 / Marcel Hlopko <hlopik@gmail.com>" |
|
231 |
! |
|
232 |
||
774 | 233 |
updateClassRefsFrom: oldOwner to: newOwner |
843
83d38f26b481
another annoying output is gone (JavaNameAndType2>>updatingClassRefFrom:to:)
hlopkmar
parents:
795
diff
changeset
|
234 |
self owner = oldOwner ifTrue: [ |
83d38f26b481
another annoying output is gone (JavaNameAndType2>>updatingClassRefFrom:to:)
hlopkmar
parents:
795
diff
changeset
|
235 |
self owner: newOwner. |
83d38f26b481
another annoying output is gone (JavaNameAndType2>>updatingClassRefFrom:to:)
hlopkmar
parents:
795
diff
changeset
|
236 |
]. |
774 | 237 |
|
238 |
"Created: / 10-05-2011 / 16:50:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
843
83d38f26b481
another annoying output is gone (JavaNameAndType2>>updatingClassRefFrom:to:)
hlopkmar
parents:
795
diff
changeset
|
239 |
"Modified: / 04-06-2011 / 18:40:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 240 |
! ! |
241 |
||
242 |
!JavaNameAndType2 class methodsFor:'documentation'! |
|
243 |
||
244 |
version_SVN |
|
245 |
^ '$Id$' |
|
246 |
! ! |