blob: 3586a29d483d1760b2c50b4ed9c57190e1fcaa4c [file] [log] [blame]
Goran Jakovljevic73a42652015-11-20 17:22:57 +01001/*
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
17public class Main {
18
19 private class Inner {
20 private long i1;
Alexey Frunze2923db72016-08-20 01:55:47 -070021 private double i2;
Goran Jakovljevic73a42652015-11-20 17:22:57 +010022 }
23 private Inner inst;
24
25 public static void main(String args[]) throws Exception {
26 Main m = new Main();
27 try {
28 m.$opt$noinline$testGetLong();
29 } catch (NullPointerException ex) {
Alexey Frunze2923db72016-08-20 01:55:47 -070030 System.out.println("NPE from GetLong");
Goran Jakovljevic73a42652015-11-20 17:22:57 +010031 }
32 try {
33 m.$opt$noinline$testPutLong(778899112233L);
34 } catch (NullPointerException ex) {
Alexey Frunze2923db72016-08-20 01:55:47 -070035 System.out.println("NPE from PutLong");
36 }
37 try {
38 m.$opt$noinline$testGetDouble();
39 } catch (NullPointerException ex) {
40 System.out.println("NPE from GetDouble");
41 }
42 try {
43 m.$opt$noinline$testPutDouble(1.0);
44 } catch (NullPointerException ex) {
45 System.out.println("NPE from PutDouble");
Goran Jakovljevic73a42652015-11-20 17:22:57 +010046 }
47 }
48
49 public void $opt$noinline$testGetLong() throws Exception {
50 long result = inst.i1;
51 throw new Exception(); // prevent inline
52 }
53
54 public void $opt$noinline$testPutLong(long a) throws Exception {
55 inst.i1 = a;
56 throw new Exception(); // prevent inline
57 }
Alexey Frunze2923db72016-08-20 01:55:47 -070058
59 public void $opt$noinline$testGetDouble() throws Exception {
60 double result = inst.i2;
61 throw new Exception(); // prevent inline
62 }
63
64 public void $opt$noinline$testPutDouble(double a) throws Exception {
65 inst.i2 = a;
66 throw new Exception(); // prevent inline
67 }
Goran Jakovljevic73a42652015-11-20 17:22:57 +010068}