Skip to content

Commit

Permalink
set ProtectionDomain for newly generated Class
Browse files Browse the repository at this point in the history
  • Loading branch information
linxuan-hqm committed Mar 20, 2013
1 parent 7ddef5a commit 105a0c7
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.security.ProtectionDomain;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedList;
Expand Down Expand Up @@ -288,7 +289,10 @@ public ClassPool getClassPool() {
return mPool;
}

public Class<?> toClass()
public Class<?> toClass(){
return toClass(getClass().getClassLoader(), getClass().getProtectionDomain());
}
public Class<?> toClass(ClassLoader loader, ProtectionDomain pd)
{
if( mCtc != null )
mCtc.detach();
Expand Down Expand Up @@ -334,7 +338,7 @@ public Class<?> toClass()
}
}
}
return mCtc.toClass();
return mCtc.toClass(loader, pd);
}
catch(RuntimeException e)
{
Expand Down

0 comments on commit 105a0c7

Please sign in to comment.