Skip to content

Resolve compiler warnings #1384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version = 3.8.1
runner.dialect = scala3

rewrite.scala3.convertToNewSyntax = false
rewrite.scala3.convertToNewSyntax = true
rewrite.scala3.removeOptionalBraces = no

rewrite.trailingCommas.style = multiple
Expand Down
10 changes: 5 additions & 5 deletions src/main/scala/edu/ie3/simona/actor/SimonaActorNaming.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package edu.ie3.simona.actor

import org.apache.pekko.actor.typed.ActorRef
import org.apache.pekko.actor.typed.scaladsl.adapter.TypedActorRefOps
import org.apache.pekko.actor.{ActorRefFactory, Props, ActorRef => ClassicRef}
import org.apache.pekko.actor.{ActorRefFactory, Props, ActorRef as ClassicRef}

import scala.util.Random

Expand Down Expand Up @@ -50,7 +50,7 @@ object SimonaActorNaming {
* @return
* the actor name based on simona conventions as string
*/
def actorName(clz: Class[_], actorId: String): String =
def actorName(clz: Class[?], actorId: String): String =
actorName(typeName(clz), actorId)

/** Constructs an actor name based on the simona convention for actor names.
Expand Down Expand Up @@ -84,7 +84,7 @@ object SimonaActorNaming {
* @return
* the actor name extract from the ActorRef
*/
def actorName(actorRef: ActorRef[_]): String = actorName(actorRef.toClassic)
def actorName(actorRef: ActorRef[?]): String = actorName(actorRef.toClassic)

/** Constructs the type name from given props.
*
Expand All @@ -94,7 +94,7 @@ object SimonaActorNaming {
def typeName(props: Props): String = {
props.args.headOption
.flatMap {
case clz: Class[_] => Some(clz)
case clz: Class[?] => Some(clz)
case _ => None
}
.map(clz => typeName(clz))
Expand All @@ -110,7 +110,7 @@ object SimonaActorNaming {
* @return
* the type name
*/
def typeName(clz: Class[_]): String =
def typeName(clz: Class[?]): String =
clz.getSimpleName.replace("$", "")

/** Pekko prevents the usage of specific special characters as names. This
Expand Down
16 changes: 8 additions & 8 deletions src/main/scala/edu/ie3/simona/agent/em/EmAgent.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ import edu.ie3.simona.ontology.messages.SchedulerMessage.{
Completion,
ScheduleActivation,
}
import edu.ie3.simona.ontology.messages.flex.FlexibilityMessage._
import edu.ie3.simona.ontology.messages.flex.FlexibilityMessage.*
import edu.ie3.simona.ontology.messages.{Activation, SchedulerMessage}
import edu.ie3.simona.service.Data.PrimaryData.ComplexPower
import edu.ie3.simona.util.TickUtil.TickLong
import edu.ie3.util.quantities.QuantityUtils._
import edu.ie3.util.scala.quantities.DefaultQuantities._
import edu.ie3.util.quantities.QuantityUtils.*
import edu.ie3.util.scala.quantities.DefaultQuantities.*
import org.apache.pekko.actor.typed.scaladsl.Behaviors
import org.apache.pekko.actor.typed.{ActorRef, Behavior}

Expand Down Expand Up @@ -136,7 +136,7 @@ object EmAgent {
inactive(
constantData,
modelShell,
EmDataCore.create(simulationStartDate),
EmDataCore.create(using simulationStartDate),
)
}

Expand Down Expand Up @@ -228,16 +228,16 @@ object EmAgent {
provideFlex.flexOptions,
)

if (updatedCore.isComplete) {
if updatedCore.isComplete then {

val allFlexOptions = updatedCore.getFlexOptions

val emFlexOptions =
modelShell.aggregateFlexOptions(allFlexOptions)

if (emData.outputConfig.flexResult) {
if emData.outputConfig.flexResult then {
val flexResult = new FlexOptionsResult(
flexOptionsCore.activeTick.toDateTime(
flexOptionsCore.activeTick.toDateTime(using
emData.simulationStartDate
),
modelShell.uuid,
Expand Down Expand Up @@ -421,7 +421,7 @@ object EmAgent {
_ ! ParticipantResultEvent(
new EmResult(
lastActiveTick
.toDateTime(emData.simulationStartDate),
.toDateTime(using emData.simulationStartDate),
modelShell.uuid,
result.p.toMegawatts.asMegaWatt,
result.q.toMegavars.asMegaVar,
Expand Down
10 changes: 5 additions & 5 deletions src/main/scala/edu/ie3/simona/agent/em/EmDataCore.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import edu.ie3.simona.agent.em.EmAgent.Actor
import edu.ie3.simona.agent.em.FlexCorrespondenceStore.WithTime
import edu.ie3.simona.exceptions.CriticalFailureException
import edu.ie3.simona.ontology.messages.flex.FlexOptions
import edu.ie3.simona.ontology.messages.flex.FlexibilityMessage._
import edu.ie3.simona.ontology.messages.flex.FlexibilityMessage.*
import edu.ie3.simona.service.Data.PrimaryData.ComplexPower
import edu.ie3.simona.util.SimonaConstants.INIT_SIM_TICK
import edu.ie3.util.scala.collection.mutable.PriorityMultiBiSet
Expand Down Expand Up @@ -91,7 +91,7 @@ object EmDataCore {
*/
def activate(newTick: Long): AwaitingFlexOptions = {
activationQueue.headKeyOption.foreach { nextScheduledTick =>
if (newTick > nextScheduledTick)
if newTick > nextScheduledTick then
throw new CriticalFailureException(
s"Cannot activate with new tick $newTick because the next scheduled tick $nextScheduledTick needs to be activated first."
)
Expand Down Expand Up @@ -222,7 +222,7 @@ object EmDataCore {
)
}

val newCore = if (activeTick == INIT_SIM_TICK) {
val newCore = if activeTick == INIT_SIM_TICK then {
Right(
AwaitingCompletions(
modelToActor,
Expand Down Expand Up @@ -449,7 +449,7 @@ object EmDataCore {
def handleCompletion(
completion: FlexCompletion
): AwaitingCompletions = {
if (!awaitedCompletions.contains(completion.modelUuid))
if !awaitedCompletions.contains(completion.modelUuid) then
throw new CriticalFailureException(
s"Participant ${completion.modelUuid} is not part of the expected completing participants"
)
Expand All @@ -459,7 +459,7 @@ object EmDataCore {
.foreach { activationQueue.set(_, completion.modelUuid) }

val updatedFlexWithNext =
if (completion.requestAtNextActivation)
if completion.requestAtNextActivation then
flexWithNext.incl(completion.modelUuid)
else flexWithNext

Expand Down
Loading
Loading