Guest User

NPE

a guest
Aug 16th, 2022
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 5.21 KB | None | 0 0
  1. // Test.java
  2. import java.util.Iterator;
  3. import java.util.List;
  4. import kotlin.Metadata;
  5. import kotlin.collections.CollectionsKt;
  6. import kotlin.jvm.internal.DefaultConstructorMarker;
  7. import kotlin.jvm.internal.Intrinsics;
  8. import org.jetbrains.annotations.NotNull;
  9. import org.jetbrains.annotations.Nullable;
  10.  
  11. @Metadata(
  12.    mv = {1, 1, 13},
  13.    bv = {1, 0, 3},
  14.    k = 1,
  15.    d1 = {"\u0000\u001a\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u000e\n\u0002\b\u0006\n\u0002\u0018\u0002\n\u0002\u0018\u0002\b6\u0018\u0000 \u00072\u00020\u0001:\u0003\u0007\b\tB\u000f\b\u0002\u0012\u0006\u0010\u0002\u001a\u00020\u0003¢\u0006\u0002\u0010\u0004R\u0011\u0010\u0002\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\u0005\u0010\u0006\u0082\u0001\u0002\n\u000b¨\u0006\u0000"},
  16.    d2 = {"LTest;", "", "key", "", "(Ljava/lang/String;)V", "getKey", "()Ljava/lang/String;", "Companion", "First", "Second", "LTest$First;", "LTest$Second;"}
  17. )
  18. public abstract class Test {
  19.    @NotNull
  20.    private final String key;
  21.    @NotNull
  22.    private static final List firstAndSecond;
  23.    public static final Test.Companion Companion = new Test.Companion((DefaultConstructorMarker)null);
  24.  
  25.    @NotNull
  26.    public final String getKey() {
  27.       return this.key;
  28.    }
  29.  
  30.    private Test(String key) {
  31.       this.key = key;
  32.    }
  33.  
  34.    static {
  35.       firstAndSecond = CollectionsKt.listOf(new Test[]{(Test)Test.First.INSTANCE, (Test)Test.Second.INSTANCE});
  36.    }
  37.  
  38.    // $FF: synthetic method
  39.    public Test(String key, DefaultConstructorMarker $constructor_marker) {
  40.       this(key);
  41.    }
  42.  
  43.    @Metadata(
  44.       mv = {1, 1, 13},
  45.       bv = {1, 0, 3},
  46.       k = 1,
  47.       d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\bÆ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002¨\u0006\u0001"},
  48.       d2 = {"LTest$First;", "LTest;", "()V"}
  49.    )
  50.    public static final class First extends Test {
  51.       public static final Test.First INSTANCE;
  52.  
  53.       private First() {
  54.          super("First", (DefaultConstructorMarker)null);
  55.       }
  56.  
  57.       static {
  58.          Test.First var0 = new Test.First();
  59.          INSTANCE = var0;
  60.       }
  61.    }
  62.  
  63.    @Metadata(
  64.       mv = {1, 1, 13},
  65.       bv = {1, 0, 3},
  66.       k = 1,
  67.       d1 = {"\u0000\n\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\bÆ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002¨\u0006\u0001"},
  68.       d2 = {"LTest$Second;", "LTest;", "()V"}
  69.    )
  70.    public static final class Second extends Test {
  71.       public static final Test.Second INSTANCE;
  72.  
  73.       private Second() {
  74.          super("Second", (DefaultConstructorMarker)null);
  75.       }
  76.  
  77.       static {
  78.          Test.Second var0 = new Test.Second();
  79.          INSTANCE = var0;
  80.       }
  81.    }
  82.  
  83.    @Metadata(
  84.       mv = {1, 1, 13},
  85.       bv = {1, 0, 3},
  86.       k = 1,
  87.       d1 = {"\u0000\u001c\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u000e\b\u0086\u0003\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0010\u0010\b\u001a\u0004\u0018\u00010\u00052\u0006\u0010\t\u001a\u00020\nR\u0017\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00050\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0006\u0010\u0007¨\u0006\u0005"},
  88.       d2 = {"LTest$Companion;", "", "()V", "firstAndSecond", "", "LTest;", "getFirstAndSecond", "()Ljava/util/List;", "findFromKey", "key", ""}
  89.    )
  90.    public static final class Companion {
  91.       @NotNull
  92.       public final List getFirstAndSecond() {
  93.          return Test.firstAndSecond;
  94.       }
  95.  
  96.       @Nullable
  97.       public final Test findFromKey(@NotNull String key) {
  98.          Intrinsics.checkParameterIsNotNull(key, "key");
  99.          Iterable $receiver$iv = (Iterable)((Test.Companion)this).getFirstAndSecond();
  100.          Iterator var3 = $receiver$iv.iterator();
  101.  
  102.          Object var10000;
  103.          while(true) {
  104.             if (var3.hasNext()) {
  105.                Object element$iv = var3.next();
  106.                Test it = (Test)element$iv;
  107.                int var6 = false;
  108.                if (!Intrinsics.areEqual(it.getKey(), key)) {
  109.                   continue;
  110.                }
  111.  
  112.                var10000 = element$iv;
  113.                break;
  114.             }
  115.  
  116.             var10000 = null;
  117.             break;
  118.          }
  119.  
  120.          return (Test)var10000;
  121.       }
  122.  
  123.       private Companion() {
  124.       }
  125.  
  126.       // $FF: synthetic method
  127.       public Companion(DefaultConstructorMarker $constructor_marker) {
  128.          this();
  129.       }
  130.    }
  131. }
  132. // MainKt.java
  133. import kotlin.Metadata;
  134. import kotlin.jvm.internal.Intrinsics;
  135.  
  136. @Metadata(
  137.    mv = {1, 1, 13},
  138.    bv = {1, 0, 3},
  139.    k = 2,
  140.    d1 = {"\u0000\b\n\u0000\n\u0002\u0010\u0002\n\u0000\u001a\u0006\u0010\u0000\u001a\u00020\u0001¨\u0006\u0002"},
  141.    d2 = {"main", "", "Test"}
  142. )
  143. public final class MainKt {
  144.    public static final void main() {
  145.       Test.First instance = Test.First.INSTANCE;
  146.       Test found = Test.Companion.findFromKey(instance.getKey());
  147.       if (found == null) {
  148.          Intrinsics.throwNpe();
  149.       }
  150.  
  151.       String var2 = String.valueOf(found.getKey());
  152.       System.out.println(var2);
  153.    }
  154.  
  155.    // $FF: synthetic method
  156.    public static void main(String[] var0) {
  157.       main();
  158.    }
  159. }
  160.  
Add Comment
Please, Sign In to add comment