1 /* 2 * Copyright (C) 2015 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 class Main { assertIntEquals(int expected, int result)18 public static void assertIntEquals(int expected, int result) { 19 if (expected != result) { 20 throw new Error("Expected: " + expected + ", found: " + result); 21 } 22 } 23 main(String[] args)24 public static void main(String[] args) { 25 Main m = new Main(); 26 27 m.$noinline$SetInstanceField(); 28 assertIntEquals(123456, m.i); 29 30 $noinline$SetStaticField(); 31 assertIntEquals(456789, s); 32 } 33 $noinline$SetInstanceField()34 private void $noinline$SetInstanceField() { 35 // Set a value than does not fit in a 16-bit (signed) integer. 36 i = 123456; 37 } 38 $noinline$SetStaticField()39 private static void $noinline$SetStaticField() { 40 // Set a value than does not fit in a 16-bit (signed) integer. 41 s = 456789; 42 } 43 44 private int i = 0; 45 private static int s = 0; 46 } 47