示例#1
0
        private static TypeWrapper LoadTypeWrapper(string clazz, [email protected] callerId)
        {
#if FIRST_PASS
            return(null);
#else
            try
            {
                TypeWrapper           context = TypeWrapper.FromClass(callerId.getCallerClass());
                TypeWrapper           wrapper = ClassLoaderWrapper.FromCallerID(callerId).LoadClassByDottedName(clazz);
                java.lang.ClassLoader loader  = callerId.getCallerClassLoader();
                if (loader != null)
                {
                    loader.checkPackageAccess(wrapper.ClassObject, callerId.getCallerClass().pd);
                }
                if (!wrapper.IsAccessibleFrom(context))
                {
                    throw new java.lang.IllegalAccessError("Try to access class " + wrapper.Name + " from class " + context.Name);
                }
                wrapper.Finish();
                return(wrapper);
            }
            catch (RetargetableJavaException x)
            {
                throw x.ToJava();
            }
#endif
        }
示例#2
0
    public static java.lang.Class defineClass(object thisUnsafe, string name, byte[] buf, int offset, int length, [email protected] callerID)
    {
#if FIRST_PASS
        return(null);
#else
        return(defineClass(thisUnsafe, name, buf, offset, length, callerID.getCallerClassLoader(), callerID.getCallerClass().pd));
#endif
    }
        // this method is used by IKVM.Runtime.JNI
        internal static ClassLoaderWrapper FromCallerID([email protected] callerID)
        {
#if FIRST_PASS
            return(null);
#else
            return(GetClassLoaderWrapper(callerID.getCallerClassLoader()));
#endif
        }
示例#4
0
        private static TypeWrapper LoadTypeWrapper(string clazz, [email protected] callerId)
        {
#if FIRST_PASS
            return(null);
#else
            try
            {
                TypeWrapper context = TypeWrapper.FromClass(callerId.getCallerClass());
#if WINRT
                RuntimeReflectionHelper.Instance.Mark(clazz);
#endif
                System.Diagnostics.Debug.WriteLine("Trying to load " + clazz);
                TypeWrapper wrapper = null;
                try {
                    wrapper = ClassLoaderWrapper.FromCallerID(callerId).LoadClassByDottedName(clazz);
                } catch (NotImplementedException nie)
                {
#if WINRT
                    RuntimeReflectionHelper.Instance.Mark(clazz);
#endif
                    System.Diagnostics.Debug.WriteLine("Not implemented " + clazz);
                    throw nie;
                }

                java.lang.ClassLoader loader = callerId.getCallerClassLoader();
                if (loader != null)
                {
                    loader.checkPackageAccess(wrapper.ClassObject, callerId.getCallerClass().pd);
                }
                if (!wrapper.IsAccessibleFrom(context))
                {
                    throw new java.lang.IllegalAccessError("Try to access class " + wrapper.Name + " from class " + context.Name);
                }
                wrapper.Finish();
                return(wrapper);
            }
            catch (RetargetableJavaException x)
            {
                throw x.ToJava();
            }
#endif
        }