Skip to content

[0.15.0] Enum entries are not part of generated .api dump anymore if the enum contains internal companion object #250

@mateuszkwiecinski

Description

@mateuszkwiecinski

For a given class:

package com.luciad.imageio.webp

public enum class CompressionType(internal val imageIoValue: String) {
    Lossy("Lossy"),
    Lossless("Lossless"),
    ;

    internal companion object {

        val imageIoCompressionTypes = entries.map { it.imageIoValue }.toTypedArray()
    }
}

Migration from 0.14.0 to 0.15.0 produces the following build failure:

Execution failed for task ':webp-imageio:apiCheck'.
> API check failed for project webp-imageio.
  --- /home/runner/work/webp-imageio/webp-imageio/webp-imageio/api/webp-imageio.api
  +++ /home/runner/work/webp-imageio/webp-imageio/webp-imageio/build/api/webp-imageio.api
  @@ -1,6 +1,4 @@
   public final class com/luciad/imageio/webp/CompressionType : java/lang/Enum {
  -	public static final field Lossless Lcom/luciad/imageio/webp/CompressionType;
  -	public static final field Lossy Lcom/luciad/imageio/webp/CompressionType;
   	public static fun getEntries ()Lkotlin/enums/EnumEntries;
   	public static fun valueOf (Ljava/lang/String;)Lcom/luciad/imageio/webp/CompressionType;
   	public static fun values ()[Lcom/luciad/imageio/webp/CompressionType;

Running apiDump generates dump without enum entries.

Expected result: Enum entries are part of api dump

This happened in: usefulness/webp-imageio#212 - a project with no custom config. I can try to come up with simpler repro if needed 👀
I checked release notes, but this is not a multiplatform project, it doesn't have any custom config, the file name name did not change and is all-lowercase

It seems like the dump is generated properly if I remove or make the companion object public

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions