Created
December 2, 2019 07:07
-
-
Save kwmt/24b1cb5b21997d2c99002b4a3ccb7ad5 to your computer and use it in GitHub Desktop.
Improvements for inline classes https://blog.jetbrains.com/kotlin/2019/11/kotlin-1-3-60-released/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// kotlin 1.3.31 | |
// MyClass.java | |
package inline; | |
import kotlin.Metadata; | |
import org.jetbrains.annotations.NotNull; | |
import org.jetbrains.annotations.Nullable; | |
@Metadata( | |
mv = {1, 1, 15}, | |
bv = {1, 0, 3}, | |
k = 1, | |
d1 = {"\u0000 \n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\b\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0000\b\u0086@\u0018\u00002\u00020\u0001B\u0012\u0012\u0006\u0010\u0002\u001a\u00020\u0003ø\u0001\u0000¢\u0006\u0004\b\u0004\u0010\u0005J\u0013\u0010\b\u001a\u00020\t2\b\u0010\n\u001a\u0004\u0018\u00010\u0001HÖ\u0003J\t\u0010\u000b\u001a\u00020\u0003HÖ\u0001J\t\u0010\f\u001a\u00020\rHÖ\u0001R\u0011\u0010\u0002\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\u0006\u0010\u0007ø\u0001\u0000\u0082\u0002\u0004\n\u0002\b\u0019¨\u0006\u000e"}, | |
d2 = {"Linline/MyClass;", "", "value", "", "constructor-impl", "(I)I", "getValue", "()I", "equals", "", "other", "hashCode", "toString", "", "kotlin_playground.main"} | |
) | |
public final class MyClass { | |
private final int value; | |
public final int getValue() { | |
return this.value; | |
} | |
// $FF: synthetic method | |
private MyClass(int value) { | |
this.value = value; | |
} | |
public static int constructor_impl/* $FF was: constructor-impl*/(int value) { | |
return value; | |
} | |
// $FF: synthetic method | |
@NotNull | |
public static final MyClass box_impl/* $FF was: box-impl*/(int v) { | |
return new MyClass(v); | |
} | |
@NotNull | |
public static String toString_impl/* $FF was: toString-impl*/(int var0) { | |
return "MyClass(value=" + var0 + ")"; | |
} | |
public static int hashCode_impl/* $FF was: hashCode-impl*/(int var0) { | |
return var0; | |
} | |
public static boolean equals_impl/* $FF was: equals-impl*/(int var0, @Nullable Object var1) { | |
if (var1 instanceof MyClass) { | |
int var2 = ((MyClass)var1).unbox-impl(); | |
if (var0 == var2) { | |
return true; | |
} | |
} | |
return false; | |
} | |
public static final boolean equals_impl0/* $FF was: equals-impl0*/(int p1, int p2) { | |
throw null; | |
} | |
// $FF: synthetic method | |
public final int unbox_impl/* $FF was: unbox-impl*/() { | |
return this.value; | |
} | |
public String toString() { | |
return toString-impl(this.value); | |
} | |
public int hashCode() { | |
return hashCode-impl(this.value); | |
} | |
public boolean equals(Object var1) { | |
return equals-impl(this.value, var1); | |
} | |
} | |
// EqualKt.java | |
package inline; | |
import kotlin.Metadata; | |
import kotlin.jvm.internal.Intrinsics; | |
@Metadata( | |
mv = {1, 1, 15}, | |
bv = {1, 0, 3}, | |
k = 2, | |
d1 = {"\u0000\b\n\u0000\n\u0002\u0010\u0002\n\u0000\u001a\u0006\u0010\u0000\u001a\u00020\u0001¨\u0006\u0002"}, | |
d2 = {"main", "", "kotlin_playground.main"} | |
) | |
public final class EqualKt { | |
public static final void main() { | |
int first = MyClass.constructor-impl(1); | |
int second = MyClass.constructor-impl(1); | |
boolean var2 = Intrinsics.areEqual(MyClass.box-impl(first), MyClass.box-impl(second)); | |
boolean var3 = false; | |
System.out.println(var2); | |
} | |
// $FF: synthetic method | |
public static void main(String[] var0) { | |
main(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MyClass.java | |
package inline; | |
import kotlin.Metadata; | |
import org.jetbrains.annotations.NotNull; | |
import org.jetbrains.annotations.Nullable; | |
@Metadata( | |
mv = {1, 1, 16}, | |
bv = {1, 0, 3}, | |
k = 1, | |
d1 = {"\u0000 \n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\b\n\u0002\b\u0005\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0010\u000e\n\u0000\b\u0086@\u0018\u00002\u00020\u0001B\u0012\u0012\u0006\u0010\u0002\u001a\u00020\u0003ø\u0001\u0000¢\u0006\u0004\b\u0004\u0010\u0005J\u0013\u0010\b\u001a\u00020\t2\b\u0010\n\u001a\u0004\u0018\u00010\u0001HÖ\u0003J\t\u0010\u000b\u001a\u00020\u0003HÖ\u0001J\t\u0010\f\u001a\u00020\rHÖ\u0001R\u0011\u0010\u0002\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\u0006\u0010\u0007ø\u0001\u0000\u0082\u0002\u0004\n\u0002\b\u0019¨\u0006\u000e"}, | |
d2 = {"Linline/MyClass;", "", "value", "", "constructor-impl", "(I)I", "getValue", "()I", "equals", "", "other", "hashCode", "toString", "", "kotlin_playground"} | |
) | |
public final class MyClass { | |
private final int value; | |
public final int getValue() { | |
return this.value; | |
} | |
// $FF: synthetic method | |
private MyClass(int value) { | |
this.value = value; | |
} | |
public static int constructor_impl/* $FF was: constructor-impl*/(int value) { | |
return value; | |
} | |
// $FF: synthetic method | |
@NotNull | |
public static final MyClass box_impl/* $FF was: box-impl*/(int v) { | |
return new MyClass(v); | |
} | |
@NotNull | |
public static String toString_impl/* $FF was: toString-impl*/(int var0) { | |
return "MyClass(value=" + var0 + ")"; | |
} | |
public static int hashCode_impl/* $FF was: hashCode-impl*/(int var0) { | |
return var0; | |
} | |
public static boolean equals_impl/* $FF was: equals-impl*/(int var0, @Nullable Object var1) { | |
if (var1 instanceof MyClass) { | |
int var2 = ((MyClass)var1).unbox-impl(); | |
if (var0 == var2) { | |
return true; | |
} | |
} | |
return false; | |
} | |
public static final boolean equals_impl0/* $FF was: equals-impl0*/(int p1, int p2) { | |
return p1 == p2; | |
} | |
// $FF: synthetic method | |
public final int unbox_impl/* $FF was: unbox-impl*/() { | |
return this.value; | |
} | |
public String toString() { | |
return toString-impl(this.value); | |
} | |
public int hashCode() { | |
return hashCode-impl(this.value); | |
} | |
public boolean equals(Object var1) { | |
return equals-impl(this.value, var1); | |
} | |
} | |
// EqualKt.java | |
package inline; | |
import kotlin.Metadata; | |
@Metadata( | |
mv = {1, 1, 16}, | |
bv = {1, 0, 3}, | |
k = 2, | |
d1 = {"\u0000\b\n\u0000\n\u0002\u0010\u0002\n\u0000\u001a\u0006\u0010\u0000\u001a\u00020\u0001¨\u0006\u0002"}, | |
d2 = {"main", "", "kotlin_playground"} | |
) | |
public final class EqualKt { | |
public static final void main() { | |
int first = MyClass.constructor-impl(1); | |
int second = MyClass.constructor-impl(1); | |
boolean var2 = MyClass.equals-impl0(first, second); | |
boolean var3 = false; | |
System.out.println(var2); | |
} | |
// $FF: synthetic method | |
public static void main(String[] var0) { | |
main(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment