def set_attribute_type(attribute, klass)
      prop = property(attribute)
      # degenerate no-op case
      return if klass == prop.type
      # If this class is the declarer, then simply set the attribute type.
      # Otherwise, if the attribute type is unspecified or is a superclass of the given class,
      # then make a new attribute metadata for this class.
      if prop.declarer == self then
        prop.type = klass
        logger.debug { "Set #{qp}.#{attribute} type to #{klass.qp}." }
      elsif prop.type.nil? or klass < prop.type then
        prop.restrict(self, :type => klass)
        logger.debug { "Restricted #{prop.declarer.qp}.#{attribute}(#{prop.type.qp}) to #{qp} with return type #{klass.qp}." }
      else
        raise ArgumentError.new("Cannot reset #{qp}.#{attribute} type #{prop.type.qp} to incompatible #{klass.qp}")
      end
    end
def set_attribute_type(attribute, klass)
      prop = property(attribute)
      # degenerate no-op case
      return if klass == prop.type
      # If this class is the declarer, then simply set the attribute type.
      # Otherwise, if the attribute type is unspecified or is a superclass of the given class,
      # then make a new attribute metadata for this class.
      if prop.declarer == self then
        prop.type = klass
        logger.debug { "Set #{qp}.#{attribute} type to #{klass.qp}." }
      elsif prop.type.nil? or klass < prop.type then
        prop.restrict(self, :type => klass)
        logger.debug { "Restricted #{prop.declarer.qp}.#{attribute}(#{prop.type.qp}) to #{qp} with return type #{klass.qp}." }
      else
        raise ArgumentError.new("Cannot reset #{qp}.#{attribute} type #{prop.type.qp} to incompatible #{klass.qp}")
      end
    end
Sets the given attribute type to klass. If attribute is defined in a superclass,
 then klass must be a subclass of the superclass attribute type.

 @param [Symbol] attribute the attribute to modify
 @param [Class] klass the attribute type
 @raise [ArgumentError] if the new type is incompatible with the current attribute type