Shih-wei Liao | 63433ba | 2011-10-15 18:40:39 -0700 | [diff] [blame^] | 1 | // Copyright 2011 Google Inc. All Rights Reserved. |
| 2 | |
| 3 | public class ReferenceMap { |
| 4 | public ReferenceMap() { |
| 5 | } |
| 6 | |
| 7 | Object f() { |
| 8 | Object x[] = new Object[2]; |
| 9 | Object y = null; |
| 10 | try { |
| 11 | y = new Object(); |
| 12 | x[2] = y; // out-of-bound exception |
| 13 | } catch(Exception ex) { |
| 14 | if (y == null) { |
| 15 | x[1] = new Object(); |
| 16 | } |
| 17 | } finally { |
| 18 | x[1] = y; |
| 19 | refmap(0); |
| 20 | }; |
| 21 | return y; |
| 22 | } |
| 23 | native int refmap(int x); |
| 24 | |
| 25 | static { |
| 26 | System.loadLibrary("arttest"); |
| 27 | } |
| 28 | |
| 29 | public static void main(String[] args) { |
| 30 | ReferenceMap rm = new ReferenceMap(); |
| 31 | rm.f(); |
| 32 | } |
| 33 | } |