diff --git a/classlib/src/main/java/org/teavm/classlib/impl/ScalaHacks.java b/classlib/src/main/java/org/teavm/classlib/impl/ScalaHacks.java index b03de9a71..0b50db976 100644 --- a/classlib/src/main/java/org/teavm/classlib/impl/ScalaHacks.java +++ b/classlib/src/main/java/org/teavm/classlib/impl/ScalaHacks.java @@ -46,6 +46,9 @@ public class ScalaHacks implements ClassHolderTransformer { case "scala.util.Properties$": transformProperties(cls); break; + case "scala.runtime.Statics": + transformStatics(cls, context.getHierarchy()); + break; default: if (cls.getName().endsWith(SCALA_INTERNAL_CLASS_MARKER)) { checkAndRemoveExportAnnotation(cls); @@ -97,6 +100,15 @@ public class ScalaHacks implements ClassHolderTransformer { } } + private void transformStatics(ClassHolder cls, ClassHierarchy hierarchy) { + for (MethodHolder method : cls.getMethods()) { + if (method.getName().equals("releaseFence")) { + ProgramEmitter pe = ProgramEmitter.create(method, hierarchy); + pe.exit(); + } + } + } + private void checkAndRemoveExportAnnotation(ClassHolder cls) { for (MethodHolder method : cls.getMethods()) { AnnotationContainer items = method.getAnnotations(); diff --git a/samples/scala/pom.xml b/samples/scala/pom.xml index 0376989c6..49875343a 100644 --- a/samples/scala/pom.xml +++ b/samples/scala/pom.xml @@ -15,7 +15,7 @@ 1.8 - 2.12.11 + 2.13.8 UTF-8 @@ -45,7 +45,7 @@ net.alchim31.maven scala-maven-plugin - 4.3.1 + 4.6.1 diff --git a/samples/scala/src/main/scala/org/teavm/samples/scala/Calculator.scala b/samples/scala/src/main/scala/org/teavm/samples/scala/Calculator.scala index 6d10de8d4..902026f6b 100644 --- a/samples/scala/src/main/scala/org/teavm/samples/scala/Calculator.scala +++ b/samples/scala/src/main/scala/org/teavm/samples/scala/Calculator.scala @@ -52,7 +52,7 @@ object Calculator { def keyword(str: String) = s(str) ~ ws >> { case (s, _) => s } - def ws = s(" ").* >> (_ => Unit) + def ws = s(" ").* >> (_ => ()) } sealed abstract class Expr