我有以下代码在运行时在 Java 程序中编译 scala 代码
Settings s = new Settings();
Global g = new Global(s);
Global.Run run = g.new Run();
List<String> files = new LinkedList<>();
files.add("src/main/java/scala/rules/ScalaRuleBasedStrategy.scala");
run.compile(JavaConverters.asScalaBufferConverter(files)
.asScala().toList());
但我收到此错误:
线程“主”java.lang.NoSuchMethodError 中的异常:scala.tools.nsc.Global$gen$.mkBlock(Lscala/collection/immutable/List;)Lscala/reflect/internal/Trees$Tree; 在 scala.tools.nsc.ast.parser.TreeBuilder.makeBlock(TreeBuilder.scala:110) 在 scala.tools.nsc.ast.parser.Parsers$Parser.block(Parsers.scala:1689)