test/tools/javac/generics/6531075/T6531075.java

Tue, 13 Sep 2011 14:14:57 +0100

author
mcimadamore
date
Tue, 13 Sep 2011 14:14:57 +0100
changeset 1085
ed338593b0b6
parent 554
9d9f26857129
child 2525
2eb010b6cb22
permissions
-rw-r--r--

7086595: Error message bug: name of initializer is 'null'
Summary: Implementation of MethodSymbol.location() should take into account static/instance initializers
Reviewed-by: jjg

mcimadamore@23 1 /*
ohair@554 2 * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
mcimadamore@23 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
mcimadamore@23 4 *
mcimadamore@23 5 * This code is free software; you can redistribute it and/or modify it
mcimadamore@23 6 * under the terms of the GNU General Public License version 2 only, as
mcimadamore@23 7 * published by the Free Software Foundation.
mcimadamore@23 8 *
mcimadamore@23 9 * This code is distributed in the hope that it will be useful, but WITHOUT
mcimadamore@23 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
mcimadamore@23 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
mcimadamore@23 12 * version 2 for more details (a copy is included in the LICENSE file that
mcimadamore@23 13 * accompanied this code).
mcimadamore@23 14 *
mcimadamore@23 15 * You should have received a copy of the GNU General Public License version
mcimadamore@23 16 * 2 along with this work; if not, write to the Free Software Foundation,
mcimadamore@23 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
mcimadamore@23 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@23 22 */
mcimadamore@23 23
mcimadamore@23 24 /*
mcimadamore@23 25 * @test
mcimadamore@23 26 * @bug 6531075
mcimadamore@23 27 *
mcimadamore@23 28 * @summary Missing synthetic casts when accessing fields/methods of intersection types including type variables
mcimadamore@23 29 * @author Maurizio Cimadamore
mcimadamore@23 30 *
mcimadamore@23 31 */
mcimadamore@23 32
mcimadamore@23 33
mcimadamore@23 34 public class T6531075 {
mcimadamore@23 35
mcimadamore@23 36 static class A {
mcimadamore@23 37 void a() {}
mcimadamore@23 38 }
mcimadamore@23 39
mcimadamore@23 40 static interface I{
mcimadamore@23 41 void i();
mcimadamore@23 42 }
mcimadamore@23 43
mcimadamore@23 44 static class E extends A implements I{
mcimadamore@23 45 public void i() {}
mcimadamore@23 46 }
mcimadamore@23 47
mcimadamore@23 48 static class C<W extends A & I, T extends W>{
mcimadamore@23 49 T t;
mcimadamore@23 50 W w;
mcimadamore@23 51 C(W w, T t) {
mcimadamore@23 52 this.w = w;
mcimadamore@23 53 this.t = t;
mcimadamore@23 54 }
mcimadamore@23 55 }
mcimadamore@23 56
mcimadamore@23 57 public static void main(String... args) {
mcimadamore@23 58 C<E,E> c = new C<E,E>(new E(), new E());
mcimadamore@23 59 testMemberMethods(c);
mcimadamore@23 60 }
mcimadamore@23 61
mcimadamore@23 62 static void testMemberMethods(C<?, ?> arg) {
mcimadamore@23 63 arg.t.a();
mcimadamore@23 64 arg.t.i();
mcimadamore@23 65 }
mcimadamore@23 66 }

mercurial