orientdb
orientdb copied to clipboard
Example code doesn't work [3.2.29 / Java 17 / scala 3.4.1]
OrientDB Version: 3.2.29
Java Version: 17 (build 17.0.11+9-Debian-1deb12u1, mixed mode, sharing)
OS: Linux 6.1.0-20-amd64#1 SMP PREEMPT_DYNAMIC Debian 6.1.85-1 (2024-04-11) x86_64 GNU/Linux
Scala: 3.4.1
Expected behavior
The Scala demo code (https://orientdb.com/docs/last/scala/Scala-Language.html) works
Actual behavior
The line
-
edge.getProperty("projects").asInstanceOf[Set[Vertex]].map(v=>v.getProperty[String]("name")).mkString(", ") else "Any"
errors out with:
-
Exception in thread "main" java.lang.ClassCastException: class com.orientechnologies.orient.core.db.record.ORecordLazySet cannot be cast to class scala.collection.immutable.Set (com.orientechnologies.orient.core.db.record.ORecordLazySet and scala.collection.immutable.Set are in unnamed module of loader 'app')
had to fix it as:
-
edge.getProperty("projects").asInstanceOf[ju.Set[Vertex]].asScala.map(v=>v.getProperty[String]("name")).mkString(", ") else "Any"
Steps to reproduce
Run the referenced example.
Might be related: Launched under Metals (clicking on the run option above "main" method):
- VSCodium: Version: 1.88.1 Release: 24104 Commit: 0d01a72525276e5e3771fe5851b9c83de0de1e2b Date: 2024-04-13T01:53:59.491Z Electron: 28.2.8 ElectronBuildId: undefined Chromium: 120.0.6099.291 Node.js: 18.18.2 V8: 12.0.267.19-electron.0 OS: Linux x64 6.1.0-20-amd64
- Metals: v1.30.0
And while I'm being thorough, build.sbt:
name := "<redacted>"
organization := "<redacted>"
version := "0.1-SNAPSHOT"
scalaVersion := "3.4.1"
libraryDependencies ++= Seq(
"org.scalafx" %% "scalafx" % "22.0.0-R33",
"org.scalatest" %% "scalatest" % "3.2.18" % "test",
"com.orientechnologies" % "orientdb-graphdb" % "3.2.29"
)
// Fork a new JVM for 'run' and 'test:run' to avoid JavaFX double initialization problems
fork := true
// set the main class for the main 'run' task
// change Compile to Test to set it for 'test:run'
Compile / run / mainClass := Some("<redacted>.ScalaFXHelloWorld")