def create(self, name: str, descriptor: str,
               code: CodeAttribute=None) -> Method:
        """
        Creates a new method from `name` and `descriptor`. If `code` is not
        ``None``, add a `Code` attribute to this method.
        """
        method = Method(self._cf)
        name = self._cf.constants.create_utf8(name)
        descriptor = self._cf.constants.create_utf8(descriptor)
        method._name_index = name.index
        method._descriptor_index = descriptor.index
        method.access_flags.acc_public = True

        if code is not None:
            method.attributes.create(CodeAttribute)

        self.append(method)
        return method
def create ( self , name : str , descriptor : str , code : CodeAttribute = None ) -> Method : method = Method ( self . _cf ) name = self . _cf . constants . create_utf8 ( name ) descriptor = self . _cf . constants . create_utf8 ( descriptor ) method . _name_index = name . index method . _descriptor_index = descriptor . index method . access_flags . acc_public = True if code is not None : method . attributes . create ( CodeAttribute ) self . append ( method ) return method
Creates a new method from `name` and `descriptor`. If `code` is not
        ``None``, add a `Code` attribute to this method.