diff --git a/.github/workflows/PR.yml b/.github/workflows/PR.yml index 7ef31f82..49b561c2 100644 --- a/.github/workflows/PR.yml +++ b/.github/workflows/PR.yml @@ -10,11 +10,11 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up JDK 17 + - name: Set up JDK 23 uses: actions/setup-java@v4 with: distribution: 'zulu' - java-version: 17 + java-version: 23 - name: Setup gradle uses: gradle/actions/setup-gradle@v4 diff --git a/.github/workflows/SNAPSHOT.yml b/.github/workflows/SNAPSHOT.yml index 02042492..4b8e7fd3 100644 --- a/.github/workflows/SNAPSHOT.yml +++ b/.github/workflows/SNAPSHOT.yml @@ -12,11 +12,11 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up JDK 17 + - name: Set up JDK 23 uses: actions/setup-java@v4 with: distribution: 'zulu' - java-version: 17 + java-version: 23 - name: Setup gradle uses: gradle/actions/setup-gradle@v4 diff --git a/build.gradle b/build.gradle index 2fd02ca9..15dcb437 100644 --- a/build.gradle +++ b/build.gradle @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + plugins { alias(libs.plugins.kotlinJvm) apply false alias(libs.plugins.spotless) @@ -35,7 +37,16 @@ allprojects { subprojects { apply(plugin: "org.jetbrains.kotlin.jvm") - kotlin.jvmToolchain(17) + tasks.withType(JavaCompile).configureEach { + sourceCompatibility = '11' + targetCompatibility = '11' + } + + tasks.withType(KotlinCompile).configureEach { + kotlinOptions { + jvmTarget = '11' + } + } tasks.withType(Test).configureEach { testLogging { diff --git a/core/build.gradle b/core/build.gradle index f5991f65..b8a6ffca 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + plugins { alias(libs.plugins.kotlinJvm) alias(libs.plugins.grammarKitComposer) diff --git a/sample-headless/src/test/kotlin/com/alecstrong/sql/psi/sample/headless/SampleHeadlessParserTest.kt b/sample-headless/src/test/kotlin/com/alecstrong/sql/psi/sample/headless/SampleHeadlessParserTest.kt index 6fd79a70..4dc48bb4 100644 --- a/sample-headless/src/test/kotlin/com/alecstrong/sql/psi/sample/headless/SampleHeadlessParserTest.kt +++ b/sample-headless/src/test/kotlin/com/alecstrong/sql/psi/sample/headless/SampleHeadlessParserTest.kt @@ -2,8 +2,10 @@ package com.alecstrong.sql.psi.sample.headless import com.alecstrong.sql.psi.core.psi.SqlLiteralExpr import com.alecstrong.sql.psi.sample.core.psi.CustomExpr -import com.intellij.psi.util.childrenOfType +import com.intellij.psi.PsiElement +import com.intellij.psi.util.PsiTreeUtil import java.io.File +import kotlin.reflect.KClass import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.fail @@ -21,7 +23,7 @@ class SampleHeadlessParserTest { stmt.createTableStmt != null -> { val createTableStmt = stmt.createTableStmt!! for (columnDef in createTableStmt.columnDefList) { - val literalExpr = columnDef.childrenOfType().single() + val literalExpr = columnDef.childrenOfType(SqlLiteralExpr::class).single() assertEquals(42, literalExpr.literalValue.numericLiteral!!.text.toInt()) } } @@ -32,7 +34,7 @@ class SampleHeadlessParserTest { for (expr in exprs) { if (expr is CustomExpr) { val fooRule = expr.fooRule - val literalExpr = fooRule.childrenOfType().single().childrenOfType().single() + val literalExpr = fooRule.childrenOfType(SqlLiteralExpr::class).single().childrenOfType(SqlLiteralExpr::class).single() assertEquals(13, literalExpr.literalValue.numericLiteral!!.text.toInt()) } } @@ -42,3 +44,5 @@ class SampleHeadlessParserTest { } } } + +fun PsiElement.childrenOfType(kClass: KClass): List = PsiTreeUtil.getChildrenOfTypeAsList(this, kClass.java)