Skip to content

Commit

Permalink
[compilation] Fix running Compose application after ProGuard optimiza…
Browse files Browse the repository at this point in the history
…tions. (#706)

Fixes JetBrains/compose-multiplatform#3387

It is probably a bug of proguard, it can't properly inline variables in some cases.

## Test
export COMPOSE_CUSTOM_VERSION=46436.333.66
./gradlew :mpp:publishComposeJbToMavenLocal -Pcompose.platforms=jvm

Open https://github.com/JetBrains/compose-multiplatform-desktop-template

Insert this code:
```
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.material.Text
import androidx.compose.ui.window.singleWindowApplication

fun main() {
    singleWindowApplication {
        AnimatedVisibility(true) {
            Text("SDg")
        }
    }
}
```
./gradlew runReleaseDistributable

It runs without crashes after the fix. Before the fix it crashes with the crash:
```
Exception in thread "main" java.lang.VerifyError: Instruction type does not match stack map
Exception Details:
  Location:
    androidx/compose/animation/AnimatedVisibilityKt.estimateAnimationDurationMillis(FFFFF)J @504: dload
```
  • Loading branch information
igordmn committed Nov 14, 2023
1 parent 7106e1b commit 00aea0d
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,7 @@ private fun estimateOverDamped(
// By finding a point between when concavity changes, and when the inflection point is,
// Newton's method will always converge onto the rightmost point (in this case),
// the one that we are interested in.
val tConcavChange = ln(-(c2 * r2 * r2) / (c1 * r1 * r1)) / (r1 - r2)
tCurr = tConcavChange
tCurr = ln(-(c2 * r2 * r2) / (c1 * r1 * r1)) / (r1 - r2)
delta
}

Expand Down

0 comments on commit 00aea0d

Please sign in to comment.