private Type DefineClass(object bytecode, object staticSecurityDomain)
{
object[] nameBytesPair = (object[])bytecode;
string className = (string)nameBytesPair[0];
byte[] classBytes = (byte[])nameBytesPair[1];
// The generated classes in this case refer only to Rhino classes
// which must be accessible through this class loader
ClassLoader rhinoLoader = GetType().GetClassLoader();
GeneratedClassLoader loader;
loader = SecurityController.CreateLoader(rhinoLoader, staticSecurityDomain);
Exception e;
try
{
Type cl = loader.DefineClass(className, classBytes);
loader.LinkClass(cl);
return cl;
}
catch (SecurityException x)
{
e = x;
}
catch (ArgumentException x)
{
e = x;
}
throw new Exception("Malformed optimizer package " + e);
}