Update ProGuardCORE (#325)

* Update ProGuardCORE

* Remove Java 20 from test list
This commit is contained in:
James Hamilton
2023-03-14 17:56:47 +01:00
committed by GitHub
parent dda133e476
commit aa1835fb93
5 changed files with 48 additions and 22 deletions

View File

@@ -28,13 +28,13 @@ dependencies {
testImplementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
testImplementation "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
testImplementation 'com.github.tschuchortdev:kotlin-compile-testing:1.4.9'
testImplementation 'dev.zacsweers.kctfork:core:0.2.1'
testImplementation 'io.kotest:kotest-runner-junit5-jvm:5.5.4' // for kotest framework
testImplementation 'io.kotest:kotest-assertions-core-jvm:5.5.4' // for kotest core jvm assertions
testImplementation 'io.kotest:kotest-property-jvm:5.5.4' // for kotest property test
testImplementation 'io.mockk:mockk:1.13.2' // for mocking
testImplementation(testFixtures("com.guardsquare:proguard-core:9.0.5")) {
testImplementation(testFixtures("com.guardsquare:proguard-core:9.0.8")) {
exclude group: 'com.guardsquare', module: 'proguard-core'
}
}
@@ -50,7 +50,7 @@ jar {
// Early access automatic downloads are not yet supported:
// https://github.com/gradle/gradle/issues/14814
// But it will work if e.g. Java N-ea is pre-installed
def javaVersionsForTest = 9..18
def javaVersionsForTest = 9..19
test {
useJUnitPlatform()
@@ -64,8 +64,8 @@ task testAllJavaVersions() { testAllTask ->
useJUnitPlatform()
ignoreFailures = true
// The version of bytebuddy used by mockk only supports Java 19 experimentally so far
if (version == 19) systemProperty 'net.bytebuddy.experimental', true
// The version of bytebuddy used by mockk only supports Java 20 experimentally so far
if (version == 20) systemProperty 'net.bytebuddy.experimental', true
testAllTask.dependsOn(it)

View File

@@ -0,0 +1,38 @@
package proguard
import io.kotest.core.spec.style.FreeSpec
import io.kotest.matchers.shouldNotBe
import proguard.testutils.ClassPoolBuilder
import proguard.testutils.JavaSource
import testutils.RequiresJavaVersion
@RequiresJavaVersion(20, 20)
class Java20RecordPatternTest : FreeSpec({
"Given a class with Java record pattern" - {
val (programClassPool, _) = ClassPoolBuilder.fromSource(
JavaSource(
"Test.java",
"""
public class Test {
public static void main(String[] args) {
printPoint(new Point(1, 2));
}
private static void printPoint(Object o) {
if (o instanceof Point(int x, int y)) {
System.out.println(x + y);
}
}
}
record Point(int x, int y) {}
""".trimIndent()
),
javacArguments = listOf("--enable-preview", "--release", "20")
)
"Then ProGuard should parse the class correctly" {
programClassPool.getClass("Test") shouldNotBe null
programClassPool.getClass("Point") shouldNotBe null
}
}
})

View File

@@ -23,14 +23,6 @@ import proguard.testutils.JavaSource
class TypeArgumentFinderTest : FreeSpec({
"Given an aload instruction with TypeToken" - {
val (programClassPool, libraryClassPool) = ClassPoolBuilder.fromSource(
JavaSource(
"Type.java",
"""
package java.lang.reflect;
public class Type {}
""".trimIndent()
),
JavaSource(
"TypeToken.java",
"""
@@ -109,14 +101,6 @@ class TypeArgumentFinderTest : FreeSpec({
"Given an invokevirtual instruction with TypeToken" - {
val (programClassPool, libraryClassPool) = ClassPoolBuilder.fromSource(
JavaSource(
"Type.java",
"""
package java.lang.reflect;
public class Type {}
""".trimIndent()
),
JavaSource(
"TypeToken.java",
"""

View File

@@ -1,5 +1,9 @@
## Version 7.3.2
### Java support
- Add support for Java 20. (#294)
### Improved
- Merge classes only when `-optimizeaggressively` is set.

View File

@@ -1,7 +1,7 @@
proguardVersion = 7.3.2
# The version of ProGuardCORE that sub-projects are built with
proguardCoreVersion = 9.0.7
proguardCoreVersion = 9.0.8
gsonVersion = 2.9.0
kotlinVersion = 1.7.20
target = 1.8