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) 2004, 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 4906605
27 * @summary compilation error for super.<T,E>f() and ClassName.super.<T,E>f()
28 * @author gafter
29 *
30 * @compile SuperTypeargs.java
31 */
33 package superTypeargs;
35 import java.util.*;
37 class A {
39 public void show() {
40 System.out.println("I am being called from class A");
41 }
42 public String toString() {
43 show();
44 return "";
45 }
46 }
48 class B {
49 public void show() {
50 System.out.println("I am being called from class B");
51 }
52 public String toString() {
53 show();
54 return "";
55 }
56 }
58 class Test1<T,E> {
60 public static <T,E> void check1(T val1, E val2) {
61 val1.toString();
62 val2.toString();
63 System.out.println("Static check1 method being invoked from class Test1");
64 }
66 public <T,E> Test1(){
67 System.out.println("The Default Test1 constructor is being called");
68 }
69 public <T,E> Test1(T val1, E val2) {
70 System.out.println("The parameter Test1 constructor is being called");
71 }
72 public <T,E> int check2(T val1, E val2) {
73 val1.toString();
74 val2.toString();
75 System.out.println("Instance method check2 being invoked from class Test1");
76 return 1;
77 }
79 }
81 class Test2<T,E> extends Test1<T,E> {
83 public static <T,E> void check1(T val1, E val2) {
84 val1.toString();
85 val2.toString();
86 System.out.println("Static check1 method being invoked from class Test2");
87 }
89 public Test2() {
90 <T,E>super();
91 System.out.println("The Default Test2 constructor is being called");
92 }
93 public <T,E> Test2(T val1, E val2) {
94 <T,E>super(val1,val2);
95 System.out.println("The parameter Test2 constructor is being called");
96 }
97 public <T,E> int check2(T val1, E val2) {
98 val1.toString();
99 val2.toString();
100 System.out.println("Instance method check2 being invoked from class Test2");
101 return 1;
102 }
104 public <T,E> int check3(T val1, E val2) {
105 System.out.println("Instance method check3 being invoked from class Test2");
106 super.<T,E>check2(val1,val2);
107 /*
108 ParametericMethodsTest13.java:66: <identifier> expected
109 super . <T,E> check2(val1,val2);
110 ^
111 ParametericMethodsTest13.java:66: not a statement
112 super . <T,E> check2(val1,val2);
113 ^
114 2 errors
115 */
116 this.<T,E>check2(val1,val2);
117 Test2.super.<T,E>check2(val1,val2);
118 return 1;
119 }
121 /*
122 ParametericMethodsTest14.java:130: check4(A,B) in Test2<A,B> cannot be applied to <A,B>(A,B)
123 tRef.<A,B>check4(new A(), new B());
124 ^
125 1 error
126 */
127 public int check4(T val1, E val2) {
128 val1.toString();
129 val2.toString();
130 System.out.println("Instance method check2 being invoked from class Test2");
131 return 1;
132 }
134 }
136 class ParametericMethodsTest14 {
138 public void assertion1() {
139 Test2.<A,B>check1(new A(), new B());
140 Test1.<A,B>check1(new A(), new B());
141 System.out.println("assertion1 passed");
142 }
143 public void assertion2() {
144 Test2<A,B> tRef = new Test2<A,B>();
145 tRef.<A,B>check1(new A(), new B());
146 tRef.<A,B>check2(new A(), new B());
147 Test1<A,B> tRef1 = tRef;
148 tRef1.<A,B>check1(new A(), new B());
149 System.out.println("assertion2 passed");
150 }
151 public void assertion3() {
152 Test2<A,B> tRef = new Test2<A,B>();
153 tRef.<A,B>check3(new A(), new B());
154 }
155 public void assertion4() {
156 Test2<A,B> tRef = new Test2<A,B>(new A(), new B());
157 tRef.<A,B>check3(new A(), new B());
158 }
160 public static void main(String args[]) {
161 ParametericMethodsTest14 tRef = new ParametericMethodsTest14();
162 tRef.assertion1();
163 tRef.assertion2();
164 tRef.assertion3();
165 tRef.assertion4();
166 }
168 }