Skip to content
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

Scala 3 #120

Merged
merged 4 commits into from
Feb 20, 2025
Merged

Scala 3 #120

merged 4 commits into from
Feb 20, 2025

Conversation

tmccombs
Copy link
Contributor

Depends on #119

@tmccombs tmccombs requested a review from mattspataro February 19, 2025 18:40
@@ -46,7 +47,7 @@ class GeneratorClassLoader extends ClassLoader(classOf[GeneratorClassLoader].get

def getClassLoader: GeneratorClassLoader = this

def loadClass[T](name: String, clazz: Class[T]) = loadClass(name).asInstanceOf[Class[_ <: T]]
def loadClass[T](name: String, clazz: Class[T]): Class[_ <: T] = loadClass(name).asInstanceOf[Class[_ <: T]]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Since this is Scala 3, we should use Class[? <: T] instead.
https://docs.scala-lang.org/scala3/reference/changed-features/wildcards.html

@@ -34,7 +34,7 @@ trait JobDataHelper {

implicit def jobDataMap: Mapping[Option[JobDataMap]] =
optional(
list(mapping("key" -> text, "value" -> text)(DataMap.apply)(DataMap.unapply))
list(mapping("key" -> text, "value" -> text)(DataMap.apply)(r => Some((r.key, r.value))))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super-nit: Whether you accept this suggestion is completely up to you, but I strongly dislike single-letter variable names unless they're referring to an index. Could you make this more descriptive?

case "cron" => cron.get
case "simple" => simple.get
})
}): ScheduleBuilder[?])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I'm surprised this was necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah.... I think what happened is ScheduleBuilder[T] isn't covariant in T, so it couldn't figure out how to merge the two ScheduleBuilder instances, and I guess couldn't figure out that ScheduleBuilder[?] would work here.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting.

),
)
}

object MaxSecondsBetweenSuccessesFormatter extends Formatter[Int] {
override val format = Some(("format.triggerMaxErrorTime", Nil))
override val format: Option[(String, Seq[Nothing])] = Some(("format.triggerMaxErrorTime", Nil))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Should we stick to original signature of format? I.e. Option[(String, Seq[Any])]:
https://www.playframework.com/documentation/2.9.3/api/scala/play/api/data/format/Formatter.html#format:Option[(String,Seq[Any])]

@tmccombs tmccombs merged commit 73bbab1 into master Feb 20, 2025
1 check passed
@tmccombs tmccombs deleted the scala-3 branch February 20, 2025 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants