Change the `class` restriction on our protocols to `AnyObject` (#1702)

Motivation:

In all contemporary Swift versions, the `class` and the `AnyObject`
protocol restriction is the same. And `class` is deprecated which warns
on newer Swift compilers.

Modifications:

Replace `class` with `AnyObject`.

Result:

No warnings on newer Swift compilers.
This commit is contained in:
Johannes Weiss 2020-12-09 19:43:11 +00:00 committed by GitHub
parent 076fda1521
commit fe10c5c063
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 6 deletions

View File

@ -19,7 +19,7 @@ import NIOConcurrencyHelpers
/// - warning: If you are not implementing a custom `Channel` type, you should never call any of these.
///
/// - note: All methods must be called from the `EventLoop` thread.
public protocol ChannelCore: class {
public protocol ChannelCore: AnyObject {
/// Returns the local bound `SocketAddress`.
func localAddress0() throws -> SocketAddress
@ -102,7 +102,7 @@ public protocol ChannelCore: class {
/// passed to or returned by the operations are used to retrieve the result of an operation after it has completed.
///
/// A `Channel` owns its `ChannelPipeline` which handles all I/O events and requests associated with the `Channel`.
public protocol Channel: class, ChannelOutboundInvoker {
public protocol Channel: AnyObject, ChannelOutboundInvoker {
/// The `Channel`'s `ByteBuffer` allocator. This is _the only_ supported way of allocating `ByteBuffer`s to be used with this `Channel`.
var allocator: ByteBufferAllocator { get }

View File

@ -17,7 +17,7 @@
/// All methods are called from within the `EventLoop` that is assigned to the `Channel` itself.
//
/// You should _never_ implement this protocol directly. Please implement one of its sub-protocols.
public protocol ChannelHandler: class {
public protocol ChannelHandler: AnyObject {
/// Called when this `ChannelHandler` is added to the `ChannelPipeline`.
///
/// - parameters:

View File

@ -732,7 +732,7 @@ enum NIORegistration: Registration {
}
/// Provides an endless stream of `EventLoop`s to use.
public protocol EventLoopGroup: class {
public protocol EventLoopGroup: AnyObject {
/// Returns the next `EventLoop` to use.
///
/// The algorithm that is used to select the next `EventLoop` is specific to each `EventLoopGroup`. A common choice

View File

@ -453,7 +453,7 @@ internal enum WriteMechanism {
case nothingToBeWritten
}
internal protocol PendingWritesManager: class {
internal protocol PendingWritesManager: AnyObject {
var isOpen: Bool { get }
var isFlushPending: Bool { get }
var writeSpinCount: UInt { get }

View File

@ -12,7 +12,7 @@
//
//===----------------------------------------------------------------------===//
protocol Benchmark: class {
protocol Benchmark: AnyObject {
func setUp() throws
func tearDown()
func run() throws -> Int