示例#1
0
 private static void createAndBindFakeOverrides(
     @NotNull ClassDescriptor current,
     @NotNull Collection<CallableMemberDescriptor> notOverridden,
     @NotNull DescriptorSink sink) {
   Queue<CallableMemberDescriptor> fromSuperQueue =
       new LinkedList<CallableMemberDescriptor>(notOverridden);
   while (!fromSuperQueue.isEmpty()) {
     CallableMemberDescriptor notOverriddenFromSuper =
         VisibilityUtilKt.findMemberWithMaxVisibility(fromSuperQueue);
     Collection<CallableMemberDescriptor> overridables =
         extractMembersOverridableInBothWays(notOverriddenFromSuper, fromSuperQueue, sink);
     createAndBindFakeOverride(overridables, current, sink);
   }
 }
示例#2
0
  private static void createAndBindFakeOverrides(
      @NotNull ClassDescriptor current,
      @NotNull Collection<CallableMemberDescriptor> notOverridden,
      @NotNull OverridingStrategy strategy) {
    // Optimization: If all notOverridden descriptors have the same containing declaration,
    // then we can just create fake overrides for them, because they should be matched correctly in
    // their containing declaration
    if (allHasSameContainingDeclaration(notOverridden)) {
      for (CallableMemberDescriptor descriptor : notOverridden) {
        createAndBindFakeOverride(Collections.singleton(descriptor), current, strategy);
      }
      return;
    }

    Queue<CallableMemberDescriptor> fromSuperQueue =
        new LinkedList<CallableMemberDescriptor>(notOverridden);
    while (!fromSuperQueue.isEmpty()) {
      CallableMemberDescriptor notOverriddenFromSuper =
          VisibilityUtilKt.findMemberWithMaxVisibility(fromSuperQueue);
      Collection<CallableMemberDescriptor> overridables =
          extractMembersOverridableInBothWays(notOverriddenFromSuper, fromSuperQueue, strategy);
      createAndBindFakeOverride(overridables, current, strategy);
    }
  }