Skip to content

Commit 090cb17

Browse files
author
Toon Willemot
committed
Update PGC version for K2
Updates the kotlinmetadata printer for K2 support
1 parent a576da6 commit 090cb17

File tree

7 files changed

+25
-28
lines changed

7 files changed

+25
-28
lines changed

kmp-cli/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ jar {
3636

3737
dependencies {
3838
implementation project(path: ":kmp-library")
39-
implementation('com.guardsquare:proguard-core:9.0.10')
40-
implementation('com.guardsquare:proguard-core-android:9.0.10')
39+
implementation('com.guardsquare:proguard-core:9.1.3')
40+
implementation('com.guardsquare:proguard-core-android:9.1.3')
4141

4242
// For some string utils.
4343
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'

kmp-library/build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
id 'java-test-fixtures'
55
id 'maven-publish'
66
id "org.jlleitschuh.gradle.ktlint" version '10.2.1'
7-
id "org.jetbrains.kotlin.jvm" version "1.9.0-RC"
7+
id "org.jetbrains.kotlin.jvm" version "2.0.0-RC2"
88
id 'signing'
99
}
1010

@@ -24,17 +24,17 @@ test {
2424
}
2525

2626
dependencies {
27-
api('com.guardsquare:proguard-core:9.0.10')
27+
api('com.guardsquare:proguard-core:9.1.3')
2828

29-
testImplementation "org.jetbrains.kotlin:kotlin-stdlib:1.9.0-RC"
30-
testImplementation "org.jetbrains.kotlin:kotlin-reflect:1.9.0-RC"
31-
testImplementation 'com.github.tschuchortdev:kotlin-compile-testing:1.5.0'
29+
testImplementation "org.jetbrains.kotlin:kotlin-stdlib:2.0.0-RC2"
30+
testImplementation "org.jetbrains.kotlin:kotlin-reflect:2.0.0-RC2"
31+
testImplementation 'dev.zacsweers.kctfork:core:0.4.1'
3232
testImplementation 'io.kotest:kotest-runner-junit5-jvm:5.4.2' // for kotest framework
3333
testImplementation 'io.kotest:kotest-assertions-core-jvm:5.4.2' // for kotest core jvm assertions
3434
testImplementation 'io.kotest:kotest-property-jvm:5.4.2' // for kotest property test
3535
testImplementation 'io.mockk:mockk:1.12.8' // for mocking
3636

37-
testImplementation(testFixtures("com.guardsquare:proguard-core:9.0.10"))
37+
testImplementation(testFixtures("com.guardsquare:proguard-core:9.1.3"))
3838
}
3939

4040
publishing {

kmp-library/src/main/java/com/guardsquare/proguard/kotlin/printer/KotlinMetadataPrinter.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ public void visitConstructor(Clazz clazz,
479479
!kotlinConstructorMetadata.flags.isSecondary));
480480
AtomicInteger annotationsCount = new AtomicInteger(0);
481481

482-
if (kotlinConstructorMetadata.flags.common.hasAnnotations &&
482+
if (kotlinConstructorMetadata.flags.hasAnnotations &&
483483
kotlinConstructorMetadata.jvmSignature != null)
484484
{
485485
pushStringBuilder();
@@ -619,7 +619,7 @@ public void visitConstructorValParameter(Clazz clazz,
619619
new KotlinPropertyFilter(property -> property.name.equals(kotlinValueParameterMetadata.parameterName),
620620
valueParameterTypeChecker));
621621

622-
printValueParameter(valueParameterTypeChecker.valueParamterType, kotlinValueParameterMetadata);
622+
printValueParameter(valueParameterTypeChecker.valueParameterType, kotlinValueParameterMetadata);
623623
pushStringBuilder();
624624
// typeAccept calls both normal type accept and then varArg type accept, for varArgs.
625625
kotlinValueParameterMetadata.typeAccept(clazz, kotlinClassKindMetadata, kotlinConstructorMetadata, this);
@@ -676,7 +676,7 @@ public void visitAnyProperty(Clazz clazz,
676676
KotlinPropertyMetadata kotlinPropertyMetadata)
677677
{
678678

679-
if (kotlinPropertyMetadata.flags.common.hasAnnotations &&
679+
if (kotlinPropertyMetadata.flags.hasAnnotations &&
680680
kotlinPropertyMetadata.referencedSyntheticMethodForAnnotations != null)
681681
{
682682
kotlinPropertyMetadata.referencedSyntheticMethodForAnnotations.accept(kotlinPropertyMetadata.referencedSyntheticMethodClass,
@@ -757,11 +757,11 @@ public void visitAnyProperty(Clazz clazz,
757757
outdent();
758758
}
759759

760-
if (kotlinPropertyMetadata.flags.hasGetter)
760+
if (kotlinPropertyMetadata.getterFlags != null)
761761
{
762762
indent();
763763
println();
764-
if (kotlinPropertyMetadata.getterFlags.common.hasAnnotations &&
764+
if (kotlinPropertyMetadata.getterFlags.hasAnnotations &&
765765
kotlinPropertyMetadata.referencedGetterMethod != null)
766766
{
767767
kotlinPropertyMetadata.referencedGetterMethod.accept(clazz,
@@ -787,11 +787,11 @@ else if (kotlinPropertyMetadata.getterFlags.isDefault)
787787
outdent();
788788
}
789789

790-
if (kotlinPropertyMetadata.flags.hasSetter)
790+
if (kotlinPropertyMetadata.setterFlags != null)
791791
{
792792
indent();
793793
println();
794-
if (kotlinPropertyMetadata.setterFlags.common.hasAnnotations &&
794+
if (kotlinPropertyMetadata.setterFlags.hasAnnotations &&
795795
kotlinPropertyMetadata.referencedSetterMethod != null)
796796
{
797797
kotlinPropertyMetadata.referencedSetterMethod.accept(clazz,
@@ -1233,7 +1233,7 @@ private String classFlags(KotlinClassFlags flags)
12331233
(flags.isAnnotationClass ? "annotation class " : "") +
12341234
(flags.isInner ? "inner " : "") + // Also isUsualClass = true.
12351235
(flags.isData ? "data " : "") + // Also isUsualClass = true.
1236-
(flags.isValue ? "value " : (flags.isInline ? "inline " : "")) + // Also isUsualClass = true.
1236+
(flags.isValue ? "value " : "") + // Also isUsualClass = true.
12371237
(flags.isUsualClass ? "class " : "") +
12381238
(flags.isFun ? "fun " : "") +
12391239
(flags.isInterface ? "interface " : "") +
@@ -1334,16 +1334,16 @@ private enum ValueParameterType
13341334

13351335
private static class ConstructorValParameterTypeChecker implements KotlinPropertyVisitor
13361336
{
1337-
public ValueParameterType valueParamterType = ValueParameterType.NORMAL;
1337+
public ValueParameterType valueParameterType = ValueParameterType.NORMAL;
13381338

13391339
@Override
13401340
public void visitAnyProperty(Clazz clazz,
13411341
KotlinDeclarationContainerMetadata kotlinDeclarationContainerMetadata,
13421342
KotlinPropertyMetadata kotlinPropertyMetadata)
13431343
{
1344-
if (kotlinPropertyMetadata.setterSignature != null) valueParamterType = ValueParameterType.VAR;
1345-
else if (kotlinPropertyMetadata.getterSignature != null) valueParamterType = ValueParameterType.VAL;
1346-
else valueParamterType = ValueParameterType.NORMAL;
1344+
if (kotlinPropertyMetadata.setterSignature != null) valueParameterType = ValueParameterType.VAR;
1345+
else if (kotlinPropertyMetadata.getterSignature != null) valueParameterType = ValueParameterType.VAL;
1346+
else valueParameterType = ValueParameterType.NORMAL;
13471347
}
13481348
}
13491349
}

kmp-library/src/test/kotlin/AnnotationClassTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class AnnotationClassTest : FunSpec({
2828

2929
testKtMetadata.trimEnd() shouldBe """
3030
/**
31-
* Kotlin class (metadata version 1.8.0).
31+
* Kotlin class (metadata version 1.9.0).
3232
* From Java class: MyAnnotation
3333
*/
3434
@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME)

kmp-library/src/test/kotlin/ContextReceiverTest.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,30 +39,27 @@ class ContextReceiverTest : FunSpec({
3939
val testKtMetadata = programClassPool.getClass("TestKt").processingInfo as String
4040
testKtMetadata.trimEnd() shouldBe """
4141
/**
42-
* Kotlin file facade (metadata version 1.8.0).
42+
* Kotlin file facade (metadata version 1.9.0).
4343
* From Java class: TestKt
4444
*/
4545
4646
// Functions
4747
48-
@SinceKotlin("1.6.20")
4948
context(LoggerContext, FooBar)
5049
fun foo() { }
5150
""".trimIndent()
5251
val fooMetadata = programClassPool.getClass("Foo").processingInfo as String
5352

5453
fooMetadata.trimEnd() shouldBe """
5554
/**
56-
* Kotlin class (metadata version 1.8.0).
55+
* Kotlin class (metadata version 1.9.0).
5756
* From Java class: Foo
5857
*/
59-
@SinceKotlin("1.6.20")
6058
context(LoggerContext, FooBar)
6159
class Foo {
6260
6361
// Properties
6462
65-
@SinceKotlin("1.6.20")
6663
context(LoggerContext)
6764
val prop: String
6865
get // getter method: public final java.lang.String getProp(LoggerContext)

kmp-library/src/test/kotlin/FlagTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class FlagTest : FunSpec({
2929

3030
testKtMetadata.trimEnd() shouldBe """
3131
/**
32-
* Kotlin file facade (metadata version 1.8.0).
32+
* Kotlin file facade (metadata version 1.9.0).
3333
* From Java class: TestKt
3434
*/
3535

kmp-library/src/test/kotlin/PrimitiveInAnnotationTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class PrimitiveInAnnotationTest : FunSpec({
3737

3838
testKtMetadata.trimEnd() shouldBe """
3939
/**
40-
* Kotlin class (metadata version 1.8.0).
40+
* Kotlin class (metadata version 1.9.0).
4141
* From Java class: Test
4242
*/
4343
@Serializer(forClass = Int::class)

0 commit comments

Comments
 (0)