WhichImplicitThis3.java revision 0
6394N/A/*
6394N/A * Copyright 2002 Sun Microsystems, Inc. All Rights Reserved.
6394N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6394N/A *
6394N/A * This code is free software; you can redistribute it and/or modify it
6394N/A * under the terms of the GNU General Public License version 2 only, as
6394N/A * published by the Free Software Foundation.
6394N/A *
6394N/A * This code is distributed in the hope that it will be useful, but WITHOUT
6394N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6394N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6394N/A * version 2 for more details (a copy is included in the LICENSE file that
6394N/A * accompanied this code).
6394N/A *
6394N/A * You should have received a copy of the GNU General Public License version
6394N/A * 2 along with this work; if not, write to the Free Software Foundation,
6394N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6394N/A *
6394N/A * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
6394N/A * CA 95054 USA or visit www.sun.com if you need additional information or
6394N/A * have any questions.
6394N/A */
6394N/A
6394N/A/**
6394N/A * @test
6394N/A * @bug 4696701
6394N/A * @summary wrong enclosing instance for local class creation
6394N/A *
6394N/A * @compile WhichImplicitThis3.java
6394N/A * @run main WhichImplicitThis3
6394N/A */
6394N/A
6394N/Apublic class WhichImplicitThis3 {
6394N/A boolean isCorrect() { return true; }
6394N/A void check() {
6394N/A class I2 {
6394N/A public void check() {
6394N/A if (!isCorrect()) throw new Error();
6394N/A }
6394N/A }
6394N/A class I3 extends WhichImplicitThis3 {
6394N/A boolean isCorrect() { return false; }
6394N/A public void check() {
6394N/A new I2().check(); // which outer does I2 get?
6394N/A }
6394N/A }
6394N/A new I3().check();
6394N/A }
6394N/A public static void main(String[] args) {
6394N/A new WhichImplicitThis3().check();
6394N/A }
6394N/A}
6394N/A