@Override protected Package definePackage(String name, String specTitle, String specVersion, String specVendor, String implTitle, String implVersion, String implVendor, URL sealBase) throws IllegalArgumentException { return super.definePackage(name, specTitle, specVersion, specVendor, implTitle, implVersion, implVendor, sealBase); }
/** This is here just for locking serialization purposes. * Delegates to super.definePackage with proper locking. * Also tracks the package in our private cache, since * getPackageFast(...,...,false) will not call super.getPackage. */ @Override protected Package definePackage(String name, String specTitle, String specVersion, String specVendor, String implTitle, String implVersion, String implVendor, URL sealBase ) throws IllegalArgumentException { synchronized (packages) { Package pkg = super.definePackage(name, specTitle, specVersion, specVendor, implTitle, implVersion, implVendor, sealBase); packages.put(name, pkg); return pkg; } }
@Implementation @Override protected Package definePackage(String name, String specTitle, String specVersion, String specVendor, String implTitle, String implVersion, String implVendor, URL sealBase) throws IllegalArgumentException { return super.definePackage(name, specTitle, specVersion, specVendor, implTitle, implVersion, implVendor, sealBase); } }
definePackage("javax.swing","","","","","","",new URL("file://junk.class"));
/** * Defines a package by name in this <tt>ConcurrentClassLoader</tt>. If the package was already defined, the * existing package is returned instead. * * @param name the package name * @param specTitle the specification title * @param specVersion the specification version * @param specVendor the specification vendor * @param implTitle the implementation title * @param implVersion the implementation version * @param implVendor the implementation vendor * @param sealBase if not {@code null}, then this package is sealed with respect to the given code source URL * * @return the newly defined package, or the existing one if one was already defined */ protected Package definePackage(final String name, final String specTitle, final String specVersion, final String specVendor, final String implTitle, final String implVersion, final String implVendor, final URL sealBase) throws IllegalArgumentException { ThreadLocal<Boolean> suppressor = GET_PACKAGE_SUPPRESSOR; suppressor.set(Boolean.TRUE); try { Package existing = packages.get(name); if (existing != null) { return existing; } Package pkg = super.definePackage(name, specTitle, specVersion, specVendor, implTitle, implVersion, implVendor, sealBase); existing = packages.putIfAbsent(name, pkg); return existing != null ? existing : pkg; } finally { suppressor.remove(); } }
if(super.getPackage(packageName) == null) { super.definePackage(packageName, null, null, null, null, null, null, null);