Package org.jboss.weld.bean.proxy.util
Class WeldDefaultProxyServices
- java.lang.Object
-
- org.jboss.weld.bean.proxy.util.WeldDefaultProxyServices
-
- All Implemented Interfaces:
org.jboss.weld.bootstrap.api.Service
,org.jboss.weld.serialization.spi.ProxyServices
public class WeldDefaultProxyServices extends Object implements org.jboss.weld.serialization.spi.ProxyServices
This class is a default implementation of ProxyServices that will only be loaded if no other implementation is detected. It is only used up until JDK 11 at which point it is replaced by its alternative implementation.This class cracks open the class loader's
defineclass
method and then uses it to define new classes.
-
-
Constructor Summary
Constructors Constructor Description WeldDefaultProxyServices()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanup()
Class<?>
defineClass(Class<?> originalClass, String className, byte[] classBytes, int off, int len)
Class<?>
defineClass(Class<?> originalClass, String className, byte[] classBytes, int off, int len, ProtectionDomain protectionDomain)
ClassLoader
getClassLoader(Class<?> proxiedBeanType)
Class<?>
loadBeanClass(String className)
Class<?>
loadClass(Class<?> originalClass, String classBinaryName)
static void
makeClassLoaderMethodsAccessible()
This method cracks openClassLoader#defineClass()
methods by callingsetAccessible()
.boolean
supportsClassDefining()
-
-
-
Method Detail
-
makeClassLoaderMethodsAccessible
public static void makeClassLoaderMethodsAccessible()
This method cracks openClassLoader#defineClass()
methods by callingsetAccessible()
.It is invoked during
WeldStartup#startContainer()
and only in case the integrator does not fully implementProxyServices
.
-
getClassLoader
public ClassLoader getClassLoader(Class<?> proxiedBeanType)
- Specified by:
getClassLoader
in interfaceorg.jboss.weld.serialization.spi.ProxyServices
-
loadBeanClass
public Class<?> loadBeanClass(String className)
- Specified by:
loadBeanClass
in interfaceorg.jboss.weld.serialization.spi.ProxyServices
-
defineClass
public Class<?> defineClass(Class<?> originalClass, String className, byte[] classBytes, int off, int len) throws ClassFormatError
- Specified by:
defineClass
in interfaceorg.jboss.weld.serialization.spi.ProxyServices
- Throws:
ClassFormatError
-
defineClass
public Class<?> defineClass(Class<?> originalClass, String className, byte[] classBytes, int off, int len, ProtectionDomain protectionDomain) throws ClassFormatError
- Specified by:
defineClass
in interfaceorg.jboss.weld.serialization.spi.ProxyServices
- Throws:
ClassFormatError
-
loadClass
public Class<?> loadClass(Class<?> originalClass, String classBinaryName) throws ClassNotFoundException
- Specified by:
loadClass
in interfaceorg.jboss.weld.serialization.spi.ProxyServices
- Throws:
ClassNotFoundException
-
supportsClassDefining
public boolean supportsClassDefining()
- Specified by:
supportsClassDefining
in interfaceorg.jboss.weld.serialization.spi.ProxyServices
-
cleanup
public void cleanup()
- Specified by:
cleanup
in interfaceorg.jboss.weld.bootstrap.api.Service
-
-