215 |
215 |
216 ResolvedJavaType getArrayClass(); |
216 ResolvedJavaType getArrayClass(); |
217 |
217 |
218 /** |
218 /** |
219 * Resolves the method implementation for virtual dispatches on objects of this dynamic type. |
219 * Resolves the method implementation for virtual dispatches on objects of this dynamic type. |
220 * This resolution process only searches "up" the class hierarchy of this type. |
220 * This resolution process only searches "up" the class hierarchy of this type. A broader search |
|
221 * that also walks "down" the hierarchy is implemented by |
|
222 * {@link #findUniqueConcreteMethod(ResolvedJavaMethod)}. For interface types it returns null |
|
223 * since no concrete object can be an interface. |
221 * |
224 * |
222 * @param method the method to select the implementation of |
225 * @param method the method to select the implementation of |
223 * @param callerType the caller or context type used to perform access checks |
226 * @param callerType the caller or context type used to perform access checks |
224 * @return the link-time resolved method (might be abstract) or {@code null} if it can not be |
227 * @return the method that would be selected at runtime (might be abstract) or {@code null} if |
225 * linked |
228 * it can not be resolved |
226 */ |
229 */ |
227 ResolvedJavaMethod resolveMethod(ResolvedJavaMethod method, ResolvedJavaType callerType); |
230 ResolvedJavaMethod resolveMethod(ResolvedJavaMethod method, ResolvedJavaType callerType); |
228 |
231 |
229 /** |
232 /** |
230 * Resolves the method implementation for virtual dispatches on objects of this dynamic type. |
233 * A convenience wrapper for {@link #resolveMethod(ResolvedJavaMethod, ResolvedJavaType)} that |
231 * This resolution process only searches "up" the class hierarchy of this type. A broader search |
234 * only returns non-abstract methods. |
232 * that also walks "down" the hierarchy is implemented by |
|
233 * {@link #findUniqueConcreteMethod(ResolvedJavaMethod)}. |
|
234 * |
235 * |
235 * @param method the method to select the implementation of |
236 * @param method the method to select the implementation of |
236 * @param callerType the caller or context type used to perform access checks |
237 * @param callerType the caller or context type used to perform access checks |
237 * @return the concrete method that would be selected at runtime, or {@code null} if there is no |
238 * @return the concrete method that would be selected at runtime, or {@code null} if there is no |
238 * concrete implementation of {@code method} in this type or any of its superclasses |
239 * concrete implementation of {@code method} in this type or any of its superclasses |
239 */ |
240 */ |
240 ResolvedJavaMethod resolveConcreteMethod(ResolvedJavaMethod method, ResolvedJavaType callerType); |
241 default ResolvedJavaMethod resolveConcreteMethod(ResolvedJavaMethod method, ResolvedJavaType callerType) { |
|
242 ResolvedJavaMethod resolvedMethod = resolveMethod(method, callerType); |
|
243 if (resolvedMethod == null || resolvedMethod.isAbstract()) { |
|
244 return null; |
|
245 } |
|
246 return resolvedMethod; |
|
247 } |
241 |
248 |
242 /** |
249 /** |
243 * Given a {@link ResolvedJavaMethod} A, returns a concrete {@link ResolvedJavaMethod} B that is |
250 * Given a {@link ResolvedJavaMethod} A, returns a concrete {@link ResolvedJavaMethod} B that is |
244 * the only possible unique target for a virtual call on A(). Returns {@code null} if either no |
251 * the only possible unique target for a virtual call on A(). Returns {@code null} if either no |
245 * such concrete method or more than one such method exists. Returns the method A if A is a |
252 * such concrete method or more than one such method exists. Returns the method A if A is a |