Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .scalafix.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ rules = [
ProcedureSyntax
RedundantSyntax
]
ExplicitResultTypes.memberVisibility = [Public]
ExplicitResultTypes.memberVisibility = [Public]
# Needed for Scalafix 0.14.7 and Scala 3.9. Remove after upgrading Scalafix.
ExplicitResultTypes.fetchScala3CompilerArtifactsOnVersionMismatch = true
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import scala.language.postfixOps
import scala.language.implicitConversions
import scala.sys.process.*

ThisBuild / scalaVersion := "3.3.8"
ThisBuild / scalaVersion := "3.9.0"
ThisBuild / organization := "eu.neverblink.jelly"
ThisBuild / homepage := Some(uri("https://w3id.org/jelly/jelly-jvm"))
ThisBuild / licenses := List("Apache-2.0" -> uri("https://www.apache.org/licenses/LICENSE-2.0"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class EnumGenerator(val info: EnumInfo):
.sorted
.toArray
val createCaseIfs = (len: Int) => {
info.values.stream.filter(value => value.getName.length eq len).forEach(value => {
info.values.stream.filter(value => value.getName.length == len).forEach(value => {
forName
.beginControlFlow("if ($S == value)", value.getName)
.addStatement("return $N", NamingUtil.filterKeyword(value.getName))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,10 @@ object RequestInfo:
// Used for the return type in the method, e.g., Optional<String>
private def getOptionalReturnType: TypeName =
if (isRepeated)
return ParameterizedTypeName.get(ClassName.get(classOf[Optional[_]]), getRepeatedStoreType)
return ParameterizedTypeName.get(ClassName.get(classOf[Optional[?]]), getRepeatedStoreType)
val typeName = getTypeName
if (!isPrimitive || (typeName eq TypeName.BOOLEAN))
return ParameterizedTypeName.get(ClassName.get(classOf[Optional[_]]), typeName.box)
return ParameterizedTypeName.get(ClassName.get(classOf[Optional[?]]), typeName.box)
if (typeName eq TypeName.INT) return TypeName.get(classOf[OptionalInt])
if (typeName eq TypeName.LONG) return TypeName.get(classOf[OptionalLong])
if (typeName eq TypeName.FLOAT) return TypeName.get(classOf[OptionalDouble])
Expand Down Expand Up @@ -453,6 +453,6 @@ object RequestInfo:

def getFields: Seq[RequestInfo.FieldInfo] = parentTypeInfo.fields
.filter(field => field.descriptor.hasOneofIndex)
.filter(field => field.descriptor.getOneofIndex eq oneOfIndex)
.filter(field => field.descriptor.getOneofIndex == oneOfIndex)
.toSeq
}
16 changes: 8 additions & 8 deletions docs/docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ The following table shows the compatibility of the Jelly-JVM implementation with
{: .jelly-table-tight }

| Jelly-JVM | Java | <abbr title="Scala is used only in tests and jelly-pekko-* modules. Other modules are 100% in Java">Scala</abbr> | <abbr title="Eclipse RDF4J">RDF4J</abbr> | <abbr title="Apache Jena">Jena</abbr> | <abbr title="Apache Pekko, used in jelly-pekko-* modules.">Pekko</abbr> | Neo4j |
|:-----------------------------------------------------------------------------------------------------------------------------------------------:|:----:|:-------------------------:|:-----------:|:-------------------------------------:|:-----------------------------------------------------------------------:|:-----------------------------------------------------:|
| [4.0.x](https://w3id.org/jelly/jelly-jvm/4.0.x)–[**{{ jvm_package_version() }}**](https://w3id.org/jelly/jelly-jvm/{{ jvm_package_version() }}) | 21+[^3] | 3.3.x (LTS)[^2] | 6.x.x | 5.4.x–6.x.x | 1.1.x–1.2.x | {{ neo4j_version('min') }}–{{ neo4j_version('max') }} |
| [3.7.x](https://w3id.org/jelly/jelly-jvm/3.7.x) | 17+ | 3.3.x (LTS)[^2] | 4.3.x–5.x.x | 5.x.x–6.x.x | 1.1.x–1.2.x | 5.1.0–5.26.0 |
| [3.5.x](https://w3id.org/jelly/jelly-jvm/3.5.x)–[3.6.x](https://w3id.org/jelly/jelly-jvm/3.6.x) | 17+ | 3.3.x (LTS)[^2] | 4.3.x–5.x.x | 5.x.x | 1.1.x–1.2.x | 5.1.0–5.26.0 |
| [3.0.x](https://w3id.org/jelly/jelly-jvm/3.0.x)–[3.4.x](https://w3id.org/jelly/jelly-jvm/3.4.x) | 17+ | 3.3.x (LTS)[^2] | 5.x.x | 5.x.x | 1.1.x | – |
| [2.0.x](https://w3id.org/jelly/jelly-jvm/2.0.x)–[2.10.x](https://w3id.org/jelly/jelly-jvm/2.10.x) | 17+ | 3.3.x (LTS) | 5.x.x | 5.x.x | 1.1.x | – |
| [1.0.x](https://w3id.org/jelly/jelly-jvm/1.0.x) | 11+ | 3.3.x (LTS)<br>2.13.x[^1] | 4.x.x | 4.x.x | 1.0.x | – |
|:-----------------------------------------------------------------------------------------------------------------------------------------------:|:----:|:----------------------------------------------------------------------------------------------------------------:|:-----------:|:-------------------------------------:|:-----------------------------------------------------------------------:|:-----------------------------------------------------:|
| [4.0.x](https://w3id.org/jelly/jelly-jvm/4.0.x)–[**{{ jvm_package_version() }}**](https://w3id.org/jelly/jelly-jvm/{{ jvm_package_version() }}) | 21+[^3] | 3.9.x (LTS)[^2] | 6.x.x | 5.4.x–6.x.x | 1.1.x–1.2.x | {{ neo4j_version('min') }}–{{ neo4j_version('max') }} |
| [3.7.x](https://w3id.org/jelly/jelly-jvm/3.7.x) | 17+ | 3.3.x (LTS)[^2] | 4.3.x–5.x.x | 5.x.x–6.x.x | 1.1.x–1.2.x | 5.1.0–5.26.0 |
| [3.5.x](https://w3id.org/jelly/jelly-jvm/3.5.x)–[3.6.x](https://w3id.org/jelly/jelly-jvm/3.6.x) | 17+ | 3.3.x (LTS)[^2] | 4.3.x–5.x.x | 5.x.x | 1.1.x–1.2.x | 5.1.0–5.26.0 |
| [3.0.x](https://w3id.org/jelly/jelly-jvm/3.0.x)–[3.4.x](https://w3id.org/jelly/jelly-jvm/3.4.x) | 17+ | 3.3.x (LTS)[^2] | 5.x.x | 5.x.x | 1.1.x | – |
| [2.0.x](https://w3id.org/jelly/jelly-jvm/2.0.x)–[2.10.x](https://w3id.org/jelly/jelly-jvm/2.10.x) | 17+ | 3.3.x (LTS) | 5.x.x | 5.x.x | 1.1.x | – |
| [1.0.x](https://w3id.org/jelly/jelly-jvm/1.0.x) | 11+ | 3.3.x (LTS)<br>2.13.x[^1] | 4.x.x | 4.x.x | 1.0.x | – |

See the **[compatibility policy](user/compatibility.md)** for more details and the **[release notes on GitHub](https://github.com/Jelly-RDF/jelly-jvm/releases)**.

Expand Down Expand Up @@ -121,5 +121,5 @@ The development of the Jelly protocol, its implementations, and supporting tooli
![European Funds for Smart Economy, Republic of Poland, Co-funded by the European Union](assets/featured/feng_rp_eu.png)

[^1]: Scala 2.13-compatible builds of Jelly-JVM are available for Jelly-JVM 1.0.x. Scala 2 support was removed in subsequent versions. [See more details](https://w3id.org/jelly/jelly-jvm/1.0.x/user/scala2).
[^2]: Scala version applies **only** to the `jelly-pekko-*` modules. The other modules **do not depend** on Scala and are compatible with any version of Java 21+.
[^2]: Scala version applies **only** to the `jelly-pekko-*` modules. The other modules **do not depend** on Scala.
[^3]: The `jelly-rdf4j-*` modules require **Java 25+**, because RDF4J 6 does. All other modules run on Java 21+. Building Jelly-JVM from source requires JDK 25+ in all cases.
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ object PekkoGrpc extends shared.ScalaExample:
.withFallback(ConfigFactory.defaultApplication())

// We will need two Pekko actor systems to run the streams – one for the server and one for the client
val serverActorSystem: ActorSystem[_] = ActorSystem(Behaviors.empty, "ServerSystem")
val clientActorSystem: ActorSystem[_] = ActorSystem(Behaviors.empty, "ClientSystem", config)
val serverActorSystem: ActorSystem[?] = ActorSystem(Behaviors.empty, "ServerSystem")
val clientActorSystem: ActorSystem[?] = ActorSystem(Behaviors.empty, "ClientSystem", config)

// Our mock dataset that we will send around in the streams
val dataset: Dataset =
Expand All @@ -73,7 +73,7 @@ object PekkoGrpc extends shared.ScalaExample:
/** Main method that starts the server and the client.
*/
def main(args: Array[String]): Unit =
given system: ActorSystem[_] = serverActorSystem
given system: ActorSystem[?] = serverActorSystem
given ExecutionContext = system.executionContext

// Start the server
Expand All @@ -95,7 +95,7 @@ object PekkoGrpc extends shared.ScalaExample:
/** The client part of the example.
*/
private def runClient(): Unit =
given system: ActorSystem[_] = clientActorSystem
given system: ActorSystem[?] = clientActorSystem
given ExecutionContext = system.executionContext

// Create a gRPC client
Expand Down Expand Up @@ -192,7 +192,7 @@ object PekkoGrpc extends shared.ScalaExample:
* You will also need to implement this trait in your own service. It defines the logic with
* which the server will handle incoming streams and subscriptions.
*/
class ExampleJellyService(using system: ActorSystem[_]) extends RdfStreamService:
class ExampleJellyService(using system: ActorSystem[?]) extends RdfStreamService:
given ExecutionContext = system.executionContext

/** Handler for clients publishing RDF streams to the server.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import org.openjdk.jmh.infra.Blackhole
object RdfStreamFrameDecodeBench:
@State(Scope.Benchmark)
class BenchInput:
var toDecode: Array[RdfStreamFrame] = _
var toDecode: Array[RdfStreamFrame] = scala.compiletime.uninitialized

@Setup(Level.Trial)
def setup(): Unit =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ object RdfTripleRecursiveBench:
class BenchInput:
val random = new scala.util.Random(123)

var toParse: Array[Byte] = _
var toParse: Array[Byte] = scala.compiletime.uninitialized

val size = 1000

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import org.openjdk.jmh.annotations.*
object ReadStringBench:
@State(Scope.Benchmark)
class BenchInput:
var toParse: Array[Byte] = _
var toParse: Array[Byte] = scala.compiletime.uninitialized

val size = 1000

var inputStream: CodedInputStream = _
var inputStream: CodedInputStream = scala.compiletime.uninitialized

@Setup(Level.Trial)
def setup(): Unit =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ object SparqlDecodeBench:
"realistic-mixed",
),
)
var preset: String = _
var preset: String = scala.compiletime.uninitialized

@Param(Array("4096"))
var valuesPerFrame: Int = _
var valuesPerFrame: Int = scala.compiletime.uninitialized

var bytes: Array[Byte] = _
var frames: Array[SparqlResultsFrame] = _
var bytes: Array[Byte] = scala.compiletime.uninitialized
var frames: Array[SparqlResultsFrame] = scala.compiletime.uninitialized

@Setup(Level.Trial)
def setup(): Unit =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ object SparqlEncodeBench:
"realistic-mixed",
),
)
var preset: String = _
var preset: String = scala.compiletime.uninitialized

@Param(Array("4096"))
var valuesPerFrame: Int = _
var valuesPerFrame: Int = scala.compiletime.uninitialized

var data: SparqlBenchData.Data = _
var data: SparqlBenchData.Data = scala.compiletime.uninitialized

@Setup(Level.Trial)
def setup(): Unit =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ object SparqlSizeReport:

private def run(config: Config): Unit =
JenaSystem.init()
val names = if config.presets.nonEmpty then config.presets else SparqlDataGen.presetNames
val names = if config.presets.nonEmpty then config.presets
else SparqlDataGen.presetNames :+ "weather"

config.dumpDir.foreach { dir =>
Files.createDirectories(dir)
Expand All @@ -131,7 +132,8 @@ object SparqlSizeReport:

var filesWritten = 0
for name <- names do
val data = SparqlBenchData.load(name)
val data = if name == "weather" then SparqlBenchData.loadWeather(throughputRows)
else SparqlBenchData.load(name)
val outputs = serialize(data, config.maxValuesPerFrame)

config.dumpDir.foreach { dir =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ object RdfStreamServer:
* actor system
*/
final class RdfStreamServer(options: RdfStreamServer.Options, streamService: RdfStreamService)(using
system: ActorSystem[_],
system: ActorSystem[?],
):
given ExecutionContext = system.executionContext

private val logger = LoggerFactory.getLogger(getClass)
private var binding: Option[ServerBinding] = _
private var binding: Option[ServerBinding] = scala.compiletime.uninitialized

/** Start this server.
* @return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,26 +117,40 @@ object RdfStreamServiceHandler {
(reader, writer) =>
(method match {
case "SubscribeRdf" =>
GrpcMarshalling.unmarshal(request.entity)(RdfStreamSubscribeSerializer, mat, reader)
GrpcMarshalling.unmarshal(request.entity)(using
RdfStreamSubscribeSerializer,
mat,
reader,
)
.map(implementation.subscribeRdf)
.map(e =>
GrpcMarshalling.marshalStream(e, eHandler)(
GrpcMarshalling.marshalStream(e, eHandler)(using
RdfStreamFrameSerializer,
writer,
system,
),
)

case "PublishRdf" =>
GrpcMarshalling.unmarshalStream(request.entity)(RdfStreamFrameSerializer, mat, reader)
GrpcMarshalling.unmarshalStream(request.entity)(using
RdfStreamFrameSerializer,
mat,
reader,
)
.flatMap(implementation.publishRdf)
.map(e =>
GrpcMarshalling.marshal(e, eHandler)(RdfStreamReceivedSerializer, writer, system),
GrpcMarshalling.marshal(e, eHandler)(using
RdfStreamReceivedSerializer,
writer,
system,
),
)

case m => Future.failed(new NotImplementedError(s"Not implemented: $m"))
})
.recoverWith(GrpcExceptionHandler.from(eHandler(system.classicSystem))(system, writer)),
.recoverWith(
GrpcExceptionHandler.from(eHandler(system.classicSystem))(using system, writer),
),
).getOrElse(unsupportedMediaType)

Function.unlift((req: model.HttpRequest) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ class GrpcSpec extends AnyWordSpec, Matchers, ScalaFutures, BeforeAndAfterAll:
.withFallback(ConfigFactory.defaultApplication())

val testKit: ActorTestKit = ActorTestKit(conf)
val serverSystem: ActorSystem[_] = testKit.system
val serverSystem: ActorSystem[?] = testKit.system

class TestService(storedData: Map[String, Seq[RdfStreamFrame]]) extends RdfStreamService:
given system: ActorSystem[_] = serverSystem
given system: ActorSystem[?] = serverSystem
given ExecutionContext = system.executionContext
var receivedData: mutable.Map[String, Seq[RdfStreamFrame]] = mutable.Map()

Expand Down Expand Up @@ -105,7 +105,7 @@ class GrpcSpec extends AnyWordSpec, Matchers, ScalaFutures, BeforeAndAfterAll:
(name, confKey, service, bound)
})

given clientSystem: ActorSystem[_] = ActorSystem(Behaviors.empty, "TestClient", conf)
given clientSystem: ActorSystem[?] = ActorSystem(Behaviors.empty, "TestClient", conf)

override def afterAll(): Unit =
ActorTestKit.shutdown(clientSystem)
Expand Down
2 changes: 0 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,3 @@ addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.4.4")
addSbtPlugin("com.github.sbt" % "sbt-jacoco" % "3.6.0")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.14.7")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.6.2")

addDependencyTreePlugin
Loading