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 public class Main {
18 
19   private class Inner {
20     private long i1;
21     private double i2;
22   }
23   private Inner inst;
24 
main(String args[])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) {
30       System.out.println("NPE from GetLong");
31     }
32     try {
33       m.$opt$noinline$testPutLong(778899112233L);
34     } catch (NullPointerException ex) {
35       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");
46     }
47   }
48 
$opt$noinline$testGetLong()49   public void $opt$noinline$testGetLong() throws Exception {
50     long result = inst.i1;
51     throw new Exception();  // prevent inline
52   }
53 
$opt$noinline$testPutLong(long a)54   public void $opt$noinline$testPutLong(long a) throws Exception {
55     inst.i1 = a;
56     throw new Exception();  // prevent inline
57   }
58 
$opt$noinline$testGetDouble()59   public void $opt$noinline$testGetDouble() throws Exception {
60     double result = inst.i2;
61     throw new Exception();  // prevent inline
62   }
63 
$opt$noinline$testPutDouble(double a)64   public void $opt$noinline$testPutDouble(double a) throws Exception {
65     inst.i2 = a;
66     throw new Exception();  // prevent inline
67   }
68 }
69