author | vranyj1 |
Fri, 25 Nov 2011 08:02:14 +0000 | |
branch | jk_new_structure |
changeset 1155 | d6f6d5fc0343 |
parent 1152 | 040cba55a7d2 |
child 1376 | c4b2cf1467c3 |
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 |
||
69 |
!JavaNameAndType2 methodsFor:'accessing'! |
|
70 |
||
774 | 71 |
constantPool |
72 |
^constantPool. |
|
73 |
||
74 |
"Created: / 10-05-2011 / 17:16:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
75 |
! |
|
76 |
||
77 |
constantPool: aJavaConstantPool |
|
78 |
constantPool := aJavaConstantPool. |
|
79 |
||
80 |
"Created: / 10-05-2011 / 17:16:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
81 |
! |
|
82 |
||
752 | 83 |
descriptor |
777 | 84 |
^constantPool at: descriptorIndex. |
752 | 85 |
|
86 |
"Created: / 08-04-2011 / 11:55:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
777 | 87 |
"Modified: / 12-05-2011 / 18:51:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 88 |
! |
89 |
||
90 |
name |
|
777 | 91 |
^ constantPool at: nameIndex. |
752 | 92 |
|
93 |
"Created: / 08-04-2011 / 11:55:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
777 | 94 |
"Modified: / 12-05-2011 / 18:42:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
761 | 95 |
! |
96 |
||
774 | 97 |
owner |
777 | 98 |
^ constantPool owner. |
774 | 99 |
|
777 | 100 |
"Created: / 12-05-2011 / 18:43:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
774 | 101 |
! |
102 |
||
777 | 103 |
owner: javaClass |
104 |
constantPool owner: javaClass. |
|
105 |
||
106 |
"Created: / 12-05-2011 / 18:43:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
107 |
! |
|
108 |
||
109 |
selector |
|
110 |
^ (self name , self descriptor) asSymbol. |
|
761 | 111 |
|
112 |
"Created: / 11-04-2011 / 21:31:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
777 | 113 |
"Modified: / 12-05-2011 / 18:51:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 114 |
! ! |
115 |
||
787
cae769b9b5c1
added JavaNameAndType2>>isUnresolved - only temporarily
hlopkmar
parents:
777
diff
changeset
|
116 |
!JavaNameAndType2 methodsFor:'backward compatibility'! |
cae769b9b5c1
added JavaNameAndType2>>isUnresolved - only temporarily
hlopkmar
parents:
777
diff
changeset
|
117 |
|
cae769b9b5c1
added JavaNameAndType2>>isUnresolved - only temporarily
hlopkmar
parents:
777
diff
changeset
|
118 |
isUnresolved |
cae769b9b5c1
added JavaNameAndType2>>isUnresolved - only temporarily
hlopkmar
parents:
777
diff
changeset
|
119 |
^false. |
cae769b9b5c1
added JavaNameAndType2>>isUnresolved - only temporarily
hlopkmar
parents:
777
diff
changeset
|
120 |
|
cae769b9b5c1
added JavaNameAndType2>>isUnresolved - only temporarily
hlopkmar
parents:
777
diff
changeset
|
121 |
"Created: / 13-05-2011 / 18:43:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
788 | 122 |
! |
123 |
||
124 |
signature |
|
125 |
^self descriptor. |
|
126 |
||
127 |
"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
|
128 |
! ! |
cae769b9b5c1
added JavaNameAndType2>>isUnresolved - only temporarily
hlopkmar
parents:
777
diff
changeset
|
129 |
|
752 | 130 |
!JavaNameAndType2 methodsFor:'comparing'! |
131 |
||
132 |
= aNameAndType |
|
777 | 133 |
self name ~= aNameAndType name ifTrue: [ ^ false ]. |
134 |
^ self descriptor = aNameAndType descriptor. |
|
752 | 135 |
|
136 |
"Created: / 08-04-2011 / 11:56:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
777 | 137 |
"Modified: / 12-05-2011 / 18:44:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 138 |
! |
139 |
||
140 |
hash |
|
777 | 141 |
^ self name hash bitXor: self descriptor hash. |
752 | 142 |
|
143 |
"Created: / 08-04-2011 / 11:57:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
777 | 144 |
"Modified: / 12-05-2011 / 18:44:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 145 |
! ! |
146 |
||
147 |
!JavaNameAndType2 methodsFor:'initialization'! |
|
148 |
||
771 | 149 |
initializeIn: aJavaConstantPool withNameAt: nameCPIndex andDescriptorAt: descriptorCPIndex |
150 |
nameIndex := nameCPIndex. |
|
151 |
descriptorIndex := descriptorCPIndex. |
|
152 |
constantPool := aJavaConstantPool. |
|
752 | 153 |
super initialize. |
154 |
||
771 | 155 |
"Created: / 10-05-2011 / 15:45:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
156 |
! ! |
|
157 |
||
774 | 158 |
!JavaNameAndType2 methodsFor:'logging'! |
159 |
||
160 |
info: arg |
|
1000 | 161 |
|
162 |
Logger log: arg severity: #info facility: 'JVM' |
|
774 | 163 |
|
164 |
"Created: / 10-05-2011 / 16:50:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1000 | 165 |
"Modified: / 14-09-2011 / 21:42:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
774 | 166 |
! |
167 |
||
168 |
warning: arg |
|
1000 | 169 |
|
170 |
Logger log: arg severity: #warn facility: 'JVM' |
|
774 | 171 |
|
172 |
"Created: / 10-05-2011 / 15:01:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1000 | 173 |
"Modified: / 14-09-2011 / 21:42:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
774 | 174 |
! ! |
175 |
||
771 | 176 |
!JavaNameAndType2 methodsFor:'printing'! |
177 |
||
178 |
printString |
|
777 | 179 |
^ 'JavaNameAndType name=' , self name printString , ' descriptor= ' |
180 |
, self descriptor printString. |
|
771 | 181 |
|
182 |
"Created: / 10-05-2011 / 14:17:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
777 | 183 |
"Modified: / 12-05-2011 / 18:44:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
771 | 184 |
! ! |
185 |
||
186 |
!JavaNameAndType2 methodsFor:'queries'! |
|
187 |
||
188 |
isJavaNameAndType |
|
189 |
"return true, if given object represents name and type struct in java constant pool" |
|
190 |
||
191 |
^ true. |
|
192 |
||
193 |
"Created: / 10-05-2011 / 12:23:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
194 |
! |
|
195 |
||
196 |
isNewJavaNameAndType |
|
197 |
"only temporary, to know if name and type is old (claus' version) or new (m version)" |
|
198 |
||
199 |
^ true. |
|
200 |
||
201 |
"Created: / 10-05-2011 / 12:24:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
202 |
! ! |
|
203 |
||
204 |
!JavaNameAndType2 methodsFor:'resolving'! |
|
205 |
||
795 | 206 |
resolve |
207 |
nameCache := constantPool at: nameIndex. |
|
208 |
descriptorCache := constantPool at: descriptorIndex. |
|
209 |
(nameCache isNil or: [ descriptorCache isNil ]) |
|
210 |
ifTrue: [ self breakPoint: #mh ]. |
|
211 |
^self. |
|
212 |
||
213 |
"Created: / 18-05-2011 / 13:19:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
214 |
! |
|
215 |
||
774 | 216 |
updateClassRefsFrom: oldOwner to: newOwner |
843
83d38f26b481
another annoying output is gone (JavaNameAndType2>>updatingClassRefFrom:to:)
hlopkmar
parents:
795
diff
changeset
|
217 |
self owner = oldOwner ifTrue: [ |
83d38f26b481
another annoying output is gone (JavaNameAndType2>>updatingClassRefFrom:to:)
hlopkmar
parents:
795
diff
changeset
|
218 |
self owner: newOwner. |
83d38f26b481
another annoying output is gone (JavaNameAndType2>>updatingClassRefFrom:to:)
hlopkmar
parents:
795
diff
changeset
|
219 |
]. |
774 | 220 |
|
221 |
"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
|
222 |
"Modified: / 04-06-2011 / 18:40:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 223 |
! ! |
224 |
||
225 |
!JavaNameAndType2 class methodsFor:'documentation'! |
|
226 |
||
227 |
version_SVN |
|
228 |
^ '$Id$' |
|
229 |
! ! |