当前位置:网站首页>Mapping location after kotlin confusion
Mapping location after kotlin confusion
2022-07-02 04:34:00 【Coating process】
author : Yugang said
Talk about this article kotlin Of mapping Location of documents , Take a specific online crash as an example
Online crash log
Caused by: java.lang.IndexOutOfBoundsException: toIndex = 10
at java.util.AbstractList.subListRangeCheck(AbstractList.java:507)
at java.util.ArrayList$SubList.subList(ArrayList.java:1238)
at b.a.a.a.p.y1.i(SearchRecordFragment.kt:12)
at b.a.a.a.p.f0.run(lambda:6)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:264)
at android.app.ActivityThread.main(ActivityThread.java:8306)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:632)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049)
Through the crash log above , The specific crash code can be found here
at java.util.ArrayList$SubList.subList(ArrayList.java:1238)
at b.a.a.a.p.y1.i(SearchRecordFragment.kt:12)
here b.a.a.a.p.y1 Represents a class , final i Represents a method , Or variables , Here is actually a method , Because there is a call stack before and after , Here we call the sublist Crash caused by method , final kt:12 The number of lines after confusion is 12 That's ok
analysis mapping, Locate the specific code
Next , We turn on mapping file , Search for b.a.a.a.p.y1 This string , give the result as follows

Find the corresponding class mapping Information , The next step is to find i, You can find many in this class i Statement of , For example, the following , It's not what we're looking for i
// This i It's a Lzay Variable of type
kotlin.Lazy lateSearchRecordAdapter$delegate -> i
// Ahead 3:4 The number of lines is wrong , What we are looking for is 12
3:4:void com.ygp.mro.app.search.adapter.SearchRecordAdapter.setShowExpandView(boolean):50:51 -> i
Keep looking , Found the final matching location , as follows
11:11:java.util.List com.ygp.mro.app.search.adapter.SearchRecordAdapter.getData():22:22 -> i
11:11:void initListShowExpand():185 -> i
12:13:void initListShowExpand():185:186 -> i
14:14:void com.ygp.mro.app.search.adapter.SearchRecordAdapter.setData(java.util.List):0:0 -> i
14:14:void initListShowExpand():186 -> i
The middle line above , It's what we want 12:13:void initListShowExpand():185:186 -> i, After confusion 12:13 The corresponding real number of rows is 185:186, So the actual collapse is 185 That's ok
Look at the corresponding source code
The source code here also calls sublist Method , Consistent with the method called by the crash , So it was determined that it was here that caused the crash
Further verify
Through the source code with mapping, You can find , The way to collapse is initListShowExpand, Where is this method called ? We did this by looking at , There are two places to call

When the concrete collapse , Where was it called , Look at the collapse log
at b.a.a.a.p.y1.i(SearchRecordFragment.kt:12)
at b.a.a.a.p.f0.run(lambda:6)
at android.os.Handler.handleCallback(Handler.java:938)
It's here b.a.a.a.p.f0 Of run Method , and run The way is handler Callback , Keep going mapping File search b.a.a.a.p.f0

Found a lot of run Call to , And there is this behind the method lambda:6, Let's find the corresponding 6 This place , eureka
6:6:void com.ygp.mro.app.search.SearchRecordFragment$initListener$2.onGlobalLayout$lambda-1(com.ygp.mro.app.search.SearchRecordFragment):151:151 -> run
6:6:void com.ygp.mro.app.search.SearchRecordFragment$initListener$2.lambda$EpImLmOa5i7W3KU8Q9jIBuQ78Gk(com.ygp.mro.app.search.SearchRecordFragment):0 -> run
6:6:void run():0 -> run
Corresponding to the source code 151 That's ok , View source code , Found the calling code

So the result is 151 Line call initListShowExpand Method , Then inside the method 185 The line crashed
边栏推荐
- Free drawing software recommended - draw io
- powershell_ View PowerShell function source code (environment variable / alias) / take function as parameter
- 千亿市场规模医疗美容行业的水究竟有多浑?
- [graduation season · advanced technology Er] young people have dreams, why are they afraid of hesitation
- LeetCode-归并排序链表
- Shenzhen will speed up the cultivation of ecology to build a global "Hongmeng Oula city", with a maximum subsidy of 10million yuan for excellent projects
- Shutdown procedure after 60
- C language guessing numbers game
- Leetcode merge sort linked list
- Message mechanism -- message processing
猜你喜欢

6月书讯 | 9本新书上市,阵容强大,闭眼入!

Federal learning: dividing non IID samples according to Dirichlet distribution

MySQL table insert Chinese change? Solution to the problem of No

Websites that it people often visit

Play with concurrency: what's the use of interruptedexception?

Pytoch --- use pytoch to realize u-net semantic segmentation

BGP experiment the next day

阿里云polkit pkexec 本地提权漏洞

The solution to the complexity brought by lambda expression

Idea autoguide package and autodelete package Settings
随机推荐
CorelDRAW graphics suite2022 free graphic design software
Pytorch yolov5 exécute la résolution de bogues à partir de 0:
社交媒体搜索引擎优化及其重要性
Ognl和EL表达式以及内存马的安全研究
idea自动导包和自动删包设置
Exposure X8 Standard Version picture post filter PS, LR and other software plug-ins
6月书讯 | 9本新书上市,阵容强大,闭眼入!
66.qt quick-qml自定义日历组件(支持竖屏和横屏)
Pit encountered in win11 pytorch GPU installation
Research on the security of ognl and El expressions and memory horse
Mysql database learning
Ten thousand volumes are known to all, and one page of a book is always relevant. TVP reading club will take you through the reading puzzle!
Dare to go out for an interview without learning some distributed technology?
Read "the way to clean code" - function names should express their behavior
Binary tree problem solving (1)
Thinkphp内核工单系统源码商业开源版 多用户+多客服+短信+邮件通知
Introduction to JSON usage scenarios and precautions
Mysql表insert中文变?号的问题解决办法
Thinkphp內核工單系統源碼商業開源版 多用戶+多客服+短信+郵件通知
cookie、session、tooken