608N/A/*
608N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
608N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
608N/A *
608N/A * This code is free software; you can redistribute it and/or modify it
608N/A * under the terms of the GNU General Public License version 2 only, as
608N/A * published by the Free Software Foundation.
608N/A *
608N/A * This code is distributed in the hope that it will be useful, but WITHOUT
608N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
608N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
608N/A * version 2 for more details (a copy is included in the LICENSE file that
608N/A * accompanied this code).
608N/A *
608N/A * You should have received a copy of the GNU General Public License version
608N/A * 2 along with this work; if not, write to the Free Software Foundation,
608N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
608N/A *
608N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
608N/A * or visit www.oracle.com if you need additional information or have any
608N/A * questions.
608N/A */
608N/A
608N/A/*
608N/A * @test
608N/A * @bug 6911256 6964740
608N/A * @author Joseph D. Darcy
608N/A * @summary Strange TWRs
608N/A * @compile/fail -source 6 WeirdTwr.java
608N/A * @compile WeirdTwr.java
608N/A * @run main WeirdTwr
608N/A */
608N/A
608N/Apublic class WeirdTwr implements AutoCloseable {
608N/A private static int closeCount = 0;
608N/A public static void main(String... args) {
608N/A try(WeirdTwr r1 = new WeirdTwr(); WeirdTwr r2 = r1) {
608N/A if (r1 != r2)
608N/A throw new RuntimeException("Unexpected inequality.");
608N/A }
608N/A if (closeCount != 2)
608N/A throw new RuntimeException("bad closeCount" + closeCount);
608N/A }
608N/A
608N/A public void close() {
608N/A closeCount++;
608N/A }
608N/A}