https://kotlinlang.org logo
Title
d

domfox

01/18/2019, 2:58 PM
The generated code performs an explicit null check before calling
substring
, so you'd get a different exception in that case:
@NotNull
   public static final String getDesc(@NotNull Class $receiver) {
      Intrinsics.checkParameterIsNotNull($receiver, "$receiver");
      if (Intrinsics.areEqual($receiver, Void.TYPE)) {
         return "V";
      } else {
         String var10000 = createArrayType($receiver).getName();
         Intrinsics.checkExpressionValueIsNotNull(var10000, "createArrayType().name");
         String var1 = var10000;
         byte var2 = 1;
         if (var1 == null) {
            throw new TypeCastException("null cannot be cast to non-null type java.lang.String");
         } else {
            var10000 = var1.substring(var2);
            Intrinsics.checkExpressionValueIsNotNull(var10000, "(this as java.lang.String).substring(startIndex)");
            return StringsKt.replace$default(var10000, '.', '/', false, 4, (Object)null);
         }
      }
   }
u

uhe

01/18/2019, 3:02 PM
And that bytecode was generated with 1.3.11 or with 1.2.71?
d

domfox

01/18/2019, 3:07 PM
1.2.71 I believe
u

uhe

01/18/2019, 3:07 PM
then I'm out of ideas 😄
k

karelpeeters

01/18/2019, 3:28 PM
Can you try to step trough it with a debugger?
d

domfox

01/18/2019, 3:29 PM
Unfortunately the problem has only been observed so far in a production setting - I can't reproduce it in a test case.