Skip to content

Commit

Permalink
Update ProGuardCORE (#325)
Browse files Browse the repository at this point in the history
* Update ProGuardCORE

* Remove Java 20 from test list
  • Loading branch information
mrjameshamilton committed Mar 14, 2023
1 parent dda133e commit aa1835f
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 22 deletions.
10 changes: 5 additions & 5 deletions base/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}
Expand All @@ -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()
Expand All @@ -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)

Expand Down
38 changes: 38 additions & 0 deletions base/src/test/kotlin/proguard/Java20RecordPatternTest.kt
Original file line number Diff line number Diff line change
@@ -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
}
}
})
Original file line number Diff line number Diff line change
Expand Up @@ -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",
"""
Expand Down Expand Up @@ -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",
"""
Expand Down
4 changes: 4 additions & 0 deletions docs/md/manual/releasenotes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Version 7.3.2

### Java support

- Add support for Java 20. (#294)

### Improved

- Merge classes only when `-optimizeaggressively` is set.
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit aa1835f

Please sign in to comment.