Skip to content

Commit 787d63e

Browse files
authored
Issue191 (#192)
* Closes #188 * Closes #188 * Closes #188 * codecov fix * codecov fix * issue 191 * issue 191 * issue 191
1 parent 1dcbdf0 commit 787d63e

21 files changed

+73
-55
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ jobs:
2222

2323
steps:
2424
- uses: actions/checkout@v2
25-
- name: Set up JDK 15
25+
- name: Set up JDK 17
2626
uses: actions/setup-java@v1
2727
with:
28-
java-version: 15
28+
java-version: 17
2929

3030
- name: Cache Gradle packages
31-
uses: actions/cache@v1
31+
uses: actions/cache@v4
3232
with:
3333
path: ~/.gradle/caches
3434
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
@@ -41,7 +41,7 @@ jobs:
4141
run: ./gradlew clean build
4242

4343
- name: Upload test report directory
44-
uses: actions/upload-artifact@v2
44+
uses: actions/upload-artifact@v4
4545
if: always()
4646
with:
4747
name: testDebugStuff

build.gradle.kts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024 XPATH-QS
2+
* Copyright (c) 2025 XPATH-QS
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a copy
55
* of this software and associated documentation files (the "Software"), to deal
@@ -20,31 +20,30 @@
2020
* SOFTWARE.
2121
*/
2222

23-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2423
import org.gradle.api.tasks.testing.logging.TestLogEvent
2524

2625
version = "0.1.6"
2726
group = "org.xpathqs"
2827
val kotestVersion = "5.8.0"
2928

3029
plugins {
31-
kotlin("jvm") version "2.0.0-Beta4"
30+
id("org.jetbrains.kotlin.jvm") version "2.3.0"
3231
id("org.jetbrains.dokka") version "1.4.32"
3332
`java-library`
3433
jacoco
3534
`maven-publish`
3635
signing
3736
id("io.codearte.nexus-staging") version "0.30.0"
38-
id("io.gitlab.arturbosch.detekt").version("1.23.5")
39-
id("info.solidsoft.pitest").version("1.9.0")
40-
id("org.jetbrains.kotlinx.kover") version "0.6.1"
37+
id("io.gitlab.arturbosch.detekt").version("1.23.8")
38+
id("info.solidsoft.pitest").version("1.19.0-rc.2")
39+
id("org.jetbrains.kotlinx.kover") version "0.9.4"
4140
}
4241

4342
java {
4443
withJavadocJar()
4544
withSourcesJar()
46-
sourceCompatibility = JavaVersion.VERSION_11
47-
targetCompatibility = JavaVersion.VERSION_11
45+
sourceCompatibility = JavaVersion.VERSION_17
46+
targetCompatibility = JavaVersion.VERSION_17
4847
}
4948

5049
jacoco {
@@ -57,13 +56,15 @@ repositories {
5756
}
5857

5958
detekt {
60-
config = files("$projectDir/detekt.yml") // point to your custom config defining rules to run, overwriting default behavior
59+
config.from(
60+
files("$projectDir/detekt.yml")
61+
)
6162
}
6263

6364
dependencies {
6465
implementation("io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.30.0")
65-
implementation("org.jetbrains.kotlin:kotlin-reflect:2.0.0-Beta4")
66-
implementation("org.yaml:snakeyaml:1.28")
66+
implementation("org.jetbrains.kotlin:kotlin-reflect:2.3.0")
67+
implementation("org.yaml:snakeyaml:2.0")
6768
implementation("net.oneandone.reflections8:reflections8:0.11.7")
6869

6970
testImplementation("org.xpathqs:gwt:0.2.5")
@@ -142,8 +143,9 @@ tasks.test {
142143
}
143144
}
144145

145-
tasks.withType<KotlinCompile> {
146-
kotlinOptions.jvmTarget = "11"
146+
147+
kotlin {
148+
jvmToolchain(17)
147149
}
148150

149151
tasks.jar {

gradle/wrapper/gradle-wrapper.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2023 XPATH-QS
2+
# Copyright (c) 2025 XPATH-QS
33
#
44
# Permission is hereby granted, free of charge, to any person obtaining a copy
55
# of this software and associated documentation files (the "Software"), to deal
@@ -22,6 +22,6 @@
2222

2323
distributionBase=GRADLE_USER_HOME
2424
distributionPath=wrapper/dists
25-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
25+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
2626
zipStoreBase=GRADLE_USER_HOME
2727
zipStorePath=wrapper/dists

src/main/kotlin/org/xpathqs/core/reflection/SelectorParser.kt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024 XPATH-QS
2+
* Copyright (c) 2025 XPATH-QS
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a copy
55
* of this software and associated documentation files (the "Software"), to deal
@@ -89,11 +89,11 @@ class SelectorParser(
8989
rootObj.children = srf.innerSelectors
9090

9191
srf.innerSelectorProps.filter {
92-
it.call(rootObj) !is NullSelector
92+
safeEvaluate(it) !is NullSelector
9393
}.forEach { prop ->
9494
prop.isAccessible = true
9595

96-
val sel = prop.call(rootObj) as BaseSelector
96+
val sel = safeEvaluate(prop) as BaseSelector
9797
val ann = prop.findAnnotation<Name>()?.value ?: prop.name
9898
setFields(
9999
to = sel,
@@ -180,4 +180,14 @@ class SelectorParser(
180180
to.freeze()
181181
}
182182
}
183+
184+
private fun safeEvaluate(prop: KProperty<*>) : Any? {
185+
return runCatching {
186+
prop.call(rootObj)
187+
}.getOrNull() ?: run {
188+
runCatching {
189+
prop.call()
190+
}.getOrNull()
191+
}
192+
}
183193
}

src/test/kotlin/org/xpathqs/core/reflection/SelectorReflectionFieldsNoScanTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022 XPATH-QS
2+
* Copyright (c) 2025 XPATH-QS
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a copy
55
* of this software and associated documentation files (the "Software"), to deal
@@ -24,6 +24,7 @@ package org.xpathqs.core.reflection
2424

2525
import io.kotest.core.spec.style.AnnotationSpec
2626
import io.kotest.matchers.collections.shouldHaveSize
27+
import org.xpathqs.core.reflection.pages.PageWithNoScan
2728

2829
class SelectorReflectionFieldsNoScanTest : AnnotationSpec() {
2930

src/test/kotlin/org/xpathqs/core/reflection/SelectorReflectionFieldsTest.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024 XPATH-QS
2+
* Copyright (c) 2025 XPATH-QS
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a copy
55
* of this software and associated documentation files (the "Software"), to deal
@@ -24,6 +24,10 @@ package org.xpathqs.core.reflection
2424

2525
import io.kotest.core.spec.style.AnnotationSpec
2626
import io.kotest.matchers.collections.shouldContainExactlyInAnyOrder
27+
import org.xpathqs.core.reflection.pages.PagePrivateMember
28+
import org.xpathqs.core.reflection.pages.PageWithBase
29+
import org.xpathqs.core.reflection.pages.PageWithBaseAndInnerGroupObject
30+
import org.xpathqs.core.reflection.pages.PageWithBaseAndInnerObject
2731
import org.xpathqs.core.selector.base.BaseSelector
2832
import org.xpathqs.core.selector.selector.Selector
2933

src/test/kotlin/org/xpathqs/core/reflection/pages/pages.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024 XPATH-QS
2+
* Copyright (c) 2025 XPATH-QS
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a copy
55
* of this software and associated documentation files (the "Software"), to deal
@@ -20,7 +20,7 @@
2020
* SOFTWARE.
2121
*/
2222

23-
package org.xpathqs.core.reflection
23+
package org.xpathqs.core.reflection.pages
2424

2525
import org.xpathqs.core.annotations.NoScan
2626
import org.xpathqs.core.selector.base.BaseSelector

src/test/kotlin/org/xpathqs/core/reflection/parser/ObjectWithBaseAndGroupObjectTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022 XPATH-QS
2+
* Copyright (c) 2025 XPATH-QS
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a copy
55
* of this software and associated documentation files (the "Software"), to deal
@@ -26,7 +26,7 @@ package org.xpathqs.core.reflection.parser
2626
import io.kotest.core.spec.style.AnnotationSpec
2727
import io.kotest.matchers.collections.shouldHaveSize
2828
import io.kotest.matchers.shouldBe
29-
import org.xpathqs.core.reflection.PageWithBaseAndInnerGroupObject
29+
import org.xpathqs.core.reflection.pages.PageWithBaseAndInnerGroupObject
3030
import org.xpathqs.core.reflection.SelectorParser
3131
import org.xpathqs.xpathShouldBe
3232

src/test/kotlin/org/xpathqs/core/reflection/parser/ObjectWithBaseAndInnerObjectTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022 XPATH-QS
2+
* Copyright (c) 2025 XPATH-QS
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a copy
55
* of this software and associated documentation files (the "Software"), to deal
@@ -26,7 +26,7 @@ import io.kotest.assertions.assertSoftly
2626
import io.kotest.core.spec.style.AnnotationSpec
2727
import io.kotest.matchers.collections.shouldHaveSize
2828
import io.kotest.matchers.shouldBe
29-
import org.xpathqs.core.reflection.PageWithBaseAndInnerObject
29+
import org.xpathqs.core.reflection.pages.PageWithBaseAndInnerObject
3030
import org.xpathqs.core.reflection.SelectorParser
3131
import org.xpathqs.core.selector.extensions.core.get
3232
import org.xpathqs.xpathShouldBe

src/test/kotlin/org/xpathqs/core/reflection/parser/ObjectWithClassArgBlockTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022 XPATH-QS
2+
* Copyright (c) 2025 XPATH-QS
33
*
44
* Permission is hereby granted, free of charge, to any person obtaining a copy
55
* of this software and associated documentation files (the "Software"), to deal
@@ -24,8 +24,8 @@ package org.xpathqs.core.reflection.parser
2424

2525
import io.kotest.assertions.assertSoftly
2626
import io.kotest.core.spec.style.AnnotationSpec
27-
import org.xpathqs.core.reflection.PageWithBlockArgMembers
28-
import org.xpathqs.core.reflection.PageWithBlockMembers
27+
import org.xpathqs.core.reflection.pages.PageWithBlockArgMembers
28+
import org.xpathqs.core.reflection.pages.PageWithBlockMembers
2929
import org.xpathqs.core.reflection.SelectorParser
3030
import org.xpathqs.core.selector.extensions.core.get
3131
import org.xpathqs.nameShouldBe

0 commit comments

Comments
 (0)