Make use of eq and ne. (#1994)

* chore: make use of eq instead of ==

* chore: make use of ne instead of !=
This commit is contained in:
He-Pin(kerr) 2025-08-03 17:32:32 +08:00 committed by GitHub
parent 19788583ee
commit 7325c729ce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
84 changed files with 158 additions and 158 deletions

View file

@ -279,7 +279,7 @@ private[remote] class ReliableDeliverySupervisor(
override val supervisorStrategy = OneForOneStrategy(loggingEnabled = false) {
case _: AssociationProblem => Escalate
case NonFatal(e) =>
val causedBy = if (e.getCause == null) "" else s"Caused by: [${e.getCause.getMessage}]"
val causedBy = if (e.getCause eq null) "" else s"Caused by: [${e.getCause.getMessage}]"
log.warning(
"Association with remote system [{}] has failed, address is now gated for [{}] ms. Reason: [{}] {}",
remoteAddress,

View file

@ -94,7 +94,7 @@ private[pekko] class RemoteSystemDaemon(
@tailrec private def addChildParentNeedsWatch(parent: ActorRef, child: ActorRef): Boolean =
parent2children.get(parent) match {
case null =>
if (parent2children.putIfAbsent(parent, Set(child)) == null) true
if (parent2children.putIfAbsent(parent, Set(child)) eq null) true
else addChildParentNeedsWatch(parent, child)
case children =>
if (parent2children.replace(parent, children, children + child)) false

View file

@ -588,7 +588,7 @@ private[remote] class EndpointManager(conf: Config, log: LoggingAdapter)
OneForOneStrategy(loggingEnabled = false) {
case InvalidAssociation(localAddress, remoteAddress, reason, disassociationInfo) =>
keepQuarantinedOr(remoteAddress) {
val causedBy = if (reason.getCause == null) "" else s"Caused by: [${reason.getCause.getMessage}]"
val causedBy = if (reason.getCause eq null) "" else s"Caused by: [${reason.getCause.getMessage}]"
log.warning(
"Tried to associate with unreachable remote address [{}]. " +
"Address is now gated for {} ms, all messages to this address will be delivered to dead letters. " +

View file

@ -1026,7 +1026,7 @@ private[remote] class Association(
}
def isConnectException: Boolean =
cause.isInstanceOf[StreamTcpException] && cause.getCause != null && cause.getCause
cause.isInstanceOf[StreamTcpException] && (cause.getCause ne null) && cause.getCause
.isInstanceOf[ConnectException]
if (stoppedIdle) {

View file

@ -768,7 +768,7 @@ private[remote] class DuplicateHandshakeReq(
push(out, currentIterator.next())
} finally {
val buf = envelope.envelopeBuffer
if (buf != null) {
if (buf ne null) {
envelope.releaseEnvelopeBuffer()
bufferPool.release(buf)
}
@ -834,7 +834,7 @@ private[remote] class DuplicateFlush(numberOfLanes: Int, system: ExtendedActorSy
push(out, currentIterator.next())
} finally {
val buf = envelope.envelopeBuffer
if (buf != null) {
if (buf ne null) {
envelope.releaseEnvelopeBuffer()
bufferPool.release(buf)
}

View file

@ -467,12 +467,12 @@ private[remote] class ArteryAeronUdpTransport(_system: ExtendedActorSystem, _pro
.stop()
.map { _ =>
flightRecorder.transportStopped()
if (aeronErrorLogTask != null) {
if (aeronErrorLogTask ne null) {
aeronErrorLogTask.cancel()
flightRecorder.transportAeronErrorLogTaskStopped()
}
if (aeron != null) aeron.close()
if (aeronErrorLog != null) aeronErrorLog.close()
if (aeron ne null) aeron.close()
if (aeronErrorLog ne null) aeronErrorLog.close()
if (mediaDriver.get.isDefined) stopMediaDriver()
Done

View file

@ -203,7 +203,7 @@ private[pekko] class TaskRunner(system: ExtendedActorSystem, val idleCpuLevel: I
case Shutdown =>
running = false
tasks.removeAll() // gc friendly
while (cmdQueue.poll() != null) () // gc friendly
while (cmdQueue.poll() ne null) () // gc friendly
shutdown.trySuccess(Done)
}
}

View file

@ -94,7 +94,7 @@ private[pekko] abstract class AbstractActorRefResolveCache[R <: ActorRef: ClassT
ref match {
case r: RemoteActorRef =>
val cachedAssociation = r.cachedAssociation
if (cachedAssociation != null && cachedAssociation.isRemovedAfterQuarantined())
if ((cachedAssociation ne null) && cachedAssociation.isRemovedAfterQuarantined())
r.cachedAssociation = null
case _ =>
}

View file

@ -39,12 +39,12 @@ private[pekko] class ThrowableSupport(system: ExtendedActorSystem) {
def toProtobufThrowable(t: Throwable): ContainerFormats.Throwable.Builder = {
val b = ContainerFormats.Throwable.newBuilder().setClassName(t.getClass.getName)
if (t.getMessage != null)
if (t.getMessage ne null)
b.setMessage(t.getMessage)
if (t.getCause != null)
if (t.getCause ne null)
b.setCause(payloadSupport.payloadBuilder(t.getCause))
val stackTrace = t.getStackTrace
if (stackTrace != null) {
if (stackTrace ne null) {
var i = 0
while (i < stackTrace.length) {
b.addStackTrace(stackTraceElementBuilder(stackTrace(i)))

View file

@ -584,9 +584,9 @@ class NettyTransport(val settings: NettyTransportSettings, val system: ExtendedA
case _: CancellationException => throw new NettyTransportExceptionNoStack("Connection was cancelled")
case NonFatal(t) =>
val msg =
if (t.getCause == null)
if (t.getCause eq null)
t.getMessage
else if (t.getCause.getCause == null)
else if (t.getCause.getCause eq null)
s"${t.getMessage}, caused by: ${t.getCause}"
else
s"${t.getMessage}, caused by: ${t.getCause}, caused by: ${t.getCause.getCause}"