< prev index next >

src/java.base/share/classes/java/lang/ClassLoader.java

Print this page




2129      *         The implementation vendor
2130      *
2131      * @param  sealBase
2132      *         If not {@code null}, then this package is sealed with
2133      *         respect to the given code source {@link java.net.URL URL}
2134      *         object.  Otherwise, the package is not sealed.
2135      *
2136      * @return  The newly defined {@code Package} object
2137      *
2138      * @throws  NullPointerException
2139      *          if {@code name} is {@code null}.
2140      *
2141      * @throws  IllegalArgumentException
2142      *          if a package of the given {@code name} is already
2143      *          defined by this class loader
2144      *
2145      * @since  1.2
2146      * @revised 9
2147      * @spec JPMS
2148      *
2149      * @see <a href="../../../technotes/guides/jar/jar.html#versioning">
2150      *      The JAR File Specification: Package Versioning</a>
2151      * @see <a href="../../../technotes/guides/jar/jar.html#sealing">
2152      *      The JAR File Specification: Package Sealing</a>
2153      */
2154     protected Package definePackage(String name, String specTitle,
2155                                     String specVersion, String specVendor,
2156                                     String implTitle, String implVersion,
2157                                     String implVendor, URL sealBase)
2158     {
2159         Objects.requireNonNull(name);
2160 
2161         // definePackage is not final and may be overridden by custom class loader
2162         Package p = new Package(name, specTitle, specVersion, specVendor,
2163                                 implTitle, implVersion, implVendor,
2164                                 sealBase, this);
2165 
2166         if (packages.putIfAbsent(name, p) != null)
2167             throw new IllegalArgumentException(name);
2168 
2169         return p;
2170     }




2129      *         The implementation vendor
2130      *
2131      * @param  sealBase
2132      *         If not {@code null}, then this package is sealed with
2133      *         respect to the given code source {@link java.net.URL URL}
2134      *         object.  Otherwise, the package is not sealed.
2135      *
2136      * @return  The newly defined {@code Package} object
2137      *
2138      * @throws  NullPointerException
2139      *          if {@code name} is {@code null}.
2140      *
2141      * @throws  IllegalArgumentException
2142      *          if a package of the given {@code name} is already
2143      *          defined by this class loader
2144      *
2145      * @since  1.2
2146      * @revised 9
2147      * @spec JPMS
2148      *


2149      * @see <a href="../../../technotes/guides/jar/jar.html#sealing">
2150      *      The JAR File Specification: Package Sealing</a>
2151      */
2152     protected Package definePackage(String name, String specTitle,
2153                                     String specVersion, String specVendor,
2154                                     String implTitle, String implVersion,
2155                                     String implVendor, URL sealBase)
2156     {
2157         Objects.requireNonNull(name);
2158 
2159         // definePackage is not final and may be overridden by custom class loader
2160         Package p = new Package(name, specTitle, specVersion, specVendor,
2161                                 implTitle, implVersion, implVendor,
2162                                 sealBase, this);
2163 
2164         if (packages.putIfAbsent(name, p) != null)
2165             throw new IllegalArgumentException(name);
2166 
2167         return p;
2168     }


< prev index next >