Skip to content

Commit

Permalink
Fix enum test, add toolchains and running on JDK 21 (#3376)
Browse files Browse the repository at this point in the history
  • Loading branch information
whyoleg authored Dec 1, 2023
1 parent 417b17b commit bb036a3
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests-thorough.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
javaVersion: [ 8, 11, 17 ]
javaVersion: [ 8, 11, 17, 21 ]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
Expand Down
4 changes: 4 additions & 0 deletions dokka-integration-tests/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ pluginManagement {
}
}

plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0"
}

dependencyResolutionManagement {
repositories {
mavenCentral()
Expand Down
4 changes: 4 additions & 0 deletions dokka-runners/runner-cli/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ pluginManagement {
}
}

plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0"
}

dependencyResolutionManagement {
repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ pluginManagement {
}
}

plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0"
}

dependencyResolutionManagement {
repositories {
mavenCentral()
Expand Down
4 changes: 4 additions & 0 deletions dokka-runners/runner-maven-plugin/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ pluginManagement {
}
}

plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0"
}

dependencyResolutionManagement {
repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,24 @@ class ObviousFunctionsTest {
assertNotNull(enum)
assertEquals("Enum", enum.name)

val javaVersion = when (val specVersion = System.getProperty("java.specification.version")) {
"1.8" -> 8
else -> specVersion.toInt()
}

// inherited from java enum
val jdkEnumInheritedFunctions = when {
// starting from JDK 18, 'finalize' is not available (finalization is deprecated in JDK 18)
javaVersion >= 18 -> setOf("clone", "getDeclaringClass", "describeConstable")
// starting from JDK 12, there is a new member in enum 'describeConstable'
javaVersion >= 12 -> setOf("clone", "getDeclaringClass", "describeConstable", "finalize")
else -> setOf("clone", "getDeclaringClass", "finalize")
}

assertObviousFunctions(
expectedObviousFunctions = emptySet(),
expectedNonObviousFunctions = setOf(
"compareTo", "equals", "hashCode", "toString",
// inherited from java enum
"clone", "finalize", "getDeclaringClass"
),
expectedNonObviousFunctions = setOf("compareTo", "equals", "hashCode", "toString") +
jdkEnumInheritedFunctions,
actualFunctions = enum.functions
)
}
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ dependencyResolutionManagement {

plugins {
`gradle-enterprise`
id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0"
}

includeBuild("dokka-integration-tests")
Expand Down

0 comments on commit bb036a3

Please sign in to comment.