Example #1
0
    public static java.lang.Class defineClass1(java.lang.ClassLoader thisClassLoader, string name, byte[] b, int off, int len, java.security.ProtectionDomain pd, string source)
    {
        // it appears the source argument is only used for trace messages in HotSpot. We'll just ignore it for now.
        Profiler.Enter("ClassLoader.defineClass");
        try
        {
            try
            {
                ClassLoaderWrapper classLoaderWrapper = ClassLoaderWrapper.GetClassLoaderWrapper(thisClassLoader);
                ClassFile          classFile          = new ClassFile(b, off, len, name, classLoaderWrapper.ClassFileParseOptions, null);
                if (name != null && classFile.Name != name)
                {
#if !FIRST_PASS
                    throw new java.lang.NoClassDefFoundError(name + " (wrong name: " + classFile.Name + ")");
#endif
                }
                TypeWrapper type = classLoaderWrapper.DefineClass(classFile, pd);
                return(type.ClassObject);
            }
            catch (RetargetableJavaException x)
            {
                throw x.ToJava();
            }
        }
        finally
        {
            Profiler.Leave("ClassLoader.defineClass");
        }
    }