< prev index next >
src/java.base/share/classes/java/lang/Class.java
Print this page
rev 50076 : [mq]: jep181-rev2
*** 3852,3872 ****
private native Class<?> getNestHost0();
/**
* Returns the nest host of the object represented by this {@code Class}.
*
! * <p>If there is any error accessing the nest host, or the nest host is
! * in any way invalid, then {@code this} is returned.
*
* <p>A <em>nest</em> is a set of classes and interfaces (nestmates) that
* form an access control context in which each nestmate has access to the
* private members of the other nestmates.
* The <em>nest host</em> is the class or interface designated to hold the list of
* classes and interfaces that make up the nest, and to which each of the
* other nestmates refer.
*
! * <p>A class or interface that is not explicitly a member of a nest,
* is a member of the nest consisting only of itself, and is the
* nest host. Every class and interface is a member of exactly one nest.
*
* @apiNote The source language compiler is responsible for deciding which classes
* and interfaces are nestmates, by generating the appropriate attributes
--- 3852,3874 ----
private native Class<?> getNestHost0();
/**
* Returns the nest host of the object represented by this {@code Class}.
*
! * <p>If there is any {@linkplain LinkageError linkage error} accessing the nest host,
! * or the nest host is in any way invalid, then {@code this} is returned.
*
* <p>A <em>nest</em> is a set of classes and interfaces (nestmates) that
* form an access control context in which each nestmate has access to the
* private members of the other nestmates.
* The <em>nest host</em> is the class or interface designated to hold the list of
* classes and interfaces that make up the nest, and to which each of the
* other nestmates refer.
+ * All nestmates are implicitly defined in the same runtime package.
*
! * <p>A class or interface that is not explicitly a member of a nest
! * (such as a primitive or array class),
* is a member of the nest consisting only of itself, and is the
* nest host. Every class and interface is a member of exactly one nest.
*
* @apiNote The source language compiler is responsible for deciding which classes
* and interfaces are nestmates, by generating the appropriate attributes
*** 3876,3887 ****
* and indirect, {@linkplain #getDeclaredClasses() nested classes and interfaces}
* (JLS 8).
* The top-level {@linkplain #getEnclosingClass() enclosing class or interface}
* is designated as the nest host.
*
! * @return the nest host of this class, or {@code this} if we cannot
! * obtain a valid nest host
* @throws SecurityException
* If the returned class is not the current class, and
* if a security manager, <i>s</i>, is present and the caller's
* class loader is not the same as or an ancestor of the class
* loader for the returned class and invocation of {@link
--- 3878,3889 ----
* and indirect, {@linkplain #getDeclaredClasses() nested classes and interfaces}
* (JLS 8).
* The top-level {@linkplain #getEnclosingClass() enclosing class or interface}
* is designated as the nest host.
*
! * @return the nest host of this class, or {@code this} if a valid nest host
! * cannot be obtained
* @throws SecurityException
* If the returned class is not the current class, and
* if a security manager, <i>s</i>, is present and the caller's
* class loader is not the same as or an ancestor of the class
* loader for the returned class and invocation of {@link
*** 3918,3928 ****
}
/**
* Determines if the given {@code Class} is a nestmate of the
* object represented by this {@code Class}. Two classes are nestmates
! * if they have the same {@linkplain #getNestHost nest host}.
*
* @param c the class to check
* @return {@code true} if this class and {@code c} are valid members of the same
* nest; and {@code false} otherwise.
*
--- 3920,3930 ----
}
/**
* Determines if the given {@code Class} is a nestmate of the
* object represented by this {@code Class}. Two classes are nestmates
! * if they have the same {@linkplain #getNestHost() nest host}.
*
* @param c the class to check
* @return {@code true} if this class and {@code c} are valid members of the same
* nest; and {@code false} otherwise.
*
< prev index next >