Skip to content

Add support for Kotlin Value Classes #2806

Closed as not planned
Closed as not planned
@mp911de

Description

@mp911de

Right now, we do not detect constructors and constructor arguments for classes that use Kotlin value classes because they do not use typically a defaulting mask.

Also, a lot from the inline classes mashup happens in the sense of rewritten property names, rewritten copy method name. Additionally, nullability infers boxing of value classes so for nullable components, Kotlin boxes values in inline classes and then unboxes these:

public final class KotlinClassGeneratingEntityInstantiatorUnitTests$WithMyNullableInlineClass {
   @NotNull
   private final String id;

   private KotlinClassGeneratingEntityInstantiatorUnitTests$WithMyNullableInlineClass(String id) {
      this.id = id;
   }

   // $FF: synthetic method
   public KotlinClassGeneratingEntityInstantiatorUnitTests$WithMyNullableInlineClass(KotlinClassGeneratingEntityInstantiatorUnitTests.MyNullableInlineClass var1, int var2, DefaultConstructorMarker var3) {
      if ((var2 & 1) != 0) {
         var1 = MyNullableInlineClass.box-impl(MyNullableInlineClass.constructor-impl("foo"));
      }

      this(var1.unbox-impl(), (DefaultConstructorMarker)null);
   }

   @NotNull
   public final String getId_MYsf4WQ/* $FF was: getId-MYsf4WQ*/() {
      return this.id;
   }

   @NotNull
   public final String component1_MYsf4WQ/* $FF was: component1-MYsf4WQ*/() {
      return this.id;
   }

   @NotNull
   public final KotlinClassGeneratingEntityInstantiatorUnitTests$WithMyNullableInlineClass copy_jv4avjM/* $FF was: copy-jv4avjM*/(@NotNull String id) {
      return new KotlinClassGeneratingEntityInstantiatorUnitTests$WithMyNullableInlineClass(id, (DefaultConstructorMarker)null);
   }

   // $FF: synthetic method
   public static KotlinClassGeneratingEntityInstantiatorUnitTests$WithMyNullableInlineClass copy_jv4avjM$default/* $FF was: copy-jv4avjM$default*/(KotlinClassGeneratingEntityInstantiatorUnitTests$WithMyNullableInlineClass var0, KotlinClassGeneratingEntityInstantiatorUnitTests.MyNullableInlineClass var1, int var2, Object var3) {
      if ((var2 & 1) != 0) {
         var1 = MyNullableInlineClass.box-impl(var0.id);
      }

      return var0.copy-jv4avjM(var1.unbox-impl());
   }

   @NotNull
   public String toString() {
      // …
   }

   public int hashCode() {
      // …
   }

   public boolean equals(@Nullable Object other) {
      // …
   }

   // $FF: synthetic method
   public KotlinClassGeneratingEntityInstantiatorUnitTests$WithMyNullableInlineClass(String id, DefaultConstructorMarker $constructor_marker) {
      this(id);
   }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions