emul/mini/src/main/java/java/lang/AutoCloseable.java
changeset 772 d382dacfd73f
parent 771 4252bfc396fc
child 773 406faa8bc64f
     1.1 --- a/emul/mini/src/main/java/java/lang/AutoCloseable.java	Tue Feb 26 14:55:55 2013 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,72 +0,0 @@
     1.4 -/*
     1.5 - * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
     1.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 - *
     1.8 - * This code is free software; you can redistribute it and/or modify it
     1.9 - * under the terms of the GNU General Public License version 2 only, as
    1.10 - * published by the Free Software Foundation.  Oracle designates this
    1.11 - * particular file as subject to the "Classpath" exception as provided
    1.12 - * by Oracle in the LICENSE file that accompanied this code.
    1.13 - *
    1.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 - * version 2 for more details (a copy is included in the LICENSE file that
    1.18 - * accompanied this code).
    1.19 - *
    1.20 - * You should have received a copy of the GNU General Public License version
    1.21 - * 2 along with this work; if not, write to the Free Software Foundation,
    1.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 - *
    1.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 - * or visit www.oracle.com if you need additional information or have any
    1.26 - * questions.
    1.27 - */
    1.28 -
    1.29 -package java.lang;
    1.30 -
    1.31 -/**
    1.32 - * A resource that must be closed when it is no longer needed.
    1.33 - *
    1.34 - * @author Josh Bloch
    1.35 - * @since 1.7
    1.36 - */
    1.37 -public interface AutoCloseable {
    1.38 -    /**
    1.39 -     * Closes this resource, relinquishing any underlying resources.
    1.40 -     * This method is invoked automatically on objects managed by the
    1.41 -     * {@code try}-with-resources statement.
    1.42 -     *
    1.43 -     * <p>While this interface method is declared to throw {@code
    1.44 -     * Exception}, implementers are <em>strongly</em> encouraged to
    1.45 -     * declare concrete implementations of the {@code close} method to
    1.46 -     * throw more specific exceptions, or to throw no exception at all
    1.47 -     * if the close operation cannot fail.
    1.48 -     *
    1.49 -     * <p><em>Implementers of this interface are also strongly advised
    1.50 -     * to not have the {@code close} method throw {@link
    1.51 -     * InterruptedException}.</em>
    1.52 -     *
    1.53 -     * This exception interacts with a thread's interrupted status,
    1.54 -     * and runtime misbehavior is likely to occur if an {@code
    1.55 -     * InterruptedException} is {@linkplain Throwable#addSuppressed
    1.56 -     * suppressed}.
    1.57 -     *
    1.58 -     * More generally, if it would cause problems for an
    1.59 -     * exception to be suppressed, the {@code AutoCloseable.close}
    1.60 -     * method should not throw it.
    1.61 -     *
    1.62 -     * <p>Note that unlike the {@link java.io.Closeable#close close}
    1.63 -     * method of {@link java.io.Closeable}, this {@code close} method
    1.64 -     * is <em>not</em> required to be idempotent.  In other words,
    1.65 -     * calling this {@code close} method more than once may have some
    1.66 -     * visible side effect, unlike {@code Closeable.close} which is
    1.67 -     * required to have no effect if called more than once.
    1.68 -     *
    1.69 -     * However, implementers of this interface are strongly encouraged
    1.70 -     * to make their {@code close} methods idempotent.
    1.71 -     *
    1.72 -     * @throws Exception if this resource cannot be closed
    1.73 -     */
    1.74 -    void close() throws Exception;
    1.75 -}