Skip to content

Commit 2197446

Browse files
committed
Update to Scala 3
Some tests are failing, Scala 3 implementation of ScriptEngine will need to be fixed
1 parent ad59910 commit 2197446

File tree

2 files changed

+39
-38
lines changed

2 files changed

+39
-38
lines changed

pom.xml

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -96,37 +96,35 @@ Wisconsin-Madison.</license.copyrightOwners>
9696
<!-- NB: Deploy releases to the SciJava Maven repository. -->
9797
<releaseProfiles>sign,deploy-to-scijava</releaseProfiles>
9898

99-
<scala.version>2.13.10</scala.version>
99+
<scala.version>3.2.2</scala.version>
100100
</properties>
101101

102-
<dependencies>
103-
<!-- SciJava dependencies -->
104-
<dependency>
105-
<groupId>org.scijava</groupId>
106-
<artifactId>scijava-common</artifactId>
107-
</dependency>
108102

109-
<!-- Scala dependencies -->
110-
<dependency>
111-
<groupId>org.scala-lang</groupId>
112-
<artifactId>scala-compiler</artifactId>
113-
<version>${scala.version}</version>
114-
<exclusions>
115-
<exclusion>
116-
<!-- To avoid error:
117-
[ERROR] Rule 3: org.apache.maven.plugins.enforcer.BanDuplicateClasses failed with message:
118-
No Duplicate Classes Allowed!
119-
- For duplicate transitive dependencies, add dependency exclusions.
120-
- For duplications between direct dependencies, resolve or add
121-
ignored classes to this rule's configuration.
122-
Found in:
123-
io.github.java-diff-utils:java-diff-utils:jar:4.12:compile
124-
org.scala-lang:scala-compiler:jar:2.13.10:compile -->
125-
<groupId>io.github.java-diff-utils</groupId>
126-
<artifactId>java-diff-utils</artifactId>
127-
</exclusion>
128-
</exclusions>
129-
</dependency>
103+
<build>
104+
<plugins>
105+
<plugin>
106+
<groupId>net.alchim31.maven</groupId>
107+
<artifactId>scala-maven-plugin</artifactId>
108+
<version>4.8.0</version>
109+
</plugin>
110+
</plugins>
111+
</build>
112+
113+
<dependencies>
114+
<!-- SciJava dependencies -->
115+
<dependency>
116+
<groupId>org.scijava</groupId>
117+
<artifactId>scijava-common</artifactId>
118+
</dependency>
119+
120+
<!-- Scala dependencies -->
121+
<dependency>
122+
<groupId>org.scala-lang</groupId>
123+
<artifactId>scala3-compiler_3</artifactId>
124+
<version>${scala.version}</version>
125+
<exclusions>
126+
</exclusions>
127+
</dependency>
130128

131129
<!-- Test dependencies -->
132130
<dependency>

src/main/java/org/scijava/plugins/scripting/scala/ScalaScriptLanguage.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,18 @@
3535
import java.util.stream.Collectors;
3636

3737
import javax.script.ScriptEngine;
38+
import javax.script.ScriptEngineManager;
3839

3940
import org.scijava.log.LogService;
4041
import org.scijava.plugin.Parameter;
4142
import org.scijava.plugin.Plugin;
4243
import org.scijava.script.AdaptedScriptLanguage;
4344
import org.scijava.script.ScriptLanguage;
4445

45-
import scala.tools.nsc.ConsoleWriter;
46-
import scala.tools.nsc.NewLinePrintWriter;
47-
import scala.tools.nsc.Settings;
48-
import scala.tools.nsc.interpreter.shell.Scripted;
46+
//import scala.tools.nsc.ConsoleWriter;
47+
//import scala.tools.nsc.NewLinePrintWriter;
48+
//import scala.tools.nsc.Settings;
49+
//import scala.tools.nsc.interpreter.shell.Scripted;
4950

5051
/**
5152
* An adapter of the Scala interpreter to the SciJava scripting interface.
@@ -67,12 +68,14 @@ public ScalaScriptLanguage() {
6768

6869
@Override
6970
public ScriptEngine getScriptEngine() {
70-
final Settings settings = new Settings();
71-
settings.classpath().value_$eq(getClasspath());
72-
73-
Scripted eng = Scripted.apply(new Scripted.Factory(), settings,
74-
new NewLinePrintWriter(new ConsoleWriter(), true));
75-
71+
// final Settings settings = new Settings();
72+
// settings.classpath().value_$eq(getClasspath());
73+
//
74+
// Scripted eng = Scripted.apply(new Scripted.Factory(), settings,
75+
// new NewLinePrintWriter(new ConsoleWriter(), true));
76+
// x = new dotty.tools.repl.ScriptEngine();
77+
//
78+
final ScriptEngine eng = new ScriptEngineManager().getEngineByName("scala");
7679
return new ScalaScriptEngine(eng);
7780
}
7881

0 commit comments

Comments
 (0)