private static String getDescriptorString(@NotNull DeclarationDescriptor descriptor) {
   if (descriptor instanceof ClassDescriptor) {
     return DescriptorUtils.getFqName(descriptor).asString();
   } else if (descriptor instanceof ConstructorDescriptor) {
     DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration();
     assert containingDeclaration != null;
     return "constructor for " + containingDeclaration.getName();
   } else if (descriptor instanceof PropertyGetterDescriptor) {
     return "getter for "
         + ((PropertyGetterDescriptor) descriptor).getCorrespondingProperty().getName();
   } else if (descriptor instanceof PropertySetterDescriptor) {
     return "setter for "
         + ((PropertySetterDescriptor) descriptor).getCorrespondingProperty().getName();
   } else if (descriptor instanceof PropertyDescriptor) {
     if (((PropertyDescriptor) descriptor).isVar()) {
       return "var " + descriptor.getName();
     }
     return "val " + descriptor.getName();
   } else if (descriptor instanceof FunctionDescriptor) {
     return "fun "
         + descriptor.getName()
         + DescriptorRenderer.FQ_NAMES_IN_TYPES.renderFunctionParameters(
             (FunctionDescriptor) descriptor);
   }
   return DescriptorRenderer.FQ_NAMES_IN_TYPES.render(descriptor);
 }
Beispiel #2
0
 private String nameForAssertions() {
   return getName() + " declared in " + DescriptorUtils.getFqName(getContainingDeclaration());
 }