Status Update
Comments
sg...@google.com <sg...@google.com> #2
Thank you for the report. Do you know what happens when the compiler does not get it wrong? Is the renaming then done as you have suggested in the comments above, or is the code otherwise different? Do you have two APKs build from the same code where one is wrong and the other is working?
Also, I can see that the companion method Nc8.m
always does throw null
- is that expected or is that also a problem?
And just to be sure, is the code referenced in the Kotlin lambda group Mx
the lazy initialization of the companion members?
br...@snapchat.com <br...@snapchat.com> #3
I don't have the mappings file on hand any more, but I believe the Mx.invoke
corresponded to one of the by lazy
fields in ReportReasonItems
. Within one of those fields, it attempts to get ReasonFeedbackBehavior.NONE
but instead throws an exception due to referencing an invalid field (Companion
instead of m
). Even if this were correct, it would throw later as m.a()
does throw null
which also unexpected and incorrect. The m.a()
would correspond to this code: val NONE: ReasonFeedbackBehavior by lazy { ... }
Below is what the code looks like when things are working. It is quite different.
// ReasonFeedbackBehavior
public final class lN {
// i.e. kotlin.Lazy NONE$delegate
public static final Iqk c = r4k.F(a.b);
public static final Iqk d = r4k.F(a.v);
public static final Iqk e = r4k.F(a.w);
public static final Iqk f = r4k.F(a.q);
public static final Iqk g = r4k.F(a.s);
public static final Iqk h = r4k.F(a.t);
public static final Iqk i = r4k.F(a.u);
public static final Iqk j = r4k.F(a.r);
public static final Iqk k = r4k.F(a.c);
public static final Iqk l = r4k.F(a.x);
public static final b m = new b(null);
private final int a;
private final Wh8 b;
// LambdaGroup corresponding to the method bodies of the by lazy lambdas in ReasonFeedbackBehavior$Companion
public static final class a extends Vsk implements nsk<lN> {
public static final a b = new a(0);
public static final a c = new a(1);
public static final a q = new a(2);
public static final a r = new a(3);
public static final a s = new a(4);
public static final a t = new a(5);
public static final a u = new a(6);
public static final a v = new a(7);
public static final a w = new a(8);
public static final a x = new a(9);
public final /* synthetic */ int a;
public a(int i) {
super(0);
this.a = i;
}
public final lN invoke() {
switch (this.a) {
case 0:
return new lN(-1, Wh8.NONE, null);
case 1:
return new lN(R.string.report_feedback_nrb, Wh8.REMOVE_OR_BLOCK, null);
case 2:
return new lN(R.string.report_feedback_rad, Wh8.DEFAULT, null);
case 3:
return new lN(R.string.report_feedback_rcb, Wh8.BLOCK_ONLY, null);
case 4:
return new lN(R.string.report_feedback_rcct, Wh8.DEFAULT, null);
case 5:
return new lN(R.string.report_feedback_rchf, Wh8.DEFAULT, null);
case 6:
return new lN(R.string.report_feedback_rcsr, Wh8.LEARN_MORE, null);
case 7:
return new lN(R.string.report_feedback_rd, Wh8.DEFAULT, null);
case 8:
return new lN(R.string.report_feedback_rg, Wh8.DEFAULT, null);
case 9:
return new lN(R.string.report_feedback_rob, Wh8.REMOVE_OR_BLOCK, null);
default:
throw null;
}
}
}
// ReasonFeedbackBehavior$Companion
public static final class b {
private b() {
}
public /* synthetic */ b(Rsk rsk) {
this();
}
// lazy init fields from ReasonFeedbackBehavior
// i.e. com.snap.inappreporting.core.config.behavior.ReasonFeedbackBehavior getNONE()
public final lN a() {
Iqk a = lN.c;
b bVar = lN.m;
return (lN) a.getValue();
}
public final lN b() {
Iqk b = lN.k;
b bVar = lN.m;
return (lN) b.getValue();
}
public final lN c() {
Iqk c = lN.f;
b bVar = lN.m;
return (lN) c.getValue();
}
public final lN d() {
Iqk d = lN.j;
b bVar = lN.m;
return (lN) d.getValue();
}
public final lN e() {
Iqk e = lN.g;
b bVar = lN.m;
return (lN) e.getValue();
}
public final lN f() {
Iqk f = lN.h;
b bVar = lN.m;
return (lN) f.getValue();
}
public final lN g() {
Iqk g = lN.i;
b bVar = lN.m;
return (lN) g.getValue();
}
public final lN h() {
Iqk h = lN.d;
b bVar = lN.m;
return (lN) h.getValue();
}
public final lN i() {
Iqk i = lN.e;
b bVar = lN.m;
return (lN) i.getValue();
}
public final lN j() {
Iqk j = lN.l;
b bVar = lN.m;
return (lN) j.getValue();
}
}
private lN(int i2, Wh8 wh8) {
this.a = i2;
this.b = wh8;
}
public /* synthetic */ lN(int i2, Wh8 wh8, Rsk rsk) {
this(i2, wh8);
}
public final Wh8 k() {
return this.b;
}
public final int l() {
return this.a;
}
}
sg...@google.com <sg...@google.com> #4
Thanks for the additional information. Do you still have two APKs - one bad and one good from built from the same source that you can share?
Would it be possible for you to try a the latest 2.2 dev version? It is 2.2.6-dev.
br...@snapchat.com <br...@snapchat.com> #5
I've shared additional details over email
ap...@google.com <ap...@google.com> #6
Branch: master
commit d5c8da8bcd4eb26496ce47a04a9e35378670daf4
Author: Søren Gjesse <sgjesse@google.com>
Date: Tue Aug 11 21:04:27 2020
Fix non-deternism in class staticizer
Bug: 161727616
Bug: 163097346
Change-Id: Id640b20abbe86691740bf4c647fe79a704a1a376
M src/main/java/com/android/tools/r8/ir/optimize/staticizer/ClassStaticizer.java
ap...@google.com <ap...@google.com> #7
Branch: 2.1
commit 29be6bb54a16003076dca279f3a30ebedcb04d67
Author: Søren Gjesse <sgjesse@google.com>
Date: Wed Aug 12 08:31:31 2020
Version 2.1.62
Cherry-pick: Fix non-deternism in class staticizer
CL:
Bug: 161727616
Bug: 163097346
Change-Id: I81b04ff8e1dc2ae479d5fe67b2390f5a757ad3ea
M src/main/java/com/android/tools/r8/Version.java
M src/main/java/com/android/tools/r8/ir/optimize/staticizer/ClassStaticizer.java
sg...@google.com <sg...@google.com>
th...@gmail.com <th...@gmail.com> #8
I have the same issue with 2.1.52. Just tried version 2.1.62 and cannot reproduce the bug anymore.
Description
Background
Upgrading from 2.0.73 to 2.1.52 seems to have introduced a weird non-deteriministic crash, which doesn't reproduce on every build. The crash is accessing a field
Companion
which has been renamed. I've included the bytecode below, but I can also share the APK if that helps.Stacktrace
Mapping:
Bytecode
Java Code