From 60b1c705316399b3e86399f98cfdeb176b5c05eb Mon Sep 17 00:00:00 2001 From: Dominique Unruh Date: Thu, 11 Apr 2024 17:37:16 +0200 Subject: [PATCH] Added javaBooleanConverter etc. to have converters matching Java's boxed types. --- src/main/scala/de/unruh/isabelle/mlvalue/Implicits.scala | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/scala/de/unruh/isabelle/mlvalue/Implicits.scala b/src/main/scala/de/unruh/isabelle/mlvalue/Implicits.scala index 892b4b7..f346e3b 100644 --- a/src/main/scala/de/unruh/isabelle/mlvalue/Implicits.scala +++ b/src/main/scala/de/unruh/isabelle/mlvalue/Implicits.scala @@ -2,11 +2,19 @@ package de.unruh.isabelle.mlvalue import de.unruh.isabelle.mlvalue.MLValue.Converter +import scala.runtime.BoxedUnit + object Implicits { @inline implicit val booleanConverter: BooleanConverter.type = BooleanConverter + /** In Java, [[booleanConverter]] does not have the right type. You may try to use this instead. */ + @inline val javaBooleanConverter: MLValue.Converter[java.lang.Boolean] = booleanConverter.asInstanceOf[MLValue.Converter[java.lang.Boolean]] @inline implicit val intConverter: IntConverter.type = IntConverter + /** In Java, [[intConverter]] does not have the right type. You may try to use this instead. */ + @inline val javaIntConverter: MLValue.Converter[java.lang.Integer] = IntConverter.asInstanceOf[MLValue.Converter[java.lang.Integer]] @inline implicit val bigIntConverter: BigIntConverter.type = BigIntConverter @inline implicit val longConverter: LongConverter.type = LongConverter + /** In Java, [[longConverter]] does not have the right type. You may try to use this instead. */ + @inline val javaLongConverter: MLValue.Converter[java.lang.Long] = LongConverter.asInstanceOf[MLValue.Converter[java.lang.Long]] @inline implicit val unitConverter: UnitConverter.type = UnitConverter @inline implicit val stringConverter: StringConverter.type = StringConverter @inline implicit val dataConverter: DataConverter.type = DataConverter