Mon, 21 Oct 2013 15:37:11 -0700
8026984: Clarity intended use of jdk.Exported
Reviewed-by: psandoz, mr, alanb
1 /*
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
26 package jdk;
28 import java.lang.annotation.*;
30 /**
31 * Indicates whether or not a JDK specific type or package is an
32 * exported part of the JDK suitable for use outside of the JDK
33 * implementation itself.
34 *
35 * This annotation should only be applied to types and packages
36 * <em>outside</em> of the Java SE namespaces of {@code java.*} and
37 * {@code javax.*} packages. For example, certain portions of {@code
38 * com.sun.*} are official parts of the JDK meant to be generally
39 * usable while other portions of {@code com.sun.*} are not. This
40 * annotation type allows those portions to be easily and
41 * programmatically distinguished.
42 *
43 * <p>If in one release a type or package is
44 * <code>@Exported(true)</code>, in a subsequent major release such a
45 * type or package can transition to <code>@Exported(false)</code>.
46 *
47 * <p>If a type or package is <code>@Exported(false)</code> in a
48 * release, it may be removed in a subsequent major release.
49 *
50 * <p>If a top-level type has an <code>@Exported</code> annotation,
51 * any nested member types with the top-level type should have an
52 * <code>@Exported</code> annotation with the same value.
53 *
54 * (In exceptional cases, if a nested type is going to be removed
55 * before its enclosing type, the nested type's could be
56 * <code>@Exported(false)</code> while its enclosing type was
57 * <code>@Exported(true)</code>.)
58 *
59 * Likewise, if a package has an <code>@Exported</code> annotation,
60 * top-level types within that package should also have an
61 * <code>@Exported</code> annotation.
62 *
63 * Sometimes a top-level type may have a different
64 * <code>@Exported</code> value than its package.
65 *
66 * @since 1.8
67 */
68 @Documented
69 @Retention(RetentionPolicy.RUNTIME)
70 @Target({ElementType.TYPE, ElementType.PACKAGE})
71 @Exported
72 public @interface Exported {
73 /**
74 * Whether or not the annotated type or package is an exported part of the JDK.
75 */
76 boolean value() default true;
77 }