Esempio n. 1
0
 @NotNull
 private static Collection<CallableMemberDescriptor> filterVisibleFakeOverrides(
     @NotNull final ClassDescriptor current,
     @NotNull Collection<CallableMemberDescriptor> toFilter) {
   return CollectionsKt.filter(
       toFilter,
       new Function1<CallableMemberDescriptor, Boolean>() {
         @Override
         public Boolean invoke(CallableMemberDescriptor descriptor) {
           // nested class could capture private member, so check for private visibility added
           return !Visibilities.isPrivate(descriptor.getVisibility())
               && Visibilities.isVisibleIgnoringReceiver(descriptor, current);
         }
       });
 }
Esempio n. 2
0
 @NotNull
 @Override
 public Collection<CallableMemberDescriptor> getDeclaredCallableMembers() {
   //noinspection unchecked
   return (Collection)
       CollectionsKt.filter(
           DescriptorUtils.getAllDescriptors(unsubstitutedMemberScope),
           new Function1<DeclarationDescriptor, Boolean>() {
             @Override
             public Boolean invoke(DeclarationDescriptor descriptor) {
               return descriptor instanceof CallableMemberDescriptor
                   && ((CallableMemberDescriptor) descriptor).getKind()
                       != CallableMemberDescriptor.Kind.FAKE_OVERRIDE;
             }
           });
 }
Esempio n. 3
0
  @NotNull
  @ReadOnly
  public List<ClassDescriptor> getDescriptorsForExtraCompanionObjects() {
    final KtObjectDeclaration allowedCompanionObject = getCompanionObjectIfAllowed();

    return CollectionsKt.map(
        CollectionsKt.filter(
            declarationProvider.getOwnerInfo().getCompanionObjects(),
            new Function1<KtObjectDeclaration, Boolean>() {
              @Override
              public Boolean invoke(KtObjectDeclaration companionObject) {
                return companionObject != allowedCompanionObject;
              }
            }),
        new Function1<KtObjectDeclaration, ClassDescriptor>() {
          @Override
          public ClassDescriptor invoke(KtObjectDeclaration companionObject) {
            return extraCompanionObjectDescriptors.invoke(companionObject);
          }
        });
  }