Skip to content

Commit

Permalink
Clean up Kotlin verification in ProGuard.java
Browse files Browse the repository at this point in the history
  • Loading branch information
tvoc-gs committed Nov 27, 2024
1 parent 844f3d7 commit f5352fe
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions base/src/main/java/proguard/ProGuard.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
import proguard.util.kotlin.asserter.KotlinMetadataVerifier;

import java.io.IOException;
import java.io.PrintWriter;

/**
* Tool for shrinking, optimizing, obfuscating, and preverifying Java classes.
Expand Down Expand Up @@ -352,11 +351,7 @@ private void initialize() throws Exception
}
passRunner.run(new Initializer(configuration), appView);

if (configuration.keepKotlinMetadata &&
configuration.enableKotlinAsserter)
{
passRunner.run(new KotlinMetadataVerifier(configuration), appView);
}
verifyKotlinMetadata();
}


Expand Down Expand Up @@ -442,11 +437,7 @@ private void shrink(boolean afterOptimizer) throws Exception
// Perform the actual shrinking.
passRunner.run(new Shrinker(configuration, afterOptimizer), appView);

if (configuration.keepKotlinMetadata &&
configuration.enableKotlinAsserter)
{
passRunner.run(new KotlinMetadataVerifier(configuration), appView);
}
verifyKotlinMetadata();
}


Expand Down Expand Up @@ -510,11 +501,7 @@ private void obfuscate() throws Exception
// Fix the Kotlin modules so the filename matches and the class names match.
passRunner.run(new NameObfuscationReferenceFixer(configuration), appView);

if (configuration.keepKotlinMetadata &&
configuration.enableKotlinAsserter)
{
passRunner.run(new KotlinMetadataVerifier(configuration), appView);
}
verifyKotlinMetadata();
}


Expand All @@ -526,6 +513,13 @@ private void adaptKotlinMetadata() throws Exception
passRunner.run(new KotlinMetadataAdapter(), appView);
}

private void verifyKotlinMetadata() throws Exception {
if (configuration.keepKotlinMetadata &&
configuration.enableKotlinAsserter)
{
passRunner.run(new KotlinMetadataVerifier(configuration), appView);
}
}

/**
* Expands primitive array constants back to traditional primitive array
Expand Down

0 comments on commit f5352fe

Please sign in to comment.