Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails on Sealed Classes #131

Closed
matejdro opened this issue Dec 11, 2023 · 2 comments
Closed

Fails on Sealed Classes #131

matejdro opened this issue Dec 11, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@matejdro
Copy link

Keeper version: 0.15.0

Steps to reproduce:

  1. Use sealed classes in tests
  2. Attempt to use Keeper with those tests

Expected result:

Everything should work

Actual result:

R8 crashes

Attachments:

Error in /.../my-app/app/build/intermediates/keeper/proguardedDebugAndroidTest/classes.jar:com.project/SomeSealedClass.class:
com.android.tools.r8.internal.nc: Sealed classes are not supported as program classes
Compilation failed
Exception in thread "main" java.lang.RuntimeException: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: /.../my-app/app/build/intermediates/keeper/proguardedDebugAndroidTest/classes.jar:com.project/SomeSealedClass.class
        at com.android.tools.r8.internal.ci.a(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:82)
        at com.android.tools.r8.tracereferences.TraceReferences.main(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:5)
Caused by: com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: /.../my-app/app/build/intermediates/keeper/proguardedDebugAndroidTest/classes.jar:com.project/SomeSealedClass.class
        at Version.fakeStackEntry(Version_3.2.78.java:0)
        at com.android.tools.r8.internal.ci.a(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:68)
        at com.android.tools.r8.internal.ci.a(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:28)
        at com.android.tools.r8.internal.ci.a(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:27)
        at com.android.tools.r8.tracereferences.TraceReferences.run(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:1)
        at com.android.tools.r8.tracereferences.TraceReferences.run(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:95)
        at com.android.tools.r8.tracereferences.TraceReferences.a(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:3)
        at com.android.tools.r8.internal.ci.a(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:74)
        ... 1 more
Caused by: com.android.tools.r8.internal.nc: Sealed classes are not supported as program classes
        at com.android.tools.r8.graph.o2.c(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:4)
        at com.android.tools.r8.internal.xa.a(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:349)
        at com.android.tools.r8.graph.r2.a(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:27)
        at com.android.tools.r8.internal.ci.a(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:85)
        at com.android.tools.r8.internal.ci.a(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:86)
        at com.android.tools.r8.internal.ci.a(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:84)
        at com.android.tools.r8.graph.r2.b(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:2)
        at com.android.tools.r8.dex.a.a(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:26)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:840)
        Suppressed: java.lang.RuntimeException: java.util.concurrent.ExecutionException: com.android.tools.r8.internal.nc: Sealed classes are not supported as program classes
                at com.android.tools.r8.dex.b.a(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:112)
                at com.android.tools.r8.dex.b.a(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:33)
                at com.android.tools.r8.dex.b.a(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:21)
                at com.android.tools.r8.dex.b.a(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:18)
                at com.android.tools.r8.tracereferences.m.<init>(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:5)
                at com.android.tools.r8.tracereferences.TraceReferences.b(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:36)
                at com.android.tools.r8.tracereferences.TraceReferences.a(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:1)
                at com.android.tools.r8.internal.ci.a(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:24)
                at com.android.tools.r8.tracereferences.TraceReferences.run(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:1)
                at com.android.tools.r8.tracereferences.TraceReferences.run(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:95)
                at com.android.tools.r8.tracereferences.TraceReferences.a(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:3)
                at com.android.tools.r8.internal.ci.a(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:74)
                at com.android.tools.r8.tracereferences.TraceReferences.main(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:5)
        Caused by: java.util.concurrent.ExecutionException: com.android.tools.r8.internal.nc: Sealed classes are not supported as program classes
                at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
                at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
                at com.android.tools.r8.utils.B.a(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:53)
                at com.android.tools.r8.dex.b.a(R8_3.2.78_60dfddd55e28838b0433e999b8824746640bf403d5e026c74b4a41007aa142e0:93)
                ... 12 more
        Caused by: [CIRCULAR REFERENCE: com.android.tools.r8.internal.nc: Sealed classes are not supported as program classes]
@matejdro matejdro added the bug Something isn't working label Dec 11, 2023
@ZacSweers
Copy link
Collaborator

You offered very little information but my guess is that you are targeting JVM 17 and Kotlin is producing Java 17 bytecode. R8 added support for Java 17 in newer versions, it's not really a keeper issue. Just update your R8 version (there are instructions in the site docs). Next release will also raise the default version.

In the future, please do include more information. I only recognized this because I'd happened to have seen the error before.

@matejdro
Copy link
Author

Thanks for the info. Only open issue about this is regarding JDK 21, so I assumed 17 was already supported, since it's much older than 17: #129

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants