Skip to content

Commit

Permalink
reenable unsafe instantiators
Browse files Browse the repository at this point in the history
  • Loading branch information
pmuir committed May 20, 2010
1 parent f464500 commit 8cabad8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java
Expand Up @@ -47,6 +47,8 @@
import org.jboss.weld.exceptions.DefinitionException;
import org.jboss.weld.exceptions.WeldException;
import org.jboss.weld.serialization.spi.ProxyServices;
import org.jboss.weld.util.reflection.SecureReflections;
import org.jboss.weld.util.reflection.instantiation.InstantiatorFactory;
import org.slf4j.cal10n.LocLogger;

/**
Expand Down Expand Up @@ -89,6 +91,7 @@ public ProxyFactory(BeanInstance beanInstance)
public ProxyFactory(Class<?> proxiedBeanType)
{
this.beanType = proxiedBeanType;
ClassLoader originalClassLoader = proxiedBeanType.getClassLoader();
this.classLoader = Container.instance().services().get(ProxyServices.class).getClassLoader(beanType);
this.protectionDomain = Container.instance().services().get(ProxyServices.class).getProtectionDomain(beanType);
this.classPool = new ClassPool();
Expand Down Expand Up @@ -122,7 +125,14 @@ public T create(BeanInstance beanInstance)
Class<T> proxyClass = getProxyClass();
try
{
proxy = proxyClass.newInstance();
if (InstantiatorFactory.useInstantiators())
{
proxy = SecureReflections.newUnsafeInstance(proxyClass);
}
else
{
proxy = SecureReflections.newInstance(proxyClass);
}
}
catch (InstantiationException e)
{
Expand Down

0 comments on commit 8cabad8

Please sign in to comment.