use of org.jetbrains.kotlin.resolve.NonReportingOverrideStrategy in project kotlin by JetBrains.
the class DescriptorResolverUtils method resolveOverrides.
@NotNull
private static <D extends CallableMemberDescriptor> Collection<D> resolveOverrides(@NotNull Name name, @NotNull Collection<D> membersFromSupertypes, @NotNull Collection<D> membersFromCurrent, @NotNull ClassDescriptor classDescriptor, @NotNull final ErrorReporter errorReporter, final boolean isStaticContext) {
final Set<D> result = new LinkedHashSet<D>();
OverridingUtil.generateOverridesInFunctionGroup(name, membersFromSupertypes, membersFromCurrent, classDescriptor, new NonReportingOverrideStrategy() {
@Override
@SuppressWarnings("unchecked")
public void addFakeOverride(@NotNull CallableMemberDescriptor fakeOverride) {
OverridingUtil.resolveUnknownVisibilityForMember(fakeOverride, new Function1<CallableMemberDescriptor, Unit>() {
@Override
public Unit invoke(@NotNull CallableMemberDescriptor descriptor) {
errorReporter.reportCannotInferVisibility(descriptor);
return Unit.INSTANCE;
}
});
result.add((D) fakeOverride);
}
@Override
public void conflict(@NotNull CallableMemberDescriptor fromSuper, @NotNull CallableMemberDescriptor fromCurrent) {
// nop
}
@Override
public void setOverriddenDescriptors(@NotNull CallableMemberDescriptor member, @NotNull Collection<? extends CallableMemberDescriptor> overridden) {
// do not set overridden descriptors for declared static fields and methods from java
if (isStaticContext && member.getKind() != CallableMemberDescriptor.Kind.FAKE_OVERRIDE) {
return;
}
super.setOverriddenDescriptors(member, overridden);
}
});
return result;
}
Aggregations