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
mcimadamore@360 | 1 | /* |
ohair@798 | 2 | * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. |
mcimadamore@360 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
mcimadamore@360 | 4 | * |
mcimadamore@360 | 5 | * This code is free software; you can redistribute it and/or modify it |
mcimadamore@360 | 6 | * under the terms of the GNU General Public License version 2 only, as |
mcimadamore@360 | 7 | * published by the Free Software Foundation. |
mcimadamore@360 | 8 | * |
mcimadamore@360 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
mcimadamore@360 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
mcimadamore@360 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
mcimadamore@360 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
mcimadamore@360 | 13 | * accompanied this code). |
mcimadamore@360 | 14 | * |
mcimadamore@360 | 15 | * You should have received a copy of the GNU General Public License version |
mcimadamore@360 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
mcimadamore@360 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
mcimadamore@360 | 18 | * |
ohair@554 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@554 | 20 | * or visit www.oracle.com if you need additional information or have any |
ohair@554 | 21 | * questions. |
mcimadamore@360 | 22 | */ |
mcimadamore@360 | 23 | |
mcimadamore@360 | 24 | /* |
mcimadamore@360 | 25 | * @test |
mcimadamore@360 | 26 | * @bug 6869075 |
mcimadamore@360 | 27 | * @summary regression: javac crashes when compiling compound string assignment with generics |
mcimadamore@360 | 28 | * @author mcimadamore |
mcimadamore@360 | 29 | */ |
mcimadamore@360 | 30 | |
mcimadamore@360 | 31 | public class T6869075 { |
mcimadamore@360 | 32 | |
mcimadamore@360 | 33 | static class Foo<X> { |
mcimadamore@360 | 34 | X x; |
mcimadamore@360 | 35 | Foo (X x) { |
mcimadamore@360 | 36 | this.x = x; |
mcimadamore@360 | 37 | } |
mcimadamore@360 | 38 | } |
mcimadamore@360 | 39 | |
mcimadamore@360 | 40 | static void test1(Foo<String> foo) { |
mcimadamore@360 | 41 | String start = foo.x; |
mcimadamore@360 | 42 | equals(foo.x += "foo", start + "foo"); |
mcimadamore@360 | 43 | } |
mcimadamore@360 | 44 | |
mcimadamore@360 | 45 | static void test2(Foo<String> foo) { |
mcimadamore@360 | 46 | String start = foo.x; |
mcimadamore@360 | 47 | equals((foo.x += "foo"), (start + "foo")); |
mcimadamore@360 | 48 | } |
mcimadamore@360 | 49 | |
mcimadamore@360 | 50 | static void test3(Foo<String> foo) { |
mcimadamore@360 | 51 | String start = foo.x; |
mcimadamore@360 | 52 | equals(((foo.x += "foo")), ((start + "foo"))); |
mcimadamore@360 | 53 | } |
mcimadamore@360 | 54 | |
mcimadamore@360 | 55 | public static void main(String[] args) { |
mcimadamore@360 | 56 | test1(new Foo<String>("Hello!")); |
mcimadamore@360 | 57 | test2(new Foo<String>("Hello!")); |
mcimadamore@360 | 58 | test3(new Foo<String>("Hello!")); |
mcimadamore@360 | 59 | } |
mcimadamore@360 | 60 | |
mcimadamore@360 | 61 | static void equals(String found, String req) { |
mcimadamore@360 | 62 | if (!found.equals(req)) { |
mcimadamore@360 | 63 | throw new AssertionError("Error (expected: "+ req + |
mcimadamore@360 | 64 | " - found: " + found + ")"); |
mcimadamore@360 | 65 | } |
mcimadamore@360 | 66 | } |
jjg@525 | 67 | } |