/** * @return true iff this is a top-level declaration or a class member with no expected "this" * object (e.g. static members in Java, values() and valueOf() methods of enum classes, etc.) */ public static boolean isStaticDeclaration(@NotNull CallableDescriptor descriptor) { if (descriptor instanceof ConstructorDescriptor) return false; DeclarationDescriptor container = descriptor.getContainingDeclaration(); return container instanceof PackageFragmentDescriptor || (container instanceof ClassDescriptor && descriptor.getDispatchReceiverParameter() == null); }
public static boolean isExtension(@NotNull CallableDescriptor descriptor) { return (descriptor.getExtensionReceiverParameter() != null); }