1 // Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file 2 // for details. All rights reserved. Use of this source code is governed by a 3 // BSD-style license that can be found in the LICENSE file. 4 package regress_37726195; 5 6 public class Regress { 7 8 // Regression test for issue where aput instructions for different primitive array types 9 // were joined. The art verifier doesn't allow that. 10 public static void set(Object array, int index, byte value) { 11 if (array instanceof float[]) { 12 float[] floats = (float[]) array; 13 floats[index] = value; 14 } else if (array instanceof int[]) { 15 int[] ints = (int[]) array; 16 ints[index] = value; 17 } 18 } 19 20 // Regression test for issue where aget instructions for different primitive array types 21 // were joined. The art verifier doesn't allow that. 22 public static void get(Object array, int index) { 23 if (array instanceof float[]) { 24 float[] floats = (float[]) array; 25 float f = floats[index]; 26 } else if (array instanceof int[]) { 27 int[] ints = (int[]) array; 28 int i = ints[index]; 29 } 30 } 31 32 public static void main(String[] args) { 33 int[] ints = { 0 }; 34 float[] floats = { 0.0f }; 35 set(ints, 0, (byte) 4); 36 System.out.println(ints[0]); 37 set(floats, 0, (byte) 4); 38 System.out.println(floats[0]); 39 get(ints, 0); 40 get(floats, 0); 41 } 42 } 43