コード例 #1
0
ファイル: DescriptorUtils.java プロジェクト: rlugojr/kotlin
 @NotNull
 @SuppressWarnings("unchecked")
 public static <D extends CallableMemberDescriptor> Set<D> getAllOverriddenDeclarations(
     @NotNull D memberDescriptor) {
   Set<D> result = new HashSet<D>();
   for (CallableMemberDescriptor overriddenDeclaration :
       memberDescriptor.getOverriddenDescriptors()) {
     CallableMemberDescriptor.Kind kind = overriddenDeclaration.getKind();
     if (kind == DECLARATION) {
       result.add((D) overriddenDeclaration);
     } else if (kind == DELEGATION || kind == FAKE_OVERRIDE || kind == SYNTHESIZED) {
       // do nothing
     } else {
       throw new AssertionError("Unexpected callable kind " + kind);
     }
     result.addAll(getAllOverriddenDeclarations((D) overriddenDeclaration));
   }
   return result;
 }
コード例 #2
0
 @NotNull
 private static Collection<CallableMemberDescriptor>
     getAllDeclaredNonOverridableOverriddenDescriptors(
         @NotNull CallableMemberDescriptor callableMemberDescriptor) {
   Set<CallableMemberDescriptor> result = Sets.newHashSet();
   Collection<CallableMemberDescriptor> nonOverridableOverriddenDescriptors =
       retainNonOverridableMembers(callableMemberDescriptor.getOverriddenDescriptors());
   for (CallableMemberDescriptor overriddenDescriptor : nonOverridableOverriddenDescriptors) {
     CallableMemberDescriptor.Kind kind = overriddenDescriptor.getKind();
     if (kind == DECLARATION) {
       result.add(overriddenDescriptor);
     } else if (kind == FAKE_OVERRIDE || kind == DELEGATION) {
       result.addAll(getAllDeclaredNonOverridableOverriddenDescriptors(overriddenDescriptor));
     } else if (kind == SYNTHESIZED) {
       // do nothing, final synthesized members can't be made open
     } else {
       throw new UnsupportedOperationException("Unexpected callable kind " + kind);
     }
   }
   return result;
 }