454
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1997 by eXept Software AG
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
|
|
14 |
|
707
|
15 |
"{ Package: 'stx:libjava' }"
|
|
16 |
|
1
|
17 |
JavaUnresolvedRefConstant subclass:#JavaUnresolvedMethodrefConstant
|
90
|
18 |
instanceVariableNames:'classIndex'
|
1
|
19 |
classVariableNames:''
|
|
20 |
poolDictionaries:''
|
2108
|
21 |
category:'Languages-Java-Reader-Support'
|
1
|
22 |
!
|
|
23 |
|
454
|
24 |
!JavaUnresolvedMethodrefConstant class methodsFor:'documentation'!
|
|
25 |
|
|
26 |
copyright
|
|
27 |
"
|
|
28 |
COPYRIGHT (c) 1997 by eXept Software AG
|
|
29 |
All Rights Reserved
|
|
30 |
|
|
31 |
This software is furnished under a license and may be used
|
|
32 |
only in accordance with the terms of that license and with the
|
|
33 |
inclusion of the above copyright notice. This software may not
|
|
34 |
be provided or otherwise made available to, or used by, any
|
|
35 |
other person. No title to or ownership of the software is
|
|
36 |
hereby transferred.
|
|
37 |
"
|
|
38 |
|
|
39 |
|
|
40 |
! !
|
1
|
41 |
|
135
|
42 |
!JavaUnresolvedMethodrefConstant class methodsFor:'instance creation'!
|
90
|
43 |
|
|
44 |
pool:aPool poolIndex:idx classIndex:cIdx nameandTypeIndex:nmIdx
|
|
45 |
^ self new
|
|
46 |
pool:aPool poolIndex:idx classIndex:cIdx nameandTypeIndex:nmIdx
|
|
47 |
! !
|
|
48 |
|
|
49 |
!JavaUnresolvedMethodrefConstant methodsFor:'accessing'!
|
|
50 |
|
163
|
51 |
argSignature
|
|
52 |
|ref cls nameAndType|
|
|
53 |
|
|
54 |
self isUnresolved ifFalse:[
|
|
55 |
self halt
|
|
56 |
].
|
|
57 |
ref := self preResolve.
|
|
58 |
ref isUnresolved ifFalse:[
|
|
59 |
^ ref argSignature
|
|
60 |
].
|
|
61 |
nameAndType := (constantPool at:nameandTypeIndex).
|
|
62 |
nameAndType isUnresolved ifTrue:[
|
|
63 |
nameAndType displayString printCR.
|
|
64 |
].
|
|
65 |
^ JavaMethod argSigArrayFromSignature:(nameAndType signature)
|
|
66 |
|
|
67 |
"Modified: 24.3.1997 / 13:05:57 / cg"
|
|
68 |
!
|
|
69 |
|
|
70 |
javaClass
|
|
71 |
|ref cls|
|
|
72 |
|
|
73 |
self isUnresolved ifFalse:[
|
|
74 |
self halt
|
|
75 |
].
|
|
76 |
ref := self preResolve.
|
|
77 |
ref isUnresolved ifFalse:[
|
|
78 |
^ ref javaClass
|
|
79 |
].
|
|
80 |
cls := constantPool at:classIndex.
|
|
81 |
^ cls
|
|
82 |
|
|
83 |
"Created: 24.3.1997 / 13:03:59 / cg"
|
|
84 |
!
|
|
85 |
|
|
86 |
method
|
|
87 |
|ref cls nameAndType|
|
|
88 |
|
|
89 |
self isUnresolved ifTrue:[
|
|
90 |
ref := self preResolve.
|
|
91 |
ref isUnresolved ifFalse:[
|
|
92 |
^ ref method
|
|
93 |
].
|
|
94 |
(cls := constantPool at:classIndex) isUnresolved ifTrue:[
|
|
95 |
cls displayString printCR.
|
|
96 |
].
|
|
97 |
nameAndType := (constantPool at:nameandTypeIndex).
|
|
98 |
nameAndType isUnresolved ifTrue:[
|
|
99 |
nameAndType displayString printCR.
|
|
100 |
].
|
|
101 |
].
|
|
102 |
('unresolved mthod: ' , self displayString) printCR.
|
|
103 |
^ self
|
|
104 |
|
|
105 |
"Modified: 24.3.1997 / 13:02:56 / cg"
|
|
106 |
!
|
|
107 |
|
|
108 |
name
|
|
109 |
|ref cls nameAndType|
|
|
110 |
|
|
111 |
self isUnresolved ifFalse:[
|
|
112 |
self halt
|
|
113 |
].
|
|
114 |
ref := self preResolve.
|
|
115 |
ref isUnresolved ifFalse:[
|
|
116 |
^ ref name
|
|
117 |
].
|
|
118 |
nameAndType := (constantPool at:nameandTypeIndex).
|
|
119 |
nameAndType isUnresolved ifTrue:[
|
|
120 |
nameAndType displayString printCR.
|
|
121 |
].
|
|
122 |
^ nameAndType name
|
|
123 |
|
|
124 |
"Modified: 24.3.1997 / 13:05:57 / cg"
|
|
125 |
"Created: 24.3.1997 / 13:06:58 / cg"
|
|
126 |
!
|
|
127 |
|
90
|
128 |
pool:aPool poolIndex:idx classIndex:cIdx nameandTypeIndex:nmIdx
|
|
129 |
constantPool := aPool.
|
|
130 |
constantPoolIndex := idx.
|
|
131 |
classIndex := cIdx.
|
|
132 |
nameandTypeIndex := nmIdx
|
|
133 |
|
163
|
134 |
!
|
|
135 |
|
|
136 |
returnType
|
|
137 |
|ref cls nameAndType|
|
|
138 |
|
|
139 |
self isUnresolved ifFalse:[
|
|
140 |
self halt
|
|
141 |
].
|
|
142 |
ref := self preResolve.
|
|
143 |
ref isUnresolved ifFalse:[
|
|
144 |
^ ref returnType
|
|
145 |
].
|
|
146 |
nameAndType := (constantPool at:nameandTypeIndex).
|
|
147 |
nameAndType isUnresolved ifTrue:[
|
|
148 |
nameAndType displayString printCR.
|
|
149 |
].
|
255
|
150 |
^ JavaMethod returnTypeFromSignature:(nameAndType signature) in:nil.
|
163
|
151 |
|
255
|
152 |
"Created: / 24.3.1997 / 13:07:45 / cg"
|
|
153 |
"Modified: / 8.1.1998 / 19:07:47 / cg"
|
627
|
154 |
!
|
|
155 |
|
|
156 |
signature
|
|
157 |
^ self name
|
|
158 |
|
|
159 |
"Created: / 14.11.1999 / 15:52:39 / cg"
|
90
|
160 |
! !
|
|
161 |
|
399
|
162 |
!JavaUnresolvedMethodrefConstant methodsFor:'queries'!
|
|
163 |
|
625
|
164 |
isJavaClassRef
|
|
165 |
^ false
|
|
166 |
|
|
167 |
"Created: / 9.11.1999 / 17:18:24 / cg"
|
|
168 |
!
|
|
169 |
|
619
|
170 |
isJavaMethodRef
|
|
171 |
^ true
|
|
172 |
|
|
173 |
"Created: / 9.11.1999 / 15:39:59 / cg"
|
|
174 |
!
|
|
175 |
|
399
|
176 |
isUnresolvedMethod
|
|
177 |
^ true
|
|
178 |
|
|
179 |
"Created: / 20.10.1998 / 17:43:19 / cg"
|
|
180 |
! !
|
|
181 |
|
1
|
182 |
!JavaUnresolvedMethodrefConstant methodsFor:'resolving'!
|
|
183 |
|
90
|
184 |
preResolve
|
|
185 |
|nameAndType class ref|
|
|
186 |
|
|
187 |
"/ first, resolve the nameAndType & signature ...
|
1
|
188 |
|
90
|
189 |
class := (constantPool at:classIndex).
|
|
190 |
class isUnresolved ifTrue:[
|
|
191 |
class := class preResolve.
|
|
192 |
].
|
|
193 |
class isUnresolved ifFalse:[
|
|
194 |
nameAndType := (constantPool at:nameandTypeIndex).
|
|
195 |
nameAndType isUnresolved ifTrue:[
|
|
196 |
nameAndType := nameAndType preResolve.
|
|
197 |
].
|
|
198 |
nameAndType isUnresolved ifFalse:[
|
|
199 |
"/ ok, got them
|
1
|
200 |
|
90
|
201 |
ref := JavaMethodref class:class nameandType:nameAndType.
|
|
202 |
constantPool at:constantPoolIndex put:ref.
|
|
203 |
^ ref
|
|
204 |
]
|
|
205 |
].
|
|
206 |
|
|
207 |
self rememberForResolveWith:(class fullName).
|
|
208 |
^ self
|
|
209 |
|
596
|
210 |
!
|
|
211 |
|
|
212 |
resolveMethod
|
707
|
213 |
"this is possibly invoked by the VM, when an unresolved methodRef is encountered.a
|
|
214 |
It should load&resolve the methodRef, and return the actual method,
|
|
215 |
or else return nil (if the method cannot be resolved)."
|
|
216 |
|
596
|
217 |
|nm sig mthd cls class|
|
|
218 |
|
|
219 |
class := (constantPool at:classIndex).
|
|
220 |
class isUnresolved ifTrue:[
|
|
221 |
class := class preResolve.
|
|
222 |
].
|
|
223 |
class isUnresolved ifTrue:[
|
|
224 |
"/ self halt:'unresolved class: ' , class name.
|
|
225 |
JavaVM throwClassNotFoundException:class name.
|
|
226 |
^ nil.
|
|
227 |
].
|
707
|
228 |
|
596
|
229 |
self halt.
|
|
230 |
cls := class javaClass.
|
|
231 |
cls ~~ class ifTrue:[
|
|
232 |
class := cls.
|
|
233 |
].
|
|
234 |
|
|
235 |
(class isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
|
|
236 |
cls := class resolve.
|
|
237 |
cls notNil ifTrue:[
|
|
238 |
class := cls
|
|
239 |
]
|
|
240 |
].
|
|
241 |
(class isMemberOf:JavaUnresolvedClassConstant) ifTrue:[
|
|
242 |
self halt:'unresolved class'.
|
|
243 |
].
|
|
244 |
mthd := self preResolve.
|
|
245 |
mthd == self ifTrue:[
|
|
246 |
self halt:'unresolved method'.
|
|
247 |
].
|
|
248 |
|
|
249 |
^ mthd
|
1
|
250 |
! !
|
|
251 |
|
135
|
252 |
!JavaUnresolvedMethodrefConstant class methodsFor:'documentation'!
|
1
|
253 |
|
|
254 |
version
|
2108
|
255 |
^ '$Header: /cvs/stx/stx/libjava/Attic/JavaUnresolvedMethodrefConstant.st,v 1.16 2002-11-22 20:11:36 cg Exp $'
|
1
|
256 |
! !
|