Skip to content

Commit e2bbf45

Browse files
author
Roman Janusz
authored
Merge pull request #427 from AVSystem/jdk17
JDK17 compatibility
2 parents d1f2c74 + d930c98 commit e2bbf45

File tree

5 files changed

+79
-5
lines changed

5 files changed

+79
-5
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
matrix:
2626
os: [ubuntu-latest]
2727
scala: [2.13.10, 2.12.17]
28-
java: [graalvm-ce-java11@21.1.0]
28+
java: [graalvm-ce-java11@21.1.0, openjdk@1.17]
2929
runs-on: ${{ matrix.os }}
3030
steps:
3131
- name: Checkout current branch (full)

commons-core/src/test/scala/com/avsystem/commons/rpc/ApiReflectionTest.scala

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ class SimpleApi {
7575
}
7676

7777
class ApiReflectionTest extends AnyFunSuite {
78-
test("String API") {
78+
test("String API JDK11") {
79+
assume(System.getProperty("java.specification.version") == "11")
7980
assert(ApiInfo.materialize[String].repr ==
8081
"""String {
8182
| def length(): Int
@@ -140,6 +141,79 @@ class ApiReflectionTest extends AnyFunSuite {
140141
)
141142
}
142143

144+
test("String API JDK17") {
145+
assume(System.getProperty("java.specification.version") == "17")
146+
assert(ApiInfo.materialize[String].repr ==
147+
"""String {
148+
| def length(): Int
149+
| def isEmpty(): Boolean
150+
| def charAt(x$1: Int): Char
151+
| def codePointAt(x$1: Int): Int
152+
| def codePointBefore(x$1: Int): Int
153+
| def codePointCount(x$1: Int, x$2: Int): Int
154+
| def offsetByCodePoints(x$1: Int, x$2: Int): Int
155+
| def getChars(x$1: Int, x$2: Int, x$3: Array[Char], x$4: Int): Unit
156+
| def getBytes(x$1: Int, x$2: Int, x$3: Array[Byte], x$4: Int): Unit
157+
| def getBytes(x$1: String): Array[Byte]
158+
| def getBytes(x$1: java.nio.charset.Charset): Array[Byte]
159+
| def getBytes(): Array[Byte]
160+
| def contentEquals(x$1: StringBuffer): Boolean
161+
| def contentEquals(x$1: CharSequence): Boolean
162+
| def equalsIgnoreCase(x$1: String): Boolean
163+
| def compareTo(x$1: String): Int
164+
| def compareToIgnoreCase(x$1: String): Int
165+
| def regionMatches(x$1: Int, x$2: String, x$3: Int, x$4: Int): Boolean
166+
| def regionMatches(x$1: Boolean, x$2: Int, x$3: String, x$4: Int, x$5: Int): Boolean
167+
| def startsWith(x$1: String, x$2: Int): Boolean
168+
| def startsWith(x$1: String): Boolean
169+
| def endsWith(x$1: String): Boolean
170+
| def indexOf(x$1: Int): Int
171+
| def indexOf(x$1: Int, x$2: Int): Int
172+
| def lastIndexOf(x$1: Int): Int
173+
| def lastIndexOf(x$1: Int, x$2: Int): Int
174+
| def indexOf(x$1: String): Int
175+
| def indexOf(x$1: String, x$2: Int): Int
176+
| def lastIndexOf(x$1: String): Int
177+
| def lastIndexOf(x$1: String, x$2: Int): Int
178+
| def substring(x$1: Int): String
179+
| def substring(x$1: Int, x$2: Int): String
180+
| def subSequence(x$1: Int, x$2: Int): CharSequence
181+
| def concat(x$1: String): String
182+
| def replace(x$1: Char, x$2: Char): String
183+
| def matches(x$1: String): Boolean
184+
| def contains(x$1: CharSequence): Boolean
185+
| def replaceFirst(x$1: String, x$2: String): String
186+
| def replaceAll(x$1: String, x$2: String): String
187+
| def replace(x$1: CharSequence, x$2: CharSequence): String
188+
| def split(x$1: String, x$2: Int): Array[String]
189+
| def split(x$1: String): Array[String]
190+
| def toLowerCase(x$1: java.util.Locale): String
191+
| def toLowerCase(): String
192+
| def toUpperCase(x$1: java.util.Locale): String
193+
| def toUpperCase(): String
194+
| def trim(): String
195+
| def strip(): String
196+
| def stripLeading(): String
197+
| def stripTrailing(): String
198+
| def isBlank(): Boolean
199+
| def lines(): java.util.stream.Stream[String]
200+
| def indent(x$1: Int): String
201+
| def stripIndent(): String
202+
| def translateEscapes(): String
203+
| def transform[R](x$1: java.util.function.Function[_ >: String, _ <: R]): R
204+
| def chars(): java.util.stream.IntStream
205+
| def codePoints(): java.util.stream.IntStream
206+
| def toCharArray(): Array[Char]
207+
| def formatted(x$1: Seq[AnyRef]): String
208+
| def intern(): String
209+
| def repeat(x$1: Int): String
210+
| def describeConstable(): java.util.Optional[String]
211+
| def resolveConstantDesc(x$1: java.lang.invoke.MethodHandles.Lookup): String
212+
| final def +(x$1: Any): String
213+
|}""".stripMargin
214+
)
215+
}
216+
143217
test("Simple API") {
144218
assert(ApiInfo.materialize[SimpleApi].repr ==
145219
"""com.avsystem.commons.rpc.SimpleApi {

commons-macros/src/main/scala/com/avsystem/commons/macros/MacroCommons.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,7 @@ trait MacroCommons extends CompatMacroCommons { bundle =>
10511051
actualParamType(param.typeSignature)
10521052

10531053
def actualParamType(tpe: Type): Type = tpe match {
1054-
case TypeRef(_, s, List(arg)) if s == definitions.RepeatedParamClass =>
1054+
case TypeRef(_, s, List(arg)) if s == definitions.RepeatedParamClass || s == definitions.JavaRepeatedParamClass =>
10551055
getType(tq"$ScalaPkg.Seq[$arg]")
10561056
case TypeRef(_, s, List(arg)) if s == definitions.ByNameParamClass =>
10571057
arg

commons-redis/src/main/scala/com/avsystem/commons/redis/commands/streams.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ object XEntryId {
398398
CommandArg((enc, eid) => enc.add(eid.toString))
399399
}
400400

401-
case class XEntry[Record](id: XEntryId, data: Record)
401+
case class XEntry[Rec](id: XEntryId, data: Rec)
402402

403403
case class XMaxlen(maxlen: Long, approx: Boolean = true)
404404
object XMaxlen {

project/Build.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ object Build extends BuildDef {
9292
githubWorkflowEnv ++= Map(
9393
"REDIS_VERSION" -> "6.2.6",
9494
),
95-
githubWorkflowJavaVersions := Seq("graalvm-ce-java11@21.1.0"),
95+
githubWorkflowJavaVersions := Seq("graalvm-ce-java11@21.1.0", "openjdk@1.17"),
9696
githubWorkflowBuildPreamble ++= Seq(
9797
WorkflowStep.Use(
9898
"actions", "cache", "v2",

0 commit comments

Comments
 (0)