QualifiedThisAndSuper_2.java revision 0
4340N/A * Copyright 1998 Sun Microsystems, Inc. All Rights Reserved. 4340N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4340N/A * This code is free software; you can redistribute it and/or modify it 4340N/A * under the terms of the GNU General Public License version 2 only, as 4340N/A * published by the Free Software Foundation. 4340N/A * This code is distributed in the hope that it will be useful, but WITHOUT 4340N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 4340N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 4340N/A * version 2 for more details (a copy is included in the LICENSE file that 4340N/A * You should have received a copy of the GNU General Public License version 4340N/A * 2 along with this work; if not, write to the Free Software Foundation, 4340N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 4340N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 4340N/A * CA 95054 USA or visit www.sun.com if you need additional information or 4340N/A * @summary Verify correct implementation of qualified 'this' and 'super'. 4340N/A * @run main QualifiedThisAndSuper_2 private String n() {
return "an"; }
protected String o() {
return "ao"; }
public class B
extends p1.
BS {
private String n() {
return "bn"; }
protected String o() {
return "bo"; }
public class C
extends p1.
CS {
private String n() {
return "cn"; }
protected String o() {
return "co"; }
check(
"this.m()",
this.m(),
"cm");
check(
"A.this.m()", A.
this.m(),
"am");
check(
"B.this.m()", B.
this.m(),
"bm");
check(
"C.this.m()", C.
this.m(),
"cm");
check(
"this.n()",
this.n(),
"cn");
check(
"A.this.n()", A.
this.n(),
"an");
check(
"B.this.n()", B.
this.n(),
"bn");
check(
"C.this.n()", C.
this.n(),
"cn");
check(
"this.o()",
this.o(),
"co");
check(
"A.this.o()", A.
this.o(),
"ao");
check(
"B.this.o()", B.
this.o(),
"bo");
check(
"C.this.o()", C.
this.o(),
"co");
check(
"super.o()",
super.o(),
"cso");
check(
"A.super.o()", A.
super.o(),
"aso");
check(
"B.super.o()", B.
super.o(),
"bso");
check(
"C.super.o()", C.
super.o(),
"cso");
// should re-use access methods. check(
"A.super.o()", A.
super.o(),
"aso");
check(
"B.super.o()", B.
super.o(),
"bso");
check(
"C.super.o()", C.
super.o(),
"cso");
check(
"this.s",
this.s,
"cs");
check(
"A.this.s", A.
this.s,
"as");
check(
"B.this.s", B.
this.s,
"bs");
check(
"C.this.s", C.
this.s,
"cs");
check(
"this.t",
this.t,
"ct");
check(
"A.this.t", A.
this.t,
"at");
check(
"B.this.t", B.
this.t,
"bt");
check(
"C.this.t", C.
this.t,
"ct");
check(
"this.u",
this.u,
"cu");
check(
"A.this.u", A.
this.u,
"au");
check(
"B.this.u", B.
this.u,
"bu");
check(
"C.this.u", C.
this.u,
"cu");
check(
"super.u",
super.u,
"csu");
check(
"A.super.u", A.
super.u,
"asu");
check(
"B.super.u", B.
super.u,
"bsu");
check(
"C.super.u", C.
super.u,
"csu");
check(
"A.this.s", A.
this.s,
"foo");
check(
"B.this.s", B.
this.s,
"bar");
check(
"C.this.s", C.
this.s,
"baz");
check(
"A.this.t", A.
this.t,
"foo");
check(
"B.this.t", B.
this.t,
"bar");
check(
"C.this.t", C.
this.t,
"baz");
check(
"A.this.u", A.
this.u,
"foo");
check(
"B.this.u", B.
this.u,
"bar");
check(
"C.this.u", C.
this.u,
"baz");
check(
"A.super.u", A.
super.u,
"foo");
check(
"B.super.u", B.
super.u,
"bar");
check(
"C.super.u", C.
super.u,
"baz");