Bump Scala version in Scala example. Add hack for Scala runtime.

This commit is contained in:
Alexey Andreev 2022-05-08 18:43:49 +03:00
parent e625409562
commit eab7ef0a2e
3 changed files with 15 additions and 3 deletions

View File

@ -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();

View File

@ -15,7 +15,7 @@
<properties>
<java.version>1.8</java.version>
<scala.version>2.12.11</scala.version>
<scala.version>2.13.8</scala.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@ -45,7 +45,7 @@
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>4.3.1</version>
<version>4.6.1</version>
<executions>
<execution>
<goals>

View File

@ -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