当前位置:网站首页>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
边栏推荐
- Fluent icon demo
- [improvement class] st table to solve the interval maximum value problem [2]
- Binary tree problem solving (2)
- 阿里云polkit pkexec 本地提权漏洞
- MySQL advanced SQL statement 2
- Lei Jun wrote a blog when he was a programmer. It's awesome
- Yyds dry inventory compiler and compiler tools
- Deeply understand the concepts of synchronization and asynchrony, blocking and non blocking, parallel and serial
- 社交媒体搜索引擎优化及其重要性
- 66.qt quick QML Custom Calendar component (supports vertical and horizontal screens)
猜你喜欢

Use a mask to restrict the input of the qlineedit control

Play with concurrency: draw a thread state transition diagram

CY7C68013A之keil编译代码

66.qt quick QML Custom Calendar component (supports vertical and horizontal screens)

C language practice - number guessing game

FAQ | FAQ for building applications for large screen devices

PIP installation of third-party libraries

One step implementation of yolox helmet detection (combined with oak intelligent depth camera)

缓存一致性解决方案——改数据时如何保证缓存和数据库中数据的一致性

Several methods of capturing packets under CS framework
随机推荐
66.qt quick QML Custom Calendar component (supports vertical and horizontal screens)
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!
Spring recruitment of Internet enterprises: Kwai meituan has expanded the most, and the annual salary of technical posts is up to nearly 400000
二叉树解题(一)
Microsoft Research Institute's new book "Fundamentals of data science", 479 Pages pdf
One step implementation of yolox helmet detection (combined with oak intelligent depth camera)
Thinkphp Kernel wo system source Commercial Open source multi - user + multi - Customer Service + SMS + email notification
The solution to the complexity brought by lambda expression
Leetcode merge sort linked list
okcc为什么云呼叫中心比传统呼叫中心更好?
idea自動導包和自動删包設置
Several methods of capturing packets under CS framework
The difference between vectorresize and reverse.
Flag bits in assembly language: CF, PF, AF, ZF, SF, TF, if, DF, of
ThinkPHP kernel work order system source code commercial open source version multi user + multi customer service + SMS + email notification
阿里云polkit pkexec 本地提权漏洞
Three years of experience in Android development interview (I regret that I didn't get n+1, Android bottom development tutorial
I sorted out some basic questions about opencv AI kit.
Yolov5网络修改教程(将backbone修改为EfficientNet、MobileNet3、RegNet等)
Pytoch --- use pytoch to predict birds