コード例 #1
0
ファイル: ByteCodeHelper.cs プロジェクト: AirwolfTsou/ikvm-1
        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
        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
        }