Package javassist.util.proxy
Class DefinePackageHelper
java.lang.Object
javassist.util.proxy.DefinePackageHelper
Helper class for invoking
ClassLoader.defineClass(String,byte[],int,int)
.- Since:
- 3.22
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static class
private static class
private static class
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
definePackage
(String className, ClassLoader loader) Defines a new package.
-
Field Details
-
privileged
-
-
Constructor Details
-
DefinePackageHelper
private DefinePackageHelper()
-
-
Method Details
-
definePackage
public static void definePackage(String className, ClassLoader loader) throws CannotCompileException Defines a new package. If the package is already defined, this method performs nothing.You do not necessarily need to call this method. If this method is called, then
getPackage()
on theClass
object returned bytoClass()
will return a non-null object.The jigsaw module introduced by Java 9 has broken this method. In Java 9 or later, the VM argument
--add-opens java.base/java.lang=ALL-UNNAMED
has to be given to the JVM so that this method can run.- Parameters:
className
- the package name.loader
- the class loader passed totoClass()
or the default one obtained bygetClassLoader()
.- Throws:
CannotCompileException
- See Also:
-