Exemplo n.º 1
0
    public static java.security.ProtectionDomain getProtectionDomain0(java.lang.Class thisClass)
    {
#if FIRST_PASS
        return(null);
#else
        TypeWrapper wrapper = TypeWrapper.FromClass(thisClass);
        if (wrapper.IsArray)
        {
            return(null);
        }
        java.security.ProtectionDomain pd = wrapper.ClassObject.pd;
        if (pd == null)
        {
            // The protection domain for statically compiled code is created lazily (not at java.lang.Class creation time),
            // to work around boot strap issues.
            AssemblyClassLoader acl = wrapper.GetClassLoader() as AssemblyClassLoader;
            if (acl != null)
            {
                pd = acl.GetProtectionDomain();
            }
            else if (wrapper is AnonymousTypeWrapper)
            {
                // dynamically compiled intrinsified lamdba anonymous types end up here and should get their
                // protection domain from the host class
                pd = ClassLoaderWrapper.GetWrapperFromType(wrapper.TypeAsTBD.DeclaringType).ClassObject.pd;
            }
        }
        return(pd);
#endif
    }
Exemplo n.º 2
0
    public static java.security.ProtectionDomain getProtectionDomain0(java.lang.Class thisClass)
    {
#if FIRST_PASS
        return(null);
#else
        TypeWrapper wrapper = TypeWrapper.FromClass(thisClass);
        while (wrapper.IsArray)
        {
            wrapper = wrapper.ElementTypeWrapper;
        }
        java.security.ProtectionDomain pd = wrapper.ClassObject.pd;
        if (pd == null)
        {
            // The protection domain for statically compiled code is created lazily (not at java.lang.Class creation time),
            // to work around boot strap issues.
            AssemblyClassLoader acl = wrapper.GetClassLoader() as AssemblyClassLoader;
            if (acl != null)
            {
                pd = acl.GetProtectionDomain();
            }
        }
        return(pd);
#endif
    }