summaryrefslogtreecommitdiff
path: root/test/ReferenceMap/ReferenceMap.java
blob: 5904d0256c2c83150ca5c76d71df5f3ebec9a6cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright 2011 Google Inc. All Rights Reserved.

public class ReferenceMap {
  public ReferenceMap() {
  }

  Object f() {
    Object x[] = new Object[2];
    Object y = null;
    try {
      y = new Object();
      x[2] = y;  // out-of-bound exception
    } catch(Exception ex) {
      if (y == null) {
        x[1] = new Object();
      }
    } finally {
      x[1] = y;
      refmap(0);
    };
    return y;
  }
  native int refmap(int x);

  static {
    System.loadLibrary("arttest");
  }

  public static void main(String[] args) {
    ReferenceMap rm = new ReferenceMap();
    rm.f();
  }
}