Mon, 24 Nov 2014 12:49:30 -0500
8029012: parameter_index for type annotation not updated after outer.this added
Summary: Fix javac's handling of type annotations when synthetic parameters are added
Reviewed-by: jjg, mcimadamore
jjg@464 | 1 | /* |
ohair@554 | 2 | * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. |
jjg@464 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
jjg@464 | 4 | * |
jjg@464 | 5 | * This code is free software; you can redistribute it and/or modify it |
jjg@464 | 6 | * under the terms of the GNU General Public License version 2 only, as |
jjg@464 | 7 | * published by the Free Software Foundation. |
jjg@464 | 8 | * |
jjg@464 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
jjg@464 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
jjg@464 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
jjg@464 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
jjg@464 | 13 | * accompanied this code). |
jjg@464 | 14 | * |
jjg@464 | 15 | * You should have received a copy of the GNU General Public License version |
jjg@464 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
jjg@464 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
jjg@464 | 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. |
jjg@464 | 22 | */ |
jjg@464 | 23 | |
jjg@464 | 24 | /* |
jjg@464 | 25 | * @test |
jjg@464 | 26 | * @bug 6326754 |
jjg@464 | 27 | * @summary Compiler will fail to handle -Xmaxerrs with -ve numbers |
jjg@464 | 28 | * |
jjg@464 | 29 | * @compile/fail/ref=T6326754.out -XDrawDiagnostics -Xmaxerrs -1 T6326754.java |
jjg@464 | 30 | * @compile/fail/ref=T6326754.out -XDrawDiagnostics -Xmaxerrs 0 T6326754.java |
jjg@464 | 31 | * @compile/fail/ref=T6326754.out -XDrawDiagnostics -Xmaxerrs 10 T6326754.java |
jjg@464 | 32 | * @compile/fail/ref=T6326754.out -XDrawDiagnostics T6326754.java |
jjg@464 | 33 | */ |
jjg@464 | 34 | class TestConstructor<T,K>{ |
jjg@464 | 35 | T t; |
jjg@464 | 36 | K k; |
jjg@464 | 37 | public TestConstructor(T t,K k){ |
jjg@464 | 38 | this.t =t; |
jjg@464 | 39 | } |
jjg@464 | 40 | public TestConstructor(K k){ |
jjg@464 | 41 | this.k = k; |
jjg@464 | 42 | this.t = null; |
jjg@464 | 43 | } |
jjg@464 | 44 | public TestConstructor(T t){ |
jjg@464 | 45 | this.t=t; |
jjg@464 | 46 | this.k=null; |
jjg@464 | 47 | } |
jjg@464 | 48 | public void setT(T t){ |
jjg@464 | 49 | this.t=t; |
jjg@464 | 50 | this.k=null; |
jjg@464 | 51 | } |
jjg@464 | 52 | public void setT(K k){ |
jjg@464 | 53 | this.k = k; |
jjg@464 | 54 | this.t = null; |
jjg@464 | 55 | } |
jjg@464 | 56 | public void setT(T t,K k){ |
jjg@464 | 57 | this.t = t; |
jjg@464 | 58 | this.k = k; |
jjg@464 | 59 | } |
jjg@464 | 60 | } |
jjg@464 | 61 | class TestC<T>{ |
jjg@464 | 62 | T t; |
jjg@464 | 63 | public <T>void setT(T t){ |
jjg@464 | 64 | this.t = t; |
jjg@464 | 65 | } |
jjg@464 | 66 | } |
jjg@464 | 67 | public class T6326754{ |
jjg@464 | 68 | public static void main(String... arg){ |
jjg@464 | 69 | TestC tC =new TestC(); |
jjg@464 | 70 | tC.setT(); |
jjg@464 | 71 | TestConstructor tc = new TestConstructor("saaa"); |
jjg@464 | 72 | tc.setT("sasa"); |
jjg@464 | 73 | TestC<Integer> tC1 = new TestC(); |
jjg@464 | 74 | tC1.setT(545); |
jjg@464 | 75 | } |
jjg@464 | 76 | } |