1Tests the fix for b/74116990 2 3The JIT was reading into incorrect dex files during class redefinition if a 4native method was present. 5 6The transformed dex file is specifically crafted to have exactly 4 methodIDs in 7it. They are (in order): 8 (0) Ljava/lang/Object;-><init>()V 9 (1) Lxyz/Transform;-><init>()V 10 (2) Lxyz/Transform;->bar()V 11 (3) Lxyz/Transform;->foo()V 12 13In the transformed version of the dex file there is a new method. The new list of methodIDs is: 14 (0) Lart/Test1949;->doNothing()V 15 (1) Ljava/lang/Object;-><init>()V 16 (2) Lxyz/Transform;-><init>()V 17 (3) Lxyz/Transform;->bar()V 18 (4) Lxyz/Transform;->foo()V 19 20This test tries to get the JIT to read out-of-bounds on the initial dex file by getting it to 21read the 5th method id of the new file (Lxyz/Transform;->foo()V) from the old dex file (which 22only has 4 method ids). 23 24To do this we need to make sure that the class being transformed is near the end of the 25alphabet (package xyz, method foo). If it is further forward than the other method-ids then the 26JIT will read an incorrect (but valid) method-id from the old-dex file. This is why the error 27wasn't caught in our other tests (package art is always at the front). 28 29The final method that causes the OOB read needs to be a native method because that is the only 30method-type the jit uses dex-file information to keep track of. 31