Package javassist.util.proxy
Class DefinePackageHelper
- java.lang.Object
-
- javassist.util.proxy.DefinePackageHelper
-
public class DefinePackageHelper extends java.lang.ObjectHelper class for invokingClassLoader.defineClass(String,byte[],int,int).- Since:
- 3.22
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classDefinePackageHelper.Helperprivate static classDefinePackageHelper.Java7private static classDefinePackageHelper.Java9private static classDefinePackageHelper.JavaOther
-
Field Summary
Fields Modifier and Type Field Description private static DefinePackageHelper.Helperprivileged
-
Constructor Summary
Constructors Modifier Constructor Description privateDefinePackageHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voiddefinePackage(java.lang.String className, java.lang.ClassLoader loader)Defines a new package.
-
-
-
Field Detail
-
privileged
private static final DefinePackageHelper.Helper privileged
-
-
Method Detail
-
definePackage
public static void definePackage(java.lang.String className, java.lang.ClassLoader loader) throws CannotCompileExceptionDefines 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 theClassobject 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-UNNAMEDhas to be given to the JVM so that this method can run.- Parameters:
loader- the class loader passed totoClass()or the default one obtained bygetClassLoader().className- the package name.- Throws:
CannotCompileException- See Also:
Class.getClassLoader(),CtClass.toClass()
-
-