Yifei Zhang | cedd452 | 2023-10-31 11:21:32 -0700 | [diff] [blame^] | 1 | # Removes runtime checks added through Kotlin to JVM code genereration to |
| 2 | # avoid linear growth as more Kotlin code is converted / added to the codebase. |
| 3 | # These checks are generally applied to Java platform types (values returned |
| 4 | # from Java code that don't have nullness annotations), but we remove them to |
| 5 | # avoid code size increases. |
| 6 | # |
| 7 | # See also https://kotlinlang.org/docs/reference/java-interop.html |
| 8 | # |
| 9 | # TODO(b/199941987): Consider standardizing these rules in a central place as |
| 10 | # Kotlin gains adoption with other platform targets. |
| 11 | -assumenosideeffects class kotlin.jvm.internal.Intrinsics { |
| 12 | # Remove check for method parameters being null |
| 13 | static void checkParameterIsNotNull(java.lang.Object, java.lang.String); |
| 14 | |
| 15 | # When a Java platform type is returned and passed to Kotlin NonNull method, |
| 16 | # remove the null check |
| 17 | static void checkExpressionValueIsNotNull(java.lang.Object, java.lang.String); |
| 18 | static void checkNotNullExpressionValue(java.lang.Object, java.lang.String); |
| 19 | |
| 20 | # Remove check that final value returned from method is null, if passing |
| 21 | # back Java platform type. |
| 22 | static void checkReturnedValueIsNotNull(java.lang.Object, java.lang.String, java.lang.String); |
| 23 | static void checkReturnedValueIsNotNull(java.lang.Object, java.lang.String); |
| 24 | |
| 25 | # Null check for accessing a field from a parent class written in Java. |
| 26 | static void checkFieldIsNotNull(java.lang.Object, java.lang.String, java.lang.String); |
| 27 | static void checkFieldIsNotNull(java.lang.Object, java.lang.String); |
| 28 | |
| 29 | # Removes code generated from !! operator which converts Nullable type to |
| 30 | # NonNull type. These would throw an NPE immediate after on access. |
| 31 | static void checkNotNull(java.lang.Object, java.lang.String); |
| 32 | static void checkNotNullParameter(java.lang.Object, java.lang.String); |
| 33 | |
| 34 | # Removes lateinit var check being used before being set. Check is applied |
| 35 | # on every field access without this. |
| 36 | static void throwUninitializedPropertyAccessException(java.lang.String); |
| 37 | } |