@@ -10,6 +10,7 @@ static MAPPING_R8_SYMBOLICATED_FILE_NAMES: &[u8] =
1010 include_bytes ! ( "res/mapping-r8-symbolicated_file_names.txt" ) ;
1111static MAPPING_OUTLINE : & [ u8 ] = include_bytes ! ( "res/mapping-outline.txt" ) ;
1212static MAPPING_OUTLINE_COMPLEX : & [ u8 ] = include_bytes ! ( "res/mapping-outline-complex.txt" ) ;
13+ static MAPPING_REWRITE_COMPLEX : & str = include_str ! ( "res/mapping-rewrite-complex.txt" ) ;
1314
1415static MAPPING_WIN_R8 : LazyLock < Vec < u8 > > = LazyLock :: new ( || {
1516 MAPPING_R8
@@ -330,3 +331,32 @@ fn test_outline_frame_retracing() {
330331 ) ;
331332 assert_eq ! ( mapped. next( ) , None ) ;
332333}
334+
335+ #[ test]
336+ fn rewrite_frame_complex_stacktrace ( ) {
337+ let mapper = ProguardMapper :: from ( MAPPING_REWRITE_COMPLEX ) ;
338+
339+ let input = "\
340+ java.lang.NullPointerException: Primary issue
341+ at a.start(SourceFile:10)
342+ at b.dispatch(SourceFile:5)
343+ at c.draw(SourceFile:20)
344+ Caused by: java.lang.IllegalStateException: Secondary issue
345+ at b.dispatch(SourceFile:5)
346+ at c.draw(SourceFile:20)
347+ " ;
348+
349+ let expected = "\
350+ java.lang.NullPointerException: Primary issue
351+ at com.example.flow.Initializer.start(SourceFile:42)
352+ at com.example.flow.StreamRouter$Inline.internalDispatch(<unknown>:30)
353+ at com.example.flow.StreamRouter.dispatch(SourceFile:12)
354+ at com.example.flow.UiBridge.render(SourceFile:200)
355+ Caused by: java.lang.IllegalStateException: Secondary issue
356+ at com.example.flow.StreamRouter.dispatch(SourceFile:12)
357+ at com.example.flow.UiBridge.render(SourceFile:200)
358+ " ;
359+
360+ let actual = mapper. remap_stacktrace ( input) . unwrap ( ) ;
361+ assert_eq ! ( actual, expected) ;
362+ }
0 commit comments