Closed coryfklein closed 3 months ago
Tapir version: 1.10.15
Scala version: 3.4.2
The generated example Tapir project won't compile with Scala 3's -Yexplicit-nulls compiler option due to how SchemaMagnoliaDerivation#derived inlines an unsafe call to java.lang.ThreadLocal#get
-Yexplicit-nulls
SchemaMagnoliaDerivation#derived
java.lang.ThreadLocal#get
What is the problem?
Generate a project with these settings:
Then turn on the -Yexplicit-nulls flag.
You can see the issue manifesting in booksListing in my IntelliJ setup like so:
booksListing
Error at the end of line 40
Found: scala.collection.mutable.Set[String] | Null Required: scala.collection.mutable.Set[String] Explanation =========== Tree: 9|SchemaMagnoliaDerivation_this. 119| sttp$tapir$generic$auto$SchemaMagnoliaDerivation$$inline$deriveCache. 119| get() I tried to show that scala.collection.mutable.Set[String] | Null conforms to scala.collection.mutable.Set[String] but none of the attempts shown below succeeded: ==> scala.collection.mutable.Set[String] | Null <: scala.collection.mutable.Set[String] ==> Null <: scala.collection.mutable.Set[String] = false The tests were made under a constraint with: uninstantiated variables: T, A, T, A constrained types: [T](value: T): sttp.tapir.generic.Derived[T], [A](elems: A*): scala.collection.mutable.Set[A], [T] (schemaType: sttp.tapir.SchemaType[T], name: Option[sttp.tapir.Schema.SName], isOptional: Boolean, description: Option[String], default: Option[(T, Option[Any])], format: Option[String], encodedExample: Option[Any], deprecated: Boolean, hidden: Boolean, validator: sttp.tapir.Validator[T], attributes: sttp.tapir.AttributeMap): sttp.tapir.Schema[T] , [A](using x$1: scala.deriving.Mirror.Of[A]): sttp.tapir.Schema[A] bounds: T A T A ordering: co-deps: contra-deps: [30:36]
Do you think that https://github.com/softwaremill/tapir/pull/3970 will satisfy the compiler? I'm not familiar with explicit-nullss
explicit-nulls
Tapir version: 1.10.15
Scala version: 3.4.2
The generated example Tapir project won't compile with Scala 3's
-Yexplicit-nulls
compiler option due to howSchemaMagnoliaDerivation#derived
inlines an unsafe call tojava.lang.ThreadLocal#get
What is the problem?
Generate a project with these settings:
Then turn on the
-Yexplicit-nulls
flag.You can see the issue manifesting in
booksListing
in my IntelliJ setup like so:Error at the end of line 40