author | hlopkmar |
Sat, 04 Jun 2011 18:30:41 +0000 | |
branch | jk_new_structure |
changeset 843 | 83d38f26b481 |
parent 795 | 6c81c73755c7 |
child 877 | f5a5b93e1c78 |
permissions | -rw-r--r-- |
752 | 1 |
"{ Package: 'stx:libjava' }" |
2 |
||
774 | 3 |
Object subclass:#JavaNameAndType2 |
795 | 4 |
instanceVariableNames:'constantPool nameIndex descriptorIndex nameCache descriptorCache' |
752 | 5 |
classVariableNames:'' |
6 |
poolDictionaries:'' |
|
7 |
category:'Languages-Java-Reader-Support-new' |
|
8 |
! |
|
9 |
||
758 | 10 |
!JavaNameAndType2 class methodsFor:'documentation'! |
11 |
||
12 |
documentation |
|
13 |
" |
|
14 |
I represent NameAndTypeInfo structure found in java constant pool. |
|
15 |
||
16 |
[author:] |
|
17 |
Marcel Hlopko <hlopkmar@fel.cvut.cz> |
|
18 |
||
19 |
[instance variables:] |
|
20 |
name - string found in constant pool at nameIndex. Represents field or method name. |
|
21 |
descriptor - string found in constant pool at descIndex. Represents field or method type. |
|
22 |
||
23 |
[class variables:] |
|
24 |
||
25 |
[see also:] |
|
26 |
||
27 |
" |
|
28 |
! ! |
|
752 | 29 |
|
30 |
!JavaNameAndType2 class methodsFor:'instance creation'! |
|
31 |
||
771 | 32 |
in: aJavaConstantPool withNameAt: arg1 andDescriptorAt: arg2 |
752 | 33 |
"Create & return a new instance for arg." |
771 | 34 |
|
35 |
^ self basicNew |
|
36 |
initializeIn: aJavaConstantPool |
|
37 |
withNameAt: arg1 |
|
38 |
andDescriptorAt: arg2 |
|
752 | 39 |
|
771 | 40 |
"Created: / 10-05-2011 / 15:45:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 41 |
! ! |
42 |
||
43 |
!JavaNameAndType2 methodsFor:'accessing'! |
|
44 |
||
774 | 45 |
constantPool |
46 |
^constantPool. |
|
47 |
||
48 |
"Created: / 10-05-2011 / 17:16:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
49 |
! |
|
50 |
||
51 |
constantPool: aJavaConstantPool |
|
52 |
constantPool := aJavaConstantPool. |
|
53 |
||
54 |
"Created: / 10-05-2011 / 17:16:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
55 |
! |
|
56 |
||
752 | 57 |
descriptor |
777 | 58 |
^constantPool at: descriptorIndex. |
752 | 59 |
|
60 |
"Created: / 08-04-2011 / 11:55:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
777 | 61 |
"Modified: / 12-05-2011 / 18:51:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 62 |
! |
63 |
||
64 |
name |
|
777 | 65 |
^ constantPool at: nameIndex. |
752 | 66 |
|
67 |
"Created: / 08-04-2011 / 11:55:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
777 | 68 |
"Modified: / 12-05-2011 / 18:42:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
761 | 69 |
! |
70 |
||
774 | 71 |
owner |
777 | 72 |
^ constantPool owner. |
774 | 73 |
|
777 | 74 |
"Created: / 12-05-2011 / 18:43:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
774 | 75 |
! |
76 |
||
777 | 77 |
owner: javaClass |
78 |
constantPool owner: javaClass. |
|
79 |
||
80 |
"Created: / 12-05-2011 / 18:43:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
81 |
! |
|
82 |
||
83 |
selector |
|
84 |
^ (self name , self descriptor) asSymbol. |
|
761 | 85 |
|
86 |
"Created: / 11-04-2011 / 21:31:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
777 | 87 |
"Modified: / 12-05-2011 / 18:51:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 88 |
! ! |
89 |
||
787
cae769b9b5c1
added JavaNameAndType2>>isUnresolved - only temporarily
hlopkmar
parents:
777
diff
changeset
|
90 |
!JavaNameAndType2 methodsFor:'backward compatibility'! |
cae769b9b5c1
added JavaNameAndType2>>isUnresolved - only temporarily
hlopkmar
parents:
777
diff
changeset
|
91 |
|
cae769b9b5c1
added JavaNameAndType2>>isUnresolved - only temporarily
hlopkmar
parents:
777
diff
changeset
|
92 |
isUnresolved |
cae769b9b5c1
added JavaNameAndType2>>isUnresolved - only temporarily
hlopkmar
parents:
777
diff
changeset
|
93 |
^false. |
cae769b9b5c1
added JavaNameAndType2>>isUnresolved - only temporarily
hlopkmar
parents:
777
diff
changeset
|
94 |
|
cae769b9b5c1
added JavaNameAndType2>>isUnresolved - only temporarily
hlopkmar
parents:
777
diff
changeset
|
95 |
"Created: / 13-05-2011 / 18:43:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
788 | 96 |
! |
97 |
||
98 |
signature |
|
99 |
^self descriptor. |
|
100 |
||
101 |
"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
|
102 |
! ! |
cae769b9b5c1
added JavaNameAndType2>>isUnresolved - only temporarily
hlopkmar
parents:
777
diff
changeset
|
103 |
|
752 | 104 |
!JavaNameAndType2 methodsFor:'comparing'! |
105 |
||
106 |
= aNameAndType |
|
777 | 107 |
self name ~= aNameAndType name ifTrue: [ ^ false ]. |
108 |
^ self descriptor = aNameAndType descriptor. |
|
752 | 109 |
|
110 |
"Created: / 08-04-2011 / 11:56:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
777 | 111 |
"Modified: / 12-05-2011 / 18:44:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 112 |
! |
113 |
||
114 |
hash |
|
777 | 115 |
^ self name hash bitXor: self descriptor hash. |
752 | 116 |
|
117 |
"Created: / 08-04-2011 / 11:57:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
777 | 118 |
"Modified: / 12-05-2011 / 18:44:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 119 |
! ! |
120 |
||
121 |
!JavaNameAndType2 methodsFor:'initialization'! |
|
122 |
||
771 | 123 |
initializeIn: aJavaConstantPool withNameAt: nameCPIndex andDescriptorAt: descriptorCPIndex |
124 |
nameIndex := nameCPIndex. |
|
125 |
descriptorIndex := descriptorCPIndex. |
|
126 |
constantPool := aJavaConstantPool. |
|
752 | 127 |
super initialize. |
128 |
||
771 | 129 |
"Created: / 10-05-2011 / 15:45:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
130 |
! ! |
|
131 |
||
774 | 132 |
!JavaNameAndType2 methodsFor:'logging'! |
133 |
||
134 |
info: arg |
|
135 |
Transcript show: arg printString. |
|
136 |
||
137 |
"Created: / 10-05-2011 / 16:50:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
138 |
! |
|
139 |
||
140 |
warning: arg |
|
141 |
Transcript show: arg printString. |
|
142 |
||
143 |
"Created: / 10-05-2011 / 15:01:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
144 |
! ! |
|
145 |
||
771 | 146 |
!JavaNameAndType2 methodsFor:'printing'! |
147 |
||
148 |
printString |
|
777 | 149 |
^ 'JavaNameAndType name=' , self name printString , ' descriptor= ' |
150 |
, self descriptor printString. |
|
771 | 151 |
|
152 |
"Created: / 10-05-2011 / 14:17:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
777 | 153 |
"Modified: / 12-05-2011 / 18:44:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
771 | 154 |
! ! |
155 |
||
156 |
!JavaNameAndType2 methodsFor:'queries'! |
|
157 |
||
158 |
isJavaNameAndType |
|
159 |
"return true, if given object represents name and type struct in java constant pool" |
|
160 |
||
161 |
^ true. |
|
162 |
||
163 |
"Created: / 10-05-2011 / 12:23:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
164 |
! |
|
165 |
||
166 |
isNewJavaNameAndType |
|
167 |
"only temporary, to know if name and type is old (claus' version) or new (m version)" |
|
168 |
||
169 |
^ true. |
|
170 |
||
171 |
"Created: / 10-05-2011 / 12:24:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
172 |
! ! |
|
173 |
||
174 |
!JavaNameAndType2 methodsFor:'resolving'! |
|
175 |
||
795 | 176 |
resolve |
177 |
nameCache := constantPool at: nameIndex. |
|
178 |
descriptorCache := constantPool at: descriptorIndex. |
|
179 |
(nameCache isNil or: [ descriptorCache isNil ]) |
|
180 |
ifTrue: [ self breakPoint: #mh ]. |
|
181 |
^self. |
|
182 |
||
183 |
"Created: / 18-05-2011 / 13:19:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
184 |
! |
|
185 |
||
774 | 186 |
updateClassRefsFrom: oldOwner to: newOwner |
843
83d38f26b481
another annoying output is gone (JavaNameAndType2>>updatingClassRefFrom:to:)
hlopkmar
parents:
795
diff
changeset
|
187 |
self owner = oldOwner ifTrue: [ |
83d38f26b481
another annoying output is gone (JavaNameAndType2>>updatingClassRefFrom:to:)
hlopkmar
parents:
795
diff
changeset
|
188 |
self owner: newOwner. |
83d38f26b481
another annoying output is gone (JavaNameAndType2>>updatingClassRefFrom:to:)
hlopkmar
parents:
795
diff
changeset
|
189 |
]. |
774 | 190 |
|
191 |
"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
|
192 |
"Modified: / 04-06-2011 / 18:40:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 193 |
! ! |
194 |
||
195 |
!JavaNameAndType2 class methodsFor:'documentation'! |
|
196 |
||
197 |
version_SVN |
|
198 |
^ '$Id$' |
|
199 |
! ! |