Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -473,19 +473,31 @@ private void processMethodOverrides() {
declaringClass.forAllSuperTypes(superType -> {
/*
* Iterate all the super types (including this type itself) looking for installed
* override notifications. If this method resolves in a super type, and it has an
* override notifications. If this method is found in a super type, and it has an
* override handler installed in that type, pass this method to the callback. It
* doesn't matter if the superMethod is actually reachable, only if it has any
* override handlers installed.
* override handlers installed. Note that ResolvedJavaType.resolveMethod() cannot be
* used here because it only resolves methods declared by the type itself or if the
* method's declaring class is assignable from the type.
*/
AnalysisMethod superMethod = resolveInType(superType);
AnalysisMethod superMethod = findInType(superType);
if (superMethod != null) {
superMethod.notifyMethodOverride(AnalysisMethod.this);
}
});
}
}

/** Find if the type declares a method with the same name and signature as this method. */
private AnalysisMethod findInType(AnalysisType type) {
try {
return type.findMethod(wrapped.getName(), getSignature());
} catch (UnsupportedFeatureException | LinkageError e) {
/* Ignore linking errors and deleted methods. */
return null;
}
}

protected void notifyMethodOverride(AnalysisMethod override) {
declaringClass.getOverrideReachabilityNotifications(this).forEach(n -> n.notifyCallback(getUniverse(), override));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,9 @@ protected void forAllSuperTypes(Consumer<AnalysisType> superTypeConsumer, boolea
if (dimension > 0 && !elementalType.isPrimitive() && !elementalType.isJavaLangObject()) {
forAllSuperTypes(universe.objectType(), dimension, true, superTypeConsumer);
}
if (this.isInterface()) {
superTypeConsumer.accept(universe.objectType());
}
}

private static void forAllSuperTypes(AnalysisType elementType, int arrayDimension, boolean processType, Consumer<AnalysisType> superTypeConsumer) {
Expand Down