Mon, 17 Oct 2011 12:57:36 +0100
7093325: Redundant entry in bytecode exception table
Summary: Inlining of finalizers does not update gaps list accordingly
Reviewed-by: jjg
1 /*
2 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
24 /*
25 * @test
26 * @bug 6751514
27 * @summary Unary post-increment with type variables crash javac during lowering
28 * @author Maurizio Cimadamore
29 */
31 public class T6751514 {
33 static class Foo<X> {
34 X x;
35 Foo (X x) {
36 this.x = x;
37 }
38 }
40 static void test1(Foo<Integer> foo) {
41 int start = foo.x;
42 equals(foo.x += 1, start + 1);
43 equals(foo.x++, start + 1);
44 equals(++foo.x, start + 3);
45 equals(foo.x--, start + 3);
46 equals(foo.x -= 1, start + 1);
47 equals(--foo.x, start);
48 }
50 static void test2(Foo<Integer> foo) {
51 int start = foo.x;
52 equals((foo.x) += 1, start + 1);
53 equals((foo.x)++, start + 1);
54 equals(++(foo.x), start + 3);
55 equals((foo.x)--, start + 3);
56 equals((foo.x) -= 1, start + 1);
57 equals(--(foo.x), start);
58 }
60 static void test3(Foo<Integer> foo) {
61 int start = foo.x;
62 equals(((foo.x)) += 1, start + 1);
63 equals(((foo.x))++, start + 1);
64 equals(++((foo.x)), start + 3);
65 equals(((foo.x))--, start + 3);
66 equals(((foo.x)) -= 1, start + 1);
67 equals(--((foo.x)), start);
68 }
70 public static void main(String[] args) {
71 test1(new Foo<Integer>(1));
72 test2(new Foo<Integer>(1));
73 test3(new Foo<Integer>(1));
74 }
76 static void equals(int found, int req) {
77 if (found != req) {
78 throw new AssertionError("Error (expected: "+ req +
79 " - found: " + found + ")");
80 }
81 }
82 }